Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
3ba9bc40
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
3ba9bc40
编写于
12月 24, 2022
作者:
O
openharmony_ci
提交者:
Gitee
12月 24, 2022
浏览文件
操作
浏览文件
下载
差异文件
!12846 【输入法框架】3.2.8.1版本changelogs补充
Merge pull request !12846 from Hollokin/master
上级
4dbbddee
673174be
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
196 addition
and
0 deletion
+196
-0
zh-cn/release-notes/changelogs/OpenHarmony_3.2.8.1/changelogs-inputmethod-framworks.md
...s/OpenHarmony_3.2.8.1/changelogs-inputmethod-framworks.md
+196
-0
未找到文件。
zh-cn/release-notes/changelogs/OpenHarmony_3.2.8.1/changelogs-inputmethod-framworks.md
0 → 100644
浏览文件 @
3ba9bc40
# 输入法框架changeLog
## cl.inputmethod_frameworks.1 API错误信息返回方式变更
下列模块内部接口使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。在API9进行变更。
-
输入法框架模块:系统接口,@ohos.inputmethod.d.ts
-
输入法服务模块:系统接口,@ohos.inputmethodengine.d.ts
-
输入法ExtentionAbility模块:系统接口,@ohos.inputmethodextensionability.d.ts
-
输入法ExtentionContext模块:系统接口,@ohos.inputmethodextensioncontext.d.ts
-
输入法子类型模块:系统接口,@ohos.inputMethodSubtype.d.ts
异步接口:通过AsyncCallback或Promise的error对象返回错误信息。
同步接口:通过抛出异常的方式返回错误信息。
**变更影响**
基于此前版本开发的应用,需适配接口的错误信息返回方式,否则会影响原有业务逻辑。
**关键接口/组件变更**
在以下接口增加错误码处理:
-
getSetting(): InputMethodSetting;
-
getController(): InputMethodController;
-
switchInputMethod(target: InputMethodProperty, callback: AsyncCallback
<boolean>
): void;
-
switchInputMethod(target: InputMethodProperty): Promise
<boolean>
;
-
switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallback
<boolean>
): void;
-
switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise
<boolean>
;
-
switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype, callback: AsyncCallback
<boolean>
): void;
-
switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype): Promise
<boolean>
;
-
listInputMethodSubtype(inputMethodProperty: InputMethodProperty, callback: AsyncCallback
<Array
<
InputMethodSubtype
>
>): void;
-
listInputMethodSubtype(inputMethodProperty: InputMethodProperty): Promise
<Array
<
InputMethodSubtype
>
>;
-
listCurrentInputMethodSubtype(callback: AsyncCallback
<Array
<
InputMethodSubtype
>
>): void;
-
listCurrentInputMethodSubtype(): Promise
<Array
<
InputMethodSubtype
>
>;
-
getInputMethods(enable: boolean, callback: AsyncCallback
<Array
<
InputMethodProperty
>
>): void;
-
getInputMethods(enable: boolean): Promise
<Array
<
InputMethodProperty
>
>;
-
showOptionalInputMethods(callback: AsyncCallback
<boolean>
): void;
-
showOptionalInputMethods(): Promise
<boolean>
;
-
stopInputSession(callback: AsyncCallback
<boolean>
): void;
-
stopInputSession(): Promise
<boolean>
;
-
showSoftKeyboard(callback: AsyncCallback
<void>
): void;
-
showSoftKeyboard():Promise
<void>
;
-
hideSoftKeyboard(callback: AsyncCallback
<void>
): void;
-
hideSoftKeyboard():Promise
<void>
;
-
hide(callback: AsyncCallback
<void>
): void;
-
hide(): Promise
<void>
;
-
onCreate(want: Want): void;
-
onDestroy(): void;
InputClient 接口下:
-
sendKeyFunction(action: number, callback: AsyncCallback
<boolean>
): void;
-
sendKeyFunction(action: number): Promise
<boolean>
;
-
deleteForward(length: number, callback: AsyncCallback
<boolean>
): void;
-
deleteForward(length: number): Promise
<boolean>
;
-
deleteBackward(length: number, callback: AsyncCallback
<boolean>
): void;
-
deleteBackward(length: number): Promise
<boolean>
;
-
insertText(text: string, callback: AsyncCallback
<boolean>
): void;
-
insertText(text: string): Promise
<boolean>
;
-
getForward(length: number, callback: AsyncCallback
<string>
): void;
-
getForward(length: number): Promise
<string>
;
-
getBackward(length: number, callback: AsyncCallback
<string>
): void;
-
getBackward(length: number): Promise
<string>
;
-
getEditorAttribute(callback: AsyncCallback
<EditorAttribute>
): void;
-
getEditorAttribute(): Promise
<EditorAttribute>
;
-
moveCursor(direction: number, callback: AsyncCallback
<void>
): void;
-
moveCursor(direction: number): Promise
<void>
;
InputMethodExtensionAbility 类下:
-
onCreate(want: Want): void;
-
onDestroy(): void;
**适配指导**
异步接口以showOptionalInputMethods为例,示例代码如下:
callback回调:
```
js
import
inputMethod
from
'
@ohos.inputmethod
'
;
let
inputMethodSetting
=
inputMethod
.
getSetting
();
try
{
inputMethodSetting
.
showOptionalInputMethods
((
err
,
data
)
=>
{
if
(
err
!==
undefined
)
{
console
.
error
(
'
Failed to showOptionalInputMethods:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
'
Succeeded in showing optionalInputMethods.
'
);
});
}
catch
(
err
)
{
console
.
error
(
'
Failed to showOptionalInputMethods:
'
+
JSON
.
stringify
(
err
));
}
```
Promise回调:
```
js
import
inputMethod
from
'
@ohos.inputmethod
'
;
let
inputMethodSetting
=
inputMethod
.
getSetting
();
inputMethodSetting
.
showOptionalInputMethods
().
then
((
data
)
=>
{
console
.
info
(
'
Succeeded in showing optionalInputMethods.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to showOptionalInputMethods:
'
+
JSON
.
stringify
(
err
));
})
```
## cl.inputmethod_frameworks.2 API部分接口废弃
以下接口标记废除:
-
getInputMethodSetting(): InputMethodSetting;
-
getInputMethodController(): InputMethodController;
-
listInputMethod(callback: AsyncCallback
<Array
<
InputMethodProperty
>
>): void;
-
listInputMethod(): Promise
<Array
<
InputMethodProperty
>
>;
-
displayOptionalInputMethod(callback: AsyncCallback
<void>
): void;
-
displayOptionalInputMethod(): Promise
<void>
;
-
stopInput(callback: AsyncCallback
<boolean>
): void;
-
stopInput(): Promise
<boolean>
;
interface InputMethodProperty:
-
readonly packageName: string;
-
readonly methodId: string;
-
getInputMethodEngine(): InputMethodEngine;
-
createKeyboardDelegate(): KeyboardDelegate;
-
hideKeyboard(callback: AsyncCallback
<void>
): void;
-
hideKeyboard(): Promise
<void>
;
替代接口如下:
-
getSetting(): InputMethodSetting;
-
getController(): InputMethodController;
-
getInputMethods(enable: boolean, callback: AsyncCallback
<Array
<
InputMethodProperty
>
>): void;
-
getInputMethods(enable: boolean): Promise
<Array
<
InputMethodProperty
>
>;
-
showOptionalInputMethods(callback: AsyncCallback
<boolean>
): void;
-
showOptionalInputMethods(): Promise
<boolean>
;
-
stopInputSession(callback: AsyncCallback
<boolean>
): void;
-
stopInputSession(): Promise
<boolean>
;
interface InputMethodProperty:
-
readonly name: string;
-
readonly id: string;
-
getInputMethodAbility(): InputMethodAbility;
-
getKeyboardDelegate(): KeyboardDelegate;
-
hide(callback: AsyncCallback
<void>
): void;
-
hide(): Promise
<void>
;
**特别注意:**
使用getInputMethodAbility()接口获取到InputMethodAbility对象,代替使用getInputMethodEngine()接口获取InputMethodEngine对象。
使用InputMethodAbility中的方法,不要再使用InputMethodEngine中的方法。
使用InputMethodAbility中的on('inputStart')方法,获取到KeyboardController实例与InputClient实例,不要再使用InputMethodEngine中的on('inputStart')方法去获取TextInputClient实例。
之前:
```
js
inputMethodEngine
.
getInputMethodEngine
().
on
(
'
inputStart
'
,
(
kbController
,
textClient
)
=>
{
let
keyboardController
=
kbController
;
let
textInputClient
=
textClient
;
// 获取到TextInputClient实例
});
```
之后:
```
js
inputMethodEngine
.
getInputMethodAbility
().
on
(
'
inputStart
'
,
(
kbController
,
client
)
=>
{
let
keyboardController
=
kbController
;
let
inputClient
=
client
;
// // 获取到InputClient实例
});
```
## cl.inputmethod_frameworks.3 API部分接口变更
变更前:
-
listInputMethod(enable: boolean, callback: AsyncCallback
<Array
<
InputMethodProperty
>
>): void;
-
listInputMethod(enable: boolean): Promise
<Array
<
InputMethodProperty
>
>;
-
terminateSelf(callback: AsyncCallback
<void>
): void;
-
terminateSelf(): Promise
<void>
;
变更后:
-
getInputMethods(enable: boolean, callback: AsyncCallback
<Array
<
InputMethodProperty
>
>): void;
-
getInputMethods(enable: boolean): Promise
<Array
<
InputMethodProperty
>
>;
-
destroy(callback: AsyncCallback
<void>
): void;
-
destroy(): Promise
<void>
;
删除API9接口:
-
startAbility(want: Want, callback: AsyncCallback
<void>
): void;
-
startAbility(want: Want, options: StartOptions, callback: AsyncCallback
<void>
): void;
-
startAbility(want: Want, options?: StartOptions): Promise
<void>
;
其他新增接口:
-
on(type: 'imeChange', callback: (inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype) => void): void;
-
off(type: 'imeChange', callback?: (inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype) => void): void;
-
interface InputMethodProperty:
-
readonly label?: string;
-
readonly icon?: string;
-
readonly iconId?: number;
-
extra: object;
-
interface InputMethodAbility:
-
on(type: 'setSubtype', callback: (inputMethodSubtype: InputMethodSubtype) => void): void;
-
off(type: 'setSubtype', callback?: (inputMethodSubtype: InputMethodSubtype) => void): void;
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录