From f04df792eaa2d8b288a3e040165bd922592c808d Mon Sep 17 00:00:00 2001 From: Julian Popescu Date: Wed, 12 Jul 2017 17:46:02 -0400 Subject: [PATCH] Fix issue with non breaking space after delimiter Autocomplete can jump to the beginning of a node if there's a non breaking space after the delimiter when typing. --- mention/plugin.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mention/plugin.js b/mention/plugin.js index 2102356..7b8546e 100644 --- a/mention/plugin.js +++ b/mention/plugin.js @@ -69,7 +69,11 @@ this.editor.execCommand('mceInsertContent', false, rawHtml); this.editor.focus(); - this.editor.selection.select(this.editor.selection.dom.select('span#autocomplete-searchtext span')[0]); + this.editor.selection.select( + this.editor.selection.dom.select( + 'span#autocomplete-searchtext span#autocomplete-delimiter' + )[0] + ); this.editor.selection.collapse(0); }, @@ -408,4 +412,4 @@ tinymce.PluginManager.add('mention', tinymce.plugins.Mention); -}); \ No newline at end of file +});