tinymce: rich text mode, how does it work

前端 未结 1 1997
孤城傲影
孤城傲影 2021-01-04 10:34

I want to understand how tinymce functions.

the rich text editor contains an html document within an iframe. how are the nested DOM elements inside editable, In othe

相关标签:
1条回答
  • 2021-01-04 11:27

    In tinyMCE's case (and most other editors) it's an <iframe> (as to not inherit styling from the parent page, among other reasons), but the magic is the contentEditable attribute being set to true.

    You can read more detail in the working draft of HTML5 here.

    You can test a very simplified demo here, the editors do much more of course with their toolbars, a backing <textarea> to store the markup for server-submission, etc...but your question seems to be how are you editing the elements, the core of that is contenteditable.

    0 讨论(0)
提交回复
热议问题