Commit Graph
17 Commits
Author SHA1 Message Date
Philip Peitsch 74a8df16c8 Correct subscription to the blur event
The blur event should always be on the event trap, as the event should
indicate when the local input is no longer active.
2014-02-03 21:53:01 +11:00
Friedrich W. H. Kossebau d2671e2a00 @returns -> @return 2014-01-31 15:33:43 +01:00
Philip Peitsch f01758db04 Use the textInput event to detect unhandled characters on Chrome & Safari
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).
2013-12-20 00:30:23 +11:00
Philip Peitsch 372485885a Workaround Safari post-composition key press event error
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.
2013-12-18 11:05:32 +11:00
Philip Peitsch 8b6ef8f6ff Support text input using the OS’s IME system
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.
2013-12-18 11:05:32 +11:00
Philip Peitsch be6c4379f0 Let EventManager.focus restore positions for all scrollable parents
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.
2013-12-18 11:05:32 +11:00
Philip Peitsch c665b1a57f Workaround for Firefox selection.collapse bug
Attempting to collapse a selection if a content editable element is the
current activeElement for the document will cause the collapse call to
throw an exception.

https://bugzilla.mozilla.org/show_bug.cgi?id=773137
https://bugzilla.mozilla.org/show_bug.cgi?id=787305
2013-12-18 11:05:31 +11:00
Philip Peitsch a5173eaf71 Don't synchronize browser & WebODF selections unnecessarily
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.
2013-12-05 17:35:42 +11:00
Philip Peitsch 1b72f4c35f Only process each mouse up & down event once at either canvas or window
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.
2013-11-21 01:50:23 +11:00
Philip Peitsch 571bb6366e Bind window-related events on direct element as well (IE compatibility)
These events will not bubble up to the window if consumed by the canvas
element.
2013-11-19 20:25:17 +11:00
Friedrich W. H. Kossebau c2a795e668 Update link to repo: now https://github.com/kogmbh/WebODF/ 2013-10-23 18:20:30 +02:00
Friedrich W. H. Kossebau 508570dab8 Add copy of the AGPL3 to sources (+ add to created zip files) 2013-10-21 17:55:16 +02:00
Philip Peitsch f4cc324fdf Ensure the tabIndex is reset when the local user's caret is re-added after undo/redo
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.
2013-10-11 12:35:10 +02:00
Philip Peitsch a6dedeed4f Add additional scroll handling when canvas regains focus
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.
2013-10-09 23:22:11 +11:00
Philip Peitsch 04a5bee3b4 Re-implement focus-without-scroll behaviour in Chrome
Previous fix attempt for issue #44 had the unintented side effect of
stopping shift+click from expanding the selection (issue #109).

The scroll-on-change behaviour has actually already been modified as
part of 90d6776. The delay put in to CaretManager.ensureCaretVisible now
ensures the caret is scrolled into view correctly once focus has been
properly set. This eliminates the need for the hidden event trap.

Fixes issue #109

Relevant test:
https://chromium.googlesource.com/chromium/blink/+/ae8d18613905f501a3ce9ba83193fe77e920afbf/LayoutTests/fast/scrolling/scroll-element-into-view.html
2013-10-09 20:11:05 +11:00
Friedrich W. H. Kossebau 21f6a42d98 Fix crash in gui.EventManager.unsubscribe(), splice called on wrong object 2013-10-04 23:38:52 +02:00
Philip Peitsch 84e221082f Allow event focus to be returned to SessionController without scrolling to the top of the ODF canvas
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
2013-10-04 19:24:13 +02:00