문제

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…)

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top