Skip to content

Commit

Permalink
Made requested changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
tdulcet committed Oct 2, 2020
1 parent d9f97f3 commit fd6beaf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/common/modules/AutocorrectHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import * as AddonSettings from "/common/modules/AddonSettings/AddonSettings.js";
import * as BrowserCommunication from "/common/modules/BrowserCommunication/BrowserCommunication.js";

import { COMMUNICATION_MESSAGE_TYPE } from "/common/modules/data/BrowserCommunicationTypes.js";
import * as symbols from "/common/modules/data/symbols.js";
import * as symbols from "/common/modules/data/Symbols.js";
import * as emojimart from "/common/lib/emoji-mart-embed/dist/emoji-mart.js";

let settings = {
const settings = {
autocorrectSymbols: null,
autocorrectEmojis: null,
autocorrectEmojiShortcodes: null,
Expand Down
5 changes: 4 additions & 1 deletion src/content_scripts/autocorrect.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ function firstDifferenceIndex(a, b) {
}

/**
* Autocorrect.
* Autocorrect on text input even by evaluating the keys and replacing the characters/string.
*
* @param {Object} event
* @returns {void}
Expand All @@ -256,6 +256,9 @@ function autocorrect(event) {
if (!((event.key.length === 0 || event.key.length === 1 || event.keyCode === 13 || event.key === 'Unidentified') && !event.ctrlKey && !event.metaKey && !event.altKey)) {
return;
}
if (!symbolpatterns) {
throw new Error("Emoji autocorrect settings have not been received. Do not autocorrect.");
}
const target = event.target;
const caretposition = getCaretPosition(target);
if (caretposition) {
Expand Down
8 changes: 4 additions & 4 deletions src/options/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,15 @@ <h1 data-i18n="">Emoji autocorrection</h1>
<li>
<div class="line">
<input class="setting save-on-change" type="checkbox" id="autocorrectEmojis" data-optiongroup="autocorrect" name="autocorrectEmojis">
<label data-i18n="" data-opt-i18n-keep-children for="autocorrectEmojis">Autocorrect Emoticon Emojis</label>
<label data-i18n="" for="autocorrectEmojis">Autocorrect Emoticon Emojis</label>
</div>
<span data-i18n="" class="line indent helper-text">For example, this will replace <code>:)</code>with ☺️, <code>:D</code>with 😃 and <code>:(</code>with ☹️.</span>
</li>

<li>
<div class="line">
<input class="setting save-on-change" type="checkbox" id="autocorrectSymbols" data-optiongroup="autocorrect" name="autocorrectSymbols">
<label data-i18n="" data-opt-i18n-keep-children for="autocorrectSymbols">Autocorrect Unicode Symbols</label>
<label data-i18n="" for="autocorrectSymbols">Autocorrect Unicode Symbols</label>
</div>
<span data-i18n="" class="line indent helper-text">For example, this will replace <code>--</code>with –, <code>--></code>with ⟶ and <code>1/4</code>with ¼.</span>
</li>
Expand All @@ -220,15 +220,15 @@ <h1 data-i18n="">Emoji autocorrection</h1>
<li>
<div class="line">
<input class="setting save-on-change" type="checkbox" id="autocorrectUnicodeQuotes" data-optiongroup="autocorrect" name="autocorrectUnicodeQuotes">
<label data-i18n="" data-opt-i18n-keep-children for="autocorrectUnicodeQuotes">Use Unicode smart quotes</label>
<label data-i18n="" for="autocorrectUnicodeQuotes">Use Unicode smart quotes</label>
</div>
<span data-i18n="" class="line indent helper-text">For example, this will replace <code>'</code>with ‘ or ’ and <code>"</code>with “ or ”.</span>
</li>

<li>
<div class="line">
<input class="setting save-on-change" type="checkbox" id="autocorrectUnicodeFracts" data-optiongroup="autocorrect" name="autocorrectUnicodeFracts">
<label data-i18n="" data-opt-i18n-keep-children for="autocorrectUnicodeFracts">Convert fractions and mathematical constants to Unicode characters</label>
<label data-i18n="" for="autocorrectUnicodeFracts">Convert fractions and mathematical constants to Unicode characters</label>
</div>
<span data-i18n="" class="line indent helper-text">For example, this will replace <code>1234.25</code>with 1234¼.</span>
</li>
Expand Down

0 comments on commit fd6beaf

Please sign in to comment.