From 29117c764d1c3b976740dcf097a537da8e628b5f Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 25 Jun 2022 16:22:41 +0800 Subject: [PATCH] :bug: fix https://github.com/siyuan-note/siyuan/issues/5284 --- app/src/util/onGetConfig.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/util/onGetConfig.ts b/app/src/util/onGetConfig.ts index 4aac44159..39755e896 100644 --- a/app/src/util/onGetConfig.ts +++ b/app/src/util/onGetConfig.ts @@ -21,6 +21,7 @@ import {openFileById} from "../editor/util"; import {focusByRange} from "../protyle/util/selection"; import {exitSiYuan} from "../dialog/processSystem"; import {openSetting} from "../config"; +import {getSearch} from "./functions"; const matchKeymap = (keymap: Record, key1: "general" | "editor", key2?: "general" | "insert" | "heading" | "list" | "table") => { if (key1 === "general") { @@ -346,12 +347,14 @@ const initWindow = () => { const currentWindow = getCurrentWindow(); currentWindow.on("focus", winOnFocus); ipcRenderer.on(Constants.SIYUAN_OPENURL, (event, url) => { - const params = url.split("?"); + if (!/^siyuan:\/\/blocks\/\d{14}-\w{7}/.test(url)) { + return; + } openFileById({ id: url.substr(16, 22), hasContext: true, action: [Constants.CB_GET_FOCUS], - zoomIn: params.length === 2 && params[1].startsWith("focus=1") + zoomIn: getSearch("focus", url) === "1" }); }); ipcRenderer.on(Constants.SIYUAN_SAVE_CLOSE, (event, close) => {