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

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

From: Aryeh Gregor <ayg@aryeh.name>
Date: Wed, 21 Sep 2011 16:41:34 -0400
Message-ID: <CAKA+Ax=xCHL8g5Cb9_dY=0FS==6D=8hrE+pCGkOhojEji_7XeQ@mail.gmail.com>
On Wed, Sep 21, 2011 at 12:58 PM, Ryosuke Niwa <rniwa at webkit.org> wrote:
> So apply, unapply, and reapply are callback functions supplied by authors
> and called by UAs.
> e.g.
> myUndoScope.undoManager.transact({
> ? apply: function() {alert('done');},
> ? unapply: function() {alert('undone');},
> ? reapply: function() {alert('redone');}
> })
>
> the above code inserts a new transaction which pops up alert('done'), and
> then alert('undo') and alert('redone') when the transaction is undone or
> redone. ?But undo/redo of a transaction is done through undoManager.undo,
> undoManager.redo, or execCommand so authors don't ever call unapply or
> reapply functions directly in those normal use cases.

Oh, I see.  Okay, then, having a boolean argument isn't such a big
problem.  "return true" and "return false" aren't as bad, because you
only have to deal with one at a time.
Received on Wednesday, 21 September 2011 13:41:34 UTC

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