Question

I would like to create a very simple WYSIWYG text editor that would only allow the user to italicize or bold the text.
I was using a simple div with contentEditable but users could paste formatted text or format text using their browser features.
What I want is more like a textarea with bold or italic text inside…
I heard about a technique of hidden textarea but I didn't really understood how it works (how the user can change the cursor position…)

Était-ce utile?

La solution

Im putting this as a more formal answer


You can basically use ckeditor here and as Renmar suggested, you can disable buttons which disable formatting features. e.g:

  • Disabling Bold and Italic will remove any bold and Italic formatting on preformated text

You can experiment here in the text editors where some features have been disabled

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top