Skip to content

fix(toolbar): isolate consecutive command history - #368

Open
sssssirius7 wants to merge 1 commit into
floatboatai:mainfrom
sssssirius7:fix/toolbar-atomic-transactions
Open

sssssirius7 wants to merge 1 commit into
floatboatai:mainfrom
sssssirius7:fix/toolbar-atomic-transactions

Conversation

@sssssirius7

@sssssirius7 sssssirius7 commented Sep 23, 2026 •

Copy link
Copy Markdown

Summary / 摘要

Motivation / 背景与动机

  • Issue: #283
  • Roadmap (docs/ROADMAP.md): N/A — bug fix for existing Toolbar commands; no new roadmap item.
  • OpenSpec change: Pending — this PR adds the opt-in public replaceRange history-isolation option.

Changes / 变更内容

  • packages/core:

    • Add the opt-in isolateHistory option to EditorAPI.replaceRange().
    • Use CodeMirror's full history isolation only when the option is enabled.
    • Clarify replacement and selection coordinate semantics in the public API docs.
    • Add core regression coverage for consecutive isolated edits.
  • packages/plugin-*:

    • Migrate Toolbar editing commands from setDocument() + setSelection() to atomic replaceRange().
    • Enable isolated history entries for consecutive Toolbar operations.
    • Cover formatting commands, links, headings, blockquotes, lists, code blocks, images, colors, highlights, horizontal rules, and the Normal text menu action.
    • Add regression tests for selections, undo behavior, consecutive commands, and IME composition flushing.
  • apps/electron-demo:

    • No changes.
  • openspec/:

    • No proposal added yet; pending maintainer guidance for the new optional public API.

Testing / 测试

  • pnpm test passes / 全绿
    未运行全量测试;已运行受影响测试,共 97 个用例通过。
  • Affected packages build (pnpm build) / 受影响包构建通过
    @floatboat/nexus-core和@floatboat/nexus-plugin-toolbar` 构建通过。
  • New / updated vitest cases / 新增或更新的 vitest 用例:
    Added coverage for atomic replacement, isolated Toolbar history, exact selections, consecutive Toolbar undo, Normal text UI action, and IME composition flushing.
  • Manual UI check in electron-demo / electron-demo 手动验证:

Compliance / 合规自检

  • CLA signed — first-time contributors will be prompted automatically by the CLA bot / 首次贡献者按 CLA 机器人提示签署
  • AI disclosure: the functional code in this PR is not primarily generated by AI. AI assistance, if any, is described below.
    AI-assisted notes / AI 使用说明:

    AI tools assisted with code exploration, implementation, test authoring, and review.
  • New dependencies (if any) listed with license & rationale (none if blank):
  • No build artifacts committed (dist/, dist-electron/, compiled .js from .ts) / 未提交构建产物
  • No secrets / .env / personal vault data committed / 无敏感信息

Checklist / 自检清单

  • Title follows Conventional Commits / 标题遵循 Conventional Commits
  • Public API changes update package README / types — 改了公共 API 已同步 README 与类型
  • Touched live-preview-table.ts → walked through the 12 Table Widget rules in CLAUDE.md / 已核对 12 条表格规则
  • New capability / breaking change → OpenSpec proposal linked / 新 capability 或破坏性变更已附 OpenSpec
  • Change aligns with project scope (GOVERNANCE.md §4) / 改动符合 GOVERNANCE.md §4 的项目范围

Screenshots / Recordings · 截图或录屏 (UI changes)

@CLAassistant

CLAassistant commented Sep 23, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

This branch has not been deployed

No deployments
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.

2 participants