简体   繁体   中英

How to make it possible to display special characters in CKEditor

I want to write a simple plugin to display special characters in CKEditor.

How to make it possible to display special characters. For example: space, tab, non-breaking space ( ).

Should work on the principle, as is done in Word.

Short answer: It is hardly possible to achieve the same results as in Word.

Why? Because CKEditor is a browser based editor that uses contentEditable. It does not render itself the content - the browsers do this. So in order to display spaces you would need to mark every single one of them with some spans. To mark line endings you would need to insert some additional elements. That's doable, but then editing is a huge problem. Many situations need to be taken into consideration, but most importantly - you need to update those spans live. This makes problems with undo manager, selection, formatting features, keyboard navigation, etc.

Therefore, a partial, but perhaps satisfying solution, could be to enable read-only mode when displaying this characters.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM