diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2022-01-04 00:53:53 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-03 17:53:53 +0100 |
commit | 48aab263d1d60612be05a67c46172b5a5a718dba (patch) | |
tree | bc4b21a8ad15c9debd94b460438ef6f3ee2ff95d /web_src/js/features/repo-wiki.js | |
parent | 8eec403068ef22ba7316fbbbd9254a54847cf5fe (diff) | |
download | gitea-48aab263d1d60612be05a67c46172b5a5a718dba.tar.gz gitea-48aab263d1d60612be05a67c46172b5a5a718dba.zip |
Fix EasyMDE validation (#18161)
Diffstat (limited to 'web_src/js/features/repo-wiki.js')
-rw-r--r-- | web_src/js/features/repo-wiki.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/web_src/js/features/repo-wiki.js b/web_src/js/features/repo-wiki.js index c7b902d31d..b76dac030e 100644 --- a/web_src/js/features/repo-wiki.js +++ b/web_src/js/features/repo-wiki.js @@ -1,5 +1,5 @@ import {initMarkupContent} from '../markup/content.js'; -import {validateTextareaNonEmpty} from './comp/CommentEasyMDE.js'; +import {attachEasyMDEToElements, validateTextareaNonEmpty} from './comp/CommentEasyMDE.js'; import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js'; const {csrfToken} = window.config; @@ -119,11 +119,15 @@ export function initRepoWikiForm() { ] }); - const $markdownEditorTextArea = $(easyMDE.codemirror.getInputField()); - $markdownEditorTextArea.addClass('js-quick-submit'); + attachEasyMDEToElements(easyMDE); - $form.on('submit', function () { - validateTextareaNonEmpty(this, $editArea); + const $mdeInputField = $(easyMDE.codemirror.getInputField()); + $mdeInputField.addClass('js-quick-submit'); + + $form.on('submit', () => { + if (!validateTextareaNonEmpty($editArea)) { + return false; + } }); setTimeout(() => { |