V 2024-05-24 10:10:49 +08:00 committed by Daniel
parent 1be46ef5fd
commit 9b14fe7bdb
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
3 changed files with 12 additions and 7 deletions

View file

@ -71,7 +71,7 @@ export const reloadSync = (app: App, data: { upsertRootIDs: string[], removeRoot
id: item.editor.protyle.block.rootID, id: item.editor.protyle.block.rootID,
}, (response) => { }, (response) => {
item.editor.protyle.wysiwyg.renderCustom(response.data.ial); item.editor.protyle.wysiwyg.renderCustom(response.data.ial);
reloadProtyle(item.editor.protyle, false); reloadProtyle(item.editor.protyle, false, true);
updateTitle(item.editor.protyle.block.rootID, item.parent, item.editor.protyle); updateTitle(item.editor.protyle.block.rootID, item.parent, item.editor.protyle);
}); });
} else if (data.removeRootIDs.includes(item.editor.protyle.block.rootID)) { } else if (data.removeRootIDs.includes(item.editor.protyle.block.rootID)) {

View file

@ -48,7 +48,8 @@ export const getDocByScroll = (options: {
scrollAttr: IScrollAttr, scrollAttr: IScrollAttr,
mergedOptions?: IOptions, mergedOptions?: IOptions,
cb?: () => void cb?: () => void
focus?: boolean focus?: boolean,
updateReadonly?: boolean
}) => { }) => {
let actions: string[] = []; let actions: string[] = [];
if (options.mergedOptions) { if (options.mergedOptions) {
@ -80,7 +81,8 @@ export const getDocByScroll = (options: {
protyle: options.protyle, protyle: options.protyle,
action: actions, action: actions,
scrollAttr: options.scrollAttr, scrollAttr: options.scrollAttr,
afterCB: options.cb afterCB: options.cb,
updateReadonly: options.updateReadonly
}); });
}); });
} else { } else {
@ -90,7 +92,8 @@ export const getDocByScroll = (options: {
protyle: options.protyle, protyle: options.protyle,
action: actions, action: actions,
scrollAttr: options.scrollAttr, scrollAttr: options.scrollAttr,
afterCB: options.cb afterCB: options.cb,
updateReadonly: options.updateReadonly
}); });
} }
}); });
@ -109,7 +112,8 @@ export const getDocByScroll = (options: {
protyle: options.protyle, protyle: options.protyle,
action: actions, action: actions,
scrollAttr: options.scrollAttr, scrollAttr: options.scrollAttr,
afterCB: options.cb afterCB: options.cb,
updateReadonly: options.updateReadonly
}); });
}); });
}; };

View file

@ -5,7 +5,7 @@ import {renderBacklink} from "../wysiwyg/renderBacklink";
import {hasClosestByClassName} from "./hasClosest"; import {hasClosestByClassName} from "./hasClosest";
import {preventScroll} from "../scroll/preventScroll"; import {preventScroll} from "../scroll/preventScroll";
export const reloadProtyle = (protyle: IProtyle, focus: boolean) => { export const reloadProtyle = (protyle: IProtyle, focus: boolean, updateReadonly?: boolean) => {
if (!protyle.preview.element.classList.contains("fn__none")) { if (!protyle.preview.element.classList.contains("fn__none")) {
protyle.preview.render(protyle); protyle.preview.render(protyle);
return; return;
@ -51,7 +51,8 @@ export const reloadProtyle = (protyle: IProtyle, focus: boolean) => {
getDocByScroll({ getDocByScroll({
protyle, protyle,
focus, focus,
scrollAttr: saveScroll(protyle, true) scrollAttr: saveScroll(protyle, true),
updateReadonly
}); });
} }
}; };