!6097 【sdk】【需求】imf_文本编辑一致性实现

Merge pull request !6097 from cy7717/master
This commit is contained in:
openharmony_ci 2023-07-10 09:39:13 +00:00 committed by Gitee
commit 58ade63967
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -958,6 +958,78 @@ declare namespace inputMethod {
* @since 10
*/
off(type: 'handleExtendAction'): void;
/**
* Register a callback and when input method ability gets left text of cursor, the callback will be invoked.
*
* @param { 'getLeftTextOfCursor' } type - event type, fixed as 'getLeftTextOfCursor'.
* @param { function } callback - processes getLeftTextOfCursor command. The callback
* must be a synchronization method and will block the input method application.
* @throws { BusinessError } 401 - parameter error.
* @throws { BusinessError } 12800009 - input method client is detached.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
on(type: 'getLeftTextOfCursor', callback: (length: number) => string): void;
/**
* Unregister the callback of getLeftTextOfCursor event.
*
* @param { 'getLeftTextOfCursor' } type - event type, fixed as 'getLeftTextOfCursor'.
* @param { function } [callback] - the callback of 'getLeftTextOfCursor',
* when subscriber unsubscribes all callback functions of event 'getLeftTextOfCursor', this parameter can be left blank.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
off(type: 'getLeftTextOfCursor', callback?: (length: number) => string): void;
/**
* Register a callback and when input method ability gets right text of cursor, the callback will be invoked.
*
* @param { 'getRightTextOfCursor' } type - event type, fixed as 'getRightTextOfCursor'.
* @param { function } callback - processes getRightTextOfCursor command. The callback
* must be a synchronization method and will block the input method application.
* @throws { BusinessError } 401 - parameter error.
* @throws { BusinessError } 12800009 - input method client is detached.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
on(type: 'getRightTextOfCursor', callback: (length: number) => string): void;
/**
* Unregister the callback of getRightTextOfCursor event.
*
* @param { 'getRightTextOfCursor' } type - event type, fixed as 'getRightTextOfCursor'.
* @param { function } [callback] - the callback of 'getRightTextOfCursor',
* when subscriber unsubscribes all callback functions of event 'getRightTextOfCursor', this parameter can be left blank.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
off(type: 'getRightTextOfCursor', callback?: (length: number) => string): void;
/**
* Register a callback and when input method ability gets the text index at cursor, the callback will be invoked.
*
* @param { 'getTextIndexAtCursor' } type - event type, fixed as 'getTextIndexAtCursor'.
* @param { function } callback - processes getTextIndexAtCursor command. The callback
* must be a synchronization method, and should return the text index at the cursor.
* @throws { BusinessError } 401 - parameter error.
* @throws { BusinessError } 12800009 - input method client is detached.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
on(type: 'getTextIndexAtCursor', callback: () => number): void;
/**
* Unregister the callback of getTextIndexAtCursor.
*
* @param { 'getTextIndexAtCursor' } type - event type, fixed as 'getTextIndexAtCursor'.
* @param { function } [callback] - the callback of 'getTextIndexAtCursor',
* when subscriber unsubscribes all callback functions of event 'getTextIndexAtCursor', this parameter can be left blank.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
off(type: 'getTextIndexAtCursor', callback?: () => number): void;
}
/**