diff --git a/src/common/modules/PageHandler.js b/src/common/modules/PageHandler.js index 62aec31..0bb5a9b 100644 --- a/src/common/modules/PageHandler.js +++ b/src/common/modules/PageHandler.js @@ -18,22 +18,7 @@ export async function insertIntoPage(text) { active: true }); - const promises = tabs.map(/* async */ (tab) => { - /* // make sure content script is inserted - await browser.tabs.executeScript(tab.id, { - code: "insertIntoPage;", - allFrames: true, - runAt: "document_end" - }).catch(() => { - // ends here if insertIntoPage == undefined - // insert function, if needed - return browser.tabs.executeScript(tab.id, { - file: "/content_scripts/insertIntoPage.js", - allFrames: true, - runAt: "document_end" - }); - }); */ - + const promises = tabs.map(tab) => { // send request to insert emoji // This will not work in Manifest V3: https://developer.chrome.com/docs/extensions/mv3/intro/mv3-migration/#executing-arbitrary-strings return browser.tabs.executeScript(tab.id, { diff --git a/src/content_scripts/autocorrect.js b/src/content_scripts/autocorrect.js index f9c4819..8b55dbf 100644 --- a/src/content_scripts/autocorrect.js +++ b/src/content_scripts/autocorrect.js @@ -187,7 +187,7 @@ function deleteCaret(target, atext) { */ function autocorrect(event) { // console.log('beforeinput', event.inputType, event.data); - if (!(event.inputType === "insertText" || event.inputType === "insertCompositionText" || event.inputType === "insertParagraph" || event.inputType === "insertLineBreak")) { + if (!["insertText", "insertCompositionText", "insertParagraph", "insertLineBreak"].includes(event.inputType)) { return; } if (!symbolpatterns) { @@ -202,7 +202,7 @@ function autocorrect(event) { if (caretposition) { const value = target.value || target.innerText; let deletecount = 0; - let insert = event.inputType === "insertLineBreak" || event.inputType === "insertParagraph" ? "\n" : event.data; + let insert = ["insertLineBreak", "insertParagraph"].includes(event.inputType) ? "\n" : event.data; const inserted = insert; let output = false; const previousText = value.slice(caretposition < longest ? 0 : caretposition - longest, caretposition); @@ -325,7 +325,6 @@ function handleResponse(message, sender) { symbolpatterns = IS_CHROME ? new RegExp(message.symbolpatterns, "u") : message.symbolpatterns; antipatterns = IS_CHROME ? new RegExp(message.antipatterns, "u") : message.antipatterns; emojiShortcodes = message.emojiShortcodes; - // console.log(message); if (enabled) { addEventListener("beforeinput", undoAutocorrect, true); diff --git a/src/options/modules/CustomOptionTriggers.js b/src/options/modules/CustomOptionTriggers.js index 70093d0..0cc2173 100644 --- a/src/options/modules/CustomOptionTriggers.js +++ b/src/options/modules/CustomOptionTriggers.js @@ -421,7 +421,7 @@ export async function registerTrigger() { TABS_PERMISSION, MESSAGE_TABS_PERMISSION, document.getElementById("tabsPermissionInfo"), - // "permissionRequiredTabs" // TODO: This will need to be localized + // "permissionRequiredTabs" // TODO(to: 'rugk'): This will need to be localized "Permission to send any updated options to your open tabs is required to prevent you having to reload all of them manually." ); } diff --git a/src/options/options.html b/src/options/options.html index 007d05d..9aab647 100644 --- a/src/options/options.html +++ b/src/options/options.html @@ -162,6 +162,7 @@