StevenDevooght / tinyMCE-mention

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

Doesn't work with valid_elements config option #7

Closed aggied closed 10 years ago

aggied commented 10 years ago

I need to be able to include custom attribs in my TinyMce elements. When I enable the valid_elements config option, the mention plugin doesn't work and I get this error:

Uncaught TypeError: Cannot read property 'top' of undefined 

which points to this code of the plugin (line 207):

 top = rtePosition.top + contentAreaPosition.top + nodePosition.top + $(this.editor.selection.getNode()).innerHeight() - $(this.editor.getDoc()).scrollTop() + 5,

To be more specific, I need to be able to insert a element bound as an AngularJS directive. Without the valid_elements option, when the content is saved TinyMce strips out my custom directive attribute of the element. This is my config for TinyMce:

valid_elements:'span[get-title]',

I've tried changing this to various things, like "p[get]" to no avail.

Any thoughts here?

aggied commented 10 years ago

Well after 5 minutes of reading the TinyMce docs a littler harder I believe I have cleared up my own misunderstanding. Looks like this works just fine:

extended_valid_elements:'span[class|style|id|name|title|get-title]',

I just misunderstood what the valid_elements option did. This should probably be closed.

StevenDevooght commented 10 years ago

Ok, I'll close this one.