|
|
@@ -37,7 +37,6 @@ class LinkEditModal extends React.PureComponent {
|
|
|
markdown: '',
|
|
|
permalink: '',
|
|
|
linkText: '',
|
|
|
- linkDom: <a></a>,
|
|
|
};
|
|
|
|
|
|
this.isApplyPukiwikiLikeLinkerPlugin = window.growiRenderer.preProcessors.some(process => process.constructor.name === 'PukiwikiLikeLinker');
|
|
|
@@ -57,7 +56,6 @@ class LinkEditModal extends React.PureComponent {
|
|
|
this.getRootPath = this.getRootPath.bind(this);
|
|
|
|
|
|
this.generateAndSetPreviewDebounced = debounce(200, this.generateAndSetPreview.bind(this));
|
|
|
- this.generateAndSetLinkTextPreviewDebounced = debounce(200, this.generateAndSetLinkTextPreview.bind(this));
|
|
|
}
|
|
|
|
|
|
componentDidUpdate(prevProps, prevState) {
|
|
|
@@ -66,7 +64,6 @@ class LinkEditModal extends React.PureComponent {
|
|
|
if (linkInputValue !== prevLinkInputValue) {
|
|
|
this.generateAndSetPreviewDebounced(linkInputValue);
|
|
|
}
|
|
|
- this.generateAndSetLinkTextPreviewDebounced();
|
|
|
}
|
|
|
|
|
|
// defaultMarkdownLink is an instance of Linker
|
|
|
@@ -190,7 +187,7 @@ class LinkEditModal extends React.PureComponent {
|
|
|
this.setState({ markdown, permalink });
|
|
|
}
|
|
|
|
|
|
- generateAndSetLinkTextPreview() {
|
|
|
+ renderLinkPreview() {
|
|
|
const linker = this.generateLink();
|
|
|
|
|
|
if (this.isUsePermanentLink && this.permalink != null) {
|
|
|
@@ -202,12 +199,9 @@ class LinkEditModal extends React.PureComponent {
|
|
|
}
|
|
|
|
|
|
const linkText = linker.generateMarkdownText();
|
|
|
- const linkDom = this.getLinkDom(linker);
|
|
|
- this.setState({ linkText, linkDom });
|
|
|
- }
|
|
|
-
|
|
|
- getLinkDom(linker) {
|
|
|
- return <a href={linker.link}>{linker.label}</a>;
|
|
|
+ return (
|
|
|
+ <div>{linkText} > <a href={linker.link}>{linker.label}</a></div>
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
handleChangeTypeahead(selected) {
|
|
|
@@ -373,7 +367,7 @@ class LinkEditModal extends React.PureComponent {
|
|
|
</div>
|
|
|
</div>
|
|
|
{/* TODO GW-3448 fix layout */}
|
|
|
- {this.state.linkText} > {this.state.linkDom}
|
|
|
+ {this.renderLinkPreview()}
|
|
|
</div>
|
|
|
|
|
|
<div className="col d-none d-lg-block pr-0 mr-3 overflow-auto">{this.renderPreview()}</div>
|