Skip to content

Copy to clipboard: stop replacing apostrophes with backticks - #281

Merged
maboa merged 2 commits into
mainfrom
280-apostrophe-backtick
Aug 4, 2026
Merged

Copy to clipboard: stop replacing apostrophes with backticks#281
maboa merged 2 commits into
mainfrom
280-apostrophe-backtick

Conversation

@maboa

@maboa maboa commented Aug 4, 2026

Copy link
Copy Markdown
Member

Fixes #280.

setupPopover() sanitised the selection with replaceAll("'", "\")before putting it on the clipboard. That escaping is inherited fromjs/share-this-clipboard.js, where it is required because the text is interpolated into an inline onclickhandler. Here the text only ever reachesclipboard.writeText()andtextContent`, both of which take arbitrary strings — so the substitution has no purpose and corrupts every quotation containing an apostrophe.

-        this.selectionText = selection.toString().replaceAll("'", "`");
+        this.selectionText = selection.toString();

Verified by selecting text containing apostrophes and copying: the clipboard and the confirmation dialog now both carry the original characters.

maboa added 2 commits August 4, 2026 17:27
setupPopover sanitised the selection with replaceAll("'", "`") before
putting it on the clipboard. That escaping is inherited from
js/share-this-clipboard.js, where it is required because the text is
interpolated into an inline onclick handler; here the text only ever
reaches clipboard.writeText() and textContent, both of which take
arbitrary strings. The substitution has no purpose in this path and
corrupts every quotation containing an apostrophe.
@maboa
maboa merged commit 7c62b03 into main Aug 4, 2026
1 check passed
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.

Copy to clipboard replaces every apostrophe with a backtick

1 participant