[whatwg] Fixing undo on the Web - UndoManager and Transaction
Ehsan Akhgari
ehsan at mozilla.com
Tue Aug 2 11:30:49 PDT 2011
This is a very nice proposal; thanks for working on this, Ryosuke! I
have a number of questions and concerns on it, and I would appreciate if
you can comment on these:
1. The definition of @undoscope seems to not address the question of
whether the document element should be an Undo Scope or not.
2. @undoscope seems to make it very hard to support the usecase of
moving the undo scope from an element to another. (I'm not sure if that
is a concern that we need to address at all, though).
3. In regard to "Should apply return a boolean value indicating whether
it successfully applied or not?", answering yes means that we should
make sure that we're going to be able to cleanly revert a transaction
when it fails, right? Also, saying yes here means that we should decide
what happens if that transaction is in a transaction group. ... all of
which makes me want to say no. :-)
4. In regard to "Need to restore selection as well", is that something
which we want all the time? Imagine an "indent" transaction which
indents a paragraph by increasing its start margin, should it change the
selection when it's undone?
5. I have serious doubts about the current specification of manual
transactions. I don't know why we need to exclude them from group
transactions, but honestly, I'm not sure why we need to have them at
all. What use cases are we trying to address by manual transactions
that would otherwise be impossible to address with managed transactions?
6. I think if we want to address selection saving/restoring, that part
belongs to the "Mutation of DOM" section. We might also need to address
some other editing related stuff in the DOM state, such as the keyboard
layout language, selection, etc.
7. I'm not sure if we should leave the interaction of @contenteditable
and @undoscope unaddressed. At the very least, we need to specify
whether by default all contenteditable elements on a web page share the
same undo manager or not. If I were to pick the default, I would
suggest that by default they should all share the document's undo manager.
8. As a last comment, I think a better name for UndoManager is
TransactionManager, since, well, that's what it really is! :-)
Cheers,
Ehsan
More information about the whatwg
mailing list