Transformed all read-only uses to use node.getElements*. Any loop that
immediately modifies the nodes in the list has been updated to use the
DomUtils.getElements* version.
When navigating vi the up/down arrow keys, the user often wants to move
multiple lines in sequence (e.g., to visually place the caret in one of
the following lines). To stop the caret suddenly jumping to the left
side of the page when crossing an empty paragraph, the caret's X position
will be stored and re-used by subsequent up/down movement for up to 2s
after navigating by line.
Any other operations performed by the local user (e.g., cursor movement
to the left or right), or edit operations by collaborative users will
immediately clear the stored X position.
There is a small edge between the canvas border and the office:text
element that the user can click in. Doing this returns null for the root
element (as it is the container that contains the office:text element),
causing an unhandled null reference exception to occur in some
circumstances.
Fixes#664.
It lazily computes required information and caches it
for further use -- an initial method inside it is
isLocalCursorWithinOwnAnnotation, which contains the logic
moved from DirectFormattingController. It would have been
expensive to perform this check separately everytime the
cursor moves in each controller.
Let DirectFormattingController obey this "edit.reviewMode"
constraint by not creating any operations or processing any
action to format text when the cursor is not within the local
user's annotation.
Signals are exposed to toolbar widgets so they may
enable/disable themselves on the fly depending on the cursor
context.
This introduces SessionConstraints into SessionController
and AnnotationController. The latter comes with a new
permission, namely "edit.annotations.onlyDeleteOwn".
Code is added into AnnotationController to check
for the author name of the annotation node to be deleted,
and do nothing if it matches the name of the current
user.
* remove @license tag (to prevent Closure compiler keeping the comment)
* use copyright@kogmbh.com email address everywhere
* remove "additional permission", to be added only to released webodf.js
* separate license header by empty line from following content
runtime.loadClass(...) no longer expects that eval(fileContent) yields
the constructor, and a few loaded files rely on that (e.g. all singletons/namespaces),
so let's be consistent
This behaviour regressed in c0332ed due to the caret overlay element
being moved inside the overlay itself. As a result, the event trap was
automatically being re-added after an undo, causing the SessionController
to incorrectly skip returning focus back to the trap upon completion.
On OSX, right-clicking on an image at the end of a range selection will
hit this particular branch. The image should remain selected if the
right-click occurs on top of it as technically it's the same behaviour
as right clicking on an existing text selection.
In Chrome, right-clicking repeatedly generates both a contextmenu AND
a mouseup event for subsequent clicks. E.g. a sequence of right clicks
generates:
1st - mousedown, contextmenu
2nd...nth - mousedown, contextmenu, mouseup
This causes problems when clicking on images as the selection is
immediately reset after being processed by the first context menu,
causing the subsequent mouseup event to try and reset the cursor
selection *again*.
Chrome + WebKit increment the click count value for the MouseEvent even
if the user switches buttons. E.g., a double click then right click
will report the last event as {button: 2, detail: 3}, causing the
selection to expand to the paragraph bounds.
Now, the click count is only reported as non-zero if the current event
is with the primary mouse button (left by default, or the right button
if the user has switched their primary mouse button around).
Using requestAnimationFrame ensures the callback is executed prior to
the next redraw, eliminating undesirable & highly visible flickers for
UI updates.
Fixes issue #491.
Management of the event trap is not related to the IME. Moving the
coordination of the disabled and readOnly flags inside the EventManager
better hides these concepts from external consumers.
Move control of event bindings from SessionController to
HyperlinkClickHandler so bindings will be updated whenever modifier is
changed. This allows some simplification as HyperlinkClickHandler can
simply use the KeyboardHandler.Modifier.
For keys that are also modifiers (e.g., Ctrl), different browsers +
platforms may report the modifier flag as leading or lagging the
keypress event. For example, pressing the ctrl key in FF on Linux will
report (ctrlKey:false)in the keydown event, while Chrome on Linux will
report (ctrlKey:true) in the keydown event. For these specific cases,
normalize the modifier flag so it is always the set to true.
Fixes issue #322.
Toggling a custom attribute on a custom XML element doesn't properly
update the visual state on some browsers (e.g., WebKit on OSX). Using
CSS classes instead seems to be better handled in these browsers,
correctly updating the mouse cursor icon on the fly.
Two new compound events:
* 'drag', which depends on 'touchstart', 'touchmove',
and 'touchend. It fires whenever a finger is placed
on an element with class 'draggable', and then moved.
* 'dragstop', which depends on 'drag' and 'touchend'.
It fires whenever the finger is lifted after a drag
on a draggable element.
SessionController, upon encountering a drag event on
a selection handle, updates the shadow cursor's selection
to match the one prescribed by the handle movement, thus
being very fast.
When a dragstop event is encountered, the selection of
the shadow cursor is fed to the local member's cursor
via SelectionController, thus utilizing an op.
an event that can be represented as a logical
composition of several events working together.
As a first usage of this class, the 'longpress' event
is introduced.
This event fires once when a finger is placed against the
screen for 400 milliseconds without moving or lifting.
Select a word when long-pressing on it.
Undo has additional logic to ensure the event trap is restored after
an undo is performed. At some point, this will need to split out of
the SessionController, but for now it is simplest to expose this to
the EditorSession for use.
Fixes remaining problems causing issue #426.
on click-to-move when keyboard is open.
This is done by momentarily hiding and displaying
the eventTrap when the keyboard is opening.
IOSSafariSupport is a drop-in class that should
make webodf function well in iOS Safari without
having to do any special platform handling anywhere
else in the code.
Do not set focus in a timeout on iOS.
When attempting click-to-move, in most desktop
browsers we need to get the new selection in a
simple 0-timeout, because the window selection
is not immediately updated when handling the
mouseup event. The focus to the event trap is
set after this is ready. Otherwise, clicking
within a selection will not do anything.
Unfortunately, in iOS Safari, it is impossible
to set focus within a timeout. Therefore, this
commit takes the least painful and simplest
thing route: check navigator.platform for
iPad, iPod, and iPhone (the hope is that this
will be reliable because of Apple's consistency),
and in that case avoid computing the selection
and focus assignment within a timeout.
This commit pulls the event trap outside the cursor,
and as a child of the canvas,
and makes the Caret track the cursor's position and
position the trap above the cursor.
This means that there is no need to manually
blur and focus the eventManager whenever an
operation is executed.
Performing the focus capture when a cursor is registered to the document
causes undo/redo to slow down, as the focus gets pulled into the cursor
as soon as the AddCursor op is executed. The focus should not be changed
while executing operations.