fix(desktop): copy rendered text instead of Markdown (#7454)

Merged
AN
1mo ago
+93-6

What & why

Fixes #7454

Rendered Markdown used the Markdown serializer for the clipboard text/plain payload. As a result, copying inline code or a fenced block into a plain-text destination included backticks and fences.

Cmd/Ctrl+C now copies the rendered text instead. Markdown remains available explicitly through Copy as Markdown in the selection context menu, including in editable Markdown views. The TipTap Markdown extension's second copied-text serializer is disabled so it cannot overwrite the plain-text result. Added translations for the new action.

How I tested it

  • bun test apps/desktop/src/renderer/components/MarkdownRenderer/components/TipTapMarkdownRenderer/serializeMarkdownTable.test.ts — 14 pass. The regression test was RED before the change (**hi** returned) and GREEN after (hi). Existing whole-table GFM and partial-table plain-text cases remain covered.
  • bun run lint — pass (7,919 files).
  • bun run check:i18n — pass for all locales.
  • bun run typecheck cannot complete in this isolated worktree because its package-local dependencies are absent (@superset/typescript/internal-package.json, bun-types). A desktop tsc check from the available dependency-bearing checkout has existing unrelated errors, but none in the five modified Markdown files.

Checklist

  • PR title follows conventional commits (type(scope): subject)
  • bun run lint passes
  • bun run typecheck passes (blocked by the isolated worktree dependency layout above)
  • "Allow edits from maintainers" is checked on this fork PR

Summary by cubic

Fixes copying in rendered Markdown so Cmd/Ctrl+C copies visible text instead of Markdown source (e.g. **hi** → hi); previously backticks and fences leaked into plain-text destinations. Markdown remains available through a new "Copy as Markdown" item in the selection context menu on read-only views.

  • The context menu stays off editable Markdown views so they keep the native Paste/Cut/Undo menu and spellcheck.
  • Whole-table copies still produce GFM Markdown; all other table-touching selections produce plain text.
  • Disabled the TipTap Markdown extension's transformCopiedText so it can't override the plain-text clipboard payload.
  • Added translations for "Copy as Markdown" across all locales.

Summary by CodeRabbit

  • New Features

    • Added a Copy as Markdown option to the text selection menu.
    • Use it to copy selected content with Markdown formatting. Standard copy continues to copy plain text outside tables; complete table selections are copied as Markdown.
  • Localization

    • Added translations for Copy as Markdown across supported languages.