浏览代码

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

Vanessa 9 月之前
父节点
当前提交
014fa5f82b
共有 2 个文件被更改,包括 6 次插入3 次删除
  1. 5 2
      app/src/protyle/util/editorCommonEvent.ts
  2. 1 1
      kernel/model/search.go

+ 5 - 2
app/src/protyle/util/editorCommonEvent.ts

@@ -28,6 +28,9 @@ import {insertAttrViewBlockAnimation} from "../render/av/row";
 import {dragUpload} from "../render/av/asset";
 import * as dayjs from "dayjs";
 import {zoomOut} from "../../menus/protyle";
+/// #if !BROWSER
+import {webUtils} from "electron";
+/// #endif
 
 const moveToNew = (protyle: IProtyle, sourceElements: Element[], targetElement: Element, newSourceElement: Element,
                    isSameDoc: boolean, isBottom: boolean, isCopy: boolean) => {
@@ -1124,7 +1127,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
                 if (event.dataTransfer.types[0] === "Files" && !isBrowser()) {
                     const files: string[] = [];
                     for (let i = 0; i < event.dataTransfer.files.length; i++) {
-                        files.push(event.dataTransfer.files[i].path);
+                        files.push(webUtils.getPathForFile(event.dataTransfer.files[i]));
                     }
                     uploadLocalFiles(files, protyle, !event.altKey);
                 } else {
@@ -1137,7 +1140,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
                     if (cellType === "mAsset" && event.dataTransfer.types[0] === "Files" && !isBrowser()) {
                         const files: string[] = [];
                         for (let i = 0; i < event.dataTransfer.files.length; i++) {
-                            files.push(event.dataTransfer.files[i].path);
+                            files.push(webUtils.getPathForFile(event.dataTransfer.files[i]));
                         }
                         dragUpload(files, protyle, cellElement);
                     }

+ 1 - 1
kernel/model/search.go

@@ -834,7 +834,7 @@ func replaceTextNode(text *ast.Node, method int, keyword string, replacement str
 			// Replace fails when search results contain mixed case in text elements https://github.com/siyuan-note/siyuan/issues/9171
 			keywords := strings.Split(keyword, " ")
 			// keyword 可能是 "foo Foo" 使用空格分隔的大小写命中情况,这里统一转换小写后去重
-			if 1 < len(keywords) {
+			if 0 < len(keywords) {
 				var lowerKeywords []string
 				for _, k := range keywords {
 					lowerKeywords = append(lowerKeywords, strings.ToLower(k))