Once conceptual change is the move away from the very overloaded "steps"
term into states. A state may be made up of one or more operations,
depending on the implementation of the undo manager.
Consumers of the SessionController would all need to check if and how
undo was supported. As a result, it makes more sense to simply expose
the necessary signals for UI purposes, and encapsulate how the signals
are bound inside SessionController
This manager supplies really simple undo and redo behaviour. Undo is
achieved by resetting the document back to the initial state, and
replaying all operations on top of it.
This undo mechanism is not suitable for a networked operation sessions
as there is no attempt to communicate the resetting of the document
state.
Initial undo state for a document is set when startEditing is called on
a session. This state is effectively a clean document with the local
cursor added to it.
* Added undo/redo buttons to the editor
The one caveat with this is that Paste in Safari is still
unsupported as Safari blocks the command on
read-only elements (a security feature perhaps?).
Neither cut or paste work on Firefox.
As per some previous commits, the maintainCursorSelection behaviour is only valid
while there is a cursor on the document. This is now properly unsubscribed when
endEditing is called.
Recent changes to make OpRemoveText accept positive lengths
only broke reverse selections, as a reverse selection will generate a
negative length (the focus node is BEFORE the anchor node)
Implemented support for range selection in edit mode
Works similarly to the existing cursor. A node is
placed in for the start and end positions of a cursor.
The window selection is updated based on cursor moved events.
The selection sync logic really belongs in SessionView. However,
as only a single selection is supported in the current
implementation, this has been temporarily put into SessionController.
A new function OdtDocument.getCursorSelection has been added
to make it trivial to support range-selection operations.
Fixed lost-in-translation
Works similarly to the existing cursor. A node is
placed in for the start and end positions of a cursor.
The window selection is updated based on cursor moved events.
The selection sync logic really belongs in SessionView. However,
as only a single selection is supported in the current
implementation, this has been temporarily put into SessionController.
A new function OdtDocument.getCursorSelection has been added
to make it trivial to support range-selection operations.
* Move responsibility for setting the memberId into Cursor to
allow proper hiding of anchor node
Sometimes a selection would appear when the cursor was moved by clicking. This is fixed by explicitly collapsing the selection which effectively makes it invisible. In addition the onmouseup event is also registered to move the cursor. The onclick event does not suffice to catch all user actions intended to move the cursor.
is zero, *delete* that textNode. So that we can avoid multiple textNodes
after backspacing.
Important: SessionController allowed removeText operations to be fired
if the position was -1. This caused a lot of nodes *after* the cursor to
be deleted in 'bulk' if you pressed backspace at the first position of the
document. Disallow that.