From e34a7b8c7fc0de06edd867b00e3ea0f6209b1840 Mon Sep 17 00:00:00 2001 From: ggeles Date: Tue, 17 Jul 2018 12:41:04 -0400 Subject: [PATCH 1/2] stor-11705 check for undefined --- index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index dc8d7c2..5aba247 100644 --- a/index.js +++ b/index.js @@ -264,8 +264,11 @@ case 1: // The user has removed everything except the delimiter. We need to remove some extra tags that TinyMce adds to keep the autocomplte working var caret = this.editor.dom.select('span#autocomplete span#_mce_caret')[0]; var searchtext = this.editor.dom.select('span#autocomplete span#autocomplete-searchtext')[0]; - this.editor.dom.add(caret.parentElement, searchtext); - this.editor.dom.remove(caret); + + if (carret && searchtext) { + this.editor.dom.add(caret.parentElement, searchtext); + this.editor.dom.remove(caret); + } this.editor.selection.select(this.editor.selection.dom.select('span#autocomplete-searchtext span')[0]); this.editor.selection.collapse(0); From 06cdbb13f570f514027182f73dfa58825b1b4e89 Mon Sep 17 00:00:00 2001 From: ggeles Date: Tue, 17 Jul 2018 12:52:17 -0400 Subject: [PATCH 2/2] stor-11705 check for undefined1 --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 5aba247..9c2cf54 100644 --- a/index.js +++ b/index.js @@ -265,7 +265,7 @@ var caret = this.editor.dom.select('span#autocomplete span#_mce_caret')[0]; var searchtext = this.editor.dom.select('span#autocomplete span#autocomplete-searchtext')[0]; - if (carret && searchtext) { + if (caret && searchtext) { this.editor.dom.add(caret.parentElement, searchtext); this.editor.dom.remove(caret); }