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

On Thu, Sep 1, 2011 at 6:26 AM, Alex Vincent <ajvincent at gmail.com> wrote:
> ? 3. I just spotted a flaw in our API's. ?Imagine the following:
> ? ? ?-
>
> ? ? ?myEditor.undoManager.transact({apply: function () {
> insert(document.createTextNode('o')) }, label: 'First transaction'});
> ? ? ?myEditor.undoManager.transact({apply: function () {
> insert(document.createTextNode('k')) }, label: 'Merging transaction'},
> true);
>
> ? ? ?- User calls myEditor.undoManager.item(0).label. ?Which label does he
> ? ? ?get back? ?For that matter, which transaction does he get back, and which
> ? ? ?transaction is forever hidden from him?
> ? ? ?- Perhaps for this reason, .item() should return a readonly
> ? ? ?Transaction[], representing the transaction group.

That's what we've been thinking for the Firefox implementation. It's
not a great solution though, but I can't think of a better one.

/ Jonas

Received on Thursday, 1 September 2011 11:13:32 UTC