Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/16732 1

Vanessac75a62204327
diff --git a/app/src/boot/globalEvent/keydown.ts b/app/src/boot/globalEvent/keydown.ts
index f3d5df0ebe..6e0678bf82 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 b6d3f5e238..306da01788 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 0ee2a037f3..1a12eb66c3 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 65b529ba12..19b4af1166 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 {