提交 1d6d20bf 编写于 作者: E ester.zhou

Update docs (16272)

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 95aadd67
...@@ -19,7 +19,7 @@ import InputMethodSubtype from '@ohos.InputMethodSubtype'; ...@@ -19,7 +19,7 @@ import InputMethodSubtype from '@ohos.InputMethodSubtype';
| Name| Type| Readable| Writable| Mandatory| Description| | Name| Type| Readable| Writable| Mandatory| Description|
| -------- | -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- | -------- |
| label | string | Yes| No| No| Label of the input method subtype.| | label | string | Yes| No| No| Label of the input method subtype.|
| name | string | Yes| No| Yes| Name of the input method subtype.| | name | string | Yes| No| Yes| Bundle name of the input method. |
| id | string | Yes| No| Yes| ID of the input method subtype.| | id | string | Yes| No| Yes| ID of the input method subtype.|
| mode | string | Yes| No| No| Mode of the input method subtype, including **upper** (uppercase) and **lower** (lowercase).| | mode | string | Yes| No| No| Mode of the input method subtype, including **upper** (uppercase) and **lower** (lowercase).|
| locale | string | Yes| No| Yes| Locale of the input method subtype.| | locale | string | Yes| No| Yes| Locale of the input method subtype.|
......
...@@ -9,7 +9,7 @@ The **inputMethod** module provides an input method framework, which can be used ...@@ -9,7 +9,7 @@ The **inputMethod** module provides an input method framework, which can be used
## Modules to Import ## Modules to Import
```js ```
import inputMethod from '@ohos.inputMethod'; import inputMethod from '@ohos.inputMethod';
``` ```
...@@ -239,7 +239,7 @@ Switches to another subtype of the current input method. This API uses an asynch ...@@ -239,7 +239,7 @@ Switches to another subtype of the current input method. This API uses an asynch
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| target | [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)| Yes| Input method subtype to switch to.| | target | [InputMethodSubtype](./js-apis-inputmethod-subtype.md)| Yes| Input method subtype to switch to.|
| callback | AsyncCallback&lt;boolean&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is **true**. Otherwise, **err** is an error object.| | callback | AsyncCallback&lt;boolean&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is **true**. Otherwise, **err** is an error object.|
**Error codes** **Error codes**
...@@ -256,9 +256,9 @@ For details about the error codes, see [Input Method Framework Error Codes](../e ...@@ -256,9 +256,9 @@ For details about the error codes, see [Input Method Framework Error Codes](../e
```js ```js
try { try {
inputMethod.switchCurrentInputMethodSubtype({ inputMethod.switchCurrentInputMethodSubtype({
id: "com.example.kikakeyboard", id: "ServiceExtAbility",
label: "ServiceExtAbility", label: "",
name: "", name: "com.example.kikakeyboard",
mode: "upper", mode: "upper",
locale: "", locale: "",
language: "", language: "",
...@@ -295,7 +295,7 @@ Switches to another subtype of the current input method. This API uses a promise ...@@ -295,7 +295,7 @@ Switches to another subtype of the current input method. This API uses a promise
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
|target | [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)| Yes| Input method subtype to switch to.| |target | [InputMethodSubtype](./js-apis-inputmethod-subtype.md)| Yes| Input method subtype to switch to.|
**Return value** **Return value**
...@@ -317,9 +317,9 @@ For details about the error codes, see [Input Method Framework Error Codes](../e ...@@ -317,9 +317,9 @@ For details about the error codes, see [Input Method Framework Error Codes](../e
```js ```js
try { try {
inputMethod.switchCurrentInputMethodSubtype({ inputMethod.switchCurrentInputMethodSubtype({
id: "com.example.kikakeyboard", id: "ServiceExtAbility",
label: "ServiceExtAbility", label: "",
name: "", name: "com.example.kikakeyboard",
mode: "upper", mode: "upper",
locale: "", locale: "",
language: "", language: "",
...@@ -352,7 +352,7 @@ Obtains the current input method subtype. ...@@ -352,7 +352,7 @@ Obtains the current input method subtype.
| Type | Description | | Type | Description |
| -------------------------------------------- | ------------------------ | | -------------------------------------------- | ------------------------ |
| [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype) | Current input method subtype.| | [InputMethodSubtype](./js-apis-inputmethod-subtype.md) | Current input method subtype.|
**Example** **Example**
...@@ -375,7 +375,7 @@ Switches to a specified subtype of a specified input method. This API uses an as ...@@ -375,7 +375,7 @@ Switches to a specified subtype of a specified input method. This API uses an as
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
|inputMethodProperty | [InputMethodProperty](#inputmethodproperty8)| Yes| Input method to switch to.| |inputMethodProperty | [InputMethodProperty](#inputmethodproperty8)| Yes| Input method to switch to.|
|inputMethodSubtype | [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)| Yes| Input method subtype to switch to.| |inputMethodSubtype | [InputMethodSubtype](./js-apis-inputmethod-subtype.md)| Yes| Input method subtype to switch to.|
| callback | AsyncCallback&lt;boolean&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is **true**. Otherwise, **err** is an error object.| | callback | AsyncCallback&lt;boolean&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is **true**. Otherwise, **err** is an error object.|
**Error codes** **Error codes**
...@@ -391,25 +391,9 @@ For details about the error codes, see [Input Method Framework Error Codes](../e ...@@ -391,25 +391,9 @@ For details about the error codes, see [Input Method Framework Error Codes](../e
```js ```js
let im = inputMethod.getCurrentInputMethod(); let im = inputMethod.getCurrentInputMethod();
let inputMethodProperty = { let imSubType = inputMethod.getCurrentInputMethodSubtype();
packageName: im.packageName,
methodId: im.methodId,
name: im.packageName,
id: im.methodId,
extra: {}
}
try { try {
inputMethod.switchCurrentInputMethodAndSubtype(inputMethodProperty, { inputMethod.switchCurrentInputMethodAndSubtype(im, imSubType, (err,result) => {
id: "com.example.kikakeyboard",
label: "ServiceExtAbility",
name: "",
mode: "upper",
locale: "",
language: "",
icon: "",
iconId: 0,
extra: {}
}, (err,result) => {
if (err !== undefined) { if (err !== undefined) {
console.error('Failed to switchCurrentInputMethodAndSubtype: ' + JSON.stringify(err)); console.error('Failed to switchCurrentInputMethodAndSubtype: ' + JSON.stringify(err));
return; return;
...@@ -440,7 +424,7 @@ Switches to a specified subtype of a specified input method. This API uses a pro ...@@ -440,7 +424,7 @@ Switches to a specified subtype of a specified input method. This API uses a pro
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
|inputMethodProperty | [InputMethodProperty](#inputmethodproperty8)| Yes| Input method to switch to.| |inputMethodProperty | [InputMethodProperty](#inputmethodproperty8)| Yes| Input method to switch to.|
|inputMethodSubtype | [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)| Yes| Input method subtype to switch to.| |inputMethodSubtype | [InputMethodSubtype](./js-apis-inputmethod-subtype.md)| Yes| Input method subtype to switch to.|
**Return value** **Return value**
...@@ -461,25 +445,9 @@ For details about the error codes, see [Input Method Framework Error Codes](../e ...@@ -461,25 +445,9 @@ For details about the error codes, see [Input Method Framework Error Codes](../e
```js ```js
let im = inputMethod.getCurrentInputMethod(); let im = inputMethod.getCurrentInputMethod();
let inputMethodProperty = { let imSubType = inputMethod.getCurrentInputMethodSubtype();
packageName: im.packageName,
methodId: im.methodId,
name: im.packageName,
id: im.methodId,
extra: {}
}
try { try {
inputMethod.switchCurrentInputMethodAndSubtype(inputMethodProperty, { inputMethod.switchCurrentInputMethodAndSubtype(inputMethodProperty, imSubType).then((result) => {
id: im.packageName,
label: im.methodId,
name: "",
mode: "upper",
locale: "",
language: "",
icon: "",
iconId: 0,
extra: {}
}).then((result) => {
if (result) { if (result) {
console.info('Succeeded in switching currentInputMethodAndSubtype.'); console.info('Succeeded in switching currentInputMethodAndSubtype.');
} else { } else {
...@@ -856,7 +824,7 @@ Enables listening for the input method and subtype change event. This API uses a ...@@ -856,7 +824,7 @@ Enables listening for the input method and subtype change event. This API uses a
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ | | -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>The value **'imeChange'** indicates the input method and subtype change event.| | type | string | Yes | Listening type.<br>The value **'imeChange'** indicates the input method and subtype change event.|
| callback | (inputMethodProperty: [InputMethodProperty](#inputmethodproperty8), inputMethodSubtype: [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)) => void | Yes| Callback used to return the input method attributes and subtype.| | callback | (inputMethodProperty: [InputMethodProperty](#inputmethodproperty8), inputMethodSubtype: [InputMethodSubtype](./js-apis-inputmethod-subtype.md)) => void | Yes| Callback used to return the input method attributes and subtype.|
**Example** **Example**
...@@ -879,7 +847,7 @@ Disables listening for the input method and subtype change event. This API uses ...@@ -879,7 +847,7 @@ Disables listening for the input method and subtype change event. This API uses
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ | | -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>The value **'imeChange'** indicates the input method and subtype change event.| | type | string | Yes | Listening type.<br>The value **'imeChange'** indicates the input method and subtype change event.|
| callback | (inputMethodProperty: [InputMethodProperty](#inputmethodproperty8), inputMethodSubtype: [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)) => void | No| Callback used to return the input method attributes and subtype.| | callback | (inputMethodProperty: [InputMethodProperty](#inputmethodproperty8), inputMethodSubtype: [InputMethodSubtype](./js-apis-inputmethod-subtype.md)) => void | No| Callback used to return the input method attributes and subtype.|
**Example** **Example**
...@@ -900,7 +868,7 @@ Obtains all subtypes of a specified input method. This API uses an asynchronous ...@@ -900,7 +868,7 @@ Obtains all subtypes of a specified input method. This API uses an asynchronous
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------------------------------------- | ---- | ---------------------- | | -------- | -------------------------------------------------- | ---- | ---------------------- |
| inputMethodProperty | InputMethodProperty| Yes| Input method to which the subtypes belong.| | inputMethodProperty | InputMethodProperty| Yes| Input method to which the subtypes belong.|
| callback | AsyncCallback&lt;Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)>&gt; | Yes| Callback used to return all subtypes of the specified input method.| | callback | AsyncCallback&lt;Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md)>&gt; | Yes| Callback used to return all subtypes of the specified input method.|
**Error codes** **Error codes**
...@@ -952,7 +920,7 @@ Obtains all subtypes of a specified input method. This API uses a promise to ret ...@@ -952,7 +920,7 @@ Obtains all subtypes of a specified input method. This API uses a promise to ret
| Type | Description | | Type | Description |
| ----------------------------------------------------------- | ---------------------- | | ----------------------------------------------------------- | ---------------------- |
| Promise<Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)>> | Promise used to return all subtypes of the specified input method.| | Promise<Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md)>> | Promise used to return all subtypes of the specified input method.|
**Error codes** **Error codes**
...@@ -996,7 +964,7 @@ Obtains all subtypes of this input method. This API uses an asynchronous callbac ...@@ -996,7 +964,7 @@ Obtains all subtypes of this input method. This API uses an asynchronous callbac
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------------------------------------- | ---- | ---------------------- | | -------- | -------------------------------------------------- | ---- | ---------------------- |
| callback | AsyncCallback&lt;Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)>&gt; | Yes | Callback used to return all subtypes of the current input method.| | callback | AsyncCallback&lt;Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md)>&gt; | Yes | Callback used to return all subtypes of the current input method.|
**Error codes** **Error codes**
...@@ -1035,7 +1003,7 @@ Obtains all subtypes of this input method. This API uses a promise to return the ...@@ -1035,7 +1003,7 @@ Obtains all subtypes of this input method. This API uses a promise to return the
| Type | Description | | Type | Description |
| ----------------------------------------------------------- | ---------------------- | | ----------------------------------------------------------- | ---------------------- |
| Promise<Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)>> | Promise used to return all subtypes of the current input method.| | Promise<Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md)>> | Promise used to return all subtypes of the current input method.|
**Error codes** **Error codes**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册