2022-02-22 12:37:51 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
import {AsyncCallback} from './basic';
|
2022-10-10 13:30:16 +00:00
|
|
|
import InputMethodSubtype from './@ohos.inputMethodSubtype';
|
2022-02-22 12:37:51 +00:00
|
|
|
|
|
|
|
/**
|
2022-10-10 13:30:16 +00:00
|
|
|
* Input method engine
|
2022-02-22 12:37:51 +00:00
|
|
|
*
|
|
|
|
* @since 8
|
2022-03-28 06:47:19 +00:00
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
2022-02-22 12:37:51 +00:00
|
|
|
*/
|
|
|
|
declare namespace inputMethodEngine {
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
const ENTER_KEY_TYPE_UNSPECIFIED: number;
|
2022-10-10 13:30:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
const ENTER_KEY_TYPE_GO: number;
|
2022-10-10 13:30:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
const ENTER_KEY_TYPE_SEARCH: number;
|
2022-10-10 13:30:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
const ENTER_KEY_TYPE_SEND: number;
|
2022-10-10 13:30:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
const ENTER_KEY_TYPE_NEXT: number;
|
2022-10-10 13:30:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
const ENTER_KEY_TYPE_DONE: number;
|
2022-10-10 13:30:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
const ENTER_KEY_TYPE_PREVIOUS: number;
|
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
const PATTERN_NULL: number;
|
2022-10-10 13:30:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
const PATTERN_TEXT: number;
|
2022-10-10 13:30:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
const PATTERN_NUMBER: number;
|
2022-10-10 13:30:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
const PATTERN_PHONE: number;
|
2022-10-10 13:30:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
const PATTERN_DATETIME: number;
|
2022-10-10 13:30:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
const PATTERN_EMAIL: number;
|
2022-10-10 13:30:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
const PATTERN_URI: number;
|
2022-10-10 13:30:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
const PATTERN_PASSWORD: number;
|
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
const FLAG_SELECTING: number;
|
2022-10-10 13:30:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
const FLAG_SINGLE_LINE: number;
|
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
const DISPLAY_MODE_PART: number;
|
2022-10-10 13:30:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
const DISPLAY_MODE_FULL: number;
|
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
const OPTION_ASCII: number;
|
2022-10-10 13:30:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
const OPTION_NONE: number;
|
2022-10-10 13:30:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
const OPTION_AUTO_CAP_CHARACTERS: number;
|
2022-10-10 13:30:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
const OPTION_AUTO_CAP_SENTENCES: number;
|
2022-10-10 13:30:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
const OPTION_AUTO_WORDS: number;
|
2022-10-10 13:30:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
const OPTION_MULTI_LINE: number;
|
2022-10-10 13:30:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
const OPTION_NO_FULLSCREEN: number;
|
2022-08-24 09:43:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The move direction of cursor: UP
|
|
|
|
* @since 9
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-08-23 07:09:47 +00:00
|
|
|
const CURSOR_UP: number;
|
2022-08-24 09:43:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The move direction of cursor: DOWN
|
|
|
|
* @since 9
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-08-23 07:09:47 +00:00
|
|
|
const CURSOR_DOWN: number;
|
2022-08-24 09:43:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The move direction of cursor: LEFT
|
|
|
|
* @since 9
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-08-23 07:09:47 +00:00
|
|
|
const CURSOR_LEFT: number;
|
2022-08-24 09:43:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The move direction of cursor: RIGHT
|
|
|
|
* @since 9
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-08-23 07:09:47 +00:00
|
|
|
const CURSOR_RIGHT: number;
|
|
|
|
|
|
|
|
/**
|
2022-10-10 13:30:16 +00:00
|
|
|
* The window styles for input method ability.
|
2022-08-23 07:09:47 +00:00
|
|
|
* @since 9
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
|
|
|
const WINDOW_TYPE_INPUT_METHOD_FLOAT: number;
|
2022-02-22 12:37:51 +00:00
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 9
|
2022-11-28 03:25:56 +00:00
|
|
|
* @returns { InputMethodAbility } the object of the InputMethodAbility.
|
2022-10-10 13:30:16 +00:00
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
|
|
|
function getInputMethodAbility(): InputMethodAbility;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.inputmethodengine.getInputMethodAbility
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
function getInputMethodEngine(): InputMethodEngine;
|
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 9
|
2022-11-28 03:25:56 +00:00
|
|
|
* @returns { KeyboardDelegate } the object of KeyboardDelegate.
|
2022-10-10 13:30:16 +00:00
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
|
|
|
function getKeyboardDelegate(): KeyboardDelegate;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.inputmethodengine.getKeyboardDelegate
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
function createKeyboardDelegate(): KeyboardDelegate;
|
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
interface KeyboardController {
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 9
|
2022-10-25 10:29:34 +00:00
|
|
|
* @throws {BusinessError} 12800003 - input method client error.
|
2022-10-10 13:30:16 +00:00
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
|
|
|
hide(callback: AsyncCallback<void>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 9
|
2022-10-28 02:41:13 +00:00
|
|
|
* @throws {BusinessError} 12800003 - input method client error.
|
2022-10-10 13:30:16 +00:00
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
|
|
|
hide(): Promise<void>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.inputmethodengine.KeyboardController.hide
|
|
|
|
*/
|
2022-03-22 02:41:09 +00:00
|
|
|
hideKeyboard(callback: AsyncCallback<void>): void;
|
2022-02-22 12:37:51 +00:00
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.inputmethodengine.KeyboardController.hide
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
hideKeyboard(): Promise<void>;
|
|
|
|
}
|
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
interface InputMethodEngine {
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* Subscribe 'inputStart'
|
|
|
|
* @since 8
|
|
|
|
* @param type inputStart
|
|
|
|
* @param callback give keyboard controller and text input client
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
on(type: 'inputStart', callback: (kbController: KeyboardController, textInputClient: TextInputClient) => void): void;
|
2022-10-10 13:30:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Unsubscribe 'inputStart'
|
|
|
|
* @since 8
|
|
|
|
* @param type inputStart
|
|
|
|
* @param callback optional, give keyboard controller and text input client
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
off(type: 'inputStart', callback?: (kbController: KeyboardController, textInputClient: TextInputClient) => void): void;
|
2022-08-24 09:43:23 +00:00
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* Subscribe 'keyboardShow'|'keyboardHide'
|
|
|
|
* @since 8
|
|
|
|
* @param type keyboardShow|keyboardHide
|
|
|
|
*/
|
|
|
|
on(type: 'keyboardShow'|'keyboardHide', callback: () => void): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unsubscribe 'keyboardShow'|'keyboardHide'
|
|
|
|
* @since 8
|
|
|
|
* @param type keyboardShow|keyboardHide
|
|
|
|
*/
|
|
|
|
off(type: 'keyboardShow'|'keyboardHide', callback?: () => void): void;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 9
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
|
|
|
interface InputMethodAbility {
|
|
|
|
/**
|
|
|
|
* Subscribe 'inputStart'
|
|
|
|
* @since 9
|
|
|
|
* @param type inputStart
|
|
|
|
* @param callback give keyboard controller and text input client
|
|
|
|
*/
|
|
|
|
on(type: 'inputStart', callback: (kbController: KeyboardController, inputClient: InputClient) => void): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unsubscribe 'inputStart'
|
|
|
|
* @since 9
|
|
|
|
* @param type inputStart
|
|
|
|
* @param callback optional, give keyboard controller and text input client
|
|
|
|
*/
|
|
|
|
off(type: 'inputStart', callback?: (kbController: KeyboardController, inputClient: InputClient) => void): void;
|
|
|
|
|
2022-08-24 09:43:23 +00:00
|
|
|
/**
|
|
|
|
* Subscribe 'inputStop'.
|
|
|
|
* @since 9
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
* @param type inputStop
|
|
|
|
*/
|
2022-08-23 07:09:47 +00:00
|
|
|
on(type: 'inputStop', callback: () => void): void;
|
2022-08-24 09:43:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Unsubscribe 'inputStop'.
|
|
|
|
* @since 9
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
* @param type inputStop
|
|
|
|
*/
|
2022-08-23 07:09:47 +00:00
|
|
|
off(type: 'inputStop', callback: () => void): void;
|
2022-08-24 09:43:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Subscribe 'setCallingWindow'.
|
|
|
|
* @since 9
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
* @param type setCallingWindow
|
|
|
|
*/
|
2022-08-23 07:09:47 +00:00
|
|
|
on(type: 'setCallingWindow', callback: (wid:number) => void): void;
|
2022-08-24 09:43:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Unsubscribe 'setCallingWindow'.
|
|
|
|
* @since 9
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
* @param type setCallingWindow
|
|
|
|
*/
|
2022-08-23 07:09:47 +00:00
|
|
|
off(type: 'setCallingWindow', callback: (wid:number) => void): void;
|
2022-10-10 13:30:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Subscribe 'keyboardShow'|'keyboardHide'
|
|
|
|
* @since 9
|
|
|
|
* @param type keyboardShow|keyboardHide
|
|
|
|
*/
|
2022-03-28 06:07:13 +00:00
|
|
|
on(type: 'keyboardShow'|'keyboardHide', callback: () => void): void;
|
2022-10-10 13:30:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Unsubscribe 'keyboardShow'|'keyboardHide'
|
|
|
|
* @since 9
|
|
|
|
* @param type keyboardShow|keyboardHide
|
|
|
|
*/
|
2022-03-28 06:07:13 +00:00
|
|
|
off(type: 'keyboardShow'|'keyboardHide', callback?: () => void): void;
|
2022-10-10 13:30:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Subscribe 'setSubtype'
|
|
|
|
* @since 9
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
|
|
|
on(type: 'setSubtype', callback: (inputMethodSubtype: InputMethodSubtype) => void): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unsubscribe 'setSubtype'
|
|
|
|
* @since 9
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-11-01 10:05:42 +00:00
|
|
|
off(type: 'setSubtype', callback?: (inputMethodSubtype: InputMethodSubtype) => void): void;
|
2022-02-22 12:37:51 +00:00
|
|
|
}
|
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.inputmethodengine.InputClient
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
interface TextInputClient {
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.inputmethodengine.InputClient.sendKeyFunction
|
|
|
|
*/
|
|
|
|
sendKeyFunction(action: number, callback: AsyncCallback<boolean>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.inputmethodengine.InputClient.sendKeyFunction
|
|
|
|
*/
|
|
|
|
sendKeyFunction(action: number): Promise<boolean>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.inputmethodengine.InputClient.deleteForward
|
|
|
|
*/
|
|
|
|
deleteForward(length: number, callback: AsyncCallback<boolean>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.inputmethodengine.InputClient.deleteForward
|
|
|
|
*/
|
|
|
|
deleteForward(length: number): Promise<boolean>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.inputmethodengine.InputClient.deleteBackward
|
|
|
|
*/
|
|
|
|
deleteBackward(length: number, callback: AsyncCallback<boolean>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.inputmethodengine.InputClient.deleteBackward
|
|
|
|
*/
|
|
|
|
deleteBackward(length: number): Promise<boolean>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.inputmethodengine.InputClient.insertText
|
|
|
|
*/
|
|
|
|
insertText(text: string, callback: AsyncCallback<boolean>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.inputmethodengine.InputClient.insertText
|
|
|
|
*/
|
|
|
|
insertText(text: string): Promise<boolean>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.inputmethodengine.InputClient.getForward
|
|
|
|
*/
|
|
|
|
getForward(length: number, callback: AsyncCallback<string>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.inputmethodengine.InputClient.getForward
|
|
|
|
*/
|
|
|
|
getForward(length: number): Promise<string>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.inputmethodengine.InputClient.getBackward
|
|
|
|
*/
|
|
|
|
getBackward(length: number, callback: AsyncCallback<string>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.inputmethodengine.InputClient.getBackward
|
|
|
|
*/
|
|
|
|
getBackward(length: number): Promise<string>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.inputmethodengine.InputClient.getEditorAttribute
|
|
|
|
*/
|
|
|
|
getEditorAttribute(callback: AsyncCallback<EditorAttribute>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.inputmethodengine.InputClient.getEditorAttribute
|
|
|
|
*/
|
|
|
|
getEditorAttribute(): Promise<EditorAttribute>;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 9
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
|
|
|
interface InputClient {
|
|
|
|
/**
|
|
|
|
* @since 9
|
2022-10-11 06:26:20 +00:00
|
|
|
* @throws {BusinessError} 401 - parameter error.
|
2022-10-10 13:30:16 +00:00
|
|
|
* @throws {BusinessError} 12800003 - input method client error.
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
sendKeyFunction(action: number, callback: AsyncCallback<boolean>): void;
|
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 9
|
2022-11-28 03:25:56 +00:00
|
|
|
* @returns { Promise<boolean> } the promise returned by the function.
|
2022-10-11 06:26:20 +00:00
|
|
|
* @throws {BusinessError} 401 - parameter error.
|
2022-10-10 13:30:16 +00:00
|
|
|
* @throws {BusinessError} 12800003 - input method client error.
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
sendKeyFunction(action: number): Promise<boolean>;
|
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 9
|
2022-10-11 06:26:20 +00:00
|
|
|
* @throws {BusinessError} 401 - parameter error.
|
2022-10-25 10:29:34 +00:00
|
|
|
* @throws {BusinessError} 12800002 - Input method engine error.
|
2022-10-10 13:30:16 +00:00
|
|
|
* @throws {BusinessError} 12800003 - input method client error.
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
deleteForward(length: number, callback: AsyncCallback<boolean>): void;
|
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 9
|
2022-11-28 03:25:56 +00:00
|
|
|
* @returns { Promise<boolean> } the promise returned by the function.
|
2022-10-11 06:26:20 +00:00
|
|
|
* @throws {BusinessError} 401 - parameter error.
|
2022-10-25 10:29:34 +00:00
|
|
|
* @throws {BusinessError} 12800002 - Input method engine error.
|
2022-10-10 13:30:16 +00:00
|
|
|
* @throws {BusinessError} 12800003 - input method client error.
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
deleteForward(length: number): Promise<boolean>;
|
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 9
|
2022-10-11 06:26:20 +00:00
|
|
|
* @throws {BusinessError} 401 - parameter error.
|
2022-10-25 10:29:34 +00:00
|
|
|
* @throws {BusinessError} 12800002 - Input method engine error.
|
2022-10-10 13:30:16 +00:00
|
|
|
* @throws {BusinessError} 12800003 - input method client error.
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
deleteBackward(length: number, callback: AsyncCallback<boolean>): void;
|
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 9
|
2022-11-28 03:25:56 +00:00
|
|
|
* @returns { Promise<boolean> } the promise returned by the function.
|
2022-10-11 06:26:20 +00:00
|
|
|
* @throws {BusinessError} 401 - parameter error.
|
2022-10-25 10:29:34 +00:00
|
|
|
* @throws {BusinessError} 12800002 - Input method engine error.
|
2022-10-10 13:30:16 +00:00
|
|
|
* @throws {BusinessError} 12800003 - input method client error.
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
deleteBackward(length: number): Promise<boolean>;
|
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 9
|
2022-10-11 06:26:20 +00:00
|
|
|
* @throws {BusinessError} 401 - parameter error.
|
2022-10-25 10:29:34 +00:00
|
|
|
* @throws {BusinessError} 12800002 - Input method engine error.
|
2022-10-10 13:30:16 +00:00
|
|
|
* @throws {BusinessError} 12800003 - input method client error.
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-03-22 02:41:09 +00:00
|
|
|
insertText(text: string, callback: AsyncCallback<boolean>): void;
|
2022-02-22 12:37:51 +00:00
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 9
|
2022-11-28 03:25:56 +00:00
|
|
|
* @returns { Promise<boolean> } the promise returned by the function.
|
2022-10-11 06:26:20 +00:00
|
|
|
* @throws {BusinessError} 401 - parameter error.
|
2022-10-25 10:29:34 +00:00
|
|
|
* @throws {BusinessError} 12800002 - Input method engine error.
|
2022-10-10 13:30:16 +00:00
|
|
|
* @throws {BusinessError} 12800003 - input method client error.
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-03-22 02:41:09 +00:00
|
|
|
insertText(text: string): Promise<boolean>;
|
2022-02-22 12:37:51 +00:00
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 9
|
2022-10-11 06:26:20 +00:00
|
|
|
* @throws {BusinessError} 401 - parameter error.
|
2022-10-10 13:30:16 +00:00
|
|
|
* @throws {BusinessError} 12800003 - input method client error.
|
2022-10-25 10:29:34 +00:00
|
|
|
* @throws {BusinessError} 12800006 - Input method controller error.
|
2022-10-10 13:30:16 +00:00
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
getForward(length: number, callback: AsyncCallback<string>): void;
|
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 9
|
2022-11-28 03:25:56 +00:00
|
|
|
* @returns { Promise<string> } the promise returned by the function.
|
2022-10-11 06:26:20 +00:00
|
|
|
* @throws {BusinessError} 401 - parameter error.
|
2022-10-10 13:30:16 +00:00
|
|
|
* @throws {BusinessError} 12800003 - input method client error.
|
2022-10-25 10:29:34 +00:00
|
|
|
* @throws {BusinessError} 12800006 - Input method controller error.
|
2022-10-10 13:30:16 +00:00
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
getForward(length: number): Promise<string>;
|
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 9
|
2022-10-11 06:26:20 +00:00
|
|
|
* @throws {BusinessError} 401 - parameter error.
|
2022-10-10 13:30:16 +00:00
|
|
|
* @throws {BusinessError} 12800003 - input method client error.
|
2022-10-25 10:29:34 +00:00
|
|
|
* @throws {BusinessError} 12800006 - Input method controller error.
|
2022-10-10 13:30:16 +00:00
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-03-28 06:07:13 +00:00
|
|
|
getBackward(length: number, callback: AsyncCallback<string>): void;
|
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 9
|
2022-11-28 03:25:56 +00:00
|
|
|
* @returns { Promise<string> } the promise returned by the function.
|
2022-10-11 06:26:20 +00:00
|
|
|
* @throws {BusinessError} 401 - parameter error.
|
2022-10-10 13:30:16 +00:00
|
|
|
* @throws {BusinessError} 12800003 - input method client error.
|
2022-10-25 10:29:34 +00:00
|
|
|
* @throws {BusinessError} 12800006 - Input method controller error.
|
2022-10-10 13:30:16 +00:00
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-03-28 06:07:13 +00:00
|
|
|
getBackward(length: number): Promise<string>;
|
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 9
|
|
|
|
* @throws {BusinessError} 12800003 - input method client error.
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-03-22 02:41:09 +00:00
|
|
|
getEditorAttribute(callback: AsyncCallback<EditorAttribute>): void;
|
2022-02-22 12:37:51 +00:00
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 9
|
2022-11-28 03:25:56 +00:00
|
|
|
* @returns { Promise<EditorAttribute> } the promise returned by the function.
|
2022-10-10 13:30:16 +00:00
|
|
|
* @throws {BusinessError} 12800003 - input method client error.
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
getEditorAttribute(): Promise<EditorAttribute>;
|
2022-08-23 07:09:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Move cursor from input method.
|
|
|
|
*
|
|
|
|
* @since 9
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
* @param direction Indicates the distance of cursor to be moved.
|
2022-10-11 06:26:20 +00:00
|
|
|
* @throws {BusinessError} 401 - parameter error.
|
2022-10-10 13:30:16 +00:00
|
|
|
* @throws {BusinessError} 12800003 - input method client error.
|
2022-08-23 07:09:47 +00:00
|
|
|
*/
|
|
|
|
moveCursor(direction: number, callback: AsyncCallback<void>): void;
|
|
|
|
|
|
|
|
/**
|
2022-11-01 10:05:42 +00:00
|
|
|
* Move cursor from input method.
|
2022-08-23 07:09:47 +00:00
|
|
|
*
|
|
|
|
* @since 9
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
* @param direction Indicates the distance of cursor to be moved.
|
2022-11-28 03:25:56 +00:00
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
2022-10-11 06:26:20 +00:00
|
|
|
* @throws {BusinessError} 401 - parameter error.
|
2022-10-10 13:30:16 +00:00
|
|
|
* @throws {BusinessError} 12800003 - input method client error.
|
2022-08-23 07:09:47 +00:00
|
|
|
*/
|
|
|
|
moveCursor(direction: number): Promise<void>;
|
2022-02-22 12:37:51 +00:00
|
|
|
}
|
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
interface KeyboardDelegate {
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* Subscribe key up or down event
|
|
|
|
*
|
|
|
|
* @since 8
|
|
|
|
*/
|
2022-03-28 06:07:13 +00:00
|
|
|
on(type: 'keyDown'|'keyUp', callback: (event: KeyEvent) => boolean): void;
|
2022-02-22 12:37:51 +00:00
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* Unsubscribe key up or down event
|
|
|
|
*
|
|
|
|
* @since 8
|
|
|
|
*/
|
2022-03-28 06:07:13 +00:00
|
|
|
off(type: 'keyDown'|'keyUp', callback?: (event: KeyEvent) => boolean): void;
|
2022-02-22 12:37:51 +00:00
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* Subscribe cursor context change
|
|
|
|
*
|
|
|
|
* @since 8
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
on(type: 'cursorContextChange', callback: (x: number, y: number, height: number) => void): void;
|
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* Unsubscribe cursor context change
|
|
|
|
*
|
|
|
|
* @since 8
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
off(type: 'cursorContextChange', callback?: (x: number, y: number, height: number) => void): void;
|
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* Subscribe selection change
|
|
|
|
*
|
|
|
|
* @since 8
|
|
|
|
*/
|
2022-03-28 06:07:13 +00:00
|
|
|
on(type: 'selectionChange', callback: (oldBegin: number, oldEnd: number, newBegin: number, newEnd: number) => void): void;
|
2022-02-22 12:37:51 +00:00
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* Unsubscribe selection change
|
|
|
|
*
|
|
|
|
* @since 8
|
|
|
|
*/
|
2022-03-28 12:59:32 +00:00
|
|
|
off(type: 'selectionChange', callback?: (oldBegin: number, oldEnd: number, newBegin: number, newEnd: number) => void): void;
|
2022-02-22 12:37:51 +00:00
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* Subscribe text change
|
|
|
|
*
|
|
|
|
* @since 8
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
on(type: 'textChange', callback: (text: string) => void): void;
|
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* Unsubscribe text change
|
|
|
|
*
|
|
|
|
* @since 8
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
off(type: 'textChange', callback?: (text: string) => void): void;
|
|
|
|
}
|
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
interface EditorAttribute {
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* Editor's pattern
|
|
|
|
*
|
|
|
|
* @since 8
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
readonly inputPattern: number;
|
2022-10-10 13:30:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Editor's key type
|
|
|
|
*
|
|
|
|
* @since 8
|
|
|
|
* @syscap SystemCapability.MiscServices.InputMethodFramework
|
|
|
|
*/
|
2022-02-22 12:37:51 +00:00
|
|
|
readonly enterKeyType: number;
|
|
|
|
}
|
2022-03-17 01:26:02 +00:00
|
|
|
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* @since 8
|
|
|
|
*/
|
2022-03-17 01:26:02 +00:00
|
|
|
interface KeyEvent {
|
2022-10-10 13:30:16 +00:00
|
|
|
/**
|
|
|
|
* Key code
|
|
|
|
*
|
|
|
|
* @since 8
|
|
|
|
*/
|
2022-03-17 01:26:02 +00:00
|
|
|
readonly keyCode: number;
|
2022-10-10 13:30:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Key action
|
|
|
|
*
|
|
|
|
* @since 8
|
|
|
|
*/
|
2022-03-17 01:26:02 +00:00
|
|
|
readonly keyAction: number;
|
|
|
|
}
|
2022-02-22 12:37:51 +00:00
|
|
|
}
|
|
|
|
|
2022-11-01 10:05:42 +00:00
|
|
|
export default inputMethodEngine;
|