This allows consumers to enter and exit edit mode multiple times without
the undo stack being reset. Once the initial undo state has been captured
after the document is loaded, there is no major problems with preserving
the undo state (other than the undo manager’s shameful performance).
Any cursor add or removal commands should be tracked for the purposes
of restoring the document state. If a cursor operation is missed, the
document will not re-add the cursor after an undo operation.
With the event trap now being inside the cursor, any repositioning of
the cursor causes the document.activeElement and window selection to
change. This causes the document to stop being editable after actions
such as bolding current text.
Now, the focus state of the event trap is checked prior to each
operation, and will be reset back to the event trap if disrupted by an
operation. Note, checks are in place to prevent stealing focus if the
document is not active when an operation is executed.
Fixes issue #298
SessionController needs to override the backspace key at all times, and
if the document is not editable, simply return true. The easiest way to
do this is to switch out the keybinding, and forcibly clobber the existing
keybinding when leaving edit mode.
If the event trap receives focus on a mouse-down event, the selection will
become "trapped" inside the content-editable bounds. This can happen when
the user double-clicks on the caret (to start word expansion) and drags.
In this instance, the selection will appear to "stick" on the single word
surrounding the caret.
Problem introduced in 8b6ef8f
If the current selection is inside the content editable event trap, attempting
to collapse the window selection will have no effect. This results in the
shift+click selection method just moving the cursor to the location of the
second click.
Problem introduced in 8b6ef8f
When composition session is ended on Safari under MacOS by pressing
another text char, Safari incorrectly reports the next keypress event’s
“which” value as the last compositionend data, rather than the new key
that was pressed.
Some IMEs will stack end & start requests back to back. If the selection
is modified between an old and new session (e.g., via text updates), the
new composition session never starts. One mainstream example of this is
inputting text using MacOS’s option+char method
This change extends the use of the event trap to allow in-line character addition
using the OS's IME. The event trap will now be moved to within the local user's
cursor block, and will become visible when a composition start event is detected.
This has been tested on Chrome, FF & Safari on all platforms. In addition, this
enables support in FF on Android.
Known issues
- No IME support on Chrome under Linux. The compositionend event emitted by Chrome
contains no data, so the input character can't be detected.
Current behaviour:
Left click causes navigation in both edit and view mode
After the change:
Same as current behaviour in view mode.
In edit mode, left click will just move the cursor to desired position. In order to navigate, user need to hold control key and then click
This also addresses an outstanding TODO in code that select-all was only
ever selecting the entire document, rather than all the text inside the
current root (e.g., the current annotation)
This re-implementation also addresses problems when navigating passed
annotations as identified in issue #65 & #65.
This also fixes a large performance issue with extending or moving the
cursor via short-cut keys.
A drag end will consume the corresponding mouse up operation, meaning
the window selection is not cleared. Cope with this by listening for
the drag event and clearing the selection.
The window selection only needs to be synchronized with WebODF on a
mouse down operation. In all other cases, the selection doesn't need to
be maintained. Removing the selection most of the time significantly
helps performance as there is heavy costs to modifying part of a DOM
tree that is selected.
In order to allow cut/copy to continue to function, an event trap was
necessary that "holds" the selection after mouse-up. This is set as
content editable to allow the cut/copy events to be fired in Firefox and
Safari.
Firefox seems to get rather confused about the window selection when
shift+extending it. Help this poor browser by resetting the window
selection back to the anchor node if the user is holding shift.
Fixes issue #123.
Previously, the editor would wait for mouse up before expanding the
virtual selection.
Now, this can easily be done on mouse down as well. this makes the
editor feel a lot more responsive when double or triple clicking to
increase expansion. It now mimics built-in Chrome behaviour.
Chrome's built-in paragraph expansion will put the end of the selection
at (p,0) of the FOLLOWING paragraph. Round this back down to ensure the
next paragraph doesn't get incorrectly selected.
Fixes issue #165.
SessionController had some internal confusion about whether to work in
selection or range+bool. This cleans these up to ensure the direction is
properly preserved throughought.
Pasting plain text with line breaks allows intelligent
merging into lists as well as multiple paragraphs.
Currently does not do the right thing on undo/redo,
as the undo manager does not respect operation groups
(yet).
The new step translator is also stricter about the requested number
of steps and will assert if more steps are requested than are available
in the document. This revealed a test that was asking for an invalid
step.
Previously, various consumers needed to be careful about only
asking for nodes inside the root node. Failure to do so resulted
in unpredictable behaviour.
To simplify the interface and improve the system robustness, this
rounding is now taken care of behind the StepsTranslator interface.
Drawing the cursor on every mouse move event badly impacts the responsiveness
of the application, because the move events buffer in the browser until
every single event is processed. By setting these on a background timer,
the cursor is updated asap, but is able to aggregate multiple move events
received in this time period.