Re: [w3c/editing] undo manager (#209)

@johanneswilm The `ยง 2. Definition` section defines the `undo history` which seems to be considered an implementation detail for the browser implementers. It suggests managing it as an ordered list with a caret pointing at the location where the redo stack ends and the undo stack starts. This means that in order to use the apply/invert model with the undo/redo callbacks, every `UndoItem`'s redo callback will have to be registered to a function like the following.

```
function redoCallback(item)
{
    applyAction(invertAction(item));
}
```

The current `UndoItemCallback` is a void function and doesn't provide the required parameter. It has to be captured beforehand and so a new handler has to be instantiated for every single `UndoItem`.

**Alternative proposal #1**
Modify the signature of `UndoItemCallback` so that it provides the `UndoItem` being operated upon as a parameter.

**Alternative proposal #2**
Make it possible for user code to provide its own `UndoHistory` implementation as opposed to enforcing it on the browser's side, accomodating both use cases (undo/redo as two different actions vs apply/invert on generic actions).

**Alternative proposal #3**
Enforce the apply/invert model by modifying the definition for the `undo history`.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/editing/issues/209#issuecomment-560821411

Received on Monday, 2 December 2019 22:56:16 UTC