From c75a62204327f46bc8df975e301447fa8cebb8df Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 31 Dec 2025 11:42:24 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/16732 1 --- app/src/boot/globalEvent/keydown.ts | 12 +----------- app/src/protyle/breadcrumb/index.ts | 12 +----------- app/src/protyle/index.ts | 16 ++++++++++------ app/src/types/index.d.ts | 1 + 4 files changed, 13 insertions(+), 28 deletions(-) diff --git a/app/src/boot/globalEvent/keydown.ts b/app/src/boot/globalEvent/keydown.ts index f3d5df0eb..6e0678bf8 100644 --- a/app/src/boot/globalEvent/keydown.ts +++ b/app/src/boot/globalEvent/keydown.ts @@ -501,17 +501,7 @@ const editKeydown = (app: App, event: KeyboardEvent) => { } if (matchHotKey(window.siyuan.config.keymap.editor.general.wysiwyg.custom, event) && !protyle.options.backlinkData) { setEditMode(protyle, "wysiwyg"); - protyle.scroll.lastScrollTop = 0; - fetchPost("/api/filetree/getDoc", { - id: protyle.block.id, - size: protyle.block.id === protyle.block.rootID ? window.siyuan.config.editor.dynamicLoadBlocks : Constants.SIZE_GET_MAX, - }, getResponse => { - onGet({ - data: getResponse, - protyle, - action: protyle.block.id === protyle.block.rootID ? [Constants.CB_GET_FOCUS, Constants.CB_GET_HTML, Constants.CB_GET_UNUNDO] : [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS, Constants.CB_GET_UNUNDO, Constants.CB_GET_HTML] - }); - }); + reloadProtyle(protyle, true); saveLayout(); event.preventDefault(); return true; diff --git a/app/src/protyle/breadcrumb/index.ts b/app/src/protyle/breadcrumb/index.ts index b6d3f5e23..306da0178 100644 --- a/app/src/protyle/breadcrumb/index.ts +++ b/app/src/protyle/breadcrumb/index.ts @@ -446,17 +446,7 @@ ${padHTML} accelerator: window.siyuan.config.keymap.editor.general.wysiwyg.custom, click: () => { setEditMode(protyle, "wysiwyg"); - protyle.scroll.lastScrollTop = 0; - fetchPost("/api/filetree/getDoc", { - id: protyle.block.id, - size: protyle.block.id === protyle.block.rootID ? window.siyuan.config.editor.dynamicLoadBlocks : Constants.SIZE_GET_MAX, - }, getResponse => { - onGet({ - data: getResponse, - protyle, - action: protyle.block.id === protyle.block.rootID ? [Constants.CB_GET_FOCUS, Constants.CB_GET_HTML, Constants.CB_GET_UNUNDO] : [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS, Constants.CB_GET_UNUNDO, Constants.CB_GET_HTML] - }); - }); + reloadProtyle(protyle, true); /// #if !MOBILE saveLayout(); /// #endif diff --git a/app/src/protyle/index.ts b/app/src/protyle/index.ts index 0ee2a037f..1a12eb66c 100644 --- a/app/src/protyle/index.ts +++ b/app/src/protyle/index.ts @@ -202,6 +202,10 @@ export class Protyle { if (this.protyle.background) { this.protyle.background.ial.title = data.data.title; } + if (window.siyuan.config.export.addTitle && + !this.protyle.preview.element.classList.contains("fn__none")) { + this.protyle.preview.render(this.protyle); + } } if (this.protyle.options.render.title && this.protyle.block.parentID === data.data.id) { if (!document.body.classList.contains("body--blur") && getSelection().rangeCount > 0 && @@ -289,14 +293,14 @@ export class Protyle { } private onTransaction(data: IWebSocketData) { + if (!this.protyle.preview.element.classList.contains("fn__none") && + data.context.rootIDs.includes(this.protyle.block.rootID)) { + this.protyle.preview.render(this.protyle); + return; + } let needCreateAction = ""; data.data[0].doOperations.find((item: IOperation) => { - if (!this.protyle.preview.element.classList.contains("fn__none")) { - this.protyle.preview.render(this.protyle); - if (item.action === "updateAttrs") { - onTransaction(this.protyle, item, false); - } - } else if (this.protyle.options.backlinkData && ["delete", "move"].includes(item.action)) { + if (this.protyle.options.backlinkData && ["delete", "move"].includes(item.action)) { // 只对特定情况刷新,否则展开、编辑等操作刷新会频繁 /// #if !MOBILE getAllModels().backlink.find(backlinkItem => { diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts index 65b529ba1..19b4af116 100644 --- a/app/src/types/index.d.ts +++ b/app/src/types/index.d.ts @@ -705,6 +705,7 @@ interface IWebSocketData { msg: string; code: number; sid?: string; + context?: any; } interface IGraphCommon {