Enable spellcheck for EasyMDE, use contenteditable mode (#19776)
Enable spellcheck for EasyMDE, use contenteditable mode. Rewrite and refactor the ImagePaste code.
This commit is contained in:
parent
cdd6371ad4
commit
76910f213f
6 changed files with 102 additions and 65 deletions
|
@ -1,7 +1,7 @@
|
|||
import $ from 'jquery';
|
||||
import {createCommentEasyMDE, getAttachedEasyMDE} from './comp/EasyMDE.js';
|
||||
import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js';
|
||||
import {initCompImagePaste, initEasyMDEImagePaste} from './comp/ImagePaste.js';
|
||||
import {initEasyMDEImagePaste} from './comp/ImagePaste.js';
|
||||
import {
|
||||
initRepoIssueBranchSelect, initRepoIssueCodeCommentCancel,
|
||||
initRepoIssueCommentDelete,
|
||||
|
@ -33,7 +33,8 @@ import initRepoPullRequestMergeForm from './repo-issue-pr-form.js';
|
|||
const {csrfToken} = window.config;
|
||||
|
||||
export function initRepoCommentForm() {
|
||||
if ($('.comment.form').length === 0) {
|
||||
const $commentForm = $('.comment.form');
|
||||
if ($commentForm.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -67,12 +68,13 @@ export function initRepoCommentForm() {
|
|||
}
|
||||
|
||||
(async () => {
|
||||
await createCommentEasyMDE($('.comment.form textarea:not(.review-textarea)'));
|
||||
initCompImagePaste($('.comment.form'));
|
||||
const $textarea = $commentForm.find('textarea:not(.review-textarea)');
|
||||
const easyMDE = await createCommentEasyMDE($textarea);
|
||||
initEasyMDEImagePaste(easyMDE, $commentForm.find('.dropzone'));
|
||||
})();
|
||||
|
||||
initBranchSelector();
|
||||
initCompMarkupContentPreviewTab($('.comment.form'));
|
||||
initCompMarkupContentPreviewTab($commentForm);
|
||||
|
||||
// List submits
|
||||
function initListSubmits(selector, outerSelector) {
|
||||
|
@ -352,9 +354,7 @@ async function onEditContent(event) {
|
|||
easyMDE = await createCommentEasyMDE($textarea);
|
||||
|
||||
initCompMarkupContentPreviewTab($editContentForm);
|
||||
if ($dropzone.length === 1) {
|
||||
initEasyMDEImagePaste(easyMDE, $dropzone[0], $dropzone.find('.files'));
|
||||
}
|
||||
initEasyMDEImagePaste(easyMDE, $dropzone);
|
||||
|
||||
const $saveButton = $editContentZone.find('.save.button');
|
||||
$textarea.on('ce-quick-submit', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue