From df7c3b7474b40ac75f5c21c6e6873276ce8596e1 Mon Sep 17 00:00:00 2001 From: Hollokin Date: Mon, 21 Nov 2022 14:29:59 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E8=BE=93=E5=85=A5=E6=B3=95=E6=A1=86?= =?UTF-8?q?=E6=9E=B6=E3=80=91=E7=A4=BA=E4=BE=8B=E4=BB=A3=E7=A0=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Hollokin --- .../reference/apis/js-apis-inputmethod.md | 61 ++++++++++--------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md b/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md index aa285044a0..d810118a35 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md @@ -93,7 +93,7 @@ getSetting(): InputMethodSetting **示例:** ```js -let InputMethodSetting = inputMethod.getSetting(); +let inputMethodSetting = inputMethod.getSetting(); ``` ## inputMethod.switchInputMethod9+ @@ -239,7 +239,7 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallb ```js let inputMethodSubtype = { - id: "com.example.kikainput", + id: "com.example.kikakeyboard", label: "ServiceExtAbility", name: "", mode: "upper", @@ -301,7 +301,7 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise<boolean& ```js let inputMethodSubtype = { - id: "com.example.kikainput", + id: "com.example.kikakeyboard", label: "ServiceExtAbility", name: "", mode: "upper", @@ -382,7 +382,7 @@ let inputMethodProperty = { extra: {} } let inputMethodSubProperty = { - id: "com.example.kikainput", + id: "com.example.kikakeyboard", label: "ServiceExtAbility", name: "", mode: "upper", @@ -445,19 +445,23 @@ switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inp ```js let inputMethodProperty = { - name: "com.example.kikakeyboard", - id: "ServiceExtAbility" + packageName: "com.example.kikakeyboard", + methodId: "ServiceExtAbility", + extra: {} } let inputMethodSubProperty = { id: "com.example.kikakeyboard", - name: "", - locale: "", label: "ServiceExtAbility", - language: "", - extra : {} + name: "", + mode: "upper", + locale: "", + language: "", + icon: "", + iconId: 0, + extra: {} } try { - inputMethod.switchCurrentInputMethodAndSubtype(property, subType).then((result) => { + inputMethod.switchCurrentInputMethodAndSubtype(inputMethodProperty, inputMethodSubProperty).then((result) => { if (result) { console.info('Success to switchCurrentInputMethodAndSubtype.'); } else { @@ -514,7 +518,7 @@ getInputMethodSetting(): InputMethodSetting **示例:** ```js -let InputMethodSetting = inputMethod.getInputMethodSetting(); +let inputMethodSetting = inputMethod.getInputMethodSetting(); ``` ## InputMethodController @@ -837,10 +841,8 @@ on(type: 'imeChange', callback: (inputMethodProperty: InputMethodProperty, input **示例:** ```js -let InputMethodSetting = inputMethod.getSetting(); -InputMethodSetting.on('imeChange', (inputMethodProperty, inputMethodSubtype) => { - InputMethodProperty = inputMethodProperty; - InputMethodSubtype = inputMethodSubtype; +inputMethodSetting.on('imeChange', (inputMethodProperty, inputMethodSubtype) => { + console.info('Succeeded in subscribing imeChange: inputMethodProperty: ' + JSON.stringify(inputMethodProperty) + " , inputMethodSubtype: " + JSON.stringify(inputMethodSubtype)); }); ``` @@ -862,8 +864,7 @@ off(type: 'imeChange', callback?: (inputMethodProperty: InputMethodProperty, inp **示例:** ```js -let InputMethodSetting = inputMethod.getSetting(); -InputMethodSetting.off('imeChange'); +inputMethodSetting.off('imeChange'); ``` ### listInputMethodSubtype9+ @@ -899,7 +900,7 @@ let inputMethodProperty = { extra:{} } try { - InputMethodSetting.listInputMethodSubtype(inputMethodProperty, (err,data) => { + inputMethodSetting.listInputMethodSubtype(inputMethodProperty, (err,data) => { if (err) { console.error('listInputMethodSubtype failed: ' + JSON.stringify(err)); return; @@ -949,7 +950,7 @@ let inputMethodProperty = { extra:{} } try { - InputMethodSetting.listInputMethodSubtype(inputMethodProperty).then((data) => { + inputMethodSetting.listInputMethodSubtype(inputMethodProperty).then((data) => { console.info('listInputMethodSubtype success'); }).catch((err) => { console.error('listInputMethodSubtype err: ' + JSON.stringify(err)); @@ -986,7 +987,7 @@ listCurrentInputMethodSubtype(callback: AsyncCallback<Array<InputMethodSub ```js try { - InputMethodSetting.listCurrentInputMethodSubtype((err, data) => { + inputMethodSetting.listCurrentInputMethodSubtype((err, data) => { if (err) { console.error('listCurrentInputMethodSubtype failed: ' + JSON.stringify(err)); return; @@ -1025,7 +1026,7 @@ listCurrentInputMethodSubtype(): Promise<Array<InputMethodSubtype>> ```js try { - InputMethodSetting.listCurrentInputMethodSubtype().then((data) => { + inputMethodSetting.listCurrentInputMethodSubtype().then((data) => { console.info('listCurrentInputMethodSubtype success'); }).catch((err) => { console.error('listCurrentInputMethodSubtype err: ' + err); @@ -1063,7 +1064,7 @@ getInputMethods(enable: boolean, callback: AsyncCallback<Array<InputMethod ```js try { - InputMethodSetting.getInputMethods(true, (err,data) => { + inputMethodSetting.getInputMethods(true, (err,data) => { if (err) { console.error('getInputMethods failed: ' + JSON.stringify(err)); return; @@ -1108,7 +1109,7 @@ getInputMethods(enable: boolean): Promise<Array<InputMethodProperty>> ```js try { - InputMethodSetting.getInputMethods(true).then((data) => { + inputMethodSetting.getInputMethods(true).then((data) => { console.info('getInputMethods success'); }).catch((err) => { console.error('getInputMethods err: ' + JSON.stringify(err)); @@ -1146,7 +1147,7 @@ showOptionalInputMethods(callback: AsyncCallback<boolean>): void ```js try { - InputMethodSetting.showOptionalInputMethods((err, data) => { + inputMethodSetting.showOptionalInputMethods((err, data) => { if (err) { console.error('showOptionalInputMethods failed: ' + JSON.stringify(err)); return; @@ -1185,7 +1186,7 @@ showOptionalInputMethods(): Promise<boolean> **示例:** ```js -InputMethodSetting.showOptionalInputMethods().then((data) => { +inputMethodSetting.showOptionalInputMethods().then((data) => { console.info('displayOptionalInputMethod success.'); }).catch((err) => { console.error('displayOptionalInputMethod err: ' + err); @@ -1213,7 +1214,7 @@ listInputMethod(callback: AsyncCallback<Array<InputMethodProperty>>) **示例:** ```js -InputMethodSetting.listInputMethod((err,data) => { +inputMethodSetting.listInputMethod((err,data) => { if (err) { console.error('listInputMethod failed because: ' + JSON.stringify(err)); return; @@ -1243,7 +1244,7 @@ listInputMethod(): Promise<Array<InputMethodProperty>> **示例:** ```js -InputMethodSetting.listInputMethod().then((data) => { +inputMethodSetting.listInputMethod().then((data) => { console.info('listInputMethod success'); }).catch((err) => { console.error('listInputMethod err: ' + JSON.stringify(err)); @@ -1271,7 +1272,7 @@ displayOptionalInputMethod(callback: AsyncCallback<void>): void **示例:** ```js -InputMethodSetting.displayOptionalInputMethod((err) => { +inputMethodSetting.displayOptionalInputMethod((err) => { if (err) { console.error('displayOptionalInputMethod failed because: ' + JSON.stringify(err)); return; @@ -1301,7 +1302,7 @@ displayOptionalInputMethod(): Promise<void> **示例:** ```js -InputMethodSetting.displayOptionalInputMethod().then(() => { +inputMethodSetting.displayOptionalInputMethod().then(() => { console.info('displayOptionalInputMethod success'); }).catch((err) => { console.error('displayOptionalInputMethod err: ' + err); -- GitLab