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.
Resynchronising the shadow cursor back to the window during a drag or
mouse-move operation is ignored in Chrome & FF, but causes exceptions
and strange selection behaviour in IE. There is no benefit to doing
this, as the selection is resynchronized on mouse-up regardless.
Internet explorer will occasionally discard the event before the timeout
callback is triggered, resulting in "Member not found" exceptions being
thrown.
The recent shadow cursor implementation hides the native browser selection
highlights. However, the shadow cursor itself only starts being drawn
after edit-mode is enabled, meaning for a readonly document the selection
is invisible (#119)
This is a simple workaround that allows the native selection to be drawn
in circumstances where the shadow cursor is not active. Long term, the
shadow cursor should be also used on non-editable documents as detailed
in solution ideas for #119.
At this point, this is not intended to be open for extension as it is too
easy to break OT logic by incorrectly manipulating the operation groups.
Instead, convert this to use a specific-built extension point under tight
control of WebODF.
esc, tab, delete, backspace, undo/redo and copy/cut.
Note: MS Word behave differently from LO/AOO when image is selected.
When press letters,numbers&symbols, MS Word inserts the text just before the
image; where LO/AOO ignores all of them.
Also you can extend selectiion using keyboard shortcuts (e.g
shift+left) in MS Word, but you cannot do so in LO/AOO.
TODO:
Esc - deselect image
Tab - move to next frame in the document
*Added a ImageSelector class to draw and clear image selection
Known issue:
The selection box is moving up and down when using browser's zooming functionality. but it is working fine with the slider zoom
hold the 'selected range' fed to it, like with any other OdtCursor. It
provides a minimal OdtCursor-like interface, with only the methods
absolutely required to make it work. It does not modify the DOM in any
way.
* Make the shadowCursor object an instance of ShadowCursor, not
OdtCursor. This is ideal because ShadowCursor does not modify anything
in the DOM, and therefore is safer and faster to use for tracking
browser selections. This makes backwards-selections work finally,
because now there are no anchor nodes to interfere with the selection
whilst dragging.
* With the introduction of the ShadowCursor, we no longer have the
selection range's endpoints coinciding the with beginning and end of the
respective startContainer and endContainer. Therefore, modify
getExtremeRanges to reflect this. If an endpoint of the selection range
does not lie within a TextNode, we latch on to the nearest text node
within.
* In the SessionController, call maintainShadowSelection() if the
selection might leak outside the allowed local root, so that the
window selection object remains root-confined.
* Clone ranges if they may be later modified.
Properly detach ranges once they are used in SelectionView, less
memory leaks.
SelectionViewManager that maintains SelectionView instances, and a
shadow cursor object that is an invisible caret-less cursor, fed to both
SessionController and SessionView, which follows the selection as it
changes.
Selections by each cursor are colored according to their memberid
The selection direction was being lost when the window's current selection
was resynchronised to the cursor selection. For firefox and some versions
of Chrome, this would cause selection extension behaviours (shift+click)
to work incorrectly when attempting to extend the selection to the left
of the caret.
Moving the cursor to the start of the removed annotation allows the
scrollIntoView behaviour to work more smoothly. Previously, removing an on-
screen annotation would likely result in the view being reset to the
cursor which was potentially offscreen at the time.
Fixes issue #33