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
The recent extraction of text manipulation functions slightly changed
the backspace key behaviour. The new interface was only returning true
if an operation was generated as a result of the call (aligning with
all other public functions on the class). This means however that back-
spacing when there is no available positions (e.g., at the beginning of
a document) was causing the browser to navigate back a page.
Element.focus() has additional logic that attempts to bring the top of
the element into view. This causes the a document that has been vertically
scrolled to reset back to the top of the document each time an Editor
button is clicked.
This redesign abstracts the event management away, and uses an invisible
div as the primary event trap. Because the div is always visible and
centred, the browser does not perform any scrolling. Non-bubbling events
are automatically forwarded from the event trap to subscribers.
Fixes Issue #44
Taking a sequence of ops also enables to give the guarantee that all
contained operations will be executed directly after each other,
in the given order. So creator of the ops can calculate the spec of each op
by relying on the known effect of the other ops.
- moved getAllStyleNames from Formatting to ObjectNameGenerator
- renamed StyleNameGeneratorTest to ObjectNameGeneratorTest and added a couple of more unit tests
Previously, the selection was being reset back to the word-boundary
of the word that contained the cursor at the time of the double-click.
Now, the browser selection is always updated, with additional logic to
expand the selection to the nearest boundary based on the double or
triple-click status of the event.
According to the specs, the click count is 0 if the user moves the
mouse between mousedown and mouse up. The definition of "moved" seems
a little loose, meaning there are still some unfixed side-effects (e.g.,
double-click & drag will reset back to word selection).
Pressing enter should clear the existing selection before adding a new
line to the document. This was missed when the functionality was added
to the insert text behaviour.
As per http://www.w3.org/TR/DOM-Level-3-Events/#event-type-mouseup,
event.detail records the number of clicks in the same way ClickHandler
was attempting to.
This has the happy side-effect of fixing an issue where double or triple
clicking on the editor's toolbar would result in the selection expanding
to word or paragraph boundaries.
This fixes a regression introduced in f7e9c89. Binding to the global
window's mouse up is necessary to allow the user selection to update.
The change introduced an undesirable side-effect though that caused clicks
entirely outside the odf canvas to reset the user selection to the
first or last position in the document.
to delete the annotation
* Add click-handling for such buttons in SessionController
* Add OdfCanvas.forgetAnnotations() to untrack annotations
* Add OpRemoveAnnotation that takes a position within the
annotation, and deletes that annotation. It also takes the
walkable length of the annotation node for OT purposes.
Any cursors inside are moved to the left of the annotation.
click and drag over a scetion of text to select it, ensuring to release the mouse-click outside of the editor. the section of text highlights but cursor remains where it was previously.
this is because the canvas element does not receive the mouse up event when releasing the mouse-click outside the canvas
changes include:
* listen to the window object rather than canvas element
* if anchor node or foucs node is outside the canvas, replace it with the closest node within the document
* ensure selectWord/selectParagraph is not called when user clicks outside of canvas
Right-clicking on Safari or Chrome on OSX causes the context menu to
appear, but the cursor is not properly updated to reflect the selection.
This means that the user could right-click & paste (for example), and
the text would appear where the cursor last was, rather than where
the right-click occurred. This problem does not occur on Windows.
This patch still is unable to expand to word-selection properly in the
browsers that try and do this as the current word expansion behaviour is
still broken in some circumstances.
TODO:
-Recreate browser default behaviours on right click (e.g., expand to word boundary on OSX)
* A new RootFilter in OdtDocument
* A new core.PositionFilterChain to concatenate filters and chains
* Functions to convert steps between two filter spaces in SelectionMover
* A keyboardMovementsFilter = { base filter + RootFilter } chain in
SessionController, used to calculate steps to move triggered by keyboard
events. These steps are then mapped to base filter's space for op
initialization
Selecting a range of text then pressing the left or right arrow keys
(without holding shift) would cause the cursor to reset back to the
anchor node (front of the selection) rather than the focus node (end
of the selection).
The existing code was mis-using selection.position, which odtDocument
indicates is the anchor node. This was made more obvious by dividing
cursor adjustments up into extend vs. move commands.