[whatwg] Fixing undo on the Web - UndoManager and Transaction

Ryosuke Niwa rniwa at webkit.org
Thu Jul 28 00:38:46 PDT 2011


On Wed, Jul 27, 2011 at 11:44 PM, Alex Vincent <ajvincent at gmail.com> wrote:
>
> I'm seeing one major hole in your interface:  you don't clearly specify how
> to *end* a transaction group.  This really matters for when I want to
> start a group manually, do a bunch of little things, and then end the group.
>

You can end a transaction group if you call transact or replace with
merge=false.

Personally, I think Jonas's API is better than yours, for its simplicity,
> but it doesn't allow for adding manual transactions in the middle of a
> grouped transaction. With his model, one explicitly calls out when a
> transaction should happen - there's no ambiguity, and when I don't want a
> transaction, I don't get one.  With your model, it's harder to tell, and
> very much either implementation-dependent or specification-dependent when a
> transaction happens natively and when it doesn't.  That makes it prone to
> bugginess / inconsistent behavior.


I don't quite get what you mean here.  Could you elaborate a little?

I'd personally take elements of both API's, myself:  add your
> ManualTransaction interface and
> UndoManager.applyManualStep(ManualTransaction) to Jonas's last UndoManager
> interface.


That was my initial thinking as well.  However,


> I also like the tendency of your API to make each transaction its own
> object, where we can store properties besides just the title on each
> transaction.


making all transactions objects will allow authors and UAs to
provide arbitrary properties on them.  Also, I wanted the transaction
objects be provided during undo, redo, and hypothetical edit action or new
transaction events.

- Ryosuke



More information about the whatwg mailing list