Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
f504f2b2
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看板
提交
f504f2b2
编写于
8月 18, 2022
作者:
M
ma-shaoyin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Signed-off-by: ma-shaoyin <mashaoyin1@huawei.com>
Changes to be committed:
上级
340b53e9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
105 addition
and
83 deletion
+105
-83
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
+28
-22
zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md
...plication-dev/reference/apis/js-apis-inputmethodengine.md
+77
-61
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
浏览文件 @
f504f2b2
...
...
@@ -146,7 +146,7 @@ stopInput(callback: AsyncCallback<boolean>): void
**示例:**
```
js
i
nputMethodController
.
stopInput
((
err
,
result
)
=>
{
I
nputMethodController
.
stopInput
((
err
,
result
)
=>
{
if
(
err
==
undefined
)
{
console
.
error
(
"
stopInput callback result---err:
"
+
err
.
msg
);
return
;
...
...
@@ -177,15 +177,17 @@ stopInput(): Promise<boolean>
```
js
await
inputMethodController
.
stopInput
().
then
((
result
)
=>
{
if
(
result
)
{
console
.
info
(
"
Success to stopInput.(promise)
"
);
}
else
{
console
.
info
(
"
Failed to stopInput.(promise)
"
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
"
stopInput promise err:
"
+
err
.
msg
);
});
async
function
InputMethod
()
{
await
InputMethodController
.
stopInput
().
then
((
result
)
=>
{
if
(
result
)
{
console
.
info
(
"
Success to stopInput.(promise)
"
);
}
else
{
console
.
info
(
"
Failed to stopInput.(promise)
"
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
"
stopInput promise err:
"
+
err
.
msg
);
});
}
```
### showSoftKeyboard<sup>9+</sup> ###
...
...
@@ -310,7 +312,7 @@ listInputMethod(callback: AsyncCallback<Array<InputMethodProperty>>)
**示例:**
```
js
i
nputMethodSetting
.
listInputMethod
((
err
,
data
)
=>
{
I
nputMethodSetting
.
listInputMethod
((
err
,
data
)
=>
{
if
(
err
==
undefined
)
{
console
.
error
(
"
listInputMethod callback result---err:
"
+
err
.
msg
);
return
;
...
...
@@ -335,11 +337,13 @@ listInputMethod(): Promise<Array<InputMethodProperty>>;
**示例:**
```
js
await
inputMethodSetting
.
listInputMethod
().
then
((
data
)
=>
{
console
.
info
(
"
listInputMethod promise result---data:
"
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
info
(
"
listInputMethod promise err:
"
+
err
.
msg
);
});
async
function
InputMethod
()
{
await
InputMethodSetting
.
listInputMethod
().
then
((
data
)
=>
{
console
.
info
(
"
listInputMethod promise result---data:
"
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
info
(
"
listInputMethod promise err:
"
+
err
.
msg
);
});
}
```
### displayOptionalInputMethod
...
...
@@ -359,7 +363,7 @@ displayOptionalInputMethod(callback: AsyncCallback<void>): void
**示例:**
```
js
i
nputMethodSetting
.
displayOptionalInputMethod
((
err
)
=>
{
I
nputMethodSetting
.
displayOptionalInputMethod
((
err
)
=>
{
if
(
err
==
undefined
)
{
console
.
error
(
"
displayOptionalInputMethod callback---err:
"
+
err
.
msg
);
return
;
...
...
@@ -385,9 +389,11 @@ inputMethodSetting.displayOptionalInputMethod((err) => {
**示例:**
```
js
await
inputMethodSetting
.
displayOptionalInputMethod
().
then
(()
=>
{
console
.
info
(
"
displayOptionalInputMethod promise
"
);
}).
catch
((
err
)
=>
{
console
.
info
(
"
listInputMethod promise err:
"
+
err
.
msg
);
});
async
function
InputMethod
()
{
await
InputMethodSetting
.
displayOptionalInputMethod
().
then
(()
=>
{
console
.
info
(
"
displayOptionalInputMethod promise
"
);
}).
catch
((
err
)
=>
{
console
.
info
(
"
listInputMethod promise err:
"
+
err
.
msg
);
});
}
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md
浏览文件 @
f504f2b2
...
...
@@ -450,11 +450,13 @@ hideKeyboard(): Promise<void>
**示例:**
```
js
await
KeyboardController
.
hideKeyboard
().
then
(()
=>
{
console
.
info
(
"
hideKeyboard promise.
"
);
}).
catch
((
err
)
=>
{
console
.
info
(
"
hideKeyboard promise err:
"
+
err
.
msg
);
});
async
function
InputMethodEngine
()
{
await
KeyboardController
.
hideKeyboard
().
then
(()
=>
{
console
.
info
(
"
hideKeyboard promise.
"
);
}).
catch
((
err
)
=>
{
console
.
info
(
"
hideKeyboard promise err:
"
+
err
.
msg
);
});
}
```
## TextInputClient<a name="TextInputClient"></a>
...
...
@@ -512,12 +514,14 @@ getForward(length:number): Promise<string>
**示例:**
```
js
var
length
=
1
;
await
client
.
getForward
(
length
).
then
((
text
)
=>
{
console
.
info
(
"
getForward promise result---res:
"
+
text
);
}).
catch
((
err
)
=>
{
console
.
error
(
"
getForward promise err:
"
+
err
.
msg
);
});
async
function
InputMethodEngine
()
{
var
length
=
1
;
await
TextInputClient
.
getForward
(
length
).
then
((
text
)
=>
{
console
.
info
(
"
getForward promise result---res:
"
+
text
);
}).
catch
((
err
)
=>
{
console
.
error
(
"
getForward promise err:
"
+
err
.
msg
);
});
}
```
### getBackward
...
...
@@ -571,12 +575,14 @@ getBackward(length:number): Promise<string>
**示例:**
```
js
var
length
=
1
;
await
TextInputClient
.
getBackward
(
length
).
then
((
text
)
=>
{
console
.
info
(
"
getBackward promise result---res:
"
+
text
);
}).
catch
((
err
)
=>
{
console
.
error
(
"
getBackward promise err:
"
+
err
.
msg
);
});
async
function
InputMethodEngine
()
{
var
length
=
1
;
await
TextInputClient
.
getBackward
(
length
).
then
((
text
)
=>
{
console
.
info
(
"
getBackward promise result---res:
"
+
text
);
}).
catch
((
err
)
=>
{
console
.
error
(
"
getBackward promise err:
"
+
err
.
msg
);
});
}
```
### deleteForward
...
...
@@ -633,16 +639,18 @@ deleteForward(length:number): Promise<boolean>
**示例:**
```
js
var
length
=
1
;
await
TextInputClient
.
deleteForward
(
length
).
then
((
result
)
=>
{
if
(
result
)
{
console
.
info
(
"
Success to deleteForward.(promise)
"
);
}
else
{
console
.
error
(
"
Failed to deleteForward.(promise)
"
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
"
deleteForward promise err:
"
+
err
.
msg
);
});
async
function
InputMethodEngine
()
{
var
length
=
1
;
await
TextInputClient
.
deleteForward
(
length
).
then
((
result
)
=>
{
if
(
result
)
{
console
.
info
(
"
Success to deleteForward.(promise)
"
);
}
else
{
console
.
error
(
"
Failed to deleteForward.(promise)
"
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
"
deleteForward promise err:
"
+
err
.
msg
);
});
}
```
### deleteBackward
...
...
@@ -699,16 +707,18 @@ deleteBackward(length:number): Promise<boolean>
**示例:**
```
js
var
length
=
1
;
await
TextInputClient
.
deleteBackward
(
length
).
then
((
result
)
=>
{
if
(
result
)
{
console
.
info
(
"
Success to deleteBackward.(promise)
"
);
}
else
{
console
.
error
(
"
Failed to deleteBackward.(promise)
"
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
"
deleteBackward promise err:
"
+
err
.
msg
);
});
async
function
InputMethodEngine
()
{
var
length
=
1
;
await
TextInputClient
.
deleteBackward
(
length
).
then
((
result
)
=>
{
if
(
result
)
{
console
.
info
(
"
Success to deleteBackward.(promise)
"
);
}
else
{
console
.
error
(
"
Failed to deleteBackward.(promise)
"
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
"
deleteBackward promise err:
"
+
err
.
msg
);
});
}
```
### sendKeyFunction
...
...
@@ -764,15 +774,17 @@ sendKeyFunction(action:number): Promise<boolean>
**示例:**
```
js
await
client
.
sendKeyFunction
(
keyFunction
).
then
((
result
)
=>
{
if
(
result
)
{
console
.
info
(
"
Success to sendKeyFunction.(promise)
"
);
}
else
{
console
.
error
(
"
Failed to sendKeyFunction.(promise)
"
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
"
sendKeyFunction promise err:
"
+
err
.
msg
);
});
async
function
InputMethodEngine
()
{
await
client
.
sendKeyFunction
(
keyFunction
).
then
((
result
)
=>
{
if
(
result
)
{
console
.
info
(
"
Success to sendKeyFunction.(promise)
"
);
}
else
{
console
.
error
(
"
Failed to sendKeyFunction.(promise)
"
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
"
sendKeyFunction promise err:
"
+
err
.
msg
);
});
}
```
### insertText
...
...
@@ -829,15 +841,17 @@ insertText(text:string): Promise<boolean>
**示例:**
```
js
await
TextInputClient
.
insertText
(
'
test
'
).
then
((
result
)
=>
{
if
(
result
)
{
console
.
info
(
"
Success to insertText.(promise)
"
);
}
else
{
console
.
error
(
"
Failed to insertText.(promise)
"
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
"
insertText promise err:
"
+
err
.
msg
);
});
async
function
InputMethodEngine
()
{
await
TextInputClient
.
insertText
(
'
test
'
).
then
((
result
)
=>
{
if
(
result
)
{
console
.
info
(
"
Success to insertText.(promise)
"
);
}
else
{
console
.
error
(
"
Failed to insertText.(promise)
"
);
}
}).
catch
((
err
)
=>
{
console
.
error
(
"
insertText promise err:
"
+
err
.
msg
);
});
}
```
### getEditorAttribute
...
...
@@ -884,12 +898,14 @@ getEditorAttribute(): Promise<EditorAttribute>
**示例:**
```
js
await
TextInputClient
.
getEditorAttribute
().
then
((
editorAttribute
)
=>
{
console
.
info
(
"
editorAttribute.inputPattern(promise):
"
+
JSON
.
stringify
(
editorAttribute
.
inputPattern
));
console
.
info
(
"
editorAttribute.enterKeyType(promise):
"
+
JSON
.
stringify
(
editorAttribute
.
enterKeyType
));
}).
catch
((
err
)
=>
{
console
.
error
(
"
getEditorAttribute promise err:
"
+
err
.
msg
);
});
async
function
InputMethodEngine
()
{
await
TextInputClient
.
getEditorAttribute
().
then
((
editorAttribute
)
=>
{
console
.
info
(
"
editorAttribute.inputPattern(promise):
"
+
JSON
.
stringify
(
editorAttribute
.
inputPattern
));
console
.
info
(
"
editorAttribute.enterKeyType(promise):
"
+
JSON
.
stringify
(
editorAttribute
.
enterKeyType
));
}).
catch
((
err
)
=>
{
console
.
error
(
"
getEditorAttribute promise err:
"
+
err
.
msg
);
});
}
```
## EditorAttribute<a name="EditorAttribute"></a>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录