Jelajahi Sumber

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

Vanessa 10 bulan lalu
induk
melakukan
e382d9db0e

+ 1 - 5
app/src/config/editor.ts

@@ -165,7 +165,7 @@ export const editor = {
         <div class="b3-label__text">${window.siyuan.languages.dynamicLoadBlocksTip}</div>
         <div class="b3-label__text">${window.siyuan.languages.dynamicLoadBlocksTip}</div>
     </div>
     </div>
     <span class="fn__space"></span>
     <span class="fn__space"></span>
-    <input class="b3-text-field fn__flex-center fn__size200" id="dynamicLoadBlocks" type="number" min="48" max="1024" value="${window.siyuan.config.editor.dynamicLoadBlocks}"/>
+    <input class="b3-text-field fn__flex-center fn__size200" id="dynamicLoadBlocks" type="number" min="48" value="${window.siyuan.config.editor.dynamicLoadBlocks}"/>
 </div>
 </div>
 <div class="fn__flex b3-label config__item">
 <div class="fn__flex b3-label config__item">
     <div class="fn__flex-1">
     <div class="fn__flex-1">
@@ -328,10 +328,6 @@ export const editor = {
                 dynamicLoadBlocks = 48;
                 dynamicLoadBlocks = 48;
                 (editor.element.querySelector("#dynamicLoadBlocks") as HTMLInputElement).value = "48";
                 (editor.element.querySelector("#dynamicLoadBlocks") as HTMLInputElement).value = "48";
             }
             }
-            if (1024 < dynamicLoadBlocks) {
-                dynamicLoadBlocks = 1024;
-                (editor.element.querySelector("#dynamicLoadBlocks") as HTMLInputElement).value = "1024";
-            }
 
 
             fetchPost("/api/setting/setEditor", {
             fetchPost("/api/setting/setEditor", {
                 fullWidth: (editor.element.querySelector("#fullWidth") as HTMLInputElement).checked,
                 fullWidth: (editor.element.querySelector("#fullWidth") as HTMLInputElement).checked,

+ 1 - 1
app/src/mobile/settings/editor.ts

@@ -195,7 +195,7 @@ export const initEditor = () => {
 <div class="b3-label">
 <div class="b3-label">
     ${window.siyuan.languages.dynamicLoadBlocks}
     ${window.siyuan.languages.dynamicLoadBlocks}
     <span class="fn__hr"></span>
     <span class="fn__hr"></span>
-    <input class="b3-text-field fn__block" id="dynamicLoadBlocks" type="number" min="48" max="1024" value="${window.siyuan.config.editor.dynamicLoadBlocks}"/>
+    <input class="b3-text-field fn__block" id="dynamicLoadBlocks" type="number" min="48" value="${window.siyuan.config.editor.dynamicLoadBlocks}"/>
     <div class="b3-label__text">${window.siyuan.languages.dynamicLoadBlocksTip}</div>
     <div class="b3-label__text">${window.siyuan.languages.dynamicLoadBlocksTip}</div>
 </div>
 </div>
 <div class="b3-label">
 <div class="b3-label">

+ 1 - 1
app/src/protyle/util/Options.ts

@@ -126,7 +126,7 @@ export class Options {
             url: Constants.UPLOAD_ADDRESS,
             url: Constants.UPLOAD_ADDRESS,
             extraData: {},
             extraData: {},
             fieldName: "file[]",
             fieldName: "file[]",
-            filename: (name: string) => name.replace(/[\\/:*?"'<>|]/g, ""),
+            filename: (name: string) => name.replace(/[\\/:*?"'<>|\[\]\(\)~!`&{}=#%$]/g, ""),
             linkToImgUrl: "",
             linkToImgUrl: "",
             withCredentials: false,
             withCredentials: false,
         }
         }

+ 0 - 1
kernel/conf/editor.go

@@ -56,7 +56,6 @@ type Editor struct {
 
 
 const (
 const (
 	MinDynamicLoadBlocks = 48
 	MinDynamicLoadBlocks = 48
-	MaxDynamicLoadBlocks = 1024
 )
 )
 
 
 func NewEditor() *Editor {
 func NewEditor() *Editor {

+ 0 - 3
kernel/model/conf.go

@@ -247,9 +247,6 @@ func InitConf() {
 	if conf.MinDynamicLoadBlocks > Conf.Editor.DynamicLoadBlocks {
 	if conf.MinDynamicLoadBlocks > Conf.Editor.DynamicLoadBlocks {
 		Conf.Editor.DynamicLoadBlocks = conf.MinDynamicLoadBlocks
 		Conf.Editor.DynamicLoadBlocks = conf.MinDynamicLoadBlocks
 	}
 	}
-	if conf.MaxDynamicLoadBlocks < Conf.Editor.DynamicLoadBlocks {
-		Conf.Editor.DynamicLoadBlocks = conf.MaxDynamicLoadBlocks
-	}
 	if 0 > Conf.Editor.BacklinkExpandCount {
 	if 0 > Conf.Editor.BacklinkExpandCount {
 		Conf.Editor.BacklinkExpandCount = 0
 		Conf.Editor.BacklinkExpandCount = 0
 	}
 	}

+ 2 - 2
kernel/model/upload.go

@@ -100,7 +100,7 @@ func InsertLocalAssets(id string, assetPaths []string, isUpload bool) (succMap m
 				return
 				return
 			}
 			}
 			f.Close()
 			f.Close()
-			succMap[fName] = "assets/" + fName
+			succMap[baseName] = "assets/" + fName
 		}
 		}
 	}
 	}
 	IncSync()
 	IncSync()
@@ -284,7 +284,7 @@ func Upload(c *gin.Context) {
 				os.RemoveAll(tmpDir2)
 				os.RemoveAll(tmpDir2)
 			}
 			}
 
 
-			succMap[fName] = strings.TrimPrefix(path.Join(relAssetsDirPath, fName), "/")
+			succMap[baseName] = strings.TrimPrefix(path.Join(relAssetsDirPath, fName), "/")
 		}
 		}
 	}
 	}