summaryrefslogtreecommitdiffstats
path: root/web_src/js/features/repo-release.js
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2022-01-05 20:17:25 +0800
committerGitHub <noreply@github.com>2022-01-05 13:17:25 +0100
commita38ba634a4da15fbb2d1b6ac6742cf01c1503ea4 (patch)
tree9bf892ae0e481e2d3b36b1eaf9a5273152c3c628 /web_src/js/features/repo-release.js
parent0572c78938d3d8287f81f53effc7ffaacd75d3e7 (diff)
downloadgitea-a38ba634a4da15fbb2d1b6ac6742cf01c1503ea4.tar.gz
gitea-a38ba634a4da15fbb2d1b6ac6742cf01c1503ea4.zip
Load EasyMDE/CodeMirror dynamically, remove RequireEasyMDE (#18069)
This PR makes frontend load EasyMDE/CodeMirror dynamically, and removes `RequireEasyMDE`.
Diffstat (limited to 'web_src/js/features/repo-release.js')
-rw-r--r--web_src/js/features/repo-release.js18
1 files changed, 10 insertions, 8 deletions
diff --git a/web_src/js/features/repo-release.js b/web_src/js/features/repo-release.js
index f69ce37d6b..915e722546 100644
--- a/web_src/js/features/repo-release.js
+++ b/web_src/js/features/repo-release.js
@@ -1,7 +1,7 @@
import attachTribute from './tribute.js';
import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js';
import {initEasyMDEImagePaste} from './comp/ImagePaste.js';
-import {createCommentEasyMDE} from './comp/CommentEasyMDE.js';
+import {createCommentEasyMDE} from './comp/EasyMDE.js';
export function initRepoRelease() {
$(document).on('click', '.remove-rel-attach', function() {
@@ -19,11 +19,13 @@ export function initRepoReleaseEditor() {
return false;
}
- const $textarea = $editor.find('textarea');
- attachTribute($textarea.get(), {mentions: false, emoji: true});
- const $files = $editor.parent().find('.files');
- const easyMDE = createCommentEasyMDE($textarea);
- initCompMarkupContentPreviewTab($editor);
- const dropzone = $editor.parent().find('.dropzone')[0];
- initEasyMDEImagePaste(easyMDE, dropzone, $files);
+ (async () => {
+ const $textarea = $editor.find('textarea');
+ await attachTribute($textarea.get(), {mentions: false, emoji: true});
+ const $files = $editor.parent().find('.files');
+ const easyMDE = await createCommentEasyMDE($textarea);
+ initCompMarkupContentPreviewTab($editor);
+ const dropzone = $editor.parent().find('.dropzone')[0];
+ initEasyMDEImagePaste(easyMDE, dropzone, $files);
+ })();
}