[whatwg] Proposed updates for the command API's

João Eiras joao.eiras at gmail.com
Wed Aug 13 17:36:48 PDT 2008

> As an implementer of a WYSIWYG editor, I would use this all the time:
>      Inserting an Image and having a reference to it.
>      Inserting HTML, then being able to filter the content.
>      Hopefully capturing the change from a paste event so I can  
> fix/filter the content.

I fully agree we need such a feature.
Currently the only possible ways of aceiving this require too much coding,  
either comparng ranges, or locating what's selected and inserting elements  
programatically which beats the entire purpouse of doing execCommand.

However defining a good API for this can be laborous. ModifiedNodes  
command seems like a bad idea, mainly because execCommand is expected to  
return boolean.

IMO, there should be an API that provides a stack (command history) with  
all commands done on a document, and the hability to move back and forward  
in that stack. Then for each object in the stack there could be some  
properties like deleted nodes, modified nodes, added nodes, timestamp,  
command executed. Scripts should be able to add event listeners for all or  
specific commands.

This would benefit two use cases: provide an UI to the user similar to  
paint.net where you can see all editions done, and also provide extra  
functionality for rte editor to debug their editor.


More information about the whatwg mailing list