Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
72c88a41
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看板
提交
72c88a41
编写于
5月 06, 2023
作者:
H
Hollokin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
示例代码缩进2空格;if(err!==undefined)等直接改为if(err)即可
Signed-off-by:
N
Hollokin
<
taoyuxin2@huawei.com
>
上级
2e52d650
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
696 addition
and
694 deletion
+696
-694
zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-ability.md
...v/reference/apis/js-apis-inputmethod-extension-ability.md
+6
-6
zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-context.md
...v/reference/apis/js-apis-inputmethod-extension-context.md
+6
-6
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
+357
-357
zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md
...plication-dev/reference/apis/js-apis-inputmethodengine.md
+327
-325
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-ability.md
浏览文件 @
72c88a41
zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-context.md
浏览文件 @
72c88a41
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
浏览文件 @
72c88a41
...
...
@@ -136,7 +136,7 @@ let prop = {
}
try
{
inputMethod
.
switchInputMethod
(
prop
,
(
err
,
result
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to switchInputMethod:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -267,7 +267,7 @@ try {
iconId
:
0
,
extra
:
{}
},
(
err
,
result
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to switchCurrentInputMethodSubtype:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -395,7 +395,7 @@ let im = inputMethod.getCurrentInputMethod();
let
imSubType
=
inputMethod
.
getCurrentInputMethodSubtype
();
try
{
inputMethod
.
switchCurrentInputMethodAndSubtype
(
im
,
imSubType
,
(
err
,
result
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to switchCurrentInputMethodAndSubtype:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -690,7 +690,7 @@ try {
}
};
inputMethodController
.
attach
(
true
,
textConfig
,
(
err
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
`Failed to attach:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
...
...
@@ -783,7 +783,7 @@ showTextInput(callback: AsyncCallback<void>): void
```
js
inputMethodController
.
showTextInput
((
err
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
`Failed to showTextInput:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
...
...
@@ -859,7 +859,7 @@ hideTextInput(callback: AsyncCallback<void>): void
```
js
inputMethodController
.
hideTextInput
((
err
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
`Failed to hideTextInput:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
...
...
@@ -932,7 +932,7 @@ detach(callback: AsyncCallback<void>): void
```
js
inputMethodController
.
detach
((
err
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
`Failed to detach:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
...
...
@@ -1006,7 +1006,7 @@ setCallingWindow(windowId: number, callback: AsyncCallback<void>): void
try
{
let
windowId
:
number
=
2000
;
inputMethodController
.
setCallingWindow
(
windowId
,
(
err
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
`Failed to setCallingWindow:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
...
...
@@ -1096,7 +1096,7 @@ updateCursor(cursorInfo: CursorInfo, callback: AsyncCallback<void>): void
```
js
try
{
inputMethodController
.
updateCursor
({
left
:
0
,
top
:
0
,
width
:
600
,
height
:
800
},
(
err
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
`Failed to updateCursor:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
...
...
@@ -1185,7 +1185,7 @@ changeSelection(text: string, start: number, end: number, callback: AsyncCallbac
```
js
try
{
inputMethodController
.
changeSelection
(
'
text
'
,
0
,
5
,
(
err
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
`Failed to changeSelection:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
...
...
@@ -1272,7 +1272,7 @@ updateAttribute(attribute: InputAttribute, callback: AsyncCallback<void>):
```
js
try
{
inputMethodController
.
updateAttribute
({
textInputType
:
0
,
enterKeyType
:
1
},
(
err
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
`Failed to updateAttribute:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
...
...
@@ -1357,7 +1357,7 @@ stopInputSession(callback: AsyncCallback<boolean>): void
```
js
try
{
inputMethodController
.
stopInputSession
((
error
,
result
)
=>
{
if
(
error
!==
undefined
)
{
if
(
error
)
{
console
.
error
(
'
Failed to stopInputSession:
'
+
JSON
.
stringify
(
error
));
return
;
}
...
...
@@ -1446,7 +1446,7 @@ showSoftKeyboard(callback: AsyncCallback<void>): void
```
js
inputMethodController
.
showSoftKeyboard
((
err
)
=>
{
if
(
err
===
undefined
)
{
if
(
!
err
)
{
console
.
info
(
'
Succeeded in showing softKeyboard.
'
);
}
else
{
console
.
error
(
'
Failed to showSoftKeyboard:
'
+
JSON
.
stringify
(
err
));
...
...
@@ -1522,7 +1522,7 @@ hideSoftKeyboard(callback: AsyncCallback<void>): void
```
js
inputMethodController
.
hideSoftKeyboard
((
err
)
=>
{
if
(
err
===
undefined
)
{
if
(
!
err
)
{
console
.
info
(
'
Succeeded in hiding softKeyboard.
'
);
}
else
{
console
.
error
(
'
Failed to hideSoftKeyboard:
'
+
JSON
.
stringify
(
err
));
...
...
@@ -1591,7 +1591,7 @@ stopInput(callback: AsyncCallback<boolean>): void
```
js
inputMethodController
.
stopInput
((
error
,
result
)
=>
{
if
(
error
!==
undefined
)
{
if
(
error
)
{
console
.
error
(
'
Failed to stopInput:
'
+
JSON
.
stringify
(
error
));
return
;
}
...
...
@@ -2146,7 +2146,7 @@ let inputMethodProperty = {
}
try
{
inputMethodSetting
.
listInputMethodSubtype
(
inputMethodProperty
,
(
err
,
data
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to listInputMethodSubtype:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -2235,7 +2235,7 @@ listCurrentInputMethodSubtype(callback: AsyncCallback<Array<InputMethodSub
```
js
try
{
inputMethodSetting
.
listCurrentInputMethodSubtype
((
err
,
data
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to listCurrentInputMethodSubtype:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -2312,7 +2312,7 @@ getInputMethods(enable: boolean, callback: AsyncCallback<Array<InputMethod
```
js
try
{
inputMethodSetting
.
getInputMethods
(
true
,
(
err
,
data
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to getInputMethods:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -2393,7 +2393,7 @@ showOptionalInputMethods(callback: AsyncCallback<boolean>): void
```
js
try
{
inputMethodSetting
.
showOptionalInputMethods
((
err
,
data
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to showOptionalInputMethods:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -2458,7 +2458,7 @@ listInputMethod(callback: AsyncCallback<Array<InputMethodProperty>>)
```
js
inputMethodSetting
.
listInputMethod
((
err
,
data
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to listInputMethod:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -2516,7 +2516,7 @@ displayOptionalInputMethod(callback: AsyncCallback<void>): void
```
js
inputMethodSetting
.
displayOptionalInputMethod
((
err
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to displayOptionalInputMethod:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md
浏览文件 @
72c88a41
...
...
@@ -513,7 +513,7 @@ let panelInfo: inputMethodEngine.PanelInfo = {
}
try
{
inputMethodEngine
.
getInputMethodAbility
().
createPanel
(
this
.
context
,
panelInfo
,
(
err
,
panel
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
log
(
'
Failed to create panel, err:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -590,7 +590,7 @@ let panelInfo: inputMethodEngine.PanelInfo = {
}
try
{
inputMethodEngine
.
getInputMethodAbility
().
createPanel
(
this
.
context
,
panelInfo
,
(
err
,
panel
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
log
(
'
Failed to create panel, err:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -642,7 +642,7 @@ let panelInfo: inputMethodEngine.PanelInfo = {
}
try
{
inputMethodEngine
.
getInputMethodAbility
().
createPanel
(
this
.
context
,
panelInfo
,
(
err
,
panel
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
log
(
'
Failed to create panel, err:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -837,7 +837,7 @@ on(type: 'textChange', callback: (text: string) => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 文本变化事件。
<br/>
-
type为’textChange‘时,表示订阅文本变化事件。 |
| callback | (text: string) => void | 是 | 回调函数,返回订阅的文本内容。
|
| callback | (text: string) => void | 是 | 回调函数,返回订阅的文本内容。|
**示例:**
...
...
@@ -1017,6 +1017,7 @@ try {
resize(width: number, height: number, callback: AsyncCallback
\<
void>): void
改变当前面板大小,使用callback异步回调。
面板存在大小限制,面板宽度不超出屏幕宽度,面板高度不高于屏幕高度的二分之一。
**系统能力:**
SystemCapability.MiscServices.InputMethodFramework
...
...
@@ -1088,6 +1089,7 @@ try {
moveTo(x: number, y: number, callback: AsyncCallback
\<
void>): void
移动面板位置,使用callback异步回调。
对FLG_FIXED状态的panel不产生实际移动效果。
**系统能力:**
SystemCapability.MiscServices.InputMethodFramework
...
...
@@ -1260,7 +1262,7 @@ promise.then(() => {
on(type: 'show' | 'hide', callback: () => void): void
监听当前面板状态,
可监听面板类型为show或者hide,
使用callback异步回调。
监听当前面板状态,使用callback异步回调。
**系统能力:**
SystemCapability.MiscServices.InputMethodFramework
...
...
@@ -1283,7 +1285,7 @@ panel.on('show', () => {
off(type: 'show' | 'hide', callback?: () => void): void
取消监听当前面板状态,
可取消监听的面板类型为show或者hide,
使用callback异步回调。
取消监听当前面板状态,使用callback异步回调。
**系统能力:**
SystemCapability.MiscServices.InputMethodFramework
...
...
@@ -1351,7 +1353,7 @@ hide(callback: AsyncCallback<void>): void
```
js
keyboardController
.
hide
((
err
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to hide keyboard:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -1413,7 +1415,7 @@ hideKeyboard(callback: AsyncCallback<void>): void
```
js
keyboardController
.
hideKeyboard
((
err
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to hide Keyboard:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -1529,7 +1531,7 @@ sendKeyFunction(action:number, callback: AsyncCallback<boolean>): void
let
action
=
1
;
try
{
inputClient
.
sendKeyFunction
(
action
,
(
err
,
result
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to sendKeyFunction:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -1621,7 +1623,7 @@ getForward(length:number, callback: AsyncCallback<string>): void
let
length
=
1
;
try
{
inputClient
.
getForward
(
length
,
(
err
,
text
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to getForward:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -1706,7 +1708,7 @@ getBackward(length:number, callback: AsyncCallback<string>): void
let
length
=
1
;
try
{
inputClient
.
getBackward
(
length
,
(
err
,
text
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to getForward:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -1791,7 +1793,7 @@ deleteForward(length:number, callback: AsyncCallback<boolean>): void
let
length
=
1
;
try
{
inputClient
.
deleteForward
(
length
,
(
err
,
result
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to delete forward:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -1884,7 +1886,7 @@ deleteBackward(length:number, callback: AsyncCallback<boolean>): void
let
length
=
1
;
try
{
inputClient
.
deleteBackward
(
length
,
(
err
,
result
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to delete Backward:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -1971,7 +1973,7 @@ insertText(text:string, callback: AsyncCallback<boolean>): void
```
js
inputClient
.
insertText
(
'
test
'
,
(
err
,
result
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to insertText:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -2056,7 +2058,7 @@ getEditorAttribute(callback: AsyncCallback<EditorAttribute>): void
```
js
inputClient
.
getEditorAttribute
((
err
,
editorAttribute
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to getEditorAttribute:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -2126,7 +2128,7 @@ moveCursor(direction: number, callback: AsyncCallback<void>): void
```
js
try
{
inputClient
.
moveCursor
(
inputMethodEngine
.
CURSOR_UP
,
(
err
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to moveCursor:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -2208,7 +2210,7 @@ selectByRange(range: Range, callback: AsyncCallback<void>): void
```
js
try
{
inputClient
.
selectByRange
({
start
:
0
,
end
:
1
},
(
err
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to selectByRange: ${err.message}
'
);
return
;
}
...
...
@@ -2291,7 +2293,7 @@ selectByMovement(movement: Movement, callback: AsyncCallback<void>): void
```
js
try
{
inputClient
.
selectByMovement
({
direction
:
1
},
(
err
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to selectByMovement: ${err.message}
'
);
return
;
}
...
...
@@ -2372,7 +2374,7 @@ getTextIndexAtCursor(callback: AsyncCallback<number>): void
```
js
inputClient
.
getTextIndexAtCursor
((
err
,
index
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to getTextIndexAtCursor: ${err.message}
'
);
return
;
}
...
...
@@ -2444,7 +2446,7 @@ sendExtendAction(action: ExtendAction, callback: AsyncCallback<void>): voi
```
js
try
{
inputClient
.
sendExtendAction
(
inputMethodEngine
.
ExtendAction
.
COPY
,
(
err
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
`Failed to sendExtendAction:
${
JSON
.
stringify
(
err
)}
`
);
return
;
}
...
...
@@ -2587,7 +2589,7 @@ getForward(length:number, callback: AsyncCallback<string>): void
```
js
let
length
=
1
;
textInputClient
.
getForward
(
length
,
(
err
,
text
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to getForward:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -2654,7 +2656,7 @@ getBackward(length:number, callback: AsyncCallback<string>): void
```
js
let
length
=
1
;
textInputClient
.
getBackward
(
length
,
(
err
,
text
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to getBackward:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -2721,7 +2723,7 @@ deleteForward(length:number, callback: AsyncCallback<boolean>): void
```
js
let
length
=
1
;
textInputClient
.
deleteForward
(
length
,
(
err
,
result
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to deleteForward:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -2784,19 +2786,19 @@ deleteBackward(length:number, callback: AsyncCallback<boolean>): void
**系统能力:**
SystemCapability.MiscServices.InputMethodFramework
**参数:**
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------- | ---- | -------------- |
| length | number | 是 | 文本长度。 |
| callback | AsyncCallback
<
boolean
>
| 是 | 回调函数。当光标后固定长度的文本删除成功,err为undefined,data为true;否则为错误对象。|
**示例:**
**示例:**
```
js
let
length
=
1
;
textInputClient
.
deleteBackward
(
length
,
(
err
,
result
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to delete backward:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -2858,19 +2860,19 @@ sendKeyFunction(action: number, callback: AsyncCallback<boolean>): void
**系统能力:**
SystemCapability.MiscServices.InputMethodFramework
**参数:**
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| action | number | 是 | 功能键键值。
<br/>
当值为0时,表示无效按键;
<br/>
当值为1时,表示确认键(即回车键)。 |
| callback | AsyncCallback
<
boolean
>
| 是 | 回调函数。当功能键发送成功,err为undefined,data为true;否则为错误对象。 |
**示例:**
**示例:**
```
js
let
action
=
1
;
textInputClient
.
sendKeyFunction
(
action
,
(
err
,
result
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to sendKeyFunction:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -2944,7 +2946,7 @@ insertText(text:string, callback: AsyncCallback<boolean>): void
```
js
textInputClient
.
insertText
(
'
test
'
,
(
err
,
result
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to insertText:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
@@ -3016,7 +3018,7 @@ getEditorAttribute(callback: AsyncCallback<EditorAttribute>): void
```
js
textInputClient
.
getEditorAttribute
((
err
,
editorAttribute
)
=>
{
if
(
err
!==
undefined
)
{
if
(
err
)
{
console
.
error
(
'
Failed to getEditorAttribute:
'
+
JSON
.
stringify
(
err
));
return
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录