openharmony 鸿蒙 changelogs-selectionfwk

2026-08-25 浏览 (1)

Word Selection Service Framework Changelog

cl.selectionfwk.1 The text Property Is Deleted from SelectionInfo Returned by the Word Selection Notification API

Access Level

System API

Change Reason

When the selection service detects that the user selects text, the returned SelectionInfo no longer contains the text property. In addition, the getSelectionContent method is used to obtain the selected text content, thereby decoupling the word selection notification from the text content acquisition.

Change Impact

Application adaptation is required.

The decoupling of the word selection notification from the text content acquisition allows you to handle the behavior more flexibly after the word selection event is listened for. In addition, the text property is no longer returned, which may affect the existing code logic that depends on this property. You need to adjust the code logic based on the new API specifications.

Start API Level

22

Change Since

OpenHarmony SDK 6.0.0.51

Key API/Component Changes

ClassProperty Deleted
SelectionInfotext: string

Adaptation Guide

You need to adjust the existing code logic based on the new API specifications. After the word selection event is listened for, the getSelectionContent method is used to obtain the selected text content.

selectionManager.on('selectionCompleted', async (info: selectionManagerSelectionInfo) => {
  try {
    let content = await selectionManager.getSelectionContent();
  } catch (err) {
    console.error(`Failed to get selection content: ${JSON.stringify(err)}`);
  }
});

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 i18n-ui-design

openharmony 鸿蒙 i18n-sorting-local

openharmony 鸿蒙 i18n-numbers-weights-measures

openharmony 鸿蒙 i18n-l10n

openharmony 鸿蒙 i18n-preferred-language

openharmony 鸿蒙 Readme-EN

openharmony 鸿蒙 i18n-language-region-display

openharmony 鸿蒙 pseudo-i18n-testing-translation

openharmony 鸿蒙 i18n-calendar

openharmony 鸿蒙 i18n-dst-transition

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/OFCzxQAQ