Commit Graph
18 Commits
Author SHA1 Message Date
Friedrich W. H. Kossebau f5454334dc Fix InputMethodEditor.destroy not unsubscribing from all events 2014-02-12 01:23:53 +01:00
Jos van den Oever ff3c396aa6 Add core.Destroyable interface.
Every class that has a destroy() method now implements this interface.
2014-02-11 12:42:41 +01:00
Jos van den Oever ddcb6009eb Add a number of more precise types and remove unneeded casts. 2014-02-10 15:59:37 +01:00
Jos van den Oever e632ed2ae6 Make a large number of controllers 100% typed. 2014-02-08 13:37:50 +01:00
Jos van den Oever ed7270442f Remove loadClass calls from class files. The load system reads the dependencies from the manifest.json files now. 2014-02-07 15:38:09 +01:00
Philip Peitsch a2edfb907f Always blur focus from the event trap before updating content editable
Toggling the content editable flag while the element is in focus will
sometimes stop the browser from allowing the IME to be activated.
Blurring the focus and then restoring ensures the browser re-evaluates
the IME state after the content editable flag has been updated.
2014-02-03 21:51:33 +11:00
Friedrich W. H. Kossebau d2671e2a00 @returns -> @return 2014-01-31 15:33:43 +01:00
Philip Peitsch 18312d6359 Only make the event trap editable if the document is in edit mode
Various browser menus (cut, delete) should only enable if the document
is currently in edit mode.
2014-01-10 20:58:15 +11:00
Philip Peitsch 8de8dde612 Restore focus to the event trap if reset by an operation
With the event trap now being inside the cursor, any repositioning of
the cursor causes the document.activeElement and window selection to
change. This causes the document to stop being editable after actions
such as bolding current text.

Now, the focus state of the event trap is checked prior to each
operation, and will be reset back to the event trap if disrupted by an
operation. Note, checks are in place to prevent stealing focus if the
document is not active when an operation is executed.

Fixes issue #298
2014-01-08 21:32:10 +11:00
Philip Peitsch 354056f68c Stop event trap from receiving focus on a mouse-down event
If the event trap receives focus on a mouse-down event, the selection will
become "trapped" inside the content-editable bounds. This can happen when
the user double-clicks on the caret (to start word expansion) and drags.
In this instance, the selection will appear to "stick" on the single word
surrounding the caret.

Problem introduced in 8b6ef8f
2013-12-24 00:48:20 +11: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 ce2d736674 Don’t steal focus if the event trap wasn’t currently selected
Removing the local cursor should NOT steal the focus back to the event
trap unless it previously had focus (it generally never would).
2013-12-19 14:39:35 +11:00
Philip Peitsch 4ef6ae8d30 Clean-up event trap more thoroughly after input
Repeated text entry events can result in lots of empty text nodes
2013-12-18 11:05:32 +11:00
Philip Peitsch 4ed2bea707 Workaround Chrome issues with Linux IMEs
In Chrome 31.0.1650.63 onUbuntu 13.10, the composed character isn't set
in the compositionend event. The text is added to the focused field
immediately after however in a textInput event. Firefox appears to be
unaffected by this bug.
2013-12-18 11:05:32 +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 693702f332 Support back-to-back composition end & start events
Some IMEs will stack end & start requests back to back. If the selection
is modified between an old and new session (e.g., via text updates), the
new composition session never starts. One mainstream example of this is
inputting text using MacOS’s option+char method
2013-12-18 11:05:32 +11:00
Philip Peitsch a85543fb93 Improve Opera 11 compatibility slightly 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