Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rich Text Editing - designMode vs contentEditable

When creating a cross-browser rich text editor. Which would you use and why?

Keep in mind that pasting has to be resilient to stand against multiple sources (notepad, word, other websites) and it should not be dependent on any Javascript libraries.

like image 979
Gary Avatar asked Aug 18 '10 15:08

Gary


People also ask

Should I use Contenteditable?

If the input should be editable by user, you should use this. Its totally on the client side, means that on browser side. Of course you should secure the value if its going to be sent to you server database.

What is Contenteditable?

The contenteditable global attribute is an enumerated attribute indicating if the element should be editable by the user. If so, the browser modifies its widget to allow editing.

How do you use Contenteditable?

Answer: Use the HTML5 contenteditable Attribute You can set the HTML5 contenteditable attribute with the value true (i.e. contentEditable="true" ) to make an element editable in HTML, such as <div> or <p> element.


1 Answers

You probably want contentEditable. designMode applies to the document, contentEditable to a specific element and its children.

http://blog.whatwg.org/the-road-to-html-5-contenteditable

like image 97
jvenema Avatar answered Oct 14 '22 06:10

jvenema