Changes

Jump to: navigation, search

WebAPI/KeboardIME

939 bytes removed, 10:05, 19 July 2013
Proposed API
void next();
// Clear Ask the focus of OS to hide the current input fieldactive Keyboard app. (was: |removeFocus()|) // OS should ignore this request if the app is currently not the active one. // The OS might respond with hidden of the virtual keyboard and will void the current input context(if it exists). // [JJ] What is removeFocus doing here. Everything that interacts with form elementsThis method belong to |mgmt| because we would like to allow Keyboard to access to // happens in the inputContext, so this should be there too. method w// [yxl] Agree with JJ. It needs be under InputContexto a input context. void removeFocushide();
};
/*
* Get the whole text content of the input field. * App is encouraged to use (|getSurroundingText() below to prevent getting to much things clogged in memory. * [JJ] Do we have any case where loading the full text | is required? * I don't see it removed in the example code. * [yxl] No, but in case any IME needs.favor of this method with params)
*/
Promise<DOMString> getText([optional] offset, [optional] length);
// The start and stop position of the selection.
Promise<boolean> setSelectionRange(long start, long length);
/* User moves the cursor, or changes the selection, or alters the composing text lengthwith other means
* TODO: dup with the onsurroundingtextchange event/callback below for cursor moment?
*
* text change event.
* [yxl] remove this and merge with onsurroundingtextchange
*/
attribute EventHandler onselectionchange;
/*
* Get the text content around the cursor of the input field.
* The text length is limited to 100 characters for each back and forth direction.
* App is encouraged to use this instead of getText() above to prevent getting to much things clogged in memory.
* TODO: how to return two values in one Promise object? as two arguments to the callback?
* [yxl] Impossible to return two value, but can wrap the two value with an object.
* Another option is to divide this method into two methods - getTextBeforeCursor and getTextAfterCursor.
*
* [JJ] Would be useful to also include other state info (cursor position, selection pos, etc.)
* So we have 1 state object that gets returned regardless of operation
* (same one as in the change handlers and setSelectionRange)
* [yxl] Not necessary. cursor position or selection pos can be get by the attributes of selectionStart
* and selectionEnd.
*/
Promise<DOMString beforeText, DOMString afterText> getSurroundingText();
/*
* @param afterString Text after and excluing cursor position.
* [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) {
* ...
/*
* [yx] I'd like to replace this method with commitText and add clearComposition to allow IME * to cancel End composition. * endComposition and actually commit the text.(was |commitText(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 committed) if the composition * did not explicitly with |endComposition()| but was interrupted with |commitTextsendKey(text)|, offset, length|setSelectionRange()|), * user moving the cursor, or remove the focus, etc.
*
* @param text The text
* [yxl]
* 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.
Confirm
478
edits

Navigation menu