From 5162792372e2b319c2b31d67ee17172223719ca2 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 26 Sep 2022 21:47:35 +0800 Subject: [PATCH] :bug: fix https://github.com/siyuan-note/siyuan/issues/5973 --- app/src/protyle/toolbar/index.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts index 4f3785d43..13c966e3f 100644 --- a/app/src/protyle/toolbar/index.ts +++ b/app/src/protyle/toolbar/index.ts @@ -127,7 +127,7 @@ export class Toolbar { }); const types = this.getCurrentType(); types.forEach(item => { - if (["a", "block-ref", "virtual-block-ref", "text", "file-annotation-ref", "inline-math", "inline-memo", ""].includes(item)) { + if (["search-mark", "a", "block-ref", "virtual-block-ref", "text", "file-annotation-ref", "inline-math", "inline-memo", ""].includes(item)) { return; } this.element.querySelector(`[data-type="${item}"]`).classList.add("protyle-toolbar__item--current"); @@ -427,18 +427,18 @@ export class Toolbar { return true; } }); - } else if (type === "block-ref" && (types.includes("virtual-block-ref") || types.includes("a"))) { - // 虚拟引用和引用、链接不能同时存在 + } else if (type === "block-ref" && (types.includes("virtual-block-ref") || types.includes("a") || types.includes("search-mark"))) { + // 虚拟引用和引用、链接、搜索高亮不能同时存在 types.find((item, index) => { - if (item === "virtual-block-ref" || item === "a") { + if (item === "virtual-block-ref" || item === "a" || item === "search-mark") { types.splice(index, 1); return true; } }); - } else if (type === "a" && (types.includes("virtual-block-ref") || types.includes("block-ref"))) { - // 链接和引用、虚拟引用不能同时存在 + } else if (type === "a" && (types.includes("virtual-block-ref") || types.includes("block-ref") || types.includes("search-mark"))) { + // 链接和引用、虚拟引用、搜索高亮不能同时存在 types.find((item, index) => { - if (item === "virtual-block-ref" || item === "block-ref") { + if (item === "virtual-block-ref" || item === "block-ref" || item === "search-mark") { types.splice(index, 1); return true; }