Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/dev' into dev

Vanessa 1 rok pred
rodič
commit
ce47fd2ed4
1 zmenil súbory, kde vykonal 8 pridanie a 2 odobranie
  1. 8 2
      app/src/menus/protyle.ts

+ 8 - 2
app/src/menus/protyle.ts

@@ -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);