Confirmed users
478
edits
(comments of Yuan) |
|||
Line 78: | Line 78: | ||
void next(); | void next(); | ||
// | // Ask the OS to hide the current active Keyboard app. (was: |removeFocus()|) | ||
// The OS | // OS should ignore this request if the app is currently not the active one. | ||
// | // The OS will void the current input context (if it exists). | ||
// | // This method belong to |mgmt| because we would like to allow Keyboard to access to | ||
// this method w/o a input context. | |||
void | void hide(); | ||
}; | }; | ||
Line 119: | Line 119: | ||
/* | /* | ||
* Get the whole text content of the input field. | * Get the whole text content of the input field. (|getSurroundingText()| is removed in favor of this method with params) | ||
*/ | */ | ||
Promise<DOMString> getText(); | Promise<DOMString> getText([optional] offset, [optional] length); | ||
// The start and stop position of the selection. | // The start and stop position of the selection. | ||
Line 148: | Line 144: | ||
Promise<boolean> setSelectionRange(long start, long length); | Promise<boolean> setSelectionRange(long start, long length); | ||
/* User moves the cursor, changes the selection | /* User moves the cursor, or changes the selection with other means | ||
* TODO: dup with the onsurroundingtextchange event/callback below for cursor moment? | * TODO: dup with the onsurroundingtextchange event/callback below for cursor moment? | ||
* | * | ||
Line 155: | Line 151: | ||
* text change event. | * text change event. | ||
* [yxl] remove this and merge with onsurroundingtextchange | * [yxl] remove this and merge with onsurroundingtextchange | ||
*/ | |||
attribute EventHandler onselectionchange; | attribute EventHandler onselectionchange; | ||
/* | /* | ||
Line 194: | Line 175: | ||
* @param afterString Text after and excluing cursor position. | * @param afterString Text after and excluing cursor position. | ||
* [yxl] To combine with onselectionchange, we need add two extra paramters - selectionStart, selectionEnd | * [yxl] To combine with onselectionchange, we need add two extra paramters - selectionStart, selectionEnd | ||
* [Tim] That would unfortunately make the callback comes with 5 parameters ... people should use the attributes instead. | |||
* function(DOMString beforeText, DOMString afterText) { | * function(DOMString beforeText, DOMString afterText) { | ||
* ... | * ... | ||
Line 227: | Line 209: | ||
/* | /* | ||
* | * End composition and actually commit the text. (was |commitText(text, offset, length)|) | ||
* Ending the composition with an empty string will not send any text. | * Ending the composition with an empty string will not send any text. | ||
* (was | | * Note that if composition always ends automatically (with the current composition committed) if the composition | ||
* did not explicitly with |endComposition()| but was interrupted with |sendKey()|, |setSelectionRange()|, | |||
* user moving the cursor, or remove the focus, etc. | |||
* | * | ||
* @param text The text | * @param text The text | ||
Line 240: | Line 222: | ||
* [yxl] | * [yxl] | ||
* Commit text to current input field and replace text around cursor position. It will clear the current composition. | * Commit text to current input field and replace text around cursor position. It will clear the current composition. | ||
* [Tim] Remove this method. | |||
* | * | ||
* @param text The string to be replaced with. | * @param text The string to be replaced with. |