Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
5f45cefd
D
Docs
项目概览
OpenHarmony
/
Docs
1 年多 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
5f45cefd
编写于
10月 12, 2022
作者:
H
Hollokin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
API资料补充
Signed-off-by:
N
Hollokin
<
taoyuxin2@huawei.com
>
上级
534e97ce
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
247 addition
and
136 deletion
+247
-136
zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-ability.md
...v/reference/apis/js-apis-inputmethod-extension-ability.md
+3
-3
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
+233
-132
zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md
...plication-dev/reference/apis/js-apis-inputmethodengine.md
+11
-1
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-ability.md
浏览文件 @
5f45cefd
...
...
@@ -69,7 +69,7 @@ Extension生命周期回调,在销毁输入法应用时回调,执行资源
onRequest(want: Want, startId: number): void;
Extension生命周期回调,在
开始执行输入法应用
时回调,执行输入法的相关操作。
Extension生命周期回调,在
一个输入法extention开始
时回调,执行输入法的相关操作。
**系统能力**
:SystemCapability.MiscServices.InputMethodFramework
...
...
@@ -87,7 +87,7 @@ Extension生命周期回调,在开始执行输入法应用时回调,执行
onConnect(want: Want): rpc.RemoteObject;
Extension生命周期回调,在
首次链
接输入法ability时回调。
Extension生命周期回调,在
输入法extention首次连
接输入法ability时回调。
**系统能力**
:SystemCapability.MiscServices.InputMethodFramework
...
...
@@ -105,7 +105,7 @@ Extension生命周期回调,在首次链接输入法ability时回调。
onDisconnect(want: Want): rpc.RemoteObject;
Extension生命周期回调,在所有
链
接在输入法extention上的ability都断开的时候回调。
Extension生命周期回调,在所有
连
接在输入法extention上的ability都断开的时候回调。
**系统能力**
:SystemCapability.MiscServices.InputMethodFramework
...
...
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
浏览文件 @
5f45cefd
...
...
@@ -34,8 +34,12 @@ import inputMethod from '@ohos.inputmethod';
| -------- | -------- | -------- | -------- | -------- |
| packageName
<sup>
deprecated
</sup>
| string | 是 | 否 | 包名。 |
| methodId
<sup>
deprecated
</sup>
| string | 是 | 否 | Ability名。 |
| name
<sup>
9+
</sup>
| string | 是 | 否 | 包名。 |
| id
<sup>
9+
</sup>
| string | 是 | 否 | Ability名。 |
| name
<sup>
9+
</sup>
| string | 是 | 否 | 包名,非必填项。 |
| id
<sup>
9+
</sup>
| string | 是 | 否 | Ability名,非必填项。 |
| label
<sup>
9+
</sup>
| string | 是 | 否 | 输入法标签,非必填项。|
| icon
<sup>
9+
</sup>
| string | 是 | 否 | 输入法图标,非必填项。 |
| iconId
<sup>
9+
</sup>
| number | 是 | 否 | 输入法图标id,非必填项。 |
| extra
<sup>
9+
</sup>
| object | 是 | 否 | 输入法其他信息,非必填项。 |
## inputMethod.getInputMethodController<sup>deprecated</sup>
...
...
@@ -82,12 +86,17 @@ getController(): InputMethodController
var
InputMethodController
=
inputMethod
.
getController
();
```
## inputMethod.getInputMethodSetting<sup>
8+
</sup>
## inputMethod.getInputMethodSetting<sup>
deprecated
</sup>
getInputMethodSetting(): InputMethodSetting
获取客户端设置实例
[
InputMethodSetting
](
#inputmethodsetting8
)
。
> **说明:**
> 从API version 9开始废弃, 建议使用[getSetting](#getSetting)替代
>
> 从 API version 6开始支持。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**返回值:**
...
...
@@ -145,8 +154,10 @@ switchInputMethod(target: InputMethodProperty, callback: AsyncCallback<boolea
**示例:**
```
js
inputMethod
.
switchInputMethod
({
packageName
:
'
com.example.kikakeyboard
'
,
methodId
:
'
com.example.kikakeyboard
'
}
,(
err
,
result
)
=>
{
try
{
inputMethod
.
switchInputMethod
({
packageName
:
'
com.example.kikakeyboard
'
,
methodId
:
'
com.example.kikakeyboard
'
},
(
err
,
result
)
=>
{
if
(
err
)
{
// 处理业务逻辑执行错误
console
.
error
(
'
switchInputMethod err:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -155,7 +166,11 @@ inputMethod.switchInputMethod({packageName:'com.example.kikakeyboard', methodId:
}
else
{
console
.
error
(
'
Failed to switchInputMethod.(callback)
'
);
}
});
});
}
catch
(
err
)
{
// 捕获参数错误
console
.
error
(
'
err:
'
+
err
.
code
+
'
err message:
'
+
err
.
message
);
}
```
## inputMethod.switchInputMethod<sup>9+</sup>
switchInputMethod(target: InputMethodProperty): Promise
<
boolean
>
...
...
@@ -181,15 +196,19 @@ switchInputMethod(target: InputMethodProperty): Promise<boolean>
**示例:**
```
js
inputMethod
.
switchInputMethod
({
packageName
:
'
com.example.kikakeyboard
'
,
methodId
:
'
com.example.kikakeyboard
'
}).
then
((
result
)
=>
{
try
{
inputMethod
.
switchInputMethod
({
packageName
:
'
com.example.kikakeyboard
'
,
methodId
:
'
com.example.kikakeyboard
'
}).
then
((
result
)
=>
{
if
(
result
)
{
console
.
info
(
'
Success to switchInputMethod.(promise)
'
);
}
else
{
console
.
error
(
'
Failed to switchInputMethod.(promise)
'
);
}
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
switchInputMethod promise err:
'
+
err
);
})
})
}
catch
(
err
)
{
console
.
error
(
'
err:
'
+
err
.
code
+
'
err message:
'
+
err
.
message
);
}
```
## inputMethod.getCurrentInputMethod<sup>9+</sup>
...
...
@@ -232,7 +251,12 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallb
**示例:**
```
js
inputMethod
.
switchCurrentInputMethodSubtype
(
subType
,(
err
,
result
)
=>
{
let
inputMethodSubProperty
=
{
id
:
"
com.example.kikainput
"
,
label
:
"
ServiceExtAbility
"
}
try
{
inputMethod
.
switchCurrentInputMethodSubtype
(
inputMethodSubProperty
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
'
switchCurrentInputMethodSubtype err:
'
+
JSON
.
stringify
(
err
));
return
;
...
...
@@ -242,7 +266,10 @@ inputMethod.switchCurrentInputMethodSubtype(subType ,(err,result) => {
}
else
{
console
.
error
(
'
Failed to switchCurrentInputMethodSubtype.(callback)
'
);
}
});
});
}
catch
(
err
)
{
console
.
error
(
'
err:
'
+
err
.
code
+
'
err message:
'
+
err
.
message
);
}
```
## inputMethod.switchCurrentInputMethodSubtype<sup>9+</sup>
...
...
@@ -264,15 +291,23 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise<boolean&
**示例:**
```
js
inputMethod
.
switchCurrentInputMethodSubtype
(
subType
).
then
((
result
)
=>
{
let
inputMethodSubProperty
=
{
id
:
"
com.example.kikainput
"
,
label
:
"
ServiceExtAbility
"
}
try
{
inputMethod
.
switchCurrentInputMethodSubtype
(
inputMethodSubProperty
).
then
((
result
)
=>
{
if
(
result
)
{
console
.
info
(
'
Success to switchCurrentInputMethodSubtype.(promise)
'
);
}
else
{
console
.
error
(
'
Failed to switchCurrentInputMethodSubtype.(promise)
'
);
}
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
switchCurrentInputMethodSubtype promise err:
'
+
err
);
})
})
}
catch
(
err
)
{
console
.
error
(
'
err:
'
+
err
.
code
+
'
err message:
'
+
err
.
message
);
}
```
## inputMethod.getCurrentInputMethodSubtype<sup>9+</sup>
...
...
@@ -318,7 +353,16 @@ switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inp
**示例:**
```
js
inputMethod
.
switchCurrentInputMethodAndSubtype
(
property
,
subType
,(
err
,
result
)
=>
{
let
inputMethodSubProperty
=
{
id
:
"
com.example.kikainput
"
,
label
:
"
ServiceExtAbility
"
}
let
inputMethodProperty
=
{
name
:
'
com.example.kikakeyboard
'
,
id
:
'
com.example.kikakeyboard
'
}
try
{
inputMethod
.
switchCurrentInputMethodAndSubtype
(
inputMethodProperty
,
inputMethodSubProperty
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
'
switchCurrentInputMethodAndSubtype err:
'
+
JSON
.
stringify
(
err
));
return
;
...
...
@@ -328,7 +372,10 @@ inputMethod.switchCurrentInputMethodAndSubtype(property, subType ,(err,result) =
}
else
{
console
.
error
(
'
Failed to switchCurrentInputMethodAndSubtype.(callback)
'
);
}
});
});
}
catch
(
err
)
{
console
.
error
(
'
err:
'
+
err
.
code
+
'
err message:
'
+
err
.
message
);
}
```
## inputMethod.switchCurrentInputMethodAndSubtype<sup>9+</sup>
...
...
@@ -351,20 +398,32 @@ switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inp
**示例:**
```
js
inputMethod
.
switchCurrentInputMethodAndSubtype
(
property
,
subType
).
then
((
result
)
=>
{
let
inputMethodSubProperty
=
{
id
:
"
com.example.kikainput
"
,
label
:
"
ServiceExtAbility
"
}
let
inputMethodProperty
=
{
name
:
'
com.example.kikakeyboard
'
,
id
:
'
com.example.kikakeyboard
'
}
try
{
inputMethod
.
switchCurrentInputMethodAndSubtype
(
property
,
subType
).
then
((
result
)
=>
{
if
(
result
)
{
console
.
info
(
'
Success to switchCurrentInputMethodAndSubtype.(promise)
'
);
}
else
{
console
.
error
(
'
Failed to switchCurrentInputMethodAndSubtype.(promise)
'
);
}
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
switchCurrentInputMethodAndSubtype promise err:
'
+
err
);
})
})
}
catch
(
err
)
{
console
.
error
(
'
err:
'
+
err
.
code
+
'
err message:
'
+
err
.
message
);
}
```
## InputMethodController
下列API示例中都需使用
[
get
InputMethodController
](
#inputmethodgetinputmethod
controller
)
回调获取到InputMethodController实例,再通过此实例调用对应方法。
下列API示例中都需使用
[
get
Controller
](
#inputmethodget
controller
)
回调获取到InputMethodController实例,再通过此实例调用对应方法。
### stopInput<sup>deprecated</sup>
...
...
@@ -412,7 +471,6 @@ stopInput(): Promise<boolean>
**示例:**
```
js
InputMethodController
.
stopInput
().
then
((
result
)
=>
{
if
(
result
)
{
...
...
@@ -442,7 +500,8 @@ stopInputSession(callback: AsyncCallback<boolean>): void
**示例:**
```
js
InputMethodController
.
stopInputSession
((
error
,
result
)
=>
{
try
{
InputMethodController
.
stopInputSession
((
error
,
result
)
=>
{
if
(
error
)
{
console
.
error
(
'
failed to stopInputSession because:
'
+
JSON
.
stringify
(
error
));
return
;
...
...
@@ -452,7 +511,10 @@ InputMethodController.stopInputSession((error, result) => {
}
else
{
console
.
error
(
'
Failed to stopInputSession.(callback)
'
);
}
});
});
}
catch
(
err
)
{
console
.
error
(
'
err:
'
+
err
.
code
+
'
err message:
'
+
err
.
message
);
}
```
### stopInputSession
...
...
@@ -471,17 +533,20 @@ stopInputSession(): Promise<boolean>
**示例:**
```
js
InputMethodController
.
stopInputSession
().
then
((
result
)
=>
{
try
{
InputMethodController
.
stopInputSession
().
then
((
result
)
=>
{
if
(
result
)
{
console
.
info
(
'
Success to stopInputSession.(promise)
'
);
}
else
{
console
.
error
(
'
Failed to stopInputSession.(promise)
'
);
}
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
stopInputSession promise err:
'
+
err
);
})
})
}
catch
(
err
)
{
console
.
error
(
'
err:
'
+
err
.
code
+
'
err message:
'
+
err
.
message
);
}
```
### showSoftKeyboard<sup>9+</sup> ###
...
...
@@ -510,7 +575,6 @@ InputMethodController.showSoftKeyboard((err) => {
})
```
### showSoftKeyboard<sup>9+</sup> ###
showSoftKeyboard(): Promise
<
void
>
...
...
@@ -588,7 +652,7 @@ InputMethodController.hideSoftKeyboard().then(async (err) => {
## InputMethodSetting<sup>8+</sup>
下列API示例中都需使用
[
get
InputMethodSetting
](
#inputmethodgetinputmethodcontroller
)
回调获取到InputMethodSetting实例,再通过此实例调用对应方法。
下列API示例中都需使用
[
get
Setting
](
#inputmethodgetsetting
)
回调获取到InputMethodSetting实例,再通过此实例调用对应方法。
### on('imeChange')<a name="imeChange"></a>
...
...
@@ -653,13 +717,21 @@ listInputMethodSubtype(inputMethodProperty: InputMethodProperty, callback: Async
**示例:**
```
js
InputMethodSetting
.
listInputMethodSubtype
({
"
name
"
:
''
,
"
id
"
:
''
},
(
err
,
data
)
=>
{
let
inputMethodSubProperty
=
{
id
:
"
com.example.kikainput
"
,
label
:
"
ServiceExtAbility
"
}
try
{
InputMethodSetting
.
listInputMethodSubtype
(
inputMethodSubProperty
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
'
listInputMethod
failed because:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
listInputMethodSubtype
failed because:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
log
(
'
listInputMethod
success
'
);
console
.
log
(
'
listInputMethodSubtype
success
'
);
});
}
catch
(
err
)
{
console
.
error
(
'
err:
'
+
err
.
code
+
'
err message:
'
+
err
.
message
);
}
```
### listInputMethodSubtype<sup>9+</sup>
...
...
@@ -679,11 +751,19 @@ listInputMethodSubtype(inputMethodProperty: InputMethodProperty): Promise<Arr
**示例:**
```
js
InputMethodSetting
.
listInputMethodSubtype
().
then
((
data
)
=>
{
let
inputMethodSubProperty
=
{
id
:
"
com.example.kikainput
"
,
label
:
"
ServiceExtAbility
"
}
try
{
InputMethodSetting
.
listInputMethodSubtype
(
inputMethodSubProperty
).
then
((
data
)
=>
{
console
.
info
(
'
listInputMethodSubtype success
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
listInputMethodSubtype promise err:
'
+
err
);
})
})
}
catch
(
err
)
{
console
.
error
(
'
err:
'
+
err
.
code
+
'
err message:
'
+
err
.
message
);
}
```
### listCurrentInputMethodSubtype<sup>9+</sup>
...
...
@@ -703,13 +783,17 @@ listCurrentInputMethodSubtype(callback: AsyncCallback<Array<InputMethodSub
**示例:**
```
js
InputMethodSetting
.
listCurrentInputMethodSubtype
((
err
,
data
)
=>
{
try
{
InputMethodSetting
.
listCurrentInputMethodSubtype
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
'
listCurrentInputMethodSubtype failed because:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
log
(
'
listCurrentInputMethodSubtype success
'
);
});
}
catch
(
err
)
{
console
.
error
(
'
err:
'
+
err
.
code
+
'
err message:
'
+
err
.
message
);
}
```
### listCurrentInputMethodSubtype<sup>9+</sup>
...
...
@@ -729,11 +813,16 @@ listCurrentInputMethodSubtype(): Promise<Array<InputMethodSubtype>>
**示例:**
```
js
InputMethodSetting
.
listCurrentInputMethodSubtype
().
then
((
data
)
=>
{
try
{
InputMethodSetting
.
listCurrentInputMethodSubtype
().
then
((
data
)
=>
{
console
.
info
(
'
listCurrentInputMethodSubtype success
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
listCurrentInputMethodSubtype promise err:
'
+
err
);
})
})
}
catch
(
err
)
{
console
.
error
(
'
err:
'
+
err
.
code
+
'
err message:
'
+
err
.
message
);
}
```
### getInputMethods<sup>9+</sup>
...
...
@@ -754,13 +843,17 @@ getInputMethods(enable: boolean, callback: AsyncCallback<Array<InputMethod
**示例:**
```
js
InputMethodSetting
.
getInputMethods
(
true
,
(
err
,
data
)
=>
{
try
{
InputMethodSetting
.
getInputMethods
(
true
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
'
getInputMethods failed because:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
log
(
'
getInputMethods success
'
);
});
}
catch
(
err
)
{
console
.
error
(
'
err:
'
+
err
.
code
+
'
err message:
'
+
err
.
message
);
}
```
### getInputMethods<sup>9+</sup>
...
...
@@ -786,11 +879,15 @@ getInputMethods(enable: boolean): Promise<Array<InputMethodProperty>>
**示例:**
```
js
InputMethodSetting
.
getInputMethods
(
true
).
then
((
data
)
=>
{
try
{
InputMethodSetting
.
getInputMethods
(
true
).
then
((
data
)
=>
{
console
.
info
(
'
getInputMethods success
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
getInputMethods promise err:
'
+
err
);
})
})
}
catch
(
err
)
{
console
.
error
(
'
err:
'
+
err
.
code
+
'
err message:
'
+
err
.
message
);
}
```
### listInputMethod<sup>deprecated</sup>
...
...
@@ -888,16 +985,20 @@ showOptionalInputMethods(callback: AsyncCallback<void>): void
**示例:**
```
js
InputMethodSetting
.
showOptionalInputMethods
((
err
)
=>
{
try
{
InputMethodSetting
.
showOptionalInputMethods
((
err
)
=>
{
if
(
err
)
{
console
.
error
(
'
showOptionalInputMethods failed because:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
'
showOptionalInputMethods success
'
);
});
});
}
catch
(
err
)
{
console
.
error
(
'
err:
'
+
err
.
code
+
'
err message:
'
+
err
.
message
);
}
```
### displayOptionalInputMethod
### displayOptionalInputMethod
<sup>deprecated</sup>
displayOptionalInputMethod(): Promise
<
void
>
...
...
zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md
浏览文件 @
5f45cefd
...
...
@@ -57,6 +57,11 @@ getInputMethodEngine(): InputMethodEngine
获取服务端实例。
> **说明:**
> 从API version 9开始废弃, 建议使用[getInputMethodAbility](#getInputMethodAbility)替代
>
> 从 API version 8开始支持。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**返回值:**
...
...
@@ -71,7 +76,7 @@ getInputMethodEngine(): InputMethodEngine
var
InputMethodEngine
=
inputMethodEngine
.
getInputMethodEngine
();
```
## inputMethodAbility.getInputMethodAbility<a name="getInputMethodAbility"></a>
## inputMethodAbility.getInputMethodAbility<a name="getInputMethodAbility"></a>
<sup>9+</sup>
getInputMethodAbility(): InputMethodAbility
...
...
@@ -97,6 +102,11 @@ createKeyboardDelegate(): KeyboardDelegate
获取客户端监听实例。
> **说明:**
> 从API version 9开始废弃, 建议使用[getKeyboardDelegate](#getKeyboardDelegate)替代
>
> 从 API version 8开始支持。
**系统能力**
: SystemCapability.MiscServices.InputMethodFramework
**返回值:**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录