Vanessa 2025-12-31 11:42:24 +08:00
parent ba9c58ede6
commit c75a622043
4 changed files with 13 additions and 28 deletions

View file

@ -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;

View file

@ -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

View file

@ -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 => {

View file

@ -705,6 +705,7 @@ interface IWebSocketData {
msg: string;
code: number;
sid?: string;
context?: any;
}
interface IGraphCommon {