🎨 Replace non-breaking spaces with normal spaces when copying https://github.com/siyuan-note/siyuan/issues/9382

This commit is contained in:
Daniel 2023-10-09 21:45:36 +08:00
parent 0ed6884761
commit da0fa0853f
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
4 changed files with 18 additions and 6 deletions

View file

@ -41,7 +41,9 @@ export const globalClick = (event: MouseEvent & { target: HTMLElement }) => {
const copyElement = hasTopClosestByClassName(event.target, "protyle-action__copy");
if (copyElement) {
writeText(copyElement.parentElement.nextElementSibling.textContent.trimEnd());
let text = copyElement.parentElement.nextElementSibling.textContent.trimEnd()
text = text.replace(/\u00A0/g, " "); // Replace non-breaking spaces with normal spaces when copying https://github.com/siyuan-note/siyuan/issues/9382
writeText(text);
showMessage(window.siyuan.languages.copied, 2000);
event.preventDefault();
return;