3 ms·
designMode is absolutely horrible though. When you press enter in the edit box, some browsers add a <br> tag, some start a new <p> tag, etc etc. It's a complete
by axod 17y ago
designMode is absolutely horrible though. When you press enter in the edit box, some browsers add a <br> tag, some start a new <p> tag, etc etc. It's a complete mess.
Also the API is ridiculous.
editableDocument.execCommand("Bold", false, null);
execCommand? seriously?
- olavk 17y agoI wrote an article for Opera about designMode and contentEditable: http://dev.opera.com/articles/view/rich-html-editing-in-the-browser-part-1/ http://dev.opera.com/articles/view/rich-html-editing-in-the-... You are right it is messy. The API as apparently modelled over the IOleCommandTarget which is a Microsoft API for document-toolbar integration. They probably never expected it to become a cross-platform standard.
- axod 17y agoThanks, useful article. I hope one day they standardize that stuff into a usable DOM API.
- euroclydon 17y agoYeah, I just assumed I was missing something. document.execCommand() has an invisible argument that is the selected rendered HTML???