From e2561a6fd1561f2df0fa4952d8477e4f7fa0727f Mon Sep 17 00:00:00 2001 From: CFT-Chris Date: Tue, 18 Dec 2018 14:00:01 -0500 Subject: [PATCH] fix(textarea,toolbar): set text caret after emoji --- src/module-textarea-emoji.js | 1 + src/module-toolbar-emoji.js | 1 + 2 files changed, 2 insertions(+) diff --git a/src/module-textarea-emoji.js b/src/module-textarea-emoji.js index 0e82af7..338a747 100644 --- a/src/module-textarea-emoji.js +++ b/src/module-textarea-emoji.js @@ -157,6 +157,7 @@ function fn_emojiElementsToPanel(type,panel,quill){ // quill.setSelection(range.index + customButton.innerHTML.length, 0); // range.index = range.index + customButton.innerHTML.length; quill.insertEmbed(range.index, 'emoji', emoji); + setTimeout(() => quill.setSelection(range.index + 1), 0); fn_close(); }); } diff --git a/src/module-toolbar-emoji.js b/src/module-toolbar-emoji.js index 05dd50a..3257ee8 100644 --- a/src/module-toolbar-emoji.js +++ b/src/module-toolbar-emoji.js @@ -179,6 +179,7 @@ function fn_emojiElementsToPanel(type,panel,quill){ let emoji_icon_html =makeElement("span", {className: "ico", innerHTML: ''+emoji.code_decimal+' ' }); let emoji_icon = emoji_icon_html.innerHTML; quill.insertEmbed(range.index, 'emoji', emoji); + setTimeout(() => quill.setSelection(range.index + 1), 0); fn_close(); }); }