Friday, September 7th, 2007
Alex is on a roll (just call him butter!) and has written about the state of browser WYSIWYG editing:
The state of in-browser WYSIWYG is somewhere between pitiful and mind-numbingly painful. Opera and Safari have pulled themselves up by the bootstraps and soon all the major browsers will be at the same level of awful, more or less. This area of DHTML doesnâ€™t get much love from browser vendors in part because only the heartiest souls ever venture into these deep, shark-infested waters so there arenâ€™t many people clamoring for fixes to the underlying capabilities. Everyone sane just picks up the Dojo Editor, TinyMCE, or one of the other good editing packages that are available.
Since watching Abe Fettig talk about his experience building a cross browser editor in Dojo, I have stayed away with a ten foot poll. Everyone is broken.
Alex has a set of APIs he would like to see:
Since itâ€™s not really reasonable to expect that browsers will remove
contentEditable, here are my proposed APi additions to it which would allow any sane editing UI to ditch the entire command structure which can slowly fade into the background over time.
editableElement.openUndoTransaction(callbackHandler): starts an undo transaction, implicitly closing any previously opened transactions. All subsequent DOM manipulation to elements which are children of this element will be considered part of the transaction and normal browser-delimited undo transaction creation is suspended until the transaction is closed. The optional callback handler is fired when the user cycles back this far in the undo stack from some future state.
editableElement.closeUndoTransaction(): ends a manual undo transaction. Implicitly called by openUndoTransaction. Closing the transaction has the effect of pushing the current DOM state (or whatever differential representation the browser may use internally) onto the browserâ€™s undo stack for this editable element. When an undo transaction is closed, browsers may resume automated generation of undo states on the stack intermingled with the manually added states.
- Support for non-standard DOM positioning properties of range objects as outlined in MSDN
These APIs added to elements with
contentEditableset will allow us to use regular-old DOM methods of manipulating user selections and adding complex content from user input without fighting for control of the undo stack or inventing our own (which has so many problems that I donâ€™t want to begin to address them). Additionally, this method of manipulation will allow toolkit authors to deliver editors which operate on the semantics of the markup more easily.
Robbert Broersma of Xopus already commented that “developing a WYSIWYG editor in-browser will eventually not involve contenteditable anymore”. Somehow I don’t see the browser vendors stepping up? :/
Posted by Dion Almaer at 8:37 am