Sync inserted AI regions immediately

- Track report editor AI regions in React state instead of only scanning contentEditable DOM during render.

- Observe editor AI region mutations and refresh the AI writing target dropdown without requiring page navigation or refresh.

- Select newly inserted AI regions immediately after insertion and keep a live DOM fallback for generation.

- Harden AI region insertion so it still appends the region if execCommand has no active editor selection.

- Escape AI region names before injecting template HTML and add an accessible label for the insert button.

- Add Playwright coverage for inserting an AI region and seeing it immediately in the AI writing dropdown.

- Update report editor, feature, progress, testing, and AGENTS documentation for AI region synchronization.
This commit is contained in:
2026-05-02 04:08:48 +08:00
parent 5a4056d899
commit 7631ae34ce
7 changed files with 101 additions and 15 deletions

View File

@@ -343,7 +343,7 @@ PostgreSQL 数据模型。当前覆盖 `Tenant`、`Department`、`User`、`UserS
- 报告管理按角色过滤
- 管理员本部门报告范围和医生本人报告范围
- 模板可用范围,含部门模板和医生个人模板
- Playwright E2E 通过真实后端 API seed 覆盖登录、报告权限、报告修订版本、医生个人模板、模板管理新增保存、路由守卫和审计日志
- Playwright E2E 通过真实后端 API seed 覆盖登录、报告权限、报告修订版本、报告 AI 区域同步、医生个人模板、模板管理新增保存、路由守卫和审计日志
- 后端权限策略覆盖报告、模板、用户管理和管理员创建规则
- 后端 Dashboard 统计按角色范围过滤
- 后端报告 metadata 兼容映射和 `ReportMedia` 视频/关键帧组装