Skip to content

Commit

Permalink
stor-11705 check for undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
ggeles committed Jul 17, 2018
1 parent 829e6fc commit e34a7b8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e34a7b8

Please sign in to comment.