Skip to content

Commit

Permalink
Removed dead code and updated comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
tdulcet committed Aug 10, 2023
1 parent e6a369a commit 883cb07
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 20 deletions.
17 changes: 1 addition & 16 deletions src/common/modules/PageHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down
5 changes: 2 additions & 3 deletions src/content_scripts/autocorrect.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/options/modules/CustomOptionTriggers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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."
);
}
1 change: 1 addition & 0 deletions src/options/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ <h1 data-i18n="__MSG_titleBehaviour__">Behavior</h1>
</ul>
</section>
<section>
<!-- TODO(to: 'rugk'): This section will need to be localized and you may want to create a warning link specifically for the Awesome Emoji Picker -->
<h1 data-i18n="">Emoji autocorrection</h1>
<span class="helper-text">With the exception of the smart quotes, all the autocorrections are done after typing the first nonmatching character following the character sequence, such as a space (␣). Press Backspace (⌫) to undo an autocorrection.</span><br>

Expand Down

0 comments on commit 883cb07

Please sign in to comment.