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:
@@ -71,6 +71,8 @@ AI 面板支持两种模式:
|
||||
- 对话模式:根据当前报告内容和图片上下文回答问题。
|
||||
- 修改模式:选中 `.ai-region` 后要求模型返回 JSON,其中包含 `reply` 和 `updatedHtml`。
|
||||
|
||||
编辑器会监听正文中的 `.ai-region` 变化;用户插入新的 AI 可编辑区域后,AI 撰写面板的目标下拉栏会立即更新,不需要离开页面或刷新。
|
||||
|
||||
模型返回 HTML 后,系统会清理换行和 `<br>`,生成差异预览。用户确认后才写入目标 `.ai-content`。
|
||||
|
||||
当前 AI 调用使用后端代理:
|
||||
|
||||
Reference in New Issue
Block a user