Screen readers tend to read input text elements as single lines, and do
not pause on new lines. Using a text area instead encourages some of these
to pause more naturally on paragraph boundaries.
Deleting the caret before calling ensures there is no way for any external
sources to get access to the soon-to-be destroyed caret.
As part of tracking this down, scheduled tasks will now throw an error
if an attempt is made to trigger the task (either delayed or immediate)
after the particular instance has been destroyed.
This then showed that functions bound to browser events swallow errors
quietly, so additional logging was added to the EventManager delegation
code to ensure errors generated when processing an event are logged.
* 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
To make this feasible, a consistent interface has been added to
compound and normal event delegates. This allows better impl
hiding from the rest of the EventManager class.
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.
A disabled element is not able to become the document's activeElement.
The better way of setting the event trap to non-editable is through
the readOnly flag. This still allows focus to be passed to the trap.
During a mouse down event, the event trap should be disabled however
to ensure it doesn't capture the window selection.
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.
The sizer element is replaced when an undo is performed, causing no
mouse move events to be reported after an undo. This breaks the shadow
cursor display.
There is no particular reason 67c1c23 changed the event binding to use
the sizer rather than the canvas element other than for consistency
with where the event trap was being added, so it is safe to revert
this particular modification.
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.
The textInput event provides a more accurate view of the resulting text
from a key press on Chrome and Safari. Use this as the fallback if the
key press event is ignored (e.g., user is inputing character code using
the Mac OS option key or Windows alt key).
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.
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.
Scrollable parents that had no current scroll offset were being ignored.
This meant that the view could end up reset at a non-0 scroll offset when
focus was restored to the event trap.
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.
Internet explorer will only trigger mouse events at the window level. If
the handler is bound to both window and canvas however, the event will
be processed twice in every other browser.
A solution to this is to track manually (without affecting the bubble or
other features on the event) that an event has been processed, and don't
process it a second time.
During the recent event & focus refactor, the tab index was being set on
initialisation of the EventManager class, and would then be unset when
the local caret was removed. This meant that no new events would be sent
to WebODF (e.g., typing) after an undo.
The scroll position was only being restored if a local operation was
generated as part of the resume focus. Additional data needs to be saved
and restored of focus is simply stolen and then returned.
If no parent elements have a non-zero scroll, there is no offsets to
restore.
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