|
@@ -152,8 +152,8 @@ class LinkEditModal extends React.PureComponent {
|
|
|
const { t } = this.props;
|
|
const { t } = this.props;
|
|
|
const path = this.state.linkInputValue;
|
|
const path = this.state.linkInputValue;
|
|
|
let markdown = '';
|
|
let markdown = '';
|
|
|
- let previewError = '';
|
|
|
|
|
let permalink = '';
|
|
let permalink = '';
|
|
|
|
|
+ let previewError = '';
|
|
|
|
|
|
|
|
if (path.startsWith('/')) {
|
|
if (path.startsWith('/')) {
|
|
|
const pathWithoutFragment = new URL(path, 'http://dummy').pathname;
|
|
const pathWithoutFragment = new URL(path, 'http://dummy').pathname;
|
|
@@ -163,8 +163,7 @@ class LinkEditModal extends React.PureComponent {
|
|
|
try {
|
|
try {
|
|
|
const { page } = await this.props.appContainer.apiGet('/pages.get', { path: pathWithoutFragment, page_id: pageId });
|
|
const { page } = await this.props.appContainer.apiGet('/pages.get', { path: pathWithoutFragment, page_id: pageId });
|
|
|
markdown = page.revision.body;
|
|
markdown = page.revision.body;
|
|
|
- // create permanent link only if path isn't permanent link because checkbox for isUsePermanentLink is disabled when permalink is ''.
|
|
|
|
|
- permalink = !isPermanentLink ? `${window.location.origin}/${page.id}` : '';
|
|
|
|
|
|
|
+ permalink = page.id;
|
|
|
}
|
|
}
|
|
|
catch (err) {
|
|
catch (err) {
|
|
|
previewError = err.message;
|
|
previewError = err.message;
|
|
@@ -217,7 +216,8 @@ class LinkEditModal extends React.PureComponent {
|
|
|
handleChangeTypeahead(selected) {
|
|
handleChangeTypeahead(selected) {
|
|
|
const page = selected[0];
|
|
const page = selected[0];
|
|
|
if (page != null) {
|
|
if (page != null) {
|
|
|
- this.setState({ linkInputValue: page.path });
|
|
|
|
|
|
|
+ const permalink = `${window.location.origin}/${page.id}`;
|
|
|
|
|
+ this.setState({ linkInputValue: page.path, permalink });
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -230,7 +230,9 @@ class LinkEditModal extends React.PureComponent {
|
|
|
if (!this.state.linkInputValue.startsWith('/') || this.state.linkerType === Linker.types.growiLink) {
|
|
if (!this.state.linkInputValue.startsWith('/') || this.state.linkerType === Linker.types.growiLink) {
|
|
|
isUseRelativePath = false;
|
|
isUseRelativePath = false;
|
|
|
}
|
|
}
|
|
|
- this.setState({ linkInputValue: link, isUseRelativePath, isUsePermanentLink: false });
|
|
|
|
|
|
|
+ this.setState({
|
|
|
|
|
+ linkInputValue: link, isUseRelativePath, isUsePermanentLink: false, permalink: '',
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
handleSelecteLinkerType(linkerType) {
|
|
handleSelecteLinkerType(linkerType) {
|