diff --git a/.DS_Store b/.DS_Store
index 2c43701..d4bca9f 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/README.md b/README.md
index ed42f06..980fdc3 100644
--- a/README.md
+++ b/README.md
@@ -12,9 +12,9 @@ Official repo of https://addons.mozilla.org/firefox/addon/emoji-sav/.
[](https://addons.mozilla.org/firefox/addon/emoji-sav/) [](https://chrome.google.com/webstore/detail/emoji/kjepehkgbooeigeflhiogplnckadlife) [](https://microsoftedge.microsoft.com/addons/detail/emoji/ejcgfbaipbelddlbokgcfajefbnnagfm)
-To support me, you can do a donation :smile: with **PayPal**, **LiberaPay** or **Ko-Fi**:
+To support me, you can do a donation :smile: with **PayPal** or **LiberaPay**:
- [](https://paypal.me/saveriomorelli) [](https://ko-fi.com/R5R31UQ8G)
+ [](https://paypal.me/saveriomorelli)
## Description
@@ -41,7 +41,7 @@ Emojis are divided in some sections, to help you to find the correct emoji quick
- Most used emojis: in the first tab you can find the emoji you use more
- Clear, modern and customisable UI
- Simplicity: with a single click you can copy an emoji
-- Short-cut: open the add-on with `Ctrl`/`Cmd`+`Alt`+`A`
+- Shortcut: open the add-on with `Ctrl`/`Cmd`+`Alt`+`A` (you can customise this)
- Tooltip: every emoji has the tooltip, so you can learn what's the name of an emoji
## How to contribute
@@ -54,7 +54,7 @@ Also, you can translate the extension (and the emojis description as well) on [C
See folder screenshots to see screenshots also of the older versions.
-
+
## License
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FSav22999%2Femoji.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2FSav22999%2Femoji?ref=badge_large)
diff --git a/js/emoji-insert-directly.js b/js/emoji-insert-directly.js
index da5a08b..5f7738b 100644
--- a/js/emoji-insert-directly.js
+++ b/js/emoji-insert-directly.js
@@ -7,12 +7,33 @@ if (browserOrChromeIndex === 0) {
}
var lastRequestNumber = -1;
browserAgentSettings.runtime.onMessage.addListener(function (request, sender, sendResponse) {
- if (request.requestNumber !== lastRequestNumber) {
+ if (request.type === "insert-emoji-by-injection" && request.requestNumber !== lastRequestNumber) {
let active = document.activeElement;
if (["input", "textarea"].includes(active.tagName.toLowerCase())) {
let pre = (active.value).substring(0, active.selectionStart);
let post = (active.value).substring(active.selectionEnd, active.value.length);
active.value = pre + request.emoji + post;
+ } else if (["p", "div", "span"].includes(active.tagName.toLowerCase()) && active.contentEditable) {
+ try {
+ let position = {start: 0, end: 0};
+ let selection = document.getSelection();
+ let range = selection.getRangeAt(0);
+ let range2 = range.cloneRange();
+ range2.selectNodeContents(active);
+ position.start = range.startOffset;
+ position.end = range.endOffset;
+ let pre = (active.textContent).substring(0, position.start);
+ let post = (active.textContent).substring(position.end, active.textContent.length);
+ active.textContent = pre + request.emoji + post;
+
+ let range3 = document.createRange();
+ range3.setStart(active.childNodes[0], position.start + (request.emoji.length));
+ range3.setEnd(active.childNodes[0], position.start + (request.emoji.length));
+ selection.removeAllRanges();
+ selection.addRange(range3);
+ } catch (e) {
+ console.error("Exception: " + e);
+ }
}
lastRequestNumber = request.requestNumber; //update the request number used to avoid to show more emoji (because of more injection scripts)
}
diff --git a/js/emojis.js b/js/emojis.js
index 6bb1b9f..a45810c 100644
--- a/js/emojis.js
+++ b/js/emojis.js
@@ -24,7 +24,7 @@ emojis_language[lang] = [];
emojis_language[lang][0] = {};
/*smileys*/
emojis_language[lang][2] = {
- "😀": ["Grinning Face", ":)", "Happy Face", "Smiley Face"],
+ "😀": ["Grinning Face", ":grinning:", ":grinning_face:", ":)", "Happy Face", "Smiley Face"],
"😃": ["Grinning Face with Big Eyes", ":D", "Happy Face", "Smiley Face", "Smiling Face with Open Mouth"],
"😄": ["Grinning Face with Smiling Eyes", "Happy Face", "Smiley Face", "Grinning Face With Squinting Eyes", "Smiling Face with Open Mouth and Smiling Eyes"],
"😁": ["Beaming Face with Smiling Eyes", "Grinning Face with Smiling Eyes"],
diff --git a/js/release_notes.js b/js/release_notes.js
index b04fe66..1d6384f 100644
--- a/js/release_notes.js
+++ b/js/release_notes.js
@@ -108,6 +108,15 @@ function releaseNotes(release) {
release_notes_text += "