aboutsummaryrefslogtreecommitdiffstats
path: root/web_src
diff options
context:
space:
mode:
Diffstat (limited to 'web_src')
-rw-r--r--web_src/js/features/comp/ComboMarkdownEditor.js9
-rw-r--r--web_src/js/features/repo-editor.js14
2 files changed, 13 insertions, 10 deletions
diff --git a/web_src/js/features/comp/ComboMarkdownEditor.js b/web_src/js/features/comp/ComboMarkdownEditor.js
index 7283dab35c..a7d69af7b4 100644
--- a/web_src/js/features/comp/ComboMarkdownEditor.js
+++ b/web_src/js/features/comp/ComboMarkdownEditor.js
@@ -4,10 +4,9 @@ import $ from 'jquery';
import {attachTribute} from '../tribute.js';
import {hideElem, showElem, autosize} from '../../utils/dom.js';
import {initEasyMDEImagePaste, initTextareaImagePaste} from './ImagePaste.js';
-import {initMarkupContent} from '../../markup/content.js';
import {handleGlobalEnterQuickSubmit} from './QuickSubmit.js';
-import {attachRefIssueContextPopup} from '../contextpopup.js';
import {emojiKeys, emojiString} from '../emoji.js';
+import {renderPreviewPanelContent} from '../repo-editor.js';
let elementIdCounter = 0;
const maxExpanderMatches = 6;
@@ -194,11 +193,7 @@ class ComboMarkdownEditor {
text: this.value(),
wiki: this.previewWiki,
}, (data) => {
- $panelPreviewer.html(data);
- initMarkupContent();
-
- const refIssues = $panelPreviewer.find('p .ref-issue');
- attachRefIssueContextPopup(refIssues);
+ renderPreviewPanelContent($panelPreviewer, data);
});
});
}
diff --git a/web_src/js/features/repo-editor.js b/web_src/js/features/repo-editor.js
index a7c59fb039..b7937cf006 100644
--- a/web_src/js/features/repo-editor.js
+++ b/web_src/js/features/repo-editor.js
@@ -1,8 +1,9 @@
import $ from 'jquery';
import {htmlEscape} from 'escape-goat';
-import {initMarkupContent} from '../markup/content.js';
import {createCodeEditor} from './codeeditor.js';
import {hideElem, showElem} from '../utils/dom.js';
+import {initMarkupContent} from '../markup/content.js';
+import {attachRefIssueContextPopup} from './contextpopup.js';
const {csrfToken} = window.config;
@@ -28,8 +29,7 @@ function initEditPreviewTab($form) {
file_path: treePathEl.val(),
}, (data) => {
const $previewPanel = $form.find(`.tab[data-tab="${$tabMenu.data('preview')}"]`);
- $previewPanel.html(data);
- initMarkupContent();
+ renderPreviewPanelContent($previewPanel, data);
});
});
}
@@ -191,3 +191,11 @@ export function initRepoEditor() {
});
})();
}
+
+export function renderPreviewPanelContent($panelPreviewer, data) {
+ $panelPreviewer.html(data);
+ initMarkupContent();
+
+ const refIssues = $panelPreviewer.find('p .ref-issue');
+ attachRefIssueContextPopup(refIssues);
+}