Skip to content

ohos: change enableSelection to copyOption#73

Open
GithubGaoYang wants to merge 1 commit into
antgroup:mainfrom
GithubGaoYang:main
Open

ohos: change enableSelection to copyOption#73
GithubGaoYang wants to merge 1 commit into
antgroup:mainfrom
GithubGaoYang:main

Conversation

@GithubGaoYang
Copy link
Copy Markdown

将 enableSelection 改为 copyOption

查看源码发现,enableSelection 仅用于设置 copyOption(源码),鉴于 CopyOptions 存在多个枚举值,只暴露 enableSelection 接口在使用上存在局限性,相比之下,暴露 CopyOptions 配置接口会更加灵活并便于开发者自定义复制选项。

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求旨在提升文本组件的复制功能灵活性。通过将单一的布尔开关 enableSelection 升级为支持多种枚举值的 copyOption,开发者现在可以更精确地控制文本的复制行为,例如指定复制到应用内或本地设备,从而增强了组件的可配置性和用户体验。

Highlights

  • 优化文本复制选项配置: 将 ITextComponentSelectionOption 接口中的布尔类型 enableSelection 字段替换为更灵活的 CopyOptions 枚举类型 copyOption,从而允许开发者自定义更细粒度的复制行为。
  • 更新 TextComponent 内部逻辑: 修改了 TextComponent 中 copyOption 的设置方式,直接使用 selectionOption.copyOption 的值,取代了之前基于 enableSelection 的条件判断。
  • 示例代码同步更新: 在 board.ets 和 feature-detail.ets 示例文件中,更新了 onMarkdownTextComponentSelectionOption 回调,将 enableSelection: true 的用法迁移至 copyOption: CopyOptions.LocalDevice。

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • HarmonyOS/markdown/src/main/ets/render/component/text.ets
    • 更新了 TextComponent 中 copyOption 的设置逻辑,直接使用 selectionOption.copyOption。
    • 在 ITextComponentSelectionOption 接口中,将 enableSelection 字段替换为 copyOption。
  • HarmonyOS/playground/src/main/ets/pages/board.ets
    • 更新了 board 组件中 onMarkdownTextComponentSelectionOption 回调的实现,使用 copyOption: CopyOptions.LocalDevice。
  • HarmonyOS/playground/src/main/ets/pages/feature-detail.ets
    • 更新了 feature-detail 组件中 onMarkdownTextComponentSelectionOption 回调的实现,使用 copyOption: CopyOptions.LocalDevice。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

本次 PR 将 enableSelection 属性修改为 copyOption,以支持更灵活的文本复制选项。此变更涉及 ITextComponentSelectionOption 接口的更新,以及在 TextComponent 中处理该选项的逻辑。同时,Playground 示例中的相关用法也已相应更新。整体变更清晰,符合 PR 描述的目标。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant