StevenDevooght / tinyMCE-mention

Mention/Autocomplete plugin for tinyMCE WYSIWYG editor.
http://stevendevooght.github.io/tinyMCE-mention/
220 stars 95 forks source link

Cannot read property 'toLowerCase' of undefined #72

Open kurdtpage opened 5 years ago

kurdtpage commented 5 years ago

I have just installed this plugin (2018-10-03) with TinyMCE version 4.2.7 and I get the following errors (I am using Sentry):

/js/tinymce/plugins/mention/plugin.min.js in e.matcher at line 1:3336

{snip} delay)},matcher:function(t)  {return~t[this.options.queryBy].toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(t)  {for(var e,i=[ {snip}

/js/tinymce/plugins/mention/plugin.min.js at line 1:4116

{snip} .hasFocus){var i=this,o=[],s=t.grep(e,function(t){return   i.matcher(t)});s=i.sorter(s),s=s.slice(0,this.options.items),t.each(s,function(e,n) {snip}

/jquery-1.11.2.min.js in Function.grep at line 2:3603

{snip}

/js/tinymce/plugins/mention/plugin.min.js in e.process at line 1:4088

{snip} ,process:function(e){if(this.hasFocus){var i=this,o=[],s=t.grep(e,function(t){return   i.matcher(t)});s=i.sorter(s),s=s.slice(0,this.options.i {snip}

/jquery-1.11.2.min.js in e at line 2:3959

{snip}

And in raw format:

TypeError: Cannot read property 'toLowerCase' of undefined
  at e.matcher(/js/tinymce/plugins/mention/plugin.min.js:1:3336)
  at ? (/js/tinymce/plugins/mention/plugin.min.js:1:4116)
  at Function.grep(/jquery-1.11.2.min.js:2:3603)
  at e.process(/js/tinymce/plugins/mention/plugin.min.js:1:4088)
  at e(/jquery-1.11.2.min.js:2:3959)
  at Object.success(/js/shiftnotes.js:34:6)
  at j(/jquery-1.11.2.min.js:2:27295)
  at Object.fireWith [as resolveWith](/jquery-1.11.2.min.js:2:28108)
  at x(/jquery-1.11.2.min.js:4:22061)
  at XMLHttpRequest.b(/jquery-1.11.2.min.js:4:25980)
AhmedElbatt commented 5 years ago

@kurdtpage I'm stuck at the same issue.May I ask you if you've already solved this issue or had a work around solution? Thanks !

kurdtpage commented 5 years ago

Sorry for the late reply, I have not changed anything. I assume this will be fixed in the next update.

It's hard to check if the variable that toLowerCase is being applied to is defined or not, because I am using minified code

TKharaishvili commented 5 years ago

I have had this issue when:

a. I didn't pass the queryBy option, or b. The queryBy option I passed wasn't present as a property in source objects

Your issue might be caused by the same reasons. If not however, try referencing the unminified script file instead, the code is only a couple hundred lines long and it's not that hard to figure out what's going on in there.