Adjust js code

This commit is contained in:
Tyrone Yeh 2024-05-03 13:14:53 +08:00
parent 64cffdd62e
commit c552d09a57
No known key found for this signature in database
GPG Key ID: A0725352B993FBDD
3 changed files with 2 additions and 3 deletions

View File

@ -185,7 +185,7 @@ export function initRepoIssueCommentEdit() {
editor = await handleReply($replyBtn);
} else {
// for normal issue/comment page
editor = getComboMarkdownEditor($('#comment-form .combo-markdown-editor'));
editor = getComboMarkdownEditor(document.querySelector('#comment-form .combo-markdown-editor'));
}
if (editor) {
if (editor.value()) {

View File

@ -414,7 +414,7 @@ export async function handleReply($el) {
showElem($form);
const $textarea = $form.find('textarea');
let editor = getComboMarkdownEditor($textarea);
let editor = getComboMarkdownEditor($textarea[0]);
if (!editor) {
// FIXME: the initialization of the dropzone is not consistent.
// When the page is loaded, the dropzone is initialized by initGlobalDropzone, but the editor is not initialized.

View File

@ -260,7 +260,6 @@ export function isElemVisible(element) {
}
export function getComboMarkdownEditor(el) {
if (el?.jquery) el = el[0];
return el?._giteaComboMarkdownEditor;
}