Repository navigation
feat(edit-any-page): autofocus input and confirm on Enter - #30
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Co-authored-by: 机智的小鱼君 <44761872+dragon-fish@users.noreply.github.com>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
审查者指南该插件现在集中处理有效的页面提交,支持通过回车键确认编辑并在成功后关闭模态框,同时在模态框打开时自动聚焦并全选页面名称输入框。 任意页面编辑提交的时序图sequenceDiagram
actor User
participant Plugin as EditAnyPagePlugin
participant Modal
participant QuickEdit
User->>Plugin: Open edit-any-page
Plugin->>Modal: confirm(pageNameForm)
Plugin->>Plugin: requestAnimationFrame()
Plugin->>Plugin: input.focus()
Plugin->>Plugin: input.select()
User->>Plugin: Press Enter
Plugin->>Plugin: submit()
alt page name is valid
Plugin->>QuickEdit: quickEdit(title: pageName)
Plugin->>Modal: close()
else page name is empty
Plugin-->>User: Keep modal open
end
文件级变更
针对关联 issue 的评估
可能关联的 issue
提示和命令与 Sourcery 交互
自定义使用体验访问你的仪表板:
获取帮助Original review guide in EnglishReviewer's GuideThe plugin now centralizes valid page submission, supports confirming the edit via Enter with successful modal closure, and autofocuses/selects the page-name input when the modal opens. Sequence diagram for edit-any-page submissionsequenceDiagram
actor User
participant Plugin as EditAnyPagePlugin
participant Modal
participant QuickEdit
User->>Plugin: Open edit-any-page
Plugin->>Modal: confirm(pageNameForm)
Plugin->>Plugin: requestAnimationFrame()
Plugin->>Plugin: input.focus()
Plugin->>Plugin: input.select()
User->>Plugin: Press Enter
Plugin->>Plugin: submit()
alt page name is valid
Plugin->>QuickEdit: quickEdit(title: pageName)
Plugin->>Modal: close()
else page name is empty
Plugin-->>User: Keep modal open
end
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
嘿——我发现了 1 个问题
给 AI Agent 的提示
请处理这次代码审查中的评论:
## 单独评论
### 评论 1
<location path="packages/edit-any-page/src/index.ts" line_range="46-49" />
<code_context>
}
)
+ // Press Enter to confirm
+ form.addEventListener('submit', (e) => {
+ e.preventDefault()
+ if (submit()) {
+ modal?.close?.()
+ }
+ })
</code_context>
<issue_to_address>
**按 Enter 键不会提交表单**
当浏览器不会在没有提交按钮的情况下隐式提交表单时,由于该表单不包含提交按钮,因此要求默认提交按钮才能进行隐式提交的浏览器,在文本输入框中按下 Enter 键时不会派发 `submit` 事件。此监听器永远不会运行,页面也不会打开以供编辑。
向表单添加一个提交按钮(可以将其设为视觉隐藏),这样按下 Enter 键就会触发表单提交处理程序。
</issue_to_address>Sourcery 评估
等待批准。 请先处理 1 个发现的问题。
阻塞性发现:packages/edit-any-page/src/index.ts:49
Original comment in English
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="packages/edit-any-page/src/index.ts" line_range="46-49" />
<code_context>
}
)
+ // Press Enter to confirm
+ form.addEventListener('submit', (e) => {
+ e.preventDefault()
+ if (submit()) {
+ modal?.close?.()
+ }
+ })
</code_context>
<issue_to_address>
**Enter does not submit the form**
When the browser does not implicitly submit a form without a submit button, the form contains no submit button, so browsers that require a default submit button for implicit submission do not dispatch a `submit` event when Enter is pressed in the text input. This listener never runs and the page is not opened for editing.
Add a submit button to the form (it can be visually hidden) so Enter activates the form submission handler.
</issue_to_address>Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: packages/edit-any-page/src/index.ts:49
| form.addEventListener('submit', (e) => { | ||
| e.preventDefault() | ||
| if (submit()) { | ||
| modal?.close?.() |
There was a problem hiding this comment.
🟠 高优先级 · 按 Enter 键不会提交表单
当浏览器不会在没有提交按钮的情况下隐式提交表单时,由于该表单不包含提交按钮,因此要求默认提交按钮才能进行隐式提交的浏览器,在文本输入框中按下 Enter 键时不会派发 submit 事件。此监听器永远不会运行,页面也不会打开以供编辑。
向表单添加一个提交按钮(可以将其设为视觉隐藏),这样按下 Enter 键就会触发表单提交处理程序。
给 AI Agent 的提示
在 `packages/edit-any-page/src/index.ts` 的第 46-49 行:
**按 Enter 键不会提交表单**
当浏览器不会在没有提交按钮的情况下隐式提交表单时,由于该表单不包含提交按钮,因此要求默认提交按钮才能进行隐式提交的浏览器,在文本输入框中按下 Enter 键时不会派发 `submit` 事件。此监听器永远不会运行,页面也不会打开以供编辑。
向表单添加一个提交按钮(可以将其设为视觉隐藏),这样按下 Enter 键就会触发表单提交处理程序。Original comment in English
🟠 High · Enter does not submit the form
When the browser does not implicitly submit a form without a submit button, the form contains no submit button, so browsers that require a default submit button for implicit submission do not dispatch a submit event when Enter is pressed in the text input. This listener never runs and the page is not opened for editing.
Add a submit button to the form (it can be visually hidden) so Enter activates the form submission handler.
Prompt for AI agents
In `packages/edit-any-page/src/index.ts` at lines 46-49:
**Enter does not submit the form**
When the browser does not implicitly submit a form without a submit button, the form contains no submit button, so browsers that require a default submit button for implicit submission do not dispatch a `submit` event when Enter is pressed in the text input. This listener never runs and the page is not opened for editing.
Add a submit button to the form (it can be visually hidden) so Enter activates the form submission handler.|
@claude 你可以安装 @inpageedit/core 依赖,确认一下接口类型是否正确,可能不需要复杂的 modal?.close?.() 守卫 |
|
Claude finished @dragon-fish's task in 20s —— View job Couldn't verify the
|
|
@claude 给你加上了权限 |
|
Claude finished @dragon-fish's task in 28s —— View job 已按类型定义简化 modal 守卫
结论: 在 改动(
我跑了 关于 Sourcery 的「Enter 不会提交」意见: 我没改这部分,也没在浏览器里测试。按 HTML 规范,只有一个会阻止隐式提交的文本输入框的表单,即使没有提交按钮,按 Enter 也会触发 |
Co-authored-by: 机智的小鱼君 <44761872+dragon-fish@users.noreply.github.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Deploying ipe-plugin-registry with
|
| Latest commit: |
61e8fc5
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://e6d2bd21.plugin-registry.pages.dev |
| Branch Preview URL: | https://claude-issue-27-20261007-142.plugin-registry.pages.dev |
close #27
Sourcery 摘要
通过自动选择输入内容和键盘确认功能,改进任意页面编辑对话框。
新功能:
增强功能:
Original summary in English
Sourcery 总结
改进编辑任意页面的对话框,提供更快捷的键盘确认方式和更便捷的初始输入状态。
新功能:
增强功能:
Original summary in English
Summary by Sourcery
Improve the edit-any-page dialog with faster keyboard confirmation and a more convenient initial input state.
New Features:
Enhancements: