Skip to content

fix: 结果区更新时保留「复制」按钮 - #6

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-inspection-0b0d
Draft

fix: 结果区更新时保留「复制」按钮#6
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-inspection-0b0d

Conversation

@cursor

@cursor cursor Bot commented May 11, 2026

Copy link
Copy Markdown

Bug and impact

Multiple tools write output with element.textContent = ... on the shared .result-box container that also holds the per-box 复制 button. In the DOM, assigning textContent on a parent replaces all descendants with a single text node, so the copy control disappeared after the first successful operation (JSON 格式化、Base64、时间戳、Hash、UUID 等). Users lost one-click copy for the rest of the session unless they reloaded the page.

Root cause

textContent on the parent result-box clears child nodes, including the <button class="copy-btn">.

Fix

  • Wrap placeholder output in <span class="result-text"> in each affected panel.
  • Add setResultBoxText(boxId, text) to update only that span.
  • Point copyResult at .result-text when present.

Validation

  • Parsed the inline <script> with new Function(...) under Node to confirm syntax.
  • Manual expectation: run any tool that fills a result box; the 复制 button remains visible and still copies the result text.

No automated test harness exists in this static single-file repo.

Open in Web View Automation 

Assigning textContent on result containers removed all child nodes,
including the per-box copy button, after the first tool output.

Co-authored-by: Muki182 <Muki182@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant