Add a Copy code button to the interview editor
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 80/100
- Issue 类型
- 功能
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- css, html, javascript
- 领域
- frontend
调研方向
先从 web/interview.html 中的编辑器标记开始,然后找到 web/interview.js 在哪里设置编辑器及其事件处理程序。在编辑器旁边添加一个按钮,它读取编辑器中的全部文本,并使用 Clipboard API 将其写入剪贴板,短暂显示 "Copied!" 提示,编辑器为空时禁用自身,并捕获权限错误。在 web/styles.css 中为其设置样式,使其与现有控件保持一致。完成的标准是:粘贴到其他地方得到的文本完全一致,且编辑器的内容、光标和选区保持不变。
由索引模型根据 Issue 内容生成。
描述
Description
Currently, candidates need to manually select all text in the code editor and copy it using keyboard shortcuts.
Adding a "Copy code" button would provide a convenient way to copy the current solution for debugging, reviewing, or sharing after practice.
Expected Behavior
- Add a "Copy code" button near the code editor.
- Clicking the button copies the entire current editor content to the clipboard.
- Display brief feedback such as "Copied!" after a successful copy.
- Disable the button when the editor is empty.
- Handle clipboard permission errors gracefully.
- Preserve the editor content, cursor position, and selection.
Suggested Implementation
The relevant files are:
web/interview.html— Add the button to the editor interface.web/interview.js— Handle the copy action using the Clipboard API.web/styles.css— Style the button consistently with the existing interface.
Testing
- Enter code in the editor.
- Click "Copy code".
- Paste the clipboard contents into another text editor.
- Verify that the copied code matches the original, including whitespace and line breaks.
- Verify that clicking the button does not modify the editor content.
- Verify the behavior when the editor is empty or clipboard access fails.
Motivation
This small usability improvement reduces repetitive manual actions and makes it easier for candidates to review their code outside CodeTrial.
- 主要语言
- Rust
- 星标
- 160
- 派生
- 64
- 平均合并
- 1 天 10 小时
- 30 天内合并 PR
- 112
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
sysprog21/codetrial 的其他 Issue
-
Four problem loader browser tests fail on Windows可能已有人在做 @Patriciaath999 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
sysprog21/codetrial#317 · 2 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
Highlight the active line in the code editor可能已有人在做 @ArthurArthurArthur0817 于 8 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
sysprog21/codetrial#247 · 3 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 35/100
维护者通常 1 天内回复
-
Allow users to start an interview without GitHub sign-in可能已有人在做 @TMQ0717 今天认领。 未关闭
sysprog21/codetrial#316 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 sysprog21/codetrial 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
starkware-libs/sequencer#15229 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 66/100
ActivityWatch/aw-notify-rs#47 · 1 条评论 ·
-
`inverse()` of a controlled `CUGate` drops the phase parameter γ可能已有人在做 @rupasri118 今天认领。 未关闭bug mod: circuit
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复