diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md b/zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md index 3a9f870ae16920a3c5c4a1c9bf6c4f0ad5b347a4..c9129e8d0cf11b46de29e14263e8c8c11f16af91 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md @@ -56,9 +56,9 @@ getInputMethodEngine(): InputMethodEngine **返回值:** - | 类型 | 说明 | - | --------------------------------------- | ------------ | - | [InputMethodEngine](#InputMethodEngine) | 服务端实例。 | +| 类型 | 说明 | +| --------------------------------------- | ------------ | +| [InputMethodEngine](#InputMethodEngine) | 服务端实例。 | **示例:** @@ -76,9 +76,9 @@ createKeyboardDelegate(): KeyboardDelegate **返回值:** - | 类型 | 说明 | - | ------------------------------------- | ---------------- | - | [KeyboardDelegate](#KeyboardDelegate) | 客户端监听实例。 | +| 类型 | 说明 | +| ------------------------------------- | ---------------- | +| [KeyboardDelegate](#KeyboardDelegate) | 客户端监听实例。 | **示例:** @@ -124,10 +124,10 @@ off(type: 'inputStart', callback?: (kbController: KeyboardController, textInputC **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | -------------------- | ---- | ------------------------ | - | type | string | 是 | 设置监听类型。
-type为‘inputStart’时表示订阅输入法绑定。 | - | callback | [KeyboardController](#KeyboardController), [TextInputClient](#TextInputClient) | 否 | 回调返回输入法操作相关实例。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | ------------------------ | +| type | string | 是 | 设置监听类型。
-type为‘inputStart’时表示订阅输入法绑定。 | +| callback | [KeyboardController](#KeyboardController), [TextInputClient](#TextInputClient) | 否 | 回调返回输入法操作相关实例。 | @@ -147,10 +147,10 @@ on(type: 'keyboardShow'|'keyboardHide', callback: () => void): void **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | ------ | ---- | ------------------------------------------------------------ | - | type | string | 是 | 设置监听类型。
- type为'keyboardShow',表示订阅输入法显示。
- type为'keyboardHide',表示订阅输入法隐藏。 | - | callback | void | 否 | 回调函数。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ------------------------------------------------------------ | +| type | string | 是 | 设置监听类型。
- type为'keyboardShow',表示订阅输入法显示。
- type为'keyboardHide',表示订阅输入法隐藏。 | +| callback | void | 否 | 回调函数。 | **示例:** @@ -170,17 +170,17 @@ off(type: 'keyboardShow'|'keyboardHide', callback?: () => void): void **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | ------ | ---- | ------------------------------------------------------------ | - | type | string | 是 | 设置监听类型。
- type为'keyboardShow',表示订阅输入法显示。
- type为'keyboardHide',表示订阅输入法隐藏。 | - | callback | void | 否 | 回调函数。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ------------------------------------------------------------ | +| type | string | 是 | 设置监听类型。
- type为'keyboardShow',表示订阅输入法显示。
- type为'keyboardHide',表示订阅输入法隐藏。 | +| callback | void | 否 | 回调函数。 | **示例:** ```js InputMethodEngine.off('keyboardShow'); ``` - + ## KeyboardDelegate @@ -196,10 +196,10 @@ on(type: 'keyDown'|'keyUp', callback: (event: KeyEvent) => boolean): void **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | ------------------------------- | ---- | ------------------------------------------------------------ | - | type | string | 是 | 设置监听类型。
- type为'keyDown',表示订阅硬键盘按下。
- type为'keyUp',表示订阅硬键盘抬起。 | - | callback | [KeyEvent](#KeyEvent) | 是 | 回调返回按键信息。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------- | ---- | ------------------------------------------------------------ | +| type | string | 是 | 设置监听类型。
- type为'keyDown',表示订阅硬键盘按下。
- type为'keyUp',表示订阅硬键盘抬起。 | +| callback | [KeyEvent](#KeyEvent) | 是 | 回调返回按键信息。 | @@ -221,10 +221,10 @@ off(type: 'keyDown'|'keyUp', callback?: (event: KeyEvent) => boolean): void **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | --------------------- | ---- | ------------------------------------------------------------ | - | type | string | 是 | 设置监听类型。
- type为'keyDown',表示订阅硬键盘按下。
- type为'keyUp',表示订阅硬键盘抬起。 | - | callback | [KeyEvent](#KeyEvent) | 否 | 回调返回按键信息。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------- | ---- | ------------------------------------------------------------ | +| type | string | 是 | 设置监听类型。
- type为'keyDown',表示订阅硬键盘按下。
- type为'keyUp',表示订阅硬键盘抬起。 | +| callback | [KeyEvent](#KeyEvent) | 否 | 回调返回按键信息。 | **示例:** @@ -242,20 +242,22 @@ on(type: 'cursorContextChange', callback: (x: number, y:number, height:number) = **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | ------ | ---- | ------------------------------------------------------------ | - | type | string | 是 | 光标变化事件。
-type为’cursorContextChange‘时,表示光标变化。 | - | callback | number | 是 | 回调返回光标信息。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ------------------------------------------------------------ | +| type | string | 是 | 光标变化事件。
-type为’cursorContextChange‘时,表示光标变化。 | +| callback | number | 是 | 回调返回光标信息。 | **示例:** - - ```js - KeyboardDelegate.on('cursorContextChange', (x, y, height) => { - console.info('cursorContextChange'); - }); - ``` + +```js + +KeyboardDelegate.on('cursorContextChange', (x, y, height) => { + console.info('cursorContextChange'); +}); + +``` ### off('cursorContextChange') @@ -267,17 +269,19 @@ off(type: 'cursorContextChange', callback?: (x: number, y:number, height:number) **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | -------------------- | ---- | ------------------------ | - | type | string | 是 | 光标变化事件。
-type为’cursorContextChange‘时,表示光标变化。 | - | callback | number | 否 | 回调返回光标信息。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ------------------------------------------------------------ | +| type | string | 是 | 光标变化事件。
-type为’cursorContextChange‘时,表示光标变化。 | +| callback | number | 否 | 回调返回光标信息。 | **示例:** - ```js - KeyboardDelegate.off('cursorContextChange'); - ``` +```js + +KeyboardDelegate.off('cursorContextChange'); + +``` ### on('selectionChange') on(type: 'selectionChange', callback: (oldBegin: number, oldEnd: number, newBegin: number, newEnd: number) => void): void @@ -288,18 +292,20 @@ on(type: 'selectionChange', callback: (oldBegin: number, oldEnd: number, newBegi **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | ------ | ---- | ------------------------------------------------------------ | - | type | string | 是 | 文本选择变化事件。
-type为’selectionChange‘时,表示选择文本变化。 | - | callback | number | 是 | 回调返回文本选择信息。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ------------------------------------------------------------ | +| type | string | 是 | 文本选择变化事件。
-type为’selectionChange‘时,表示选择文本变化。 | +| callback | number | 是 | 回调返回文本选择信息。 | **示例:** - - ```js - KeyboardDelegate.on('selectionChange', (oldBegin, oldEnd, newBegin, newEnd) => { - console.info('selectionChange'); - }); - ``` + +```js + +KeyboardDelegate.on('selectionChange', (oldBegin, oldEnd, newBegin, newEnd) => { + console.info('selectionChange'); +}); + +``` ### off('selectionChange') @@ -311,16 +317,18 @@ off(type: 'selectionChange', callback?: (oldBegin: number, oldEnd: number, newBe **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | -------------------- | ---- | ------------------------ | - | type | string | 是 | 文本选择变化事件。
-type为’selectionChange‘时,表示选择文本变化。 | - | callback | number | 否 | 回调返回文本选择信息。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ------------------------------------------------------------ | +| type | string | 是 | 文本选择变化事件。
-type为’selectionChange‘时,表示选择文本变化。 | +| callback | number | 否 | 回调返回文本选择信息。 | **示例:** - ```js - KeyboardDelegate.off('selectionChange'); - ``` +```js + +KeyboardDelegate.off('selectionChange'); + +``` ### on('textChange') @@ -333,18 +341,20 @@ on(type: 'textChange', callback: (text: string) => void): void **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | ------------------------------- | ---- | ------------------------------------------------------------ | - | type | string | 是 | 文本变化事件。
-type为’textChange‘时,表示当前文本变化。 | - | callback | string | 是 | 回调返回当前文本内容。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ------------------------------------------------------------ | +| type | string | 是 | 文本变化事件。
-type为’textChange‘时,表示当前文本变化。 | +| callback | string | 是 | 回调返回当前文本内容。 | **示例:** - ```js - KeyboardDelegate.on('textChange', (text) => { - console.info('textChange'); - }); - ``` +```js + +KeyboardDelegate.on('textChange', (text) => { + console.info('textChange'); +}); + +``` ### off('textChange') @@ -356,16 +366,16 @@ off(type: 'textChange', callback?: (text: string) => void): void **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | -------------------- | ---- | ------------------------ | - | type | string | 是 | 文本变化事件。
-type为’textChange‘时,表示当前文本变化。 | - | callback | string | 否 | 回调返回当前文本内容。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ------------------------------------------------------------ | +| type | string | 是 | 文本变化事件。
-type为’textChange‘时,表示当前文本变化。 | +| callback | string | 否 | 回调返回当前文本内容。 | **示例:** - ```js - KeyboardDelegate.off('textChange'); - ``` +```js +KeyboardDelegate.off('textChange'); +``` ## KeyboardController @@ -381,9 +391,9 @@ hideKeyboard(callback: AsyncCallback<void>): void **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | ---------------------- | ---- | -------- | - | callback | AsyncCallback<void> | 否 | 回调函数 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | -------- | +| callback | AsyncCallback<void> | 否 | 回调函数 | **示例:** @@ -403,9 +413,9 @@ hideKeyboard(): Promise<void> **返回值:** - | 类型 | 说明 | - | ---------------- | -------- | - | Promise<void> | 回调函数 | +| 类型 | 说明 | +| ---------------- | -------- | +| Promise<void> | 回调函数 | **示例:** @@ -427,10 +437,10 @@ getForward(length:number, callback: AsyncCallback<string>): void **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | -------- | -------- | -------- | - | length | number | 是 | 文本长度。 | - | callback | AsyncCallback<string> | 是 | 返回文本。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| length | number | 是 | 文本长度。 | +| callback | AsyncCallback<string> | 是 | 返回文本。 | **示例:** @@ -450,15 +460,15 @@ getForward(length:number): Promise<string> **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | -------- | -------- | -------- | - | length | number | 是 | 文本长度。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| length | number | 是 | 文本长度。 | **返回值:** - | 类型 | 说明 | - | ------------------------------- | ------------------------------------------------------------ | - | Promise<string> | 返回文本。 | +| 类型 | 说明 | +| ------------------------------- | ------------------------------------------------------------ | +| Promise<string> | 返回文本。 | **示例:** @@ -477,10 +487,10 @@ getBackward(length:number, callback: AsyncCallback<string>): void **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | -------- | -------- | -------- | - | length | number | 是 | 文本长度。 | - | callback | AsyncCallback<string> | 是 | 返回文本。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| length | number | 是 | 文本长度。 | +| callback | AsyncCallback<string> | 是 | 返回文本。 | **示例:** @@ -500,15 +510,15 @@ getBackward(length:number): Promise<string> **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | -------- | -------- | -------- | - | length | number | 是 | 文本长度。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| length | number | 是 | 文本长度。 | **返回值:** - | 类型 | 说明 | - | ------------------------------- | ------------------------------------------------------------ | - | Promise<string> | 返回文本。 | +| 类型 | 说明 | +| ------------------------------- | ------------------------------------------------------------ | +| Promise<string> | 返回文本。 | **示例:** @@ -527,10 +537,10 @@ deleteForward(length:number, callback: AsyncCallback<boolean>): void **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | -------- | -------- | -------- | - | length | number | 是 | 文本长度。 | - | callback | AsyncCallback<boolean> | 是 | 操作成功与否。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| length | number | 是 | 文本长度。 | +| callback | AsyncCallback<boolean> | 是 | 操作成功与否。 | **示例:** @@ -548,24 +558,24 @@ deleteForward(length:number): Promise<boolean> **系统能力**: SystemCapability.MiscServices.InputMethodFramework **参数:** - - | 参数名 | 类型 | 必填 | 说明 | - | -------- | -------- | -------- | -------- | - | length | number | 是 | 文本长度。 | - + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ---------- | +| length | number | 是 | 文本长度。 | + **返回值:** - | 类型 | 说明 | - | ------------------------------- | ------------------------------------------------------------ | - | Promise<boolean> | 操作成功与否。 | +| 类型 | 说明 | +| ---------------------- | -------------- | +| Promise<boolean> | 操作成功与否。 | **示例:** - ```js - var isSuccess = TextInputClient.deleteForward(5); - console.info("isSuccess = " + isSuccess); - ``` - +```js +var isSuccess = TextInputClient.deleteForward(5); + console.info("isSuccess = " + isSuccess); +``` + ### deleteBackward deleteBackward(length:number, callback: AsyncCallback<boolean>): void @@ -576,18 +586,20 @@ deleteBackward(length:number, callback: AsyncCallback<boolean>): void **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | -------- | -------- | -------- | - | length | number | 是 | 文本长度。 | - | callback | AsyncCallback<boolean> | 是 | 操作成功与否。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------- | ---- | -------------- | +| length | number | 是 | 文本长度。 | +| callback | AsyncCallback<boolean> | 是 | 操作成功与否。 | **示例:** - ```js - TextInputClient.deleteBackward(5, (isSuccess)=>{ - console.info("isSuccess = " + isSuccess); - }); - ``` +```js + + TextInputClient.deleteBackward(5, (isSuccess)=>{ + console.info("isSuccess = " + isSuccess); +}); + +``` ### deleteBackward @@ -598,22 +610,24 @@ deleteBackward(length:number): Promise<boolean> **系统能力**: SystemCapability.MiscServices.InputMethodFramework **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | -------- | -------- | -------- | - | length | number | 是 | 文本长度。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| length | number | 是 | 文本长度。 | **返回值:** - | 类型 | 说明 | - | ------------------------------- | ------------------------------------------------------------ | - | Promise<boolean> | 操作成功与否。 | +| 类型 | 说明 | +| ------------------------------- | ------------------------------------------------------------ | +| Promise<boolean> | 操作成功与否。 | **示例:** - ```js - var isSuccess = TextInputClient.deleteBackward(5); - console.info("isSuccess = " + isSuccess); - ``` +```js + + var isSuccess = TextInputClient.deleteBackward(5); + console.info("isSuccess = " + isSuccess); + +``` ### sendKeyFunction sendKeyFunction(action:number, callback: AsyncCallback<boolean>): void @@ -624,18 +638,20 @@ sendKeyFunction(action:number, callback: AsyncCallback<boolean>): void **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | -------- | -------- | -------- | - | action | number | 是 | 编辑框属性。 | - | callback | AsyncCallback<boolean> | 是 | 操作成功与否。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| action | number | 是 | 编辑框属性。 | +| callback | AsyncCallback<boolean> | 是 | 操作成功与否。 | **示例:** - ```js - TextInputClient.sendKeyFunction(inputMethod.ENTER_KEY_TYPE_NEXT,(isSuccess)=>{ - console.info("isSuccess = " + isSuccess); - }); - ``` +```js + + TextInputClient.sendKeyFunction(inputMethod.ENTER_KEY_TYPE_NEXT,(isSuccess)=>{ + console.info("isSuccess = " + isSuccess); +}); + +``` ### sendKeyFunction @@ -647,15 +663,15 @@ sendKeyFunction(action:number): Promise<boolean> **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | -------- | -------- | -------- | - | action | number | 是 | 编辑框属性。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| action | number | 是 | 编辑框属性。 | **返回值:** - | 类型 | 说明 | - | ------------------------------- | ------------------------------------------------------------ | - | Promise<boolean> | 操作成功与否。 | +| 类型 | 说明 | +| ------------------------------- | ------------------------------------------------------------ | +| Promise<boolean> | 操作成功与否。 | **示例:** @@ -663,7 +679,7 @@ sendKeyFunction(action:number): Promise<boolean> var isSuccess = TextInputClient.sendKeyFunction(inputMethod.ENTER_KEY_TYPE_NEXT); console.info("isSuccess = " + isSuccess); ``` - + ### insertText insertText(text:string, callback: AsyncCallback<boolean>): void @@ -674,18 +690,20 @@ insertText(text:string, callback: AsyncCallback<boolean>): void **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | -------- | -------- | -------- | - | text | string | 是 | 文本。 | - | callback | AsyncCallback<boolean> | 是 | 操作成功与否。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| text | string | 是 | 文本。 | +| callback | AsyncCallback<boolean> | 是 | 操作成功与否。 | **示例:** - ```js - TextInputClient.insertText("test", (isSuccess)=>{ - console.info("isSuccess = " + isSuccess); - }); - ``` +```js + +TextInputClient.insertText("test", (isSuccess)=>{ + console.info("isSuccess = " + isSuccess); +}); + +``` ### insertText @@ -697,15 +715,15 @@ insertText(text:string): Promise<boolean> **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | -------- | -------- | -------- | - | text | string | 是 | 文本。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| text | string | 是 | 文本。 | **返回值:** - - | 类型 | 说明 | - | ------------------------------- | ------------------------------------------------------------ | - | Promise<boolean> | 操作成功与否。 | + +| 类型 | 说明 | +| ------------------------------- | ------------------------------------------------------------ | +| Promise<boolean> | 操作成功与否。 | **示例:** @@ -713,7 +731,7 @@ insertText(text:string): Promise<boolean> var isSuccess = TextInputClient.insertText("test"); console.info("isSuccess = " + isSuccess); ``` - + ### getEditorAttribute getEditorAttribute(callback: AsyncCallback<EditorAttribute>): void @@ -724,9 +742,9 @@ getEditorAttribute(callback: AsyncCallback<EditorAttribute>): void **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | ------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | - | callback | AsyncCallback<[EditorAttribute](#EditorAttribute)> | 是 | 编辑框属性值。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| callback | AsyncCallback<[EditorAttribute](#EditorAttribute)> | 是 | 编辑框属性值。 | **示例:** @@ -745,9 +763,9 @@ getEditorAttribute(): EditorAttribute **返回值:** - | 类型 | 说明 | - | ------------------------------- | ------------------------------------------------------------ | - | Promise<[EditorAttribute](#EditorAttribute)> | 返回编辑框属性值。 | +| 类型 | 说明 | +| ------------------------------- | ------------------------------------------------------------ | +| Promise<[EditorAttribute](#EditorAttribute)> | 返回编辑框属性值。 | **示例:**