🐛 The file name encoding is abnormal after copying the image and pasting it https://github.com/siyuan-note/siyuan/issues/11246

This commit is contained in:
Daniel 2024-05-06 12:13:56 +08:00
parent 2d93e384be
commit 31542c67f2
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -946,7 +946,10 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
accelerator: "⌘C",
icon: "iconCopy",
click() {
writeText(protyle.lute.BlockDOM2StdMd(assetElement.outerHTML));
let content = protyle.lute.BlockDOM2StdMd(assetElement.outerHTML);
// The file name encoding is abnormal after copying the image and pasting it https://github.com/siyuan-note/siyuan/issues/11246
content = content.replace(/%20/g, " ");
writeText(content);
}
}).element);
window.siyuan.menus.menu.append(new MenuItem({
@ -963,7 +966,10 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
accelerator: "⌘X",
label: window.siyuan.languages.cut,
click() {
writeText(protyle.lute.BlockDOM2StdMd(assetElement.outerHTML));
let content = protyle.lute.BlockDOM2StdMd(assetElement.outerHTML);
// The file name encoding is abnormal after copying the image and pasting it https://github.com/siyuan-note/siyuan/issues/11246
content = content.replace(/%20/g, " ");
writeText(content);
(assetElement as HTMLElement).outerHTML = "<wbr>";
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
updateTransaction(protyle, id, nodeElement.outerHTML, html);