Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Add a Copy code button to the interview editor

未关闭 适合新手
#318 0 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 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

  1. Enter code in the editor.
  2. Click "Copy code".
  3. Paste the clipboard contents into another text editor.
  4. Verify that the copied code matches the original, including whitespace and line breaks.
  5. Verify that clicking the button does not modify the editor content.
  6. 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 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

sysprog21/codetrial 的其他 Issue

查看 sysprog21/codetrial 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。