Skip to content

fix: prevent revert when deleting all script in script editor.#563

Merged
MakinoharaShoko merged 1 commit intoOpenWebGAL:devfrom
fltLi:fix/deletion-revert
Mar 14, 2026
Merged

fix: prevent revert when deleting all script in script editor.#563
MakinoharaShoko merged 1 commit intoOpenWebGAL:devfrom
fltLi:fix/deletion-revert

Conversation

@fltLi
Copy link

@fltLi fltLi commented Feb 22, 2026

fix: #562

原来的代码把空字符串误判为无效更改, 此处增加对空字符串的特判, 使其生效.

persist empty content to prevent revert when deleting all script.
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @fltLi, 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!

此拉取请求旨在解决脚本编辑器中一个关键的可用性问题。在之前的实现中,当用户清空脚本编辑器中的所有内容时,系统会错误地将空字符串判断为无效输入,从而导致编辑器的内容被意外地回滚到之前的状态。本次更改通过引入对空字符串的明确处理,确保了用户能够成功保存一个空的脚本文件,从而提升了编辑器的稳定性和用户体验。

Highlights

  • 修复脚本编辑器中的空字符串处理: 解决了当用户在脚本编辑器中删除所有内容(导致空字符串)时,系统错误地将其视为无效更改并导致内容回滚的问题。通过增加对空字符串的特殊判断,确保其能被正确保存。
Changelog
  • packages/origine2/src/pages/editor/TextEditor/TextEditor.tsx
    • 修复了当value为空字符串时,currentText.current不会被更新的问题。
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
Contributor

@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

The pull request addresses a bug where deleting all script content in the editor was not recognized as a valid change, leading to unintended reverts. The fix correctly handles empty string values, ensuring that such changes are persisted. The change is minimal and directly targets the reported issue, improving the editor's robustness.

@MakinoharaShoko MakinoharaShoko changed the base branch from main to dev March 14, 2026 09:50
@MakinoharaShoko MakinoharaShoko merged commit affdc95 into OpenWebGAL:dev Mar 14, 2026
6 checks passed
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.

[bug] 在脚本编辑器中一次性删除全部文本后切至其他界面, 会回退删除.

3 participants