[whatwg] Fixing undo on the Web - UndoManager and Transaction
Jonas Sicking
jonas at sicking.cc
Sat Aug 13 14:22:59 PDT 2011
On Friday, August 12, 2011, Ryosuke Niwa <rniwa at webkit.org> wrote:
> On Fri, Aug 12, 2011 at 3:11 PM, Ehsan Akhgari <ehsan at mozilla.com> wrote:
>>
>> On 11-08-12 6:10 PM, Ryosuke Niwa wrote:
>>>
>>> But having authors add flag in almost all cases isn't that nice either.
>>
>> Why do you think that authors need to specify the flag in almost all
cases?
>
> Because almost all text editing operations need to restore selection upon
redo.
One option would be to have just one function, but pass it boolean
indicating if it's the first application or a redo. That way it's easy to
surround the selection management with "if (reapply)"
This seems to combine the best of both proposals. No encoring code
duplication, but still easy to have reapply-specific code paths such as
selection management.
/ Jonas
More information about the whatwg
mailing list