Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
95c2e18f
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
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看板
提交
95c2e18f
编写于
5月 07, 2023
作者:
H
Hollokin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
删除多余空格
Signed-off-by:
N
Hollokin
<
taoyuxin2@huawei.com
>
上级
cee270cb
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
140 addition
and
140 deletion
+140
-140
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
+66
-66
zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md
...plication-dev/reference/apis/js-apis-inputmethodengine.md
+74
-74
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
浏览文件 @
95c2e18f
...
@@ -31,13 +31,13 @@ import inputMethod from '@ohos.inputMethod';
...
@@ -31,13 +31,13 @@ import inputMethod from '@ohos.inputMethod';
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| name
<sup>
9+
</sup>
| string | 是 | 否 |
输入法内部名称。必填
。|
| name
<sup>
9+
</sup>
| string | 是 | 否 |
必填。输入法内部名称
。|
| id
<sup>
9+
</sup>
| string | 是 | 否 |
输入法唯一标识。必填
。|
| id
<sup>
9+
</sup>
| string | 是 | 否 |
必填。输入法唯一标识
。|
| label
<sup>
9+
</sup>
| string | 是 | 否 |
输入法对外显示名称。 非必填
。|
| label
<sup>
9+
</sup>
| string | 是 | 否 |
非必填。输入法对外显示名称
。|
| labelId
<sup>
10+
</sup>
| string | 是 | 否 |
输入法对外显示名称资源号。 非必填
。|
| labelId
<sup>
10+
</sup>
| string | 是 | 否 |
非必填。输入法对外显示名称资源号
。|
| icon
<sup>
9+
</sup>
| string | 是 | 否 |
输入法图标数据。非必填。
|
| icon
<sup>
9+
</sup>
| string | 是 | 否 |
非必填。输入法图标数据。
|
| iconId
<sup>
9+
</sup>
| number | 是 | 否 |
输入法图标资源号。非必填
。 |
| iconId
<sup>
9+
</sup>
| number | 是 | 否 |
非必填。输入法图标资源号
。 |
| extra
<sup>
10+
</sup>
| object | 是 | 是 |
输入法扩展信息。 非必填
。|
| extra
<sup>
10+
</sup>
| object | 是 | 是 |
非必填。输入法扩展信息
。|
| packageName
<sup>
(deprecated)
</sup>
| string | 是 | 否 | 输入法包名。必填。
<br/>
**说明:**
从API version 8开始支持,从API version 9开始废弃,建议使用name替代。 |
| packageName
<sup>
(deprecated)
</sup>
| string | 是 | 否 | 输入法包名。必填。
<br/>
**说明:**
从API version 8开始支持,从API version 9开始废弃,建议使用name替代。 |
| methodId
<sup>
(deprecated)
</sup>
| string | 是 | 否 | 输入法唯一标识。必填。
<br/>
**说明:**
从API version 8开始支持,从API version 9开始废弃,建议使用id替代。 |
| methodId
<sup>
(deprecated)
</sup>
| string | 是 | 否 | 输入法唯一标识。必填。
<br/>
**说明:**
从API version 8开始支持,从API version 9开始废弃,建议使用id替代。 |
...
@@ -126,15 +126,15 @@ switchInputMethod(target: InputMethodProperty, callback: AsyncCallback<boolea
...
@@ -126,15 +126,15 @@ switchInputMethod(target: InputMethodProperty, callback: AsyncCallback<boolea
**示例:**
**示例:**
```
js
```
js
let
prop
=
inputMethod
.
getCurrentInputMethod
();
let
currentIme
=
inputMethod
.
getCurrentInputMethod
();
try
{
try
{
inputMethod
.
switchInputMethod
(
prop
,
(
err
,
result
)
=>
{
inputMethod
.
switchInputMethod
(
currentIme
,
(
err
,
result
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
error
(
`Failed to switchInputMethod:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to switchInputMethod:
${
JSON
.
stringify
(
err
)}
`
);
return
;
return
;
}
}
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Succeeded in switching inputmethod.
'
);
console
.
log
(
'
Succeeded in switching inputmethod.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to switchInputMethod.
'
);
console
.
error
(
'
Failed to switchInputMethod.
'
);
}
}
...
@@ -176,11 +176,11 @@ switchInputMethod(target: InputMethodProperty): Promise<boolean>
...
@@ -176,11 +176,11 @@ switchInputMethod(target: InputMethodProperty): Promise<boolean>
**示例:**
**示例:**
```
js
```
js
let
prop
=
inputMethod
.
getCurrentInputMethod
();
let
currentIme
=
inputMethod
.
getCurrentInputMethod
();
try
{
try
{
inputMethod
.
switchInputMethod
(
prop
).
then
((
result
)
=>
{
inputMethod
.
switchInputMethod
(
currentIme
).
then
((
result
)
=>
{
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Succeeded in switching inputmethod.
'
);
console
.
log
(
'
Succeeded in switching inputmethod.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to switchInputMethod.
'
);
console
.
error
(
'
Failed to switchInputMethod.
'
);
}
}
...
@@ -258,7 +258,7 @@ try {
...
@@ -258,7 +258,7 @@ try {
return
;
return
;
}
}
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Succeeded in switching currentInputMethodSubtype.
'
);
console
.
log
(
'
Succeeded in switching currentInputMethodSubtype.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to switchCurrentInputMethodSubtype
'
);
console
.
error
(
'
Failed to switchCurrentInputMethodSubtype
'
);
}
}
...
@@ -315,7 +315,7 @@ try {
...
@@ -315,7 +315,7 @@ try {
extra
:
{}
extra
:
{}
}).
then
((
result
)
=>
{
}).
then
((
result
)
=>
{
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Succeeded in switching currentInputMethodSubtype.
'
);
console
.
log
(
'
Succeeded in switching currentInputMethodSubtype.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to switchCurrentInputMethodSubtype.
'
);
console
.
error
(
'
Failed to switchCurrentInputMethodSubtype.
'
);
}
}
...
@@ -377,16 +377,16 @@ switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inp
...
@@ -377,16 +377,16 @@ switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inp
**示例:**
**示例:**
```
js
```
js
let
im
=
inputMethod
.
getCurrentInputMethod
();
let
currentIme
=
inputMethod
.
getCurrentInputMethod
();
let
imSubType
=
inputMethod
.
getCurrentInputMethodSubtype
();
let
imSubType
=
inputMethod
.
getCurrentInputMethodSubtype
();
try
{
try
{
inputMethod
.
switchCurrentInputMethodAndSubtype
(
im
,
imSubType
,
(
err
,
result
)
=>
{
inputMethod
.
switchCurrentInputMethodAndSubtype
(
currentIme
,
imSubType
,
(
err
,
result
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
error
(
`Failed to switchCurrentInputMethodAndSubtype:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to switchCurrentInputMethodAndSubtype:
${
JSON
.
stringify
(
err
)}
`
);
return
;
return
;
}
}
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Succeeded in switching currentInputMethodAndSubtype.
'
);
console
.
log
(
'
Succeeded in switching currentInputMethodAndSubtype.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to switchCurrentInputMethodAndSubtype.
'
);
console
.
error
(
'
Failed to switchCurrentInputMethodAndSubtype.
'
);
}
}
...
@@ -431,12 +431,12 @@ switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inp
...
@@ -431,12 +431,12 @@ switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inp
**示例:**
**示例:**
```
js
```
js
let
im
=
inputMethod
.
getCurrentInputMethod
();
let
currentIme
=
inputMethod
.
getCurrentInputMethod
();
let
imSubType
=
inputMethod
.
getCurrentInputMethodSubtype
();
let
imSubType
=
inputMethod
.
getCurrentInputMethodSubtype
();
try
{
try
{
inputMethod
.
switchCurrentInputMethodAndSubtype
(
im
,
imSubType
).
then
((
result
)
=>
{
inputMethod
.
switchCurrentInputMethodAndSubtype
(
currentIme
,
imSubType
).
then
((
result
)
=>
{
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Succeeded in switching currentInputMethodAndSubtype.
'
);
console
.
log
(
'
Succeeded in switching currentInputMethodAndSubtype.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to switchCurrentInputMethodAndSubtype.
'
);
console
.
error
(
'
Failed to switchCurrentInputMethodAndSubtype.
'
);
}
}
...
@@ -500,7 +500,7 @@ let inputMethodSetting = inputMethod.getInputMethodSetting();
...
@@ -500,7 +500,7 @@ let inputMethodSetting = inputMethod.getInputMethodSetting();
文本输入类型。
文本输入类型。
**系统能力
**
:
SystemCapability.MiscServices.InputMethodFramework
**系统能力
:**
SystemCapability.MiscServices.InputMethodFramework
| 名称 | 值 |说明 |
| 名称 | 值 |说明 |
| -------- | -------- |-------- |
| -------- | -------- |-------- |
...
@@ -518,7 +518,7 @@ let inputMethodSetting = inputMethod.getInputMethodSetting();
...
@@ -518,7 +518,7 @@ let inputMethodSetting = inputMethod.getInputMethodSetting();
输入法Enter键所代表的功能类型。
输入法Enter键所代表的功能类型。
**系统能力
**
:
SystemCapability.MiscServices.InputMethodFramework
**系统能力
:**
SystemCapability.MiscServices.InputMethodFramework
| 名称 | 值 |说明 |
| 名称 | 值 |说明 |
| -------- | -------- |-------- |
| -------- | -------- |-------- |
...
@@ -535,7 +535,7 @@ let inputMethodSetting = inputMethod.getInputMethodSetting();
...
@@ -535,7 +535,7 @@ let inputMethodSetting = inputMethod.getInputMethodSetting();
输入法软键盘状态。
输入法软键盘状态。
**系统能力
**
:
SystemCapability.MiscServices.InputMethodFramework
**系统能力
:**
SystemCapability.MiscServices.InputMethodFramework
| 名称 | 值 |说明 |
| 名称 | 值 |说明 |
| -------- | -------- |-------- |
| -------- | -------- |-------- |
...
@@ -547,7 +547,7 @@ let inputMethodSetting = inputMethod.getInputMethodSetting();
...
@@ -547,7 +547,7 @@ let inputMethodSetting = inputMethod.getInputMethodSetting();
光标移动方向。
光标移动方向。
**系统能力
**
:
SystemCapability.MiscServices.InputMethodFramework
**系统能力
:**
SystemCapability.MiscServices.InputMethodFramework
| 名称 | 值 |说明 |
| 名称 | 值 |说明 |
| -------- | -------- |-------- |
| -------- | -------- |-------- |
...
@@ -560,7 +560,7 @@ let inputMethodSetting = inputMethod.getInputMethodSetting();
...
@@ -560,7 +560,7 @@ let inputMethodSetting = inputMethod.getInputMethodSetting();
对编辑框中文本的扩展编辑操作类型。
对编辑框中文本的扩展编辑操作类型。
**系统能力
**
:
SystemCapability.MiscServices.InputMethodFramework
**系统能力
:**
SystemCapability.MiscServices.InputMethodFramework
| 名称 | 值 |说明 |
| 名称 | 值 |说明 |
| -------- | -------- |-------- |
| -------- | -------- |-------- |
...
@@ -680,7 +680,7 @@ try {
...
@@ -680,7 +680,7 @@ try {
console
.
error
(
`Failed to attach:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to attach:
${
JSON
.
stringify
(
err
)}
`
);
return
;
return
;
}
}
console
.
info
(
'
Succeeded in attaching the inputMethod.
'
);
console
.
log
(
'
Succeeded in attaching the inputMethod.
'
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
`Failed to attach:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to attach:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -730,7 +730,7 @@ try {
...
@@ -730,7 +730,7 @@ try {
}
}
};
};
inputMethodController
.
attach
(
true
,
textConfig
).
then
(()
=>
{
inputMethodController
.
attach
(
true
,
textConfig
).
then
(()
=>
{
console
.
info
(
'
Succeeded in attaching inputMethod.
'
);
console
.
log
(
'
Succeeded in attaching inputMethod.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to attach:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to attach:
${
JSON
.
stringify
(
err
)}
`
);
})
})
...
@@ -773,7 +773,7 @@ inputMethodController.showTextInput((err) => {
...
@@ -773,7 +773,7 @@ inputMethodController.showTextInput((err) => {
console
.
error
(
`Failed to showTextInput:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to showTextInput:
${
JSON
.
stringify
(
err
)}
`
);
return
;
return
;
}
}
console
.
info
(
'
Succeeded in showing the inputMethod.
'
);
console
.
log
(
'
Succeeded in showing the inputMethod.
'
);
});
});
```
```
...
@@ -807,7 +807,7 @@ showTextInput(): Promise<void>
...
@@ -807,7 +807,7 @@ showTextInput(): Promise<void>
```
js
```
js
inputMethodController
.
showTextInput
().
then
(()
=>
{
inputMethodController
.
showTextInput
().
then
(()
=>
{
console
.
info
(
'
Succeeded in showing text input.
'
);
console
.
log
(
'
Succeeded in showing text input.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to showTextInput:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to showTextInput:
${
JSON
.
stringify
(
err
)}
`
);
});
});
...
@@ -849,7 +849,7 @@ inputMethodController.hideTextInput((err) => {
...
@@ -849,7 +849,7 @@ inputMethodController.hideTextInput((err) => {
console
.
error
(
`Failed to hideTextInput:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to hideTextInput:
${
JSON
.
stringify
(
err
)}
`
);
return
;
return
;
}
}
console
.
info
(
'
Succeeded in hiding text input.
'
);
console
.
log
(
'
Succeeded in hiding text input.
'
);
});
});
```
```
...
@@ -885,7 +885,7 @@ hideTextInput(): Promise<void>
...
@@ -885,7 +885,7 @@ hideTextInput(): Promise<void>
```
js
```
js
inputMethodController
.
hideTextInput
().
then
(()
=>
{
inputMethodController
.
hideTextInput
().
then
(()
=>
{
console
.
info
(
'
Succeeded in hiding inputMethod.
'
);
console
.
log
(
'
Succeeded in hiding inputMethod.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to hideTextInput:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to hideTextInput:
${
JSON
.
stringify
(
err
)}
`
);
})
})
...
@@ -922,7 +922,7 @@ inputMethodController.detach((err) => {
...
@@ -922,7 +922,7 @@ inputMethodController.detach((err) => {
console
.
error
(
`Failed to detach:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to detach:
${
JSON
.
stringify
(
err
)}
`
);
return
;
return
;
}
}
console
.
info
(
'
Succeeded in detaching inputMethod.
'
);
console
.
log
(
'
Succeeded in detaching inputMethod.
'
);
});
});
```
```
...
@@ -953,7 +953,7 @@ detach(): Promise<void>
...
@@ -953,7 +953,7 @@ detach(): Promise<void>
```
js
```
js
inputMethodController
.
detach
().
then
(()
=>
{
inputMethodController
.
detach
().
then
(()
=>
{
console
.
info
(
'
Succeeded in detaching inputMethod.
'
);
console
.
log
(
'
Succeeded in detaching inputMethod.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to detach:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to detach:
${
JSON
.
stringify
(
err
)}
`
);
});
});
...
@@ -996,7 +996,7 @@ try {
...
@@ -996,7 +996,7 @@ try {
console
.
error
(
`Failed to setCallingWindow:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to setCallingWindow:
${
JSON
.
stringify
(
err
)}
`
);
return
;
return
;
}
}
console
.
info
(
'
Succeeded in setting callingWindow.
'
);
console
.
log
(
'
Succeeded in setting callingWindow.
'
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
`Failed to setCallingWindow:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to setCallingWindow:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -1041,7 +1041,7 @@ setCallingWindow(windowId: number): Promise<void>
...
@@ -1041,7 +1041,7 @@ setCallingWindow(windowId: number): Promise<void>
try
{
try
{
let
windowId
:
number
=
2000
;
let
windowId
:
number
=
2000
;
inputMethodController
.
setCallingWindow
(
windowId
).
then
(()
=>
{
inputMethodController
.
setCallingWindow
(
windowId
).
then
(()
=>
{
console
.
info
(
'
Succeeded in setting callingWindow.
'
);
console
.
log
(
'
Succeeded in setting callingWindow.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to setCallingWindow:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to setCallingWindow:
${
JSON
.
stringify
(
err
)}
`
);
})
})
...
@@ -1086,7 +1086,7 @@ try {
...
@@ -1086,7 +1086,7 @@ try {
console
.
error
(
`Failed to updateCursor:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to updateCursor:
${
JSON
.
stringify
(
err
)}
`
);
return
;
return
;
}
}
console
.
info
(
'
Succeeded in updating cursorInfo.
'
);
console
.
log
(
'
Succeeded in updating cursorInfo.
'
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
`Failed to updateCursor:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to updateCursor:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -1130,7 +1130,7 @@ updateCursor(cursorInfo: CursorInfo): Promise<void>
...
@@ -1130,7 +1130,7 @@ updateCursor(cursorInfo: CursorInfo): Promise<void>
```
js
```
js
try
{
try
{
inputMethodController
.
updateCursor
({
left
:
0
,
top
:
0
,
width
:
600
,
height
:
800
}).
then
(()
=>
{
inputMethodController
.
updateCursor
({
left
:
0
,
top
:
0
,
width
:
600
,
height
:
800
}).
then
(()
=>
{
console
.
info
(
'
Succeeded in updating cursorInfo.
'
);
console
.
log
(
'
Succeeded in updating cursorInfo.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to updateCursor:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to updateCursor:
${
JSON
.
stringify
(
err
)}
`
);
})
})
...
@@ -1175,7 +1175,7 @@ try {
...
@@ -1175,7 +1175,7 @@ try {
console
.
error
(
`Failed to changeSelection:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to changeSelection:
${
JSON
.
stringify
(
err
)}
`
);
return
;
return
;
}
}
console
.
info
(
'
Succeeded in changing selection.
'
);
console
.
log
(
'
Succeeded in changing selection.
'
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
`Failed to changeSelection:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to changeSelection:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -1219,7 +1219,7 @@ changeSelection(text: string, start: number, end: number): Promise<void>
...
@@ -1219,7 +1219,7 @@ changeSelection(text: string, start: number, end: number): Promise<void>
```
js
```
js
try
{
try
{
inputMethodController
.
changeSelection
(
'
test
'
,
0
,
5
).
then
(()
=>
{
inputMethodController
.
changeSelection
(
'
test
'
,
0
,
5
).
then
(()
=>
{
console
.
info
(
'
Succeeded in changing selection.
'
);
console
.
log
(
'
Succeeded in changing selection.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to changeSelection:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to changeSelection:
${
JSON
.
stringify
(
err
)}
`
);
})
})
...
@@ -1262,7 +1262,7 @@ try {
...
@@ -1262,7 +1262,7 @@ try {
console
.
error
(
`Failed to updateAttribute:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to updateAttribute:
${
JSON
.
stringify
(
err
)}
`
);
return
;
return
;
}
}
console
.
info
(
'
Succeeded in updating attribute.
'
);
console
.
log
(
'
Succeeded in updating attribute.
'
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
`Failed to updateAttribute:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to updateAttribute:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -1304,7 +1304,7 @@ updateAttribute(attribute: InputAttribute): Promise<void>
...
@@ -1304,7 +1304,7 @@ updateAttribute(attribute: InputAttribute): Promise<void>
```
js
```
js
try
{
try
{
inputMethodController
.
updateAttribute
({
textInputType
:
0
,
enterKeyType
:
1
}).
then
(()
=>
{
inputMethodController
.
updateAttribute
({
textInputType
:
0
,
enterKeyType
:
1
}).
then
(()
=>
{
console
.
info
(
'
Succeeded in updating attribute.
'
);
console
.
log
(
'
Succeeded in updating attribute.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to updateAttribute:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to updateAttribute:
${
JSON
.
stringify
(
err
)}
`
);
})
})
...
@@ -1348,7 +1348,7 @@ try {
...
@@ -1348,7 +1348,7 @@ try {
return
;
return
;
}
}
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Succeeded in stopping inputSession.
'
);
console
.
log
(
'
Succeeded in stopping inputSession.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to stopInputSession.
'
);
console
.
error
(
'
Failed to stopInputSession.
'
);
}
}
...
@@ -1389,7 +1389,7 @@ stopInputSession(): Promise<boolean>
...
@@ -1389,7 +1389,7 @@ stopInputSession(): Promise<boolean>
try
{
try
{
inputMethodController
.
stopInputSession
().
then
((
result
)
=>
{
inputMethodController
.
stopInputSession
().
then
((
result
)
=>
{
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Succeeded in stopping inputSession.
'
);
console
.
log
(
'
Succeeded in stopping inputSession.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to stopInputSession.
'
);
console
.
error
(
'
Failed to stopInputSession.
'
);
}
}
...
@@ -1433,7 +1433,7 @@ showSoftKeyboard(callback: AsyncCallback<void>): void
...
@@ -1433,7 +1433,7 @@ showSoftKeyboard(callback: AsyncCallback<void>): void
```
js
```
js
inputMethodController
.
showSoftKeyboard
((
err
)
=>
{
inputMethodController
.
showSoftKeyboard
((
err
)
=>
{
if
(
!
err
)
{
if
(
!
err
)
{
console
.
info
(
'
Succeeded in showing softKeyboard.
'
);
console
.
log
(
'
Succeeded in showing softKeyboard.
'
);
}
else
{
}
else
{
console
.
error
(
`Failed to show softKeyboard:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to show softKeyboard:
${
JSON
.
stringify
(
err
)}
`
);
}
}
...
@@ -1509,7 +1509,7 @@ hideSoftKeyboard(callback: AsyncCallback<void>): void
...
@@ -1509,7 +1509,7 @@ hideSoftKeyboard(callback: AsyncCallback<void>): void
```
js
```
js
inputMethodController
.
hideSoftKeyboard
((
err
)
=>
{
inputMethodController
.
hideSoftKeyboard
((
err
)
=>
{
if
(
!
err
)
{
if
(
!
err
)
{
console
.
info
(
'
Succeeded in hiding softKeyboard.
'
);
console
.
log
(
'
Succeeded in hiding softKeyboard.
'
);
}
else
{
}
else
{
console
.
error
(
`Failed to hide softKeyboard:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to hide softKeyboard:
${
JSON
.
stringify
(
err
)}
`
);
}
}
...
@@ -1582,7 +1582,7 @@ inputMethodController.stopInput((err, result) => {
...
@@ -1582,7 +1582,7 @@ inputMethodController.stopInput((err, result) => {
return
;
return
;
}
}
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Succeeded in stopping input.
'
);
console
.
log
(
'
Succeeded in stopping input.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to stopInput.
'
);
console
.
error
(
'
Failed to stopInput.
'
);
}
}
...
@@ -1614,7 +1614,7 @@ stopInput(): Promise<boolean>
...
@@ -1614,7 +1614,7 @@ stopInput(): Promise<boolean>
```
js
```
js
inputMethodController
.
stopInput
().
then
((
result
)
=>
{
inputMethodController
.
stopInput
().
then
((
result
)
=>
{
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Succeeded in stopping input.
'
);
console
.
log
(
'
Succeeded in stopping input.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to stopInput.
'
);
console
.
error
(
'
Failed to stopInput.
'
);
}
}
...
@@ -1651,7 +1651,7 @@ on(type: 'insertText', callback: (text: string) => void): void;
...
@@ -1651,7 +1651,7 @@ on(type: 'insertText', callback: (text: string) => void): void;
```
js
```
js
try
{
try
{
inputMethodController
.
on
(
'
insertText
'
,
(
text
)
=>
{
inputMethodController
.
on
(
'
insertText
'
,
(
text
)
=>
{
console
.
info
(
`Succeeded in subscribing insertText:
${
text
}
`
);
console
.
log
(
`Succeeded in subscribing insertText:
${
text
}
`
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
`Failed to subscribe insertText:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to subscribe insertText:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -1706,7 +1706,7 @@ on(type: 'deleteLeft' | 'deleteRight', callback: (length: number) => void): void
...
@@ -1706,7 +1706,7 @@ on(type: 'deleteLeft' | 'deleteRight', callback: (length: number) => void): void
```
js
```
js
try
{
try
{
inputMethodController
.
on
(
'
deleteLeft
'
,
(
length
)
=>
{
inputMethodController
.
on
(
'
deleteLeft
'
,
(
length
)
=>
{
console
.
info
(
`Succeeded in subscribing deleteLeft, length:
${
length
}
`
);
console
.
log
(
`Succeeded in subscribing deleteLeft, length:
${
length
}
`
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
`Failed to subscribe deleteLeft:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to subscribe deleteLeft:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -1714,7 +1714,7 @@ try {
...
@@ -1714,7 +1714,7 @@ try {
try
{
try
{
inputMethodController
.
on
(
'
deleteRight
'
,
(
length
)
=>
{
inputMethodController
.
on
(
'
deleteRight
'
,
(
length
)
=>
{
console
.
info
(
`Succeeded in subscribing deleteRight, length:
${
length
}
`
);
console
.
log
(
`Succeeded in subscribing deleteRight, length:
${
length
}
`
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
`Failed to subscribe deleteRight:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to subscribe deleteRight:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -1770,7 +1770,7 @@ on(type: 'sendKeyboardStatus', callback: (keyBoardStatus: KeyboardStatus) => voi
...
@@ -1770,7 +1770,7 @@ on(type: 'sendKeyboardStatus', callback: (keyBoardStatus: KeyboardStatus) => voi
```
js
```
js
try
{
try
{
inputMethodController
.
on
(
'
sendKeyboardStatus
'
,
(
keyBoardStatus
)
=>
{
inputMethodController
.
on
(
'
sendKeyboardStatus
'
,
(
keyBoardStatus
)
=>
{
console
.
info
(
`Succeeded in subscribing sendKeyboardStatus, keyBoardStatus:
${
keyBoardStatus
}
`
);
console
.
log
(
`Succeeded in subscribing sendKeyboardStatus, keyBoardStatus:
${
keyBoardStatus
}
`
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
`Failed to subscribe sendKeyboardStatus:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to subscribe sendKeyboardStatus:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -1825,7 +1825,7 @@ on(type: 'sendFunctionKey', callback: (functionKey: FunctionKey) => void): void
...
@@ -1825,7 +1825,7 @@ on(type: 'sendFunctionKey', callback: (functionKey: FunctionKey) => void): void
```
js
```
js
try
{
try
{
inputMethodController
.
on
(
'
sendFunctionKey
'
,
(
functionKey
)
=>
{
inputMethodController
.
on
(
'
sendFunctionKey
'
,
(
functionKey
)
=>
{
console
.
info
(
`Succeeded in subscribing sendFunctionKey, functionKey.enterKeyType:
${
functionKey
.
enterKeyType
}
`
);
console
.
log
(
`Succeeded in subscribing sendFunctionKey, functionKey.enterKeyType:
${
functionKey
.
enterKeyType
}
`
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
`Failed to subscribe sendFunctionKey:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to subscribe sendFunctionKey:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -1880,7 +1880,7 @@ on(type: 'moveCursor', callback: (direction: Direction) => void): void
...
@@ -1880,7 +1880,7 @@ on(type: 'moveCursor', callback: (direction: Direction) => void): void
```
js
```
js
try
{
try
{
inputMethodController
.
on
(
'
moveCursor
'
,
(
direction
)
=>
{
inputMethodController
.
on
(
'
moveCursor
'
,
(
direction
)
=>
{
console
.
info
(
`Succeeded in subscribing moveCursor, direction:
${
direction
}
`
);
console
.
log
(
`Succeeded in subscribing moveCursor, direction:
${
direction
}
`
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
`Failed to subscribe moveCursor:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to subscribe moveCursor:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -1935,7 +1935,7 @@ on(type: 'handleExtendAction', callback: (action: ExtendAction) => void): void
...
@@ -1935,7 +1935,7 @@ on(type: 'handleExtendAction', callback: (action: ExtendAction) => void): void
```
js
```
js
try
{
try
{
inputMethodController
.
on
(
'
handleExtendAction
'
,
(
action
)
=>
{
inputMethodController
.
on
(
'
handleExtendAction
'
,
(
action
)
=>
{
console
.
info
(
`Succeeded in subscribing handleExtendAction, action:
${
action
}
`
);
console
.
log
(
`Succeeded in subscribing handleExtendAction, action:
${
action
}
`
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
`Failed to subscribe handleExtendAction:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to subscribe handleExtendAction:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -1981,7 +1981,7 @@ on(type: 'selectByRange', callback: Callback<Range>): void
...
@@ -1981,7 +1981,7 @@ on(type: 'selectByRange', callback: Callback<Range>): void
```
js
```
js
inputMethodController
.
on
(
'
selectByRange
'
,
(
range
)
=>
{
inputMethodController
.
on
(
'
selectByRange
'
,
(
range
)
=>
{
console
.
info
(
'
Succeeded in subscribing selectByRange: start:
'
+
range
.
start
+
"
, end:
"
+
range
.
end
);
console
.
log
(
`Succeeded in subscribing selectByRange: start:
${
range
.
start
}
, end:
${
range
.
end
}
`
);
});
});
```
```
...
@@ -2024,7 +2024,7 @@ on(type: 'selectByMovement', callback: Callback<Movement>): void
...
@@ -2024,7 +2024,7 @@ on(type: 'selectByMovement', callback: Callback<Movement>): void
```
js
```
js
inputMethodController
.
on
(
'
selectByMovement
'
,
(
movement
)
=>
{
inputMethodController
.
on
(
'
selectByMovement
'
,
(
movement
)
=>
{
console
.
info
(
'
Succeeded in subscribing selectByMovement: direction:
'
+
movement
.
direction
);
console
.
log
(
'
Succeeded in subscribing selectByMovement: direction:
'
+
movement
.
direction
);
});
});
```
```
...
@@ -2071,7 +2071,7 @@ on(type: 'imeChange', callback: (inputMethodProperty: InputMethodProperty, input
...
@@ -2071,7 +2071,7 @@ on(type: 'imeChange', callback: (inputMethodProperty: InputMethodProperty, input
```
js
```
js
inputMethodSetting
.
on
(
'
imeChange
'
,
(
inputMethodProperty
,
inputMethodSubtype
)
=>
{
inputMethodSetting
.
on
(
'
imeChange
'
,
(
inputMethodProperty
,
inputMethodSubtype
)
=>
{
console
.
info
(
'
Succeeded in subscribing imeChange: inputMethodProperty:
'
+
JSON
.
stringify
(
inputMethodProperty
)
+
"
, inputMethodSubtype:
"
+
JSON
.
stringify
(
inputMethodSubtype
));
console
.
log
(
'
Succeeded in subscribing imeChange: inputMethodProperty:
'
+
JSON
.
stringify
(
inputMethodProperty
)
+
"
, inputMethodSubtype:
"
+
JSON
.
stringify
(
inputMethodSubtype
));
});
});
```
```
...
@@ -2178,7 +2178,7 @@ let inputMethodProperty = {
...
@@ -2178,7 +2178,7 @@ let inputMethodProperty = {
}
}
try
{
try
{
inputMethodSetting
.
listInputMethodSubtype
(
inputMethodProperty
).
then
((
data
)
=>
{
inputMethodSetting
.
listInputMethodSubtype
(
inputMethodProperty
).
then
((
data
)
=>
{
console
.
info
(
'
Succeeded in listing inputMethodSubtype.
'
);
console
.
log
(
'
Succeeded in listing inputMethodSubtype.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to listInputMethodSubtype:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to listInputMethodSubtype:
${
JSON
.
stringify
(
err
)}
`
);
})
})
...
@@ -2254,7 +2254,7 @@ listCurrentInputMethodSubtype(): Promise<Array<InputMethodSubtype>>
...
@@ -2254,7 +2254,7 @@ listCurrentInputMethodSubtype(): Promise<Array<InputMethodSubtype>>
```
js
```
js
try
{
try
{
inputMethodSetting
.
listCurrentInputMethodSubtype
().
then
((
data
)
=>
{
inputMethodSetting
.
listCurrentInputMethodSubtype
().
then
((
data
)
=>
{
console
.
info
(
'
Succeeded in listing currentInputMethodSubtype.
'
);
console
.
log
(
'
Succeeded in listing currentInputMethodSubtype.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to listCurrentInputMethodSubtype:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to listCurrentInputMethodSubtype:
${
JSON
.
stringify
(
err
)}
`
);
})
})
...
@@ -2337,7 +2337,7 @@ getInputMethods(enable: boolean): Promise<Array<InputMethodProperty>>
...
@@ -2337,7 +2337,7 @@ getInputMethods(enable: boolean): Promise<Array<InputMethodProperty>>
```
js
```
js
try
{
try
{
inputMethodSetting
.
getInputMethods
(
true
).
then
((
data
)
=>
{
inputMethodSetting
.
getInputMethods
(
true
).
then
((
data
)
=>
{
console
.
info
(
'
Succeeded in getting inputMethods.
'
);
console
.
log
(
'
Succeeded in getting inputMethods.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to getInputMethods:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to getInputMethods:
${
JSON
.
stringify
(
err
)}
`
);
})
})
...
@@ -2377,7 +2377,7 @@ try {
...
@@ -2377,7 +2377,7 @@ try {
console
.
error
(
`Failed to showOptionalInputMethods:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to showOptionalInputMethods:
${
JSON
.
stringify
(
err
)}
`
);
return
;
return
;
}
}
console
.
info
(
'
Succeeded in showing optionalInputMethods.
'
);
console
.
log
(
'
Succeeded in showing optionalInputMethods.
'
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
`Failed to showOptionalInputMethods:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to showOptionalInputMethods:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -2410,7 +2410,7 @@ showOptionalInputMethods(): Promise<boolean>
...
@@ -2410,7 +2410,7 @@ showOptionalInputMethods(): Promise<boolean>
```
js
```
js
inputMethodSetting
.
showOptionalInputMethods
().
then
((
data
)
=>
{
inputMethodSetting
.
showOptionalInputMethods
().
then
((
data
)
=>
{
console
.
info
(
'
Succeeded in showing optionalInputMethods.
'
);
console
.
log
(
'
Succeeded in showing optionalInputMethods.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to showOptionalInputMethods:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to showOptionalInputMethods:
${
JSON
.
stringify
(
err
)}
`
);
})
})
...
@@ -2468,7 +2468,7 @@ listInputMethod(): Promise<Array<InputMethodProperty>>
...
@@ -2468,7 +2468,7 @@ listInputMethod(): Promise<Array<InputMethodProperty>>
```
js
```
js
inputMethodSetting
.
listInputMethod
().
then
((
data
)
=>
{
inputMethodSetting
.
listInputMethod
().
then
((
data
)
=>
{
console
.
info
(
'
Succeeded in listing inputMethod.
'
);
console
.
log
(
'
Succeeded in listing inputMethod.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to listInputMethod:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to listInputMethod:
${
JSON
.
stringify
(
err
)}
`
);
})
})
...
@@ -2500,7 +2500,7 @@ inputMethodSetting.displayOptionalInputMethod((err) => {
...
@@ -2500,7 +2500,7 @@ inputMethodSetting.displayOptionalInputMethod((err) => {
console
.
error
(
`Failed to displayOptionalInputMethod:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to displayOptionalInputMethod:
${
JSON
.
stringify
(
err
)}
`
);
return
;
return
;
}
}
console
.
info
(
'
Succeeded in displaying optionalInputMethod.
'
);
console
.
log
(
'
Succeeded in displaying optionalInputMethod.
'
);
});
});
```
```
...
@@ -2526,7 +2526,7 @@ displayOptionalInputMethod(): Promise<void>
...
@@ -2526,7 +2526,7 @@ displayOptionalInputMethod(): Promise<void>
```
js
```
js
inputMethodSetting
.
displayOptionalInputMethod
().
then
(()
=>
{
inputMethodSetting
.
displayOptionalInputMethod
().
then
(()
=>
{
console
.
info
(
'
Succeeded in displaying optionalInputMethod.
'
);
console
.
log
(
'
Succeeded in displaying optionalInputMethod.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to displayOptionalInputMethod:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to displayOptionalInputMethod:
${
JSON
.
stringify
(
err
)}
`
);
})
})
...
...
zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md
浏览文件 @
95c2e18f
...
@@ -508,8 +508,8 @@ createPanel(ctx: BaseContext, info: PanelInfo, callback: AsyncCallback\<Panel>):
...
@@ -508,8 +508,8 @@ createPanel(ctx: BaseContext, info: PanelInfo, callback: AsyncCallback\<Panel>):
```
js
```
js
let
panelInfo
:
inputMethodEngine
.
PanelInfo
=
{
let
panelInfo
:
inputMethodEngine
.
PanelInfo
=
{
panelType
:
SOFT_KEYBOARD
,
panelType
:
inputMethodEngine
.
PanelType
.
SOFT_KEYBOARD
,
panelFlag
:
FLG_FIXED
panelFlag
:
inputMethodEngine
.
PanelFlag
.
FLG_FIXED
}
}
try
{
try
{
inputMethodEngine
.
getInputMethodAbility
().
createPanel
(
this
.
context
,
panelInfo
,
(
err
,
panel
)
=>
{
inputMethodEngine
.
getInputMethodAbility
().
createPanel
(
this
.
context
,
panelInfo
,
(
err
,
panel
)
=>
{
...
@@ -556,8 +556,8 @@ createPanel(ctx: BaseContext, info: PanelInfo): Promise\<Panel>
...
@@ -556,8 +556,8 @@ createPanel(ctx: BaseContext, info: PanelInfo): Promise\<Panel>
```
js
```
js
let
panelInfo
:
inputMethodEngine
.
PanelInfo
=
{
let
panelInfo
:
inputMethodEngine
.
PanelInfo
=
{
panelType
:
SOFT_KEYBOARD
,
panelType
:
inputMethodEngine
.
PanelType
.
SOFT_KEYBOARD
,
panelFlag
:
FLG_FIXED
panelFlag
:
inputMethodEngine
.
PanelFlag
.
FLG_FIXED
}
}
inputMethodEngine
.
getInputMethodAbility
().
createPanel
(
this
.
context
,
panelInfo
).
then
((
panel
)
=>
{
inputMethodEngine
.
getInputMethodAbility
().
createPanel
(
this
.
context
,
panelInfo
).
then
((
panel
)
=>
{
console
.
log
(
'
Succeed in creating panel.
'
);
console
.
log
(
'
Succeed in creating panel.
'
);
...
@@ -585,8 +585,8 @@ destroyPanel(panel: Panel, callback: AsyncCallback\<void>): void;
...
@@ -585,8 +585,8 @@ destroyPanel(panel: Panel, callback: AsyncCallback\<void>): void;
```
js
```
js
let
panelInfo
:
inputMethodEngine
.
PanelInfo
=
{
let
panelInfo
:
inputMethodEngine
.
PanelInfo
=
{
panelType
:
SOFT_KEYBOARD
,
panelType
:
inputMethodEngine
.
PanelType
.
SOFT_KEYBOARD
,
panelFlag
:
FLG_FIXED
panelFlag
:
inputMethodEngine
.
PanelFlag
.
FLG_FIXED
}
}
try
{
try
{
inputMethodEngine
.
getInputMethodAbility
().
createPanel
(
this
.
context
,
panelInfo
,
(
err
,
panel
)
=>
{
inputMethodEngine
.
getInputMethodAbility
().
createPanel
(
this
.
context
,
panelInfo
,
(
err
,
panel
)
=>
{
...
@@ -637,8 +637,8 @@ destroyPanel(panel: Panel): Promise\<void>;
...
@@ -637,8 +637,8 @@ destroyPanel(panel: Panel): Promise\<void>;
```
js
```
js
let
panelInfo
:
inputMethodEngine
.
PanelInfo
=
{
let
panelInfo
:
inputMethodEngine
.
PanelInfo
=
{
panelType
:
SOFT_KEYBOARD
,
panelType
:
inputMethodEngine
.
PanelType
.
SOFT_KEYBOARD
,
panelFlag
:
FLG_FIXED
panelFlag
:
inputMethodEngine
.
PanelFlag
.
FLG_FIXED
}
}
try
{
try
{
inputMethodEngine
.
getInputMethodAbility
().
createPanel
(
this
.
context
,
panelInfo
,
(
err
,
panel
)
=>
{
inputMethodEngine
.
getInputMethodAbility
().
createPanel
(
this
.
context
,
panelInfo
,
(
err
,
panel
)
=>
{
...
@@ -687,13 +687,13 @@ on(type: 'keyDown'|'keyUp', callback: (event: KeyEvent) => boolean): void
...
@@ -687,13 +687,13 @@ on(type: 'keyDown'|'keyUp', callback: (event: KeyEvent) => boolean): void
```
js
```
js
inputMethodEngine
.
getKeyboardDelegate
().
on
(
'
keyUp
'
,
(
keyEvent
)
=>
{
inputMethodEngine
.
getKeyboardDelegate
().
on
(
'
keyUp
'
,
(
keyEvent
)
=>
{
console
.
info
(
'
inputMethodEngine keyCode.(keyUp):
'
+
JSON
.
stringify
(
keyEvent
.
keyCode
));
console
.
log
(
'
inputMethodEngine keyCode.(keyUp):
'
+
JSON
.
stringify
(
keyEvent
.
keyCode
));
console
.
info
(
'
inputMethodEngine keyAction.(keyUp):
'
+
JSON
.
stringify
(
keyEvent
.
keyAction
));
console
.
log
(
'
inputMethodEngine keyAction.(keyUp):
'
+
JSON
.
stringify
(
keyEvent
.
keyAction
));
return
true
;
return
true
;
});
});
inputMethodEngine
.
getKeyboardDelegate
().
on
(
'
keyDown
'
,
(
keyEvent
)
=>
{
inputMethodEngine
.
getKeyboardDelegate
().
on
(
'
keyDown
'
,
(
keyEvent
)
=>
{
console
.
info
(
'
inputMethodEngine keyCode.(keyDown):
'
+
JSON
.
stringify
(
keyEvent
.
keyCode
));
console
.
log
(
'
inputMethodEngine keyCode.(keyDown):
'
+
JSON
.
stringify
(
keyEvent
.
keyCode
));
console
.
info
(
'
inputMethodEngine keyAction.(keyDown):
'
+
JSON
.
stringify
(
keyEvent
.
keyAction
));
console
.
log
(
'
inputMethodEngine keyAction.(keyDown):
'
+
JSON
.
stringify
(
keyEvent
.
keyAction
));
return
true
;
return
true
;
});
});
```
```
...
@@ -898,7 +898,7 @@ try {
...
@@ -898,7 +898,7 @@ try {
console
.
error
(
`Failed to setUiContent:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to setUiContent:
${
JSON
.
stringify
(
err
)}
`
);
return
;
return
;
}
}
console
.
info
(
'
Succeeded in setting the content.
'
);
console
.
log
(
'
Succeeded in setting the content.
'
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
`Failed to setUiContent:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to setUiContent:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -931,7 +931,7 @@ setUiContent(path: string): Promise\<void>
...
@@ -931,7 +931,7 @@ setUiContent(path: string): Promise\<void>
try
{
try
{
let
promise
=
panel
.
setUiContent
(
'
pages/page2/page2
'
);
let
promise
=
panel
.
setUiContent
(
'
pages/page2/page2
'
);
promise
.
then
(()
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in setting the content.
'
);
console
.
log
(
'
Succeeded in setting the content.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to setUiContent:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to setUiContent:
${
JSON
.
stringify
(
err
)}
`
);
});
});
...
@@ -967,7 +967,7 @@ try {
...
@@ -967,7 +967,7 @@ try {
console
.
error
(
`Failed to setUiContent:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to setUiContent:
${
JSON
.
stringify
(
err
)}
`
);
return
;
return
;
}
}
console
.
info
(
'
Succeeded in setting the content.
'
);
console
.
log
(
'
Succeeded in setting the content.
'
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
`Failed to setUiContent:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to setUiContent:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -1003,7 +1003,7 @@ storage.setOrCreate('storageSimpleProp',121);
...
@@ -1003,7 +1003,7 @@ storage.setOrCreate('storageSimpleProp',121);
try
{
try
{
let
promise
=
panel
.
setUiContent
(
'
pages/page2/page2
'
);
let
promise
=
panel
.
setUiContent
(
'
pages/page2/page2
'
);
promise
.
then
(()
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in setting the content.
'
);
console
.
log
(
'
Succeeded in setting the content.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to setUiContent:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to setUiContent:
${
JSON
.
stringify
(
err
)}
`
);
});
});
...
@@ -1039,7 +1039,7 @@ try {
...
@@ -1039,7 +1039,7 @@ try {
console
.
error
(
`Failed to resize panel:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to resize panel:
${
JSON
.
stringify
(
err
)}
`
);
return
;
return
;
}
}
console
.
info
(
'
Succeeded in changing the panel size.
'
);
console
.
log
(
'
Succeeded in changing the panel size.
'
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
`Failed to resize panel:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to resize panel:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -1075,7 +1075,7 @@ resize(width: number, height: number): Promise\<void>;
...
@@ -1075,7 +1075,7 @@ resize(width: number, height: number): Promise\<void>;
try
{
try
{
let
promise
=
panel
.
resize
(
500
,
1000
);
let
promise
=
panel
.
resize
(
500
,
1000
);
promise
.
then
(()
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in changing the panel size.
'
);
console
.
log
(
'
Succeeded in changing the panel size.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to resize panel:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to resize panel:
${
JSON
.
stringify
(
err
)}
`
);
});
});
...
@@ -1111,7 +1111,7 @@ try {
...
@@ -1111,7 +1111,7 @@ try {
console
.
error
(
`Failed to move panel:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to move panel:
${
JSON
.
stringify
(
err
)}
`
);
return
;
return
;
}
}
console
.
info
(
'
Succeeded in moving the panel.
'
);
console
.
log
(
'
Succeeded in moving the panel.
'
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
`Failed to move panel:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to move panel:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -1147,7 +1147,7 @@ moveTo(x: number, y: number): Promise\<void>
...
@@ -1147,7 +1147,7 @@ moveTo(x: number, y: number): Promise\<void>
try
{
try
{
let
promise
=
windowClass
.
moveTo
(
300
,
300
);
let
promise
=
windowClass
.
moveTo
(
300
,
300
);
promise
.
then
(()
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in moving the panel.
'
);
console
.
log
(
'
Succeeded in moving the panel.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to move panel:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to move panel:
${
JSON
.
stringify
(
err
)}
`
);
});
});
...
@@ -1178,7 +1178,7 @@ panel.show((err) => {
...
@@ -1178,7 +1178,7 @@ panel.show((err) => {
console
.
error
(
`Failed to show panel:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to show panel:
${
JSON
.
stringify
(
err
)}
`
);
return
;
return
;
}
}
console
.
info
(
'
Succeeded in showing the panel.
'
);
console
.
log
(
'
Succeeded in showing the panel.
'
);
});
});
```
```
...
@@ -1201,7 +1201,7 @@ show(): Promise\<void>
...
@@ -1201,7 +1201,7 @@ show(): Promise\<void>
```
js
```
js
let
promise
=
panel
.
show
();
let
promise
=
panel
.
show
();
promise
.
then
(()
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in showing the panel.
'
);
console
.
log
(
'
Succeeded in showing the panel.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to show panel:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to show panel:
${
JSON
.
stringify
(
err
)}
`
);
});
});
...
@@ -1229,7 +1229,7 @@ panel.hide((err) => {
...
@@ -1229,7 +1229,7 @@ panel.hide((err) => {
console
.
error
(
`Failed to hide panel:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to hide panel:
${
JSON
.
stringify
(
err
)}
`
);
return
;
return
;
}
}
console
.
info
(
'
Succeeded in hiding the panel.
'
);
console
.
log
(
'
Succeeded in hiding the panel.
'
);
});
});
```
```
...
@@ -1252,7 +1252,7 @@ hide(): Promise\<void>
...
@@ -1252,7 +1252,7 @@ hide(): Promise\<void>
```
js
```
js
let
promise
=
panel
.
hide
();
let
promise
=
panel
.
hide
();
promise
.
then
(()
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in hiding the panel.
'
);
console
.
log
(
'
Succeeded in hiding the panel.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to hide panel:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to hide panel:
${
JSON
.
stringify
(
err
)}
`
);
});
});
...
@@ -1277,7 +1277,7 @@ on(type: 'show' | 'hide', callback: () => void): void
...
@@ -1277,7 +1277,7 @@ on(type: 'show' | 'hide', callback: () => void): void
```
js
```
js
panel
.
on
(
'
show
'
,
()
=>
{
panel
.
on
(
'
show
'
,
()
=>
{
console
.
info
(
'
Panel is showing.
'
);
console
.
log
(
'
Panel is showing.
'
);
});
});
```
```
...
@@ -1387,9 +1387,9 @@ hide(): Promise<void>
...
@@ -1387,9 +1387,9 @@ hide(): Promise<void>
```
js
```
js
keyboardController
.
hide
().
then
(()
=>
{
keyboardController
.
hide
().
then
(()
=>
{
console
.
info
(
'
Succeeded in hiding keyboard.
'
);
console
.
log
(
'
Succeeded in hiding keyboard.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
`Failed to hide:
${
JSON
.
stringify
(
err
)}
`
);
console
.
log
(
`Failed to hide:
${
JSON
.
stringify
(
err
)}
`
);
});
});
```
```
...
@@ -1445,9 +1445,9 @@ hideKeyboard(): Promise<void>
...
@@ -1445,9 +1445,9 @@ hideKeyboard(): Promise<void>
```
js
```
js
keyboardController
.
hideKeyboard
().
then
(()
=>
{
keyboardController
.
hideKeyboard
().
then
(()
=>
{
console
.
info
(
'
Succeeded in hiding keyboard.
'
);
console
.
log
(
'
Succeeded in hiding keyboard.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
`Failed to hideKeyboard:
${
JSON
.
stringify
(
err
)}
`
);
console
.
log
(
`Failed to hideKeyboard:
${
JSON
.
stringify
(
err
)}
`
);
});
});
```
```
...
@@ -1536,9 +1536,9 @@ try {
...
@@ -1536,9 +1536,9 @@ try {
return
;
return
;
}
}
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Succeeded in sending key function.
'
);
console
.
log
(
'
Succeeded in sending key function.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to sendKeyFunction.
'
);
console
.
error
(
'
Failed to sendKeyFunction.
'
);
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
...
@@ -1581,9 +1581,9 @@ let action = 1;
...
@@ -1581,9 +1581,9 @@ let action = 1;
try
{
try
{
inputClient
.
sendKeyFunction
(
action
).
then
((
result
)
=>
{
inputClient
.
sendKeyFunction
(
action
).
then
((
result
)
=>
{
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Succeeded in sending key function.
'
);
console
.
log
(
'
Succeeded in sending key function.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to sendKeyFunction.
'
);
console
.
error
(
'
Failed to sendKeyFunction.
'
);
}
}
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to sendKeyFunction:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to sendKeyFunction:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -1669,7 +1669,7 @@ getForward(length:number): Promise<string>
...
@@ -1669,7 +1669,7 @@ getForward(length:number): Promise<string>
let
length
=
1
;
let
length
=
1
;
try
{
try
{
inputClient
.
getForward
(
length
).
then
((
text
)
=>
{
inputClient
.
getForward
(
length
).
then
((
text
)
=>
{
console
.
info
(
'
Succeeded in getting forward, text:
'
+
text
);
console
.
log
(
'
Succeeded in getting forward, text:
'
+
text
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to getForward:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to getForward:
${
JSON
.
stringify
(
err
)}
`
);
});
});
...
@@ -1754,7 +1754,7 @@ getBackward(length:number): Promise<string>
...
@@ -1754,7 +1754,7 @@ getBackward(length:number): Promise<string>
let
length
=
1
;
let
length
=
1
;
try
{
try
{
inputClient
.
getBackward
(
length
).
then
((
text
)
=>
{
inputClient
.
getBackward
(
length
).
then
((
text
)
=>
{
console
.
info
(
'
Succeeded in getting backward, text:
'
+
text
);
console
.
log
(
'
Succeeded in getting backward, text:
'
+
text
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to getBackward:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to getBackward:
${
JSON
.
stringify
(
err
)}
`
);
});
});
...
@@ -1798,7 +1798,7 @@ try {
...
@@ -1798,7 +1798,7 @@ try {
return
;
return
;
}
}
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Succeeded in deleting forward.
'
);
console
.
log
(
'
Succeeded in deleting forward.
'
);
}
else
{
}
else
{
console
.
error
(
`Failed to deleteForward:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to deleteForward:
${
JSON
.
stringify
(
err
)}
`
);
}
}
...
@@ -1844,9 +1844,9 @@ let length = 1;
...
@@ -1844,9 +1844,9 @@ let length = 1;
try
{
try
{
inputClient
.
deleteForward
(
length
).
then
((
result
)
=>
{
inputClient
.
deleteForward
(
length
).
then
((
result
)
=>
{
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Succeeded in deleting forward.
'
);
console
.
log
(
'
Succeeded in deleting forward.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to delete Forward.
'
);
console
.
error
(
'
Failed to delete Forward.
'
);
}
}
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to deleteForward:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to deleteForward:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -1891,7 +1891,7 @@ try {
...
@@ -1891,7 +1891,7 @@ try {
return
;
return
;
}
}
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Succeeded in deleting backward.
'
);
console
.
log
(
'
Succeeded in deleting backward.
'
);
}
else
{
}
else
{
console
.
error
(
`Failed to deleteBackward:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to deleteBackward:
${
JSON
.
stringify
(
err
)}
`
);
}
}
...
@@ -1936,9 +1936,9 @@ deleteBackward(length:number): Promise<boolean>
...
@@ -1936,9 +1936,9 @@ deleteBackward(length:number): Promise<boolean>
let
length
=
1
;
let
length
=
1
;
inputClient
.
deleteBackward
(
length
).
then
((
result
)
=>
{
inputClient
.
deleteBackward
(
length
).
then
((
result
)
=>
{
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Succeeded in deleting backward.
'
);
console
.
log
(
'
Succeeded in deleting backward.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to deleteBackward.
'
);
console
.
error
(
'
Failed to deleteBackward.
'
);
}
}
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to deleteBackward:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to deleteBackward:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -1978,9 +1978,9 @@ inputClient.insertText('test', (err, result) => {
...
@@ -1978,9 +1978,9 @@ inputClient.insertText('test', (err, result) => {
return
;
return
;
}
}
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Succeeded in inserting text.
'
);
console
.
log
(
'
Succeeded in inserting text.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to insertText.
'
);
console
.
error
(
'
Failed to insertText.
'
);
}
}
});
});
```
```
...
@@ -2020,9 +2020,9 @@ insertText(text:string): Promise<boolean>
...
@@ -2020,9 +2020,9 @@ insertText(text:string): Promise<boolean>
try
{
try
{
inputClient
.
insertText
(
'
test
'
).
then
((
result
)
=>
{
inputClient
.
insertText
(
'
test
'
).
then
((
result
)
=>
{
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Succeeded in inserting text.
'
);
console
.
log
(
'
Succeeded in inserting text.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to insertText.
'
);
console
.
error
(
'
Failed to insertText.
'
);
}
}
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to insertText:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to insertText:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -2093,8 +2093,8 @@ getEditorAttribute(): Promise<EditorAttribute>
...
@@ -2093,8 +2093,8 @@ getEditorAttribute(): Promise<EditorAttribute>
```
js
```
js
inputClient
.
getEditorAttribute
().
then
((
editorAttribute
)
=>
{
inputClient
.
getEditorAttribute
().
then
((
editorAttribute
)
=>
{
console
.
info
(
'
editorAttribute.inputPattern:
'
+
JSON
.
stringify
(
editorAttribute
.
inputPattern
));
console
.
log
(
'
editorAttribute.inputPattern:
'
+
JSON
.
stringify
(
editorAttribute
.
inputPattern
));
console
.
info
(
'
editorAttribute.enterKeyType:
'
+
JSON
.
stringify
(
editorAttribute
.
enterKeyType
));
console
.
log
(
'
editorAttribute.enterKeyType:
'
+
JSON
.
stringify
(
editorAttribute
.
enterKeyType
));
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to getEditorAttribute:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to getEditorAttribute:
${
JSON
.
stringify
(
err
)}
`
);
});
});
...
@@ -2132,7 +2132,7 @@ try {
...
@@ -2132,7 +2132,7 @@ try {
console
.
error
(
`Failed to moveCursor:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to moveCursor:
${
JSON
.
stringify
(
err
)}
`
);
return
;
return
;
}
}
console
.
info
(
'
Succeeded in moving cursor.
'
);
console
.
log
(
'
Succeeded in moving cursor.
'
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
`Failed to moveCursor:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to moveCursor:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -2214,7 +2214,7 @@ try {
...
@@ -2214,7 +2214,7 @@ try {
console
.
error
(
`Failed to selectByRange:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to selectByRange:
${
JSON
.
stringify
(
err
)}
`
);
return
;
return
;
}
}
console
.
info
(
'
Succeeded in selecting by range.
'
);
console
.
log
(
'
Succeeded in selecting by range.
'
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
`Failed to selectByRange:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to selectByRange:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -2297,7 +2297,7 @@ try {
...
@@ -2297,7 +2297,7 @@ try {
console
.
error
(
`Failed to selectByMovement:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to selectByMovement:
${
JSON
.
stringify
(
err
)}
`
);
return
;
return
;
}
}
console
.
info
(
'
Succeeded in selecting by movement.
'
);
console
.
log
(
'
Succeeded in selecting by movement.
'
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
`Failed to selectByMovement:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to selectByMovement:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -2378,7 +2378,7 @@ inputClient.getTextIndexAtCursor((err, index) => {
...
@@ -2378,7 +2378,7 @@ inputClient.getTextIndexAtCursor((err, index) => {
console
.
error
(
`Failed to getTextIndexAtCursor:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to getTextIndexAtCursor:
${
JSON
.
stringify
(
err
)}
`
);
return
;
return
;
}
}
console
.
info
(
'
Succeeded in getTextIndexAtCursor:
'
+
index
);
console
.
log
(
'
Succeeded in getTextIndexAtCursor:
'
+
index
);
});
});
```
```
...
@@ -2409,7 +2409,7 @@ getTextIndexAtCursor(): Promise<number>
...
@@ -2409,7 +2409,7 @@ getTextIndexAtCursor(): Promise<number>
```
js
```
js
inputClient
.
getTextIndexAtCursor
().
then
((
index
)
=>
{
inputClient
.
getTextIndexAtCursor
().
then
((
index
)
=>
{
console
.
info
(
'
Succeeded in getTextIndexAtCursor:
'
+
index
);
console
.
log
(
'
Succeeded in getTextIndexAtCursor:
'
+
index
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to getTextIndexAtCursor:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to getTextIndexAtCursor:
${
JSON
.
stringify
(
err
)}
`
);
});
});
...
@@ -2450,7 +2450,7 @@ try {
...
@@ -2450,7 +2450,7 @@ try {
console
.
error
(
`Failed to sendExtendAction:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to sendExtendAction:
${
JSON
.
stringify
(
err
)}
`
);
return
;
return
;
}
}
console
.
info
(
'
Succeeded in sending extend action.
'
);
console
.
log
(
'
Succeeded in sending extend action.
'
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
`Failed to sendExtendAction:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to sendExtendAction:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -2493,7 +2493,7 @@ sendExtendAction(action: ExtendAction): Promise<void>
...
@@ -2493,7 +2493,7 @@ sendExtendAction(action: ExtendAction): Promise<void>
```
js
```
js
try
{
try
{
inputClient
.
sendExtendAction
(
inputMethodEngine
.
ExtendAction
.
COPY
).
then
(()
=>
{
inputClient
.
sendExtendAction
(
inputMethodEngine
.
ExtendAction
.
COPY
).
then
(()
=>
{
console
.
info
(
'
Succeeded in sending extend action.
'
);
console
.
log
(
'
Succeeded in sending extend action.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to sendExtendAction:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to sendExtendAction:
${
JSON
.
stringify
(
err
)}
`
);
});
});
...
@@ -2626,7 +2626,7 @@ getForward(length:number): Promise<string>
...
@@ -2626,7 +2626,7 @@ getForward(length:number): Promise<string>
```
js
```
js
let
length
=
1
;
let
length
=
1
;
textInputClient
.
getForward
(
length
).
then
((
text
)
=>
{
textInputClient
.
getForward
(
length
).
then
((
text
)
=>
{
console
.
info
(
'
Succeeded in getting forward, text:
'
+
text
);
console
.
log
(
'
Succeeded in getting forward, text:
'
+
text
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to getForward:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to getForward:
${
JSON
.
stringify
(
err
)}
`
);
});
});
...
@@ -2693,7 +2693,7 @@ getBackward(length:number): Promise<string>
...
@@ -2693,7 +2693,7 @@ getBackward(length:number): Promise<string>
```
js
```
js
let
length
=
1
;
let
length
=
1
;
textInputClient
.
getBackward
(
length
).
then
((
text
)
=>
{
textInputClient
.
getBackward
(
length
).
then
((
text
)
=>
{
console
.
info
(
'
Succeeded in getting backward:
'
+
JSON
.
stringify
(
text
));
console
.
log
(
'
Succeeded in getting backward:
'
+
JSON
.
stringify
(
text
));
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to getBackward:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to getBackward:
${
JSON
.
stringify
(
err
)}
`
);
});
});
...
@@ -2728,9 +2728,9 @@ textInputClient.deleteForward(length, (err, result) => {
...
@@ -2728,9 +2728,9 @@ textInputClient.deleteForward(length, (err, result) => {
return
;
return
;
}
}
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Succeeded in deleting forward.
'
);
console
.
log
(
'
Succeeded in deleting forward.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to deleteForward.
'
);
console
.
error
(
'
Failed to deleteForward.
'
);
}
}
});
});
```
```
...
@@ -2765,9 +2765,9 @@ deleteForward(length:number): Promise<boolean>
...
@@ -2765,9 +2765,9 @@ deleteForward(length:number): Promise<boolean>
let
length
=
1
;
let
length
=
1
;
textInputClient
.
deleteForward
(
length
).
then
((
result
)
=>
{
textInputClient
.
deleteForward
(
length
).
then
((
result
)
=>
{
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Succeeded in deleting forward.
'
);
console
.
log
(
'
Succeeded in deleting forward.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to delete forward.
'
);
console
.
error
(
'
Failed to delete forward.
'
);
}
}
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to deleteForward:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to deleteForward:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -2803,9 +2803,9 @@ textInputClient.deleteBackward(length, (err, result) => {
...
@@ -2803,9 +2803,9 @@ textInputClient.deleteBackward(length, (err, result) => {
return
;
return
;
}
}
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Succeeded in deleting backward.
'
);
console
.
log
(
'
Succeeded in deleting backward.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to deleteBackward.
'
);
console
.
error
(
'
Failed to deleteBackward.
'
);
}
}
});
});
```
```
...
@@ -2840,9 +2840,9 @@ deleteBackward(length:number): Promise<boolean>
...
@@ -2840,9 +2840,9 @@ deleteBackward(length:number): Promise<boolean>
let
length
=
1
;
let
length
=
1
;
textInputClient
.
deleteBackward
(
length
).
then
((
result
)
=>
{
textInputClient
.
deleteBackward
(
length
).
then
((
result
)
=>
{
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Succeeded in deleting backward.
'
);
console
.
log
(
'
Succeeded in deleting backward.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to deleteBackward.
'
);
console
.
error
(
'
Failed to deleteBackward.
'
);
}
}
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to deleteBackward:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to deleteBackward:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -2877,9 +2877,9 @@ textInputClient.sendKeyFunction(action, (err, result) => {
...
@@ -2877,9 +2877,9 @@ textInputClient.sendKeyFunction(action, (err, result) => {
return
;
return
;
}
}
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Succeeded in sending key function.
'
);
console
.
log
(
'
Succeeded in sending key function.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to sendKeyFunction.
'
);
console
.
error
(
'
Failed to sendKeyFunction.
'
);
}
}
});
});
```
```
...
@@ -2914,9 +2914,9 @@ sendKeyFunction(action: number): Promise<boolean>
...
@@ -2914,9 +2914,9 @@ sendKeyFunction(action: number): Promise<boolean>
let
action
=
1
;
let
action
=
1
;
textInputClient
.
sendKeyFunction
(
action
).
then
((
result
)
=>
{
textInputClient
.
sendKeyFunction
(
action
).
then
((
result
)
=>
{
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Succeeded in sending key function.
'
);
console
.
log
(
'
Succeeded in sending key function.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to sendKeyFunction.
'
);
console
.
error
(
'
Failed to sendKeyFunction.
'
);
}
}
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to sendKeyFunction:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to sendKeyFunction:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -2951,9 +2951,9 @@ textInputClient.insertText('test', (err, result) => {
...
@@ -2951,9 +2951,9 @@ textInputClient.insertText('test', (err, result) => {
return
;
return
;
}
}
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Succeeded in inserting text.
'
);
console
.
log
(
'
Succeeded in inserting text.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to insertText.
'
);
console
.
error
(
'
Failed to insertText.
'
);
}
}
});
});
```
```
...
@@ -2987,9 +2987,9 @@ insertText(text:string): Promise<boolean>
...
@@ -2987,9 +2987,9 @@ insertText(text:string): Promise<boolean>
```
js
```
js
textInputClient
.
insertText
(
'
test
'
).
then
((
result
)
=>
{
textInputClient
.
insertText
(
'
test
'
).
then
((
result
)
=>
{
if
(
result
)
{
if
(
result
)
{
console
.
info
(
'
Succeeded in inserting text.
'
);
console
.
log
(
'
Succeeded in inserting text.
'
);
}
else
{
}
else
{
console
.
error
(
'
Failed to insertText.
'
);
console
.
error
(
'
Failed to insertText.
'
);
}
}
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to insertText:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to insertText:
${
JSON
.
stringify
(
err
)}
`
);
...
@@ -3049,8 +3049,8 @@ getEditorAttribute(): Promise<EditorAttribute>
...
@@ -3049,8 +3049,8 @@ getEditorAttribute(): Promise<EditorAttribute>
```
js
```
js
textInputClient
.
getEditorAttribute
().
then
((
editorAttribute
)
=>
{
textInputClient
.
getEditorAttribute
().
then
((
editorAttribute
)
=>
{
console
.
info
(
'
editorAttribute.inputPattern:
'
+
JSON
.
stringify
(
editorAttribute
.
inputPattern
));
console
.
log
(
'
editorAttribute.inputPattern:
'
+
JSON
.
stringify
(
editorAttribute
.
inputPattern
));
console
.
info
(
'
editorAttribute.enterKeyType:
'
+
JSON
.
stringify
(
editorAttribute
.
enterKeyType
));
console
.
log
(
'
editorAttribute.enterKeyType:
'
+
JSON
.
stringify
(
editorAttribute
.
enterKeyType
));
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to getEditorAttribute:
${
JSON
.
stringify
(
err
)}
`
);
console
.
error
(
`Failed to getEditorAttribute:
${
JSON
.
stringify
(
err
)}
`
);
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录