fix: closes #12807, fix quick reply js error

This commit is contained in:
Barış Soner Uşaklı
2024-09-19 09:41:17 -04:00
parent 3cee59f94d
commit 06ac0c992c

View File

@@ -8,7 +8,7 @@ define('quickreply', [
alerts, uploadHelpers, mousetrap, storage, hooks alerts, uploadHelpers, mousetrap, storage, hooks
) { ) {
const QuickReply = { const QuickReply = {
_active: {}, _autocomplete: null,
}; };
QuickReply.init = function () { QuickReply.init = function () {
@@ -29,7 +29,7 @@ define('quickreply', [
destroyAutoComplete(); destroyAutoComplete();
}); });
$(window).trigger('composer:autocomplete:init', data); $(window).trigger('composer:autocomplete:init', data);
QuickReply._active.core_qr = autocomplete.setup(data); QuickReply._autocomplete = autocomplete.setup(data);
mousetrap.bind('ctrl+return', (e) => { mousetrap.bind('ctrl+return', (e) => {
if (e.target === element.get(0)) { if (e.target === element.get(0)) {
@@ -92,7 +92,7 @@ define('quickreply', [
components.get('topic/quickreply/text').val(''); components.get('topic/quickreply/text').val('');
storage.removeItem(qrDraftId); storage.removeItem(qrDraftId);
autocomplete._active.core_qr.hide(); QuickReply._autocomplete.hide();
hooks.fire('action:quickreply.success', { data }); hooks.fire('action:quickreply.success', { data });
}); });
}); });
@@ -125,9 +125,9 @@ define('quickreply', [
}; };
function destroyAutoComplete() { function destroyAutoComplete() {
if (QuickReply._active.core_qr) { if (QuickReply._autocomplete) {
QuickReply._active.core_qr.destroy(); QuickReply._autocomplete.destroy();
QuickReply._active.core_qr = null; QuickReply._autocomplete = null;
} }
} }