javascript - TinyMCE: validate elements on each keystroke -
i'm using tinymce base wysiwyg editor, , i'd allow subset of html elements entered in it, whatever mean.
there 3 different means of entering html elements editor: buttons (such bold button), shortcuts (ctrl+b
bold) , copy-pasting.
i'm using custom template, have limited number of buttons allow number of elements.
but using shortcuts or copy/pasting, user can add whatever wants editor.
the valid_elements
configuration option allows filter out elements (it works whitelist), it's triggered on cleanup, (afaik) run when form submitted.
this great, i don't want things added editor in first place if they're not valid elements.
how achieve behavior?
this great, don't want things added editor in first place if they're not valid elements.
this not easy because need check each way of code can editor , check before insertion if html code valid. might easier call cleanup on actions:ed.execcommand('mcecleanup');
otherwise have check
- the insertion using code plugin
- copy/paste using paste_preprocess setting
- the insertion using code plugin
- and annoying: pasting using right click browser menu (this pain in ass handle)
Comments
Post a Comment