Changes

Jump to: navigation, search

WebAPI/KeboardIME

1,278 bytes added, 09:11, 12 August 2013
m
detailed description of setComposition and endComposition
* send a character with its key events.
* @param modifiers see http://mxr.mozilla.org/mozilla-central/source/dom/interfaces/base/nsIDOMWindowUtils.idl#206
* @return true if succeeds. Otherwise false if the input context becomes voidinvalid.
* Alternative: sendKey(KeyboardEvent event), but we will likely waste memory for creating the KeyboardEvent object.
*/
Promise<boolean> sendKey(long keyCode, long charCode, [optional] long modifiers);
/*
* Set current compositioncomposing text. It This method will start composition or update compositionif it * has started. The composition will be started right before the cursor position and any * selected text will be replaced by the composing text. When the composition is started, * calling this method can update the text and move cursor winthin the range of the composing * text. * @param text The new composition text to show. * @param cursor The new cursor position relative to the start of the composition text. The cursor Position in should * be positioned within the composition text . This means the value should be >= 0 and <= the length of * composition text. Defaults to the lenght of composition text, i.e., the cursorwill be positioned after * the composition text.
*
* The API implementation should automatically ends composing text, which is shown with underlined style to distinguish from the existing text, is used * to compose non-ASCII characters from keystrokes, e.g. Pinyin or Hiragana. The composing text is the composition * session (with event intermediate text to help input complex character and confirm is not committed to current input field. Therefore * if any text operation other than composition is performed, the current composition) if will be automatically * endComposition is never calledcanceled and the composing text will be cleared. Same apply when the inputContext is lostduring a * during a unfinished composition session. * * To finish composition and commit text to current input field, an IME should call |endComposition|.
*/
<strike>// [JS] A more detailed description of how to use these two functions would be great. // It's not really obvious to me what either of these two arguments do.</strike> Promise<boolean> setComposition(DOMString text, [optional] long cursor);
/*
* End composition , clear the composing text and actually commit the given textto current input field. (was |commitText(The text, offset, length)|) * Ending the composition with an empty string will not send any text. * Note that if composition always ends automatically (with the current composition be committed) if before the composition cursor position. * did not explicitly with |endComposition()| but was interrupted with |sendKey()|, |setSelectionRange()|@param text The text to commited before cursor position. If empty string is given,no text will be * user moving the cursor, or remove the focus, etccommitted.
*
* @param text The textNote that composition always ends automatically with nothing to commit if the composition does not * explicitly end by calling |endComposition|, but is interrupted by |sendKey|, |setSelectionRange|, * |replaceSurroundingText|, |deleteSurroundingText|, user moving the cursor, or changing the focus, etc.
*/
Promise<boolean> endComposition(DOMString text);
Confirm
58
edits

Navigation menu