[whatwg] Fixing undo on the Web - UndoManager and Transaction
jonas at sicking.cc
Fri Aug 5 19:12:04 PDT 2011
On Fri, Aug 5, 2011 at 5:17 PM, Ryosuke Niwa <rniwa at webkit.org> wrote:
> On Fri, Aug 5, 2011 at 5:06 PM, Jonas Sicking <jonas at sicking.cc> wrote:
>> For example in the collaborative editing case I would think that the
>> page generally wants to get a semantic understanding of the editing
>> operations so that it can reapply them even if the DOM looks somewhat
>> different when an action is redone. I.e. even if someone else has
>> edited the page by the time the action is redone.
> You're right that you can redo what the UA did after you unapplied the
> managed transaction UA inserted. So maybe "replace" isn't really that
> useful after all. But I had an impression that having to "replay" UA's DOM
> changes is annoying. But getting rid of "replace" will certainly make the
> API simpler, and we might able to address the latter concern by introducing
> a function that take a mutation list and re-applies it.
You'll need to be able to "replay" the UA's DOM changes anyway since
you need to redo them if the user "undo"s and "redo"s.
>> If it's needed for other reasons too, then of course we should. But
>> I'd like to understand those other reasons.
> e.g. some apps may want to use br instead of p or div for paragraph
For these I would imagine you cancel the beforeEditingAction event and
do your own DOM modifications.
> And there might be some custom UI that shows up around the
> inserted text.
For this I wouldn't imagine you want to replace the managed
transaction anyway since you still want to let the UA deal with
undo/redo, right? Instead I'd merge another transaction which adds the
custom UI with the managed one that the UA created.
More information about the whatwg