Add md hotkey support for expando editor

- When original textarea supports markdown, the textarea of the expanded popup will also have markdown support
- Also add the small markdown icon at the top
This commit is contained in:
Wolfsblvt
2025-03-11 04:42:03 +01:00
parent cf63b70997
commit 0cde7e7a7f

View File

@ -1506,7 +1506,7 @@ jQuery(function () {
embedMessageFile(messageId, messageBlock);
});
$(document).on('click', '.editor_maximize', function () {
$(document).on('click', '.editor_maximize', async function () {
const broId = $(this).attr('data-for');
const bro = $(`#${broId}`);
const contentEditable = bro.is('[contenteditable]');
@ -1525,6 +1525,12 @@ jQuery(function () {
textarea.value = String(contentEditable ? bro[0].innerText : bro.val());
textarea.classList.add('height100p', 'wide100p', 'maximized_textarea');
bro.hasClass('monospace') && textarea.classList.add('monospace');
if (power_user.enable_md_hotkeys && bro.hasClass('mdHotkeys')) {
textarea.classList.add('mdHotkeys');
const mdIcon = document.createElement('i');
mdIcon.classList.add('fa-brands', 'fa-markdown', 'mdhotkey_icon', 'alignSelfStart');
wrapper.appendChild(mdIcon);
}
textarea.addEventListener('input', function () {
if (contentEditable) {
bro[0].innerText = textarea.value;
@ -1565,7 +1571,7 @@ jQuery(function () {
});
}
callGenericPopup(wrapper, POPUP_TYPE.TEXT, '', { wide: true, large: true });
await callGenericPopup(wrapper, POPUP_TYPE.TEXT, '', { wide: true, large: true });
});
$(document).on('click', 'body.documentstyle .mes .mes_text', function () {