W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2011

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

From: Jonas Sicking <jonas@sicking.cc>
Date: Thu, 1 Sep 2011 11:13:32 -0700
Message-ID: <CA+c2ei9OZbhoX8rHgWAtEmjW3w0Cr4+=pUnq2Ph80EMumcRkTg@mail.gmail.com>
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

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:36 UTC