Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yang2765
Docs
提交
502ace34
D
Docs
项目概览
yang2765
/
Docs
与 Fork 源项目一致
Fork自
OpenHarmony / Docs
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
502ace34
编写于
5月 12, 2022
作者:
孙
孙悦
提交者:
Gitee
5月 12, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md.
Signed-off-by:
N
sunyue
<
sunyue77@h-partners.com
>
上级
1e77945f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
87 addition
and
67 deletion
+87
-67
zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md
...plication-dev/reference/apis/js-apis-inputmethodengine.md
+87
-67
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md
浏览文件 @
502ace34
...
...
@@ -52,13 +52,13 @@ getInputMethodEngine(): InputMethodEngine
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
返回值
**返回值:**
| 类型 | 说明 |
| --------------------------------------- | ------------ |
|
[
InputMethodEngine
](
#InputMethodEngine
)
| 服务端实例。 |
-
示例
**示例:**
```
js
var
InputMethodEngine
=
inputMethodEngine
.
getInputMethodEngine
();
...
...
@@ -72,13 +72,13 @@ createKeyboardDelegate(): KeyboardDelegate
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
返回值
**返回值:**
| 类型 | 说明 |
| ------------------------------------- | ---------------- |
|
[
KeyboardDelegate
](
#KeyboardDelegate
)
| 客户端监听实例。 |
-
示例
**示例:**
```
js
var
KeyboardDelegate
=
inputMethodEngine
.
createKeyboardDelegate
();
...
...
@@ -96,14 +96,14 @@ on(type: 'inputStart', callback: (kbController: KeyboardController, textInputCli
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
参数:
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。
<br/>
-type为‘inputStart’时表示订阅输入法绑定。 |
| callback |
[
KeyboardController
](
#KeyboardController
)
,
[
TextInputClient
](
#TextInputClient
)
| 是 | 回调返回输入法操作相关实例。 |
-
示例:
**示例:**
```
js
InputMethodEngine
.
on
(
'
inputStart
'
,
(
kbController
,
textInputClient
)
=>
{
...
...
@@ -120,7 +120,7 @@ off(type: 'inputStart', callback?: (kbController: KeyboardController, textInputC
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
参数:
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ------------------------ |
...
...
@@ -129,7 +129,7 @@ off(type: 'inputStart', callback?: (kbController: KeyboardController, textInputC
-
示例:
**示例:**
```
js
InputMethodEngine
.
off
(
'
inputStart
'
);
...
...
@@ -143,14 +143,14 @@ on(type: 'keyboardShow'|'keyboardHide', callback: () => void): void
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
参数:
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。
<br/>
-
type为'keyboardShow',表示订阅输入法显示。
<br/>
-
type为'keyboardHide',表示订阅输入法隐藏。 |
| callback | void | 否 | 回调函数。 |
-
示例:
**示例:**
```
js
InputMethodEngine
.
on
(
'
keyboardShow
'
,
(
err
)
=>
{
...
...
@@ -166,14 +166,14 @@ off(type: 'keyboardShow'|'keyboardHide', callback?: () => void): void
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
参数:
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。
<br/>
-
type为'keyboardShow',表示订阅输入法显示。
<br/>
-
type为'keyboardHide',表示订阅输入法隐藏。 |
| callback | void | 否 | 回调函数。 |
-
示例:
**示例:**
```
js
InputMethodEngine
.
off
(
'
keyboardShow
'
);
...
...
@@ -192,7 +192,7 @@ on(type: 'keyDown'|'keyUp', callback: (event: KeyEvent) => boolean): void
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
参数:
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
...
...
@@ -201,7 +201,7 @@ on(type: 'keyDown'|'keyUp', callback: (event: KeyEvent) => boolean): void
-
示例:
**示例:**
```
js
KeyboardDelegate
.
on
(
'
keyDown
'
,
(
event
)
=>
{
...
...
@@ -217,14 +217,14 @@ off(type: 'keyDown'|'keyUp', callback?: (event: KeyEvent) => boolean): void
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
参数:
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。
<br/>
-
type为'keyDown',表示订阅硬键盘按下。
<br/>
-
type为'keyUp',表示订阅硬键盘抬起。 |
| callback |
[
KeyEvent
](
#KeyEvent
)
| 否 | 回调返回按键信息。 |
-
示例:
**示例:**
```
js
KeyboardDelegate
.
off
(
'
keyDown
'
);
...
...
@@ -238,7 +238,7 @@ on(type: 'cursorContextChange', callback: (x: number, y:number, height:number) =
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
参数:
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
...
...
@@ -247,7 +247,7 @@ on(type: 'cursorContextChange', callback: (x: number, y:number, height:number) =
-
示例:
**示例:**
```
js
KeyboardDelegate
.
on
(
'
cursorContextChange
'
,
(
x
,
y
,
height
)
=>
{
...
...
@@ -263,7 +263,7 @@ off(type: 'cursorContextChange', callback?: (x: number, y:number, height:number)
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
参数:
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ------------------------ |
...
...
@@ -271,7 +271,7 @@ off(type: 'cursorContextChange', callback?: (x: number, y:number, height:number)
| callback | number | 否 | 回调返回光标信息。 |
-
示例:
**示例:**
```js
KeyboardDelegate.off('cursorContextChange');
...
...
@@ -284,14 +284,14 @@ on(type: 'selectionChange', callback: (oldBegin: number, oldEnd: number, newBegi
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
参数:
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 文本选择变化事件。<br/>-type为’selectionChange‘时,表示选择文本变化。 |
| callback | number | 是 | 回调返回文本选择信息。 |
-
示例:
**示例:**
```
js
KeyboardDelegate
.
on
(
'
selectionChange
'
,
(
oldBegin
,
oldEnd
,
newBegin
,
newEnd
)
=>
{
...
...
@@ -307,14 +307,14 @@ off(type: 'selectionChange', callback?: (oldBegin: number, oldEnd: number, newBe
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
参数:
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ------------------------ |
| type | string | 是 | 文本选择变化事件。<br/>-type为’selectionChange‘时,表示选择文本变化。 |
| callback | number | 否 | 回调返回文本选择信息。 |
-
示例:
**示例:**
```js
KeyboardDelegate.off('selectionChange');
...
...
@@ -329,14 +329,14 @@ on(type: 'textChange', callback: (text: string) => void): void
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
参数:
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | 文本变化事件。<br/>-type为’textChange‘时,表示当前文本变化。 |
| callback | string | 是 | 回调返回当前文本内容。 |
-
示例:
**示例:**
```js
KeyboardDelegate.on('textChange', (text) => {
...
...
@@ -352,14 +352,14 @@ off(type: 'textChange', callback?: (text: string) => void): void
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
参数:
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ------------------------ |
| type | string | 是 | 文本变化事件。<br/>-type为’textChange‘时,表示当前文本变化。 |
| callback | string | 否 | 回调返回当前文本内容。 |
-
示例:
**示例:**
```js
KeyboardDelegate.off('textChange');
...
...
@@ -377,13 +377,13 @@ hideKeyboard(callback: AsyncCallback<void>): void
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
参数:
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------- | ---- | -------- |
| callback | AsyncCallback
<
void> | 否 | 回调函数 |
-
示例
**示例:**
```
js
...
...
@@ -399,14 +399,13 @@ hideKeyboard(): Promise<void>
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
返回值
**返回值:**
| 类型 | 说明 |
| ---------------- | -------- |
| Promise
<
void> | 回调函数 |
-
示例
**示例:**
```
js
KeyboardController
.
hideKeyboard
();
...
...
@@ -424,14 +423,15 @@ getForward(length:number, callback: AsyncCallback<string>): void
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
参数
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| length | number | 是 | 文本长度。 |
| callback | AsyncCallback
<
string
>
| 是 | 返回文本。 |
-
示例
**示例:**
```
js
TextInputClient
.
getForward
(
5
,(
text
)
=>
{
console
.
info
(
"
text =
"
+
text
);
...
...
@@ -446,18 +446,20 @@ getForward(length:number): Promise<string>
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
参数
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| length | number | 是 | 文本长度。 |
-
返回值
**返回值:**
| 类型 | 说明 |
| ------------------------------- | ------------------------------------------------------------ |
| Promise
<
string
>
| 返回文本。 |
-
示例
**示例:**
```
js
var
text
=
TextInputClient
.
getForward
(
5
);
console
.
info
(
"
text =
"
+
text
);
...
...
@@ -471,14 +473,15 @@ getBackward(length:number, callback: AsyncCallback<string>): void
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
参数
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| length | number | 是 | 文本长度。 |
| callback | AsyncCallback
<
string
>
| 是 | 返回文本。 |
-
示例
**示例:**
```
js
TextInputClient
.
getBackward
(
5
,(
text
)
=>
{
console
.
info
(
"
text =
"
+
text
);
...
...
@@ -493,18 +496,20 @@ getBackward(length:number): Promise<string>
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
参数
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| length | number | 是 | 文本长度。 |
-
返回值
**返回值:**
| 类型 | 说明 |
| ------------------------------- | ------------------------------------------------------------ |
| Promise
<
string
>
| 返回文本。 |
-
示例
**示例:**
```
js
var
text
=
TextInputClient
.
getBackward
(
5
);
console
.
info
(
"
text =
"
+
text
);
...
...
@@ -518,14 +523,15 @@ deleteForward(length:number, callback: AsyncCallback<boolean>): void
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
参数
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| length | number | 是 | 文本长度。 |
| callback | AsyncCallback
<
boolean
>
| 是 | 操作成功与否。 |
-
示例
**示例:**
```
js
TextInputClient
.
deleteForward
(
5
,(
isSuccess
)
=>
{
console
.
info
(
"
isSuccess =
"
+
isSuccess
);
...
...
@@ -539,18 +545,20 @@ deleteForward(length:number): Promise<boolean>
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
参数
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| length | number | 是 | 文本长度。 |
-
返回值
**返回值:**
| 类型 | 说明 |
| ------------------------------- | ------------------------------------------------------------ |
| Promise<boolean> | 操作成功与否。 |
-
示例
**示例:**
```js
var isSuccess = TextInputClient.deleteForward(5);
console.info("isSuccess = " + isSuccess);
...
...
@@ -564,14 +572,15 @@ deleteBackward(length:number, callback: AsyncCallback<boolean>): void
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
参数
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| length | number | 是 | 文本长度。 |
| callback | AsyncCallback<boolean> | 是 | 操作成功与否。 |
-
示例
**示例:**
```js
TextInputClient.deleteBackward(5, (isSuccess)=>{
console.info("isSuccess = " + isSuccess);
...
...
@@ -586,17 +595,18 @@ deleteBackward(length:number): Promise<boolean>
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
参数
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| length | number | 是 | 文本长度。 |
-
返回值
**返回值:**
| 类型 | 说明 |
| ------------------------------- | ------------------------------------------------------------ |
| Promise
<
boolean
>
| 操作成功与否。 |
-
示例
**示例:**
```js
var isSuccess = TextInputClient.deleteBackward(5);
...
...
@@ -610,14 +620,15 @@ sendKeyFunction(action:number, callback: AsyncCallback<boolean>): void
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
参数
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| action | number | 是 | 编辑框属性。 |
| callback | AsyncCallback<boolean> | 是 | 操作成功与否。 |
-
示例
**示例:**
```js
TextInputClient.sendKeyFunction(inputMethod.ENTER_KEY_TYPE_NEXT,(isSuccess)=>{
console.info("isSuccess = " + isSuccess);
...
...
@@ -632,17 +643,19 @@ sendKeyFunction(action:number): Promise<boolean>
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
参数
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| action | number | 是 | 编辑框属性。 |
-
返回值
**返回值:**
| 类型 | 说明 |
| ------------------------------- | ------------------------------------------------------------ |
| Promise
<
boolean
>
| 操作成功与否。 |
-
示例
**示例:**
```
js
var
isSuccess
=
TextInputClient
.
sendKeyFunction
(
inputMethod
.
ENTER_KEY_TYPE_NEXT
);
...
...
@@ -657,14 +670,15 @@ insertText(text:string, callback: AsyncCallback<boolean>): void
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
参数
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| text | string | 是 | 文本。 |
| callback | AsyncCallback<boolean> | 是 | 操作成功与否。 |
-
示例
**示例:**
```js
TextInputClient.insertText("test", (isSuccess)=>{
console.info("isSuccess = " + isSuccess);
...
...
@@ -679,17 +693,19 @@ insertText(text:string): Promise<boolean>
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
参数
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| text | string | 是 | 文本。 |
-
返回值
**返回值:**
| 类型 | 说明 |
| ------------------------------- | ------------------------------------------------------------ |
| Promise
<
boolean
>
| 操作成功与否。 |
-
示例
**示例:**
```
js
var
isSuccess
=
TextInputClient
.
insertText
(
"
test
"
);
...
...
@@ -704,12 +720,14 @@ getEditorAttribute(callback: AsyncCallback<EditorAttribute>): void
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
参数
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| callback | AsyncCallback
<
[EditorAttribute](#EditorAttribute)
>
| 是 | 编辑框属性值。 |
-
示例
**示例:**
```
js
TextInputClient
.
getEditorAttribute
((
EditorAttribute
)
=>
{
});
...
...
@@ -723,12 +741,14 @@ getEditorAttribute(): Promise<EditorAttribute>
**系统能力**
: SystemCapability.Miscservices.InputMethodFramework
-
返回值
**返回值:**
| 类型 | 说明 |
| ------------------------------- | ------------------------------------------------------------ |
| Promise
<
[EditorAttribute](#EditorAttribute)
>
| 返回编辑框属性值。 |
-
示例
**示例:**
```
js
var
EditorAttribute
=
TextInputClient
.
getEditorAttribute
();
```
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录