W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2011

Re: before/after editaction

From: Jonas Sicking <jonas@sicking.cc>
Date: Tue, 30 Aug 2011 18:39:52 -0700
Message-ID: <CA+c2ei-cd+efHPqemOKS9i5X=g2s=2kCPSwb7tgCOQcSCrMDJw@mail.gmail.com>
To: Ryosuke Niwa <rniwa@webkit.org>
Cc: Darin Adler <darin@apple.com>, public-webapps <public-webapps@w3.org>
On Tue, Aug 30, 2011 at 5:07 PM, Ryosuke Niwa <rniwa@webkit.org> wrote:
> On Tue, Aug 30, 2011 at 4:34 PM, Darin Adler <darin@apple.com> wrote:
>>
>> My question was not about the undo command. I meant that if I implemented
>> a handler for the aftereditaction event that changed b tags to strong tags,
>> how would the undo machinery undo what I had done?
>
> Ah, I see.  So UA won't be able to undo/redo those DOM changes as of now.
>  However, authors can use UndoManager and transactions (see
> http://rniwa.com/editing/undomanager.html) to hook into UA's undo manager.
>  e.g. if authors wanted UAs to manage undo/redo for those changes, they can
> make those changes as a managed transaction.

My suggestion during the above mentioned Toronto meeting was that the
UA starts a managed transaction before firing the beforeEditAction
event.  This transaction would record any changes done during the
beforeEditAction and the afterEditAction event. It would also record
the changes done by the UA itself as the actual edit action.

This way, and changes done during the beforeEditAction and
afterEditAction events would be automatically part of the "undo-able"
action created in response to the command. So if the page cancels the
beforeEditAction in response to a "bold" command, and instead inserts
<strong> elements, then this modification would be undone if the user
or the page initiates an undo.

I think this proposal got minuted for the first day.

The one thing that this doesn't solve is what to do in cases when the
page wants to replace the current action with a manual transaction
rather than the managed one usually created. Ideas for how to solve
that are welcome.

/ Jonas
Received on Wednesday, 31 August 2011 01:40:51 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:47 GMT