Skip to content

Copy chat answers and show them as raw text - #416

Merged
besessener merged 1 commit into
mainfrom
ccr-c76d696c-itzhrh
Oct 21, 2026
Merged

besessener merged 1 commit into
mainfrom
ccr-c76d696c-itzhrh

Conversation

@besessener

@besessener besessener commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

What

Two small buttons now sit under every finished chat answer:

  • „Antwort kopieren“ copies the answer to the clipboard exactly as written (the Markdown source). A check mark shows for 2 s when it works. If the copy fails, a toast tells the user to select the text and press Ctrl+C.
  • „Als Rohtext anzeigen“ (aria-pressed) switches that one answer between the formatted view and its unformatted text, shown in a selectable <pre>.

Why the permission change

The Electron session handler denied every permission except the microphone, so navigator.clipboard.writeText was rejected with NotAllowedError: Write permission denied (I confirmed this with a probe in the E2E app). permissions.ts now also grants clipboard-sanitized-write, under the same conditions as the microphone: main window only, Archivist's own origin. Reading the clipboard (clipboard-read, deprecated-sync-clipboard-read) stays denied. Pasting with Ctrl+V needs no permission.

Docs

  • docs/reference/funktionen.md: chat section describes copying and the raw-text switch.
  • docs/reference/aktionsstufen.md: the Electron section now lists two permission exceptions instead of one.

Tests

  • Unit (tests/unit/desktop-permissions.test.ts): clipboard writes are allowed only for the main window's own pages, and reads are never allowed. This covers both the request handler and the check handler.
  • E2E (tests/e2e/chat-copy.spec.ts, via the chat page object): the copy button puts the exact Markdown on the system clipboard (read back through Electron's clipboard), and the raw-text switch shows the unformatted text and toggles back.

Local gates: typecheck, format:check, lint, depcruise, knip, test:coverage (3140 tests), the full Playwright suite (181 passed) and prek all pass. gitleaks and zizmor could not run here because there was no network access for their downloads.

🤖 Generated with Claude Code

https://claude.ai/code/session_012XEC1k66v7QL5XagMjdKr9

Each answer gets „Antwort kopieren“ (copies the Markdown as written) and a
„Als Rohtext anzeigen“ switch that shows the unformatted text. The main
window may now write to the clipboard (clipboard-sanitized-write); reading
it stays denied.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012XEC1k66v7QL5XagMjdKr9
@besessener
besessener marked this pull request as ready for review October 21, 2026 20:35
@besessener
besessener merged commit f742399 into main Oct 21, 2026
6 checks passed
@besessener
besessener deleted the ccr-c76d696c-itzhrh branch October 21, 2026 20:35
@besessener besessener mentioned this pull request Oct 22, 2026
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.

2 participants