An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Restrict publish-mode commands and search replacement and document Docker ports https://github.com/siyuan-note/siyuan/issues/11928
Daniel7029aafe8d4b
diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20201227201128-m1wrouw.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20201227201128-m1wrouw.syindex 51a4cb8f7d..0b14be576f 100644--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20201227201128-m1wrouw.sy+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20201227201128-m1wrouw.sy@@ -6,7 +6,7 @@"id": "20201227201128-m1wrouw","title": "Docker hosting","type": "doc",- "updated": "20260903150000"+ "updated": "20260918190000"},"Children": [{@@ -293,7 +293,8 @@"Type": "NodeHeading","HeadingLevel": 2,"Properties": {- "id": "20201227201751-5d6snqe"+ "id": "20201227201751-5d6snqe",+ "updated": "20260918190000"},"Children": [{@@ -396,7 +397,7 @@"Type": "NodeParagraph","Properties": {"id": "20210301202938-prn2v5a",- "updated": "20231108220518"+ "updated": "20260918190000"},"Children": [{@@ -422,6 +423,19 @@{"Type": "NodeText","Data": ""+ },+ {+ "Type": "NodeText",+ "Data": ". When deploying with Docker and enabling the publish service, add "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "code",+ "TextMarkTextContent": "-p 6808:6808"+ },+ {+ "Type": "NodeText",+ "Data": " to the container creation command in addition to the hosting port mapping. Docker uses host-port:container-port mappings; if you change the publish service port, update the container port accordingly and use the host port to access the service. Use a fixed publish service port rather than 0"}]},diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20240517031132-jmr5ihm.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20240517031132-jmr5ihm.syindex f6c2a6fe6b..b780a74b28 100644--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20240517031132-jmr5ihm.sy+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20240517031132-jmr5ihm.sy@@ -6,7 +6,7 @@"id": "20240517031132-jmr5ihm","title": "Publish service","type": "doc",- "updated": "20260803163440"+ "updated": "20260918190000"},"Children": [{@@ -44,7 +44,7 @@"HeadingLevel": 2,"Properties": {"id": "20260315160303-vbqukj8",- "updated": "20260803163440"+ "updated": "20260918190000"},"Children": [{@@ -59,7 +59,7 @@"ListData": {},"Properties": {"id": "20260315160303-5spvi7o",- "updated": "20260803163440"+ "updated": "20260918190000"},"Children": [{@@ -154,7 +154,7 @@},"Properties": {"id": "20260315160303-27cpoh4",- "updated": "20260315160303"+ "updated": "20260918190000"},"Children": [{@@ -162,7 +162,7 @@"Type": "NodeParagraph","Properties": {"id": "20260315160303-pber85t",- "updated": "20260315160328"+ "updated": "20260918190000"},"Children": [{@@ -177,6 +177,19 @@{"Type": "NodeText","Data": ""+ },+ {+ "Type": "NodeText",+ "Data": ". When deploying with Docker and enabling the publish service, add "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "code",+ "TextMarkTextContent": "-p 6808:6808"+ },+ {+ "Type": "NodeText",+ "Data": " to the container creation command in addition to the hosting port mapping. Docker uses host-port:container-port mappings; if you change the publish service port, update the container port accordingly and use the host port to access the service. Use a fixed publish service port rather than 0"}]}@@ -739,4 +752,4 @@]}]-}\ No newline at end of file+}diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20201227173504-847cs1q.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20201227173504-847cs1q.syindex 96be54d94f..f3cfb4350f 100644--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20201227173504-847cs1q.sy+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20201227173504-847cs1q.sy@@ -6,7 +6,7 @@"id": "20201227173504-847cs1q","title": "Docker 伺服","type": "doc",- "updated": "20260903150000"+ "updated": "20260918190000"},"Children": [{@@ -293,7 +293,8 @@"Type": "NodeHeading","HeadingLevel": 2,"Properties": {- "id": "20201227174908-s19h988"+ "id": "20201227174908-s19h988",+ "updated": "20260918190000"},"Children": [{@@ -396,7 +397,7 @@"Type": "NodeParagraph","Properties": {"id": "20210301201353-sffb1m7",- "updated": "20231108220447"+ "updated": "20260918190000"},"Children": [{@@ -422,6 +423,19 @@{"Type": "NodeText","Data": ""+ },+ {+ "Type": "NodeText",+ "Data": "。通过 Docker 部署并启用发布服务时,除伺服端口映射外,还需在创建容器的命令中添加 "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "code",+ "TextMarkTextContent": "-p 6808:6808"+ },+ {+ "Type": "NodeText",+ "Data": "。Docker 端口映射格式为宿主机端口:容器端口;若修改发布服务端口,应同步调整容器端口,访问时使用宿主机端口。请使用固定的发布服务端口,不要设置为 0"}]},diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20240517031028-xqinazo.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20240517031028-xqinazo.syindex beda3dbb71..91d2d8fb13 100644--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20240517031028-xqinazo.sy+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20240517031028-xqinazo.sy@@ -6,7 +6,7 @@"id": "20240517031028-xqinazo","title": "发布服务","type": "doc",- "updated": "20260803163440"+ "updated": "20260918190000"},"Children": [{@@ -44,7 +44,7 @@"HeadingLevel": 2,"Properties": {"id": "20260315160139-adeko8a",- "updated": "20260803163440"+ "updated": "20260918190000"},"Children": [{@@ -59,7 +59,7 @@"ListData": {},"Properties": {"id": "20260315160139-at1ed35",- "updated": "20260803163440"+ "updated": "20260918190000"},"Children": [{@@ -117,7 +117,7 @@},"Properties": {"id": "20260315160139-b1xi49d",- "updated": "20260315160022"+ "updated": "20260918190000"},"Children": [{@@ -149,7 +149,7 @@"ListData": {},"Properties": {"id": "20260315160139-s6g9em2",- "updated": "20260315160022"+ "updated": "20260918190000"},"Children": [{@@ -161,7 +161,7 @@},"Properties": {"id": "20260315160139-mrop3l5",- "updated": "20260315160022"+ "updated": "20260918190000"},"Children": [{@@ -169,7 +169,7 @@"Type": "NodeParagraph","Properties": {"id": "20260315160139-qvpt75f",- "updated": "20260315160022"+ "updated": "20260918190000"},"Children": [{@@ -184,6 +184,19 @@{"Type": "NodeText","Data": ""+ },+ {+ "Type": "NodeText",+ "Data": "。通过 Docker 部署并启用发布服务时,除伺服端口映射外,还需在创建容器的命令中添加 "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "code",+ "TextMarkTextContent": "-p 6808:6808"+ },+ {+ "Type": "NodeText",+ "Data": "。Docker 端口映射格式为宿主机端口:容器端口;若修改发布服务端口,应同步调整容器端口,访问时使用宿主机端口。请使用固定的发布服务端口,不要设置为 0"}]}@@ -750,4 +763,4 @@]}]-}\ No newline at end of file+}diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122459-08mi5cq.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122459-08mi5cq.syindex bd2bdade94..1c769772d6 100644--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122459-08mi5cq.sy+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122459-08mi5cq.sy@@ -6,7 +6,7 @@"id": "20211226122459-08mi5cq","title": "Docker 伺服","type": "doc",- "updated": "20260903150000"+ "updated": "20260918190000"},"Children": [{@@ -277,7 +277,7 @@"HeadingLevel": 2,"Properties": {"id": "20211226122519-kdp3vo5",- "updated": "20211226011647"+ "updated": "20260918190000"},"Children": [{@@ -374,7 +374,7 @@"Type": "NodeParagraph","Properties": {"id": "20211226122519-ajimm1z",- "updated": "20231108220606"+ "updated": "20260918190000"},"Children": [{@@ -400,6 +400,19 @@{"Type": "NodeText","Data": ""+ },+ {+ "Type": "NodeText",+ "Data": "。透過 Docker 部署並啟用發布服務時,除了伺服連接埠映射外,還需在建立容器的指令中加入 "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "code",+ "TextMarkTextContent": "-p 6808:6808"+ },+ {+ "Type": "NodeText",+ "Data": "。Docker 連接埠映射格式為主機連接埠:容器連接埠;若修改發布服務連接埠,應同步調整容器連接埠,存取時使用主機連接埠。請使用固定的發布服務連接埠,不要設定為 0"}]},diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20240517031052-mgoxs16.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20240517031052-mgoxs16.syindex 9135d061f1..7eb1ad889b 100644--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20240517031052-mgoxs16.sy+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20240517031052-mgoxs16.sy@@ -6,7 +6,7 @@"id": "20240517031052-mgoxs16","title": "發布服務","type": "doc",- "updated": "20260803163402"+ "updated": "20260918190000"},"Children": [{@@ -44,7 +44,7 @@"HeadingLevel": 2,"Properties": {"id": "20260315160433-v2hgbex",- "updated": "20260803163402"+ "updated": "20260918190000"},"Children": [{@@ -59,7 +59,7 @@"ListData": {},"Properties": {"id": "20260315160433-ubgzvn4",- "updated": "20260803163402"+ "updated": "20260918190000"},"Children": [{@@ -154,7 +154,7 @@},"Properties": {"id": "20260315160433-f69yncp",- "updated": "20260315160433"+ "updated": "20260918190000"},"Children": [{@@ -162,7 +162,7 @@"Type": "NodeParagraph","Properties": {"id": "20260315160433-u476kdm",- "updated": "20260315160433"+ "updated": "20260918190000"},"Children": [{@@ -177,6 +177,19 @@{"Type": "NodeText","Data": ""+ },+ {+ "Type": "NodeText",+ "Data": "。透過 Docker 部署並啟用發布服務時,除了伺服連接埠映射外,還需在建立容器的指令中加入 "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "code",+ "TextMarkTextContent": "-p 6808:6808"+ },+ {+ "Type": "NodeText",+ "Data": "。Docker 連接埠映射格式為主機連接埠:容器連接埠;若修改發布服務連接埠,應同步調整容器連接埠,存取時使用主機連接埠。請使用固定的發布服務連接埠,不要設定為 0"}]}@@ -739,4 +752,4 @@]}]-}\ No newline at end of file+}diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-f16hpct.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-f16hpct.syindex 14c197ab50..729619c002 100644--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-f16hpct.sy+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-f16hpct.sy@@ -7,7 +7,7 @@"id": "20240530101000-f16hpct","title": "Docker サーバー","type": "doc",- "updated": "20260903150000"+ "updated": "20260918190000"},"Children": [{@@ -361,7 +361,7 @@"Properties": {"ID": "20240530101000-hmjllir","id": "20240530101000-e245wms",- "updated": "20240530101000"+ "updated": "20260918190000"},"Children": [{@@ -386,7 +386,7 @@{"Type": "NodeTextMark","TextMarkType": "code",- "TextMarkTextContent": "ENTRYPOINT [ \u0026quot;/opt/siyuan/kernel\u0026quot; ]"+ "TextMarkTextContent": "ENTRYPOINT [ "/opt/siyuan/kernel" ]"},{"Type": "NodeText",@@ -469,7 +469,7 @@"Properties": {"ID": "20240530101000-cld3snp","id": "20240530101000-tusg4ak",- "updated": "20240530101000"+ "updated": "20260918190000"},"Children": [{@@ -495,6 +495,19 @@{"Type": "NodeText","Data": ""+ },+ {+ "Type": "NodeText",+ "Data": "。Docker で公開サービスを有効にする場合は、通常のサーバーポートのマッピングに加えて、コンテナ作成コマンドに "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "code",+ "TextMarkTextContent": "-p 6808:6808"+ },+ {+ "Type": "NodeText",+ "Data": " を追加してください。Docker のポートマッピングはホスト側ポート:コンテナ側ポートの形式です。公開サービスのポートを変更した場合はコンテナ側ポートも変更し、アクセス時にはホスト側ポートを使用してください。公開サービスには固定ポートを指定し、0 に設定しないでください"}]},diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240610233601-ylh1mvk.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240610233601-ylh1mvk.syindex 7de79c9cc8..1cb4e3ac1c 100644--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240610233601-ylh1mvk.sy+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240610233601-ylh1mvk.sy@@ -6,7 +6,7 @@"id": "20240610233601-ylh1mvk","title": "サービスを公開","type": "doc",- "updated": "20260803163402"+ "updated": "20260918190000"},"Children": [{@@ -44,7 +44,7 @@"HeadingLevel": 2,"Properties": {"id": "20260315160203-l0m0q2g",- "updated": "20260803163402"+ "updated": "20260918190000"},"Children": [{@@ -59,7 +59,7 @@"ListData": {},"Properties": {"id": "20260315160203-kmbr9ic",- "updated": "20260803163402"+ "updated": "20260918190000"},"Children": [{@@ -154,7 +154,7 @@},"Properties": {"id": "20260315160203-ws1iee3",- "updated": "20260315160459"+ "updated": "20260918190000"},"Children": [{@@ -162,7 +162,7 @@"Type": "NodeParagraph","Properties": {"id": "20260315160203-aarfptq",- "updated": "20260315160459"+ "updated": "20260918190000"},"Children": [{@@ -177,6 +177,19 @@{"Type": "NodeText","Data": " です"+ },+ {+ "Type": "NodeText",+ "Data": "。Docker で公開サービスを有効にする場合は、通常のサーバーポートのマッピングに加えて、コンテナ作成コマンドに "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "code",+ "TextMarkTextContent": "-p 6808:6808"+ },+ {+ "Type": "NodeText",+ "Data": " を追加してください。Docker のポートマッピングはホスト側ポート:コンテナ側ポートの形式です。公開サービスのポートを変更した場合はコンテナ側ポートも変更し、アクセス時にはホスト側ポートを使用してください。公開サービスには固定ポートを指定し、0 に設定しないでください"}]}@@ -739,4 +752,4 @@]}]-}\ No newline at end of file+}diff --git a/app/src/command/nativeCommands.test.ts b/app/src/command/nativeCommands.test.tsnew file mode 100644index 0000000000..8a04ce0ad2--- /dev/null+++ b/app/src/command/nativeCommands.test.ts@@ -0,0 +1,51 @@+import {it} from "node:test";+import * as assert from "node:assert/strict";+import {ensureNativeCommands, getNativeCommandId} from "./nativeCommands";+import {getCommandRegistry} from "./service";+import type {ICommandContextSnapshot} from "./types";++it("hides publish write commands and rejects their shortcut execution", async () => {+ const original = Object.getOwnPropertyDescriptor(globalThis, "window");+ const blocked = ["addToDatabase", "closeUnmodified", "editReadonly", "switchReadonly", "replace",+ "move", "newFile", "dailyNote", "syncNow", "dataHistory"];+ const siyuan = {+ isPublish: true,+ config: {keymap: {+ general: Object.fromEntries([...blocked, "search"].map(key => [key, {}])),+ editor: {general: {switchReadonly: {}}},+ }},+ };+ Object.defineProperty(globalThis, "window", {configurable: true, value: {siyuan}});+ try {+ const app = {};+ const executed: string[] = [];+ ensureNativeCommands(app, command => executed.push(command));+ const registry = getCommandRegistry(app);+ for (const environment of ["browser-desktop", "browser-mobile"] as const) {+ const context: ICommandContextSnapshot = {+ app, source: "commandPanel", environment, focus: "fileTree", selectedBlocks: [],+ };+ const visible = registry.list(context).map(command => command.id);+ for (const command of blocked) {+ const id = getNativeCommandId(command);+ assert.ok(!visible.includes(id), command);+ assert.equal((await registry.execute(id, {...context, source: "shortcut"})).status, "unavailable");+ }+ assert.ok(visible.includes(getNativeCommandId("search")));+ assert.equal((await registry.execute(getNativeCommandId("search"), context)).status, "executed");+ }+ assert.deepEqual(executed, ["search", "search"]);+ siyuan.isPublish = false;+ const context: ICommandContextSnapshot = {+ app, source: "commandPanel", environment: "browser-desktop", focus: "global", selectedBlocks: [],+ };+ assert.ok(registry.list(context).some(command => command.id === getNativeCommandId("replace")));+ assert.equal((await registry.execute(getNativeCommandId("replace"), context)).status, "executed");+ } finally {+ if (original) {+ Object.defineProperty(globalThis, "window", original);+ } else {+ Reflect.deleteProperty(globalThis, "window");+ }+ }+});diff --git a/app/src/command/nativeCommands.ts b/app/src/command/nativeCommands.tsindex 9e265fed12..c260185b98 100644--- a/app/src/command/nativeCommands.ts+++ b/app/src/command/nativeCommands.ts@@ -22,6 +22,11 @@ const getHotkey = (item: INativeCommandCatalogItem) => {return window.siyuan.config.keymap.editor[item.keymapPath[1]][item.keymapPath[2]]?.custom || "";};+const publishUnavailableCommands = new Set([+ "addToDatabase", "closeUnmodified", "editReadonly", "switchReadonly", "replace",+ "move", "newFile", "dailyNote", "syncNow", "dataHistory",+]);+const matchesContext = (item: INativeCommandCatalogItem, context: ICommandContextSnapshot) => {// 命令面板和快捷键共用只读限制,文档树操作仍按文档树上下文处理。if (context.focus !== "fileTree" && context.protyle?.disabled &&@@ -51,6 +56,7 @@ const createNativeCommand = (hotkey: () => getHotkey(item),order,platform: environment => isNativeCommandSupported(item, environment),+ when: () => !window.siyuan.isPublish || !publishUnavailableCommands.has(item.legacyId),enabled: context => matchesContext(item, context),execute: context => execute(item.legacyId, context),});diff --git a/app/src/mobile/menu/search.ts b/app/src/mobile/menu/search.tsindex 0edc67a490..1b6fa6d49b 100644--- a/app/src/mobile/menu/search.ts+++ b/app/src/mobile/menu/search.ts@@ -41,6 +41,9 @@ import {import {cancelSearchRequest, scheduleSearchRequest} from "../../search/request";const replace = (element: Element, config: Config.IUILayoutTabSearchConfig, isAll: boolean) => {+ if (window.siyuan.isPublish) {+ return;+ }if (config.method === 2) {showMessage(window.siyuan.languages._kernel[132]);return;@@ -107,6 +110,9 @@ const replace = (element: Element, config: Config.IUILayoutTabSearchConfig, isAlconst updateConfig = (element: Element, newConfig: Config.IUILayoutTabSearchConfig, config: Config.IUILayoutTabSearchConfig,clear = false) => {+ if (window.siyuan.isPublish) {+ newConfig = {...newConfig, hasReplace: false};+ }if (config.hasReplace !== newConfig.hasReplace) {if (newConfig.hasReplace) {element.querySelector('[data-type="toggle-replace"]').classList.add("toolbar__icon--active");@@ -601,6 +607,9 @@ const initSearchEvent = (app: App, element: Element, config: Config.IUILayoutTabevent.preventDefault();break;} else if (type === "toggle-replace") {+ if (window.siyuan.isPublish) {+ return;+ }config.hasReplace = !config.hasReplace;replaceInputElement.parentElement.classList.toggle("fn__none");target.classList.toggle("toolbar__icon--active");@@ -781,6 +790,9 @@ export const popSearch = (app: App, searchConfig?: Config.IUILayoutTabSearchConf});}+ if (window.siyuan.isPublish) {+ config.hasReplace = false;+ }activeBlur();let includeChild = true;let enableIncludeChild = false;@@ -834,7 +846,7 @@ export const popSearch = (app: App, searchConfig?: Config.IUILayoutTabSearchConf</div><div class="toolbar"><span class="fn__flex-1"></span>- <svg data-type="toggle-replace" class="toolbar__icon${config.hasReplace ? " toolbar__icon--active" : ""}"><use xlink:href="#iconReplace"></use></svg>+ <svg data-type="toggle-replace" class="toolbar__icon${window.siyuan.isPublish ? " fn__none" : ""}${config.hasReplace ? " toolbar__icon--active" : ""}"><use xlink:href="#iconReplace"></use></svg><svg ${enableIncludeChild ? "" : "disabled"} data-type="include" class="toolbar__icon${includeChild ? " toolbar__icon--active" : ""}"><use xlink:href="#iconInclude"></use></svg><svg data-type="path" class="toolbar__icon"><use xlink:href="#iconFolder"></use></svg><svg ${document.querySelector("#empty").classList.contains("fn__none") ? "" : "disabled"} data-type="currentPath" class="toolbar__icon"><use xlink:href="#iconFocus"></use></svg>diff --git a/app/src/search/spread.ts b/app/src/search/spread.tsindex 6419aaf809..167a561b0a 100644--- a/app/src/search/spread.ts+++ b/app/src/search/spread.ts@@ -25,6 +25,9 @@ export const openSearch = async (options: {notebookIds?: string[],searchPath?: string}) => {+ if (window.siyuan.isPublish && options.hotkey === Constants.DIALOG_REPLACE) {+ return;+ }const version = ++openSearchVersion;const existingSearchDialog = window.siyuan.dialogs.find((item) => item.element.querySelector("#searchList"));const existingSearchElement = existingSearchDialog?.element.querySelector(".b3-dialog__body");diff --git a/app/src/search/util.ts b/app/src/search/util.tsindex d4df239430..c460c18d7d 100644--- a/app/src/search/util.ts+++ b/app/src/search/util.ts@@ -129,6 +129,9 @@ export const openGlobalSearch = (app: App, text: string, replace: boolean, searc// closeCB 不存在为页签搜索export const genSearch = (app: App, config: Config.IUILayoutTabSearchConfig, element: HTMLElement, closeCB?: () => void) => {+ if (window.siyuan.isPublish) {+ config.hasReplace = false;+ }let includeChild = true;let enableIncludeChild = false;config.idPath.forEach(item => {@@ -194,7 +197,7 @@ export const genSearch = (app: App, config: Config.IUILayoutTabSearchConfig, ele<span class="fn__space"></span>${genQueryHTML(config.method, "searchSyntaxCheck")}<span class="fn__space"></span>- <span id="searchReplace" aria-label="${window.siyuan.languages.replace}" class="block__icon ariaLabel" data-position="9south">+ <span id="searchReplace" aria-label="${window.siyuan.languages.replace}" class="block__icon ariaLabel${window.siyuan.isPublish ? " fn__none" : ""}" data-position="9south"><svg><use xlink:href="#iconReplace"></use></svg></span><span class="fn__space"></span>@@ -585,6 +588,9 @@ export const genSearch = (app: App, config: Config.IUILayoutTabSearchConfig, eleinputEvent(element, config, edit, true);break;} else if (target.id === "searchReplace") {+ if (window.siyuan.isPublish) {+ return;+ }// ctrl+P 不需要保存config.hasReplace = !config.hasReplace;element.querySelectorAll(".search__header")[1].classList.toggle("fn__none");@@ -1132,6 +1138,9 @@ export const updateConfig = (element: Element, item: Config.IUILayoutTabSearchCopersistedConfig: options?.storageConfig,});const runtimeConfig = resolvedConfig.runtimeConfig;+ if (window.siyuan.isPublish) {+ runtimeConfig.hasReplace = false;+ }if (config.hasReplace !== runtimeConfig.hasReplace) {const replaceHeaderElement = element.querySelectorAll(".search__header")[1];if (runtimeConfig.hasReplace) {@@ -1363,6 +1372,9 @@ export const getArticle = (options: {};export const replace = (element: Element, config: Config.IUILayoutTabSearchConfig, edit: Protyle, isAll: boolean) => {+ if (window.siyuan.isPublish) {+ return;+ }if (config.method === 2 || config.method === 4) {showMessage(window.siyuan.languages._kernel[132]);return;