diff options
author | Gusted <williamzijl7@hotmail.com> | 2022-01-02 22:31:03 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-02 23:31:03 +0100 |
commit | 496acbe9e5fb02b6c9ad1a85c328220d4db51a6b (patch) | |
tree | 810d49b5384ff8486b1f52b5cdfba8b5b54ccf47 /web_src/js/features/repo-wiki.js | |
parent | 948949f42989bbbb701a51cfe9d6bd3cd6b246c8 (diff) | |
download | gitea-496acbe9e5fb02b6c9ad1a85c328220d4db51a6b.tar.gz gitea-496acbe9e5fb02b6c9ad1a85c328220d4db51a6b.zip |
Require codereview to have content (#18156)
- Report a validityError when the codeReview have no comment.
- Resolves #18151
- Refactor
Diffstat (limited to 'web_src/js/features/repo-wiki.js')
-rw-r--r-- | web_src/js/features/repo-wiki.js | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/web_src/js/features/repo-wiki.js b/web_src/js/features/repo-wiki.js index ee23dda8c4..c7b902d31d 100644 --- a/web_src/js/features/repo-wiki.js +++ b/web_src/js/features/repo-wiki.js @@ -1,4 +1,5 @@ import {initMarkupContent} from '../markup/content.js'; +import {validateTextareaNonEmpty} from './comp/CommentEasyMDE.js'; import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js'; const {csrfToken} = window.config; @@ -121,19 +122,8 @@ export function initRepoWikiForm() { const $markdownEditorTextArea = $(easyMDE.codemirror.getInputField()); $markdownEditorTextArea.addClass('js-quick-submit'); - $form.on('submit', function (e) { - // The original edit area HTML element is hidden and replaced by the - // SimpleMDE/EasyMDE editor, breaking HTML5 input validation if the text area is empty. - // This is a workaround for this upstream bug. - // See https://github.com/sparksuite/simplemde-markdown-editor/issues/324 - const input = $editArea.val(); - if (!input.length) { - e.preventDefault(); - $markdownEditorTextArea.prop('required', true); - this.reportValidity(); - } else { - $markdownEditorTextArea.prop('required', false); - } + $form.on('submit', function () { + validateTextareaNonEmpty(this, $editArea); }); setTimeout(() => { |