I need to create a very basic online WYSIWYG editor that supports only a few formatting options (e.g., bold, italic, font color). I've tried using a div with contenteditable
enabled.
One issue I've encountered is that users can paste text with more formatting options than I want my editor to support (e.g. lists, font size, etc.). Is there a reliable cross-browser approach to ensure that pasted text is converted to plain text stripped of formatting (or better yet, only allows the formatting options that the editor wants to support)?
Here is an example: