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

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

From: Ryosuke Niwa <rniwa@webkit.org>
Date: Wed, 21 Sep 2011 09:58:27 -0700
Message-ID: <CABNRm63hEwZ8ZhBJexsHRiDTwtGynq8L667KV+aKzv78tE+O6w@mail.gmail.com>
So apply, unapply, and reapply are callback functions supplied by authors
and called by UAs.

  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.

You could argue that there might be some authors that want to wrap
undoManager around and be a man-in-middle but we haven't seen any use case
for that yet.

- Ryosuke

On Wed, Sep 21, 2011 at 9:22 AM, Aryeh Gregor <ayg at aryeh.name> wrote:

> On Wed, Sep 21, 2011 at 11:33 AM, Ryosuke Niwa <rniwa at webkit.org> wrote:
> > So the argument is that authors will never call apply themselves. Only
> > browsers would.
> I'm very confused now.  Why would it be in an IDL in a web standard if
> authors will never call it?  It's an implementation detail then.  I
> feel like I must be missing something fundamental here.
Received on Wednesday, 21 September 2011 09:58:27 UTC

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