Search code examples
phpjavascriptwysiwyg

What's the best way to limit tags in a WYSIWYG editor?


limitation of tags in a wysiwyg editor by excluding buttons is completly not enough, because i still can copy a page content and past it in the editor, and... it's will accept it !

i want some solution to limit the allowed tags, by example i love the way stackoverflow limit it by the traditional way of *** and quotes, but i don't want this style , i still like the wisiwyg's Real-time editing.

Note : If it's impossible, how i can do that in the php script which receive the html ?

Thanks


Solution

  • You could use regular expressions to processing the tags you would like to remove. The fckEditor does something very similar to your requirement when it pastes the clipboard contents as unformatted text. As it is open source, I think you can get some inspiration from it or even use it if it fits your requirements.