mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 01:50:12 +01:00
This commit is contained in:
parent
20e2e7b41a
commit
b470885e75
21 changed files with 32 additions and 33 deletions
|
|
@ -35,7 +35,6 @@ export abstract class Constants {
|
|||
|
||||
// size
|
||||
public static readonly SIZE_TOOLBAR_HEIGHT: number = 42;
|
||||
public static readonly SIZE_GET = 36;
|
||||
public static readonly SIZE_GET_MAX = 102400;
|
||||
public static readonly SIZE_UNDO = 64;
|
||||
public static readonly SIZE_TITLE = 512;
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ const switchEditor = (editor: Editor, options: IOpenFileOptions, allModels: IMod
|
|||
fetchPost("/api/filetree/getDoc", {
|
||||
id: options.id,
|
||||
mode: (options.action && options.action.includes(Constants.CB_GET_CONTEXT)) ? 3 : 0,
|
||||
size: Constants.SIZE_GET,
|
||||
size: window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, editor.editor.protyle, options.action);
|
||||
// 大纲点击折叠标题下的内容时,需更新反链面板
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ export class Outline extends Model {
|
|||
fetchPost("/api/filetree/getDoc", {
|
||||
id: item.editor.protyle.block.rootID,
|
||||
mode: 0,
|
||||
size: Constants.SIZE_GET,
|
||||
size: window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, item.editor.protyle, [Constants.CB_GET_FOCUS]);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -451,7 +451,7 @@ export const zoomOut = (protyle: IProtyle, id: string, focusId?: string, isPushB
|
|||
}
|
||||
fetchPost("/api/filetree/getDoc", {
|
||||
id,
|
||||
size: id === protyle.block.rootID ? Constants.SIZE_GET : Constants.SIZE_GET_MAX,
|
||||
size: id === protyle.block.rootID ? window.siyuan.config.editor.dynamicLoadBlocks : Constants.SIZE_GET_MAX,
|
||||
}, getResponse => {
|
||||
if (isPushBack) {
|
||||
onGet(getResponse, protyle, id === protyle.block.rootID ? [Constants.CB_GET_FOCUS, Constants.CB_GET_HTML] : [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS, Constants.CB_GET_HTML]);
|
||||
|
|
@ -468,7 +468,7 @@ export const zoomOut = (protyle: IProtyle, id: string, focusId?: string, isPushB
|
|||
fetchPost("/api/filetree/getDoc", {
|
||||
id: focusId,
|
||||
mode: 3,
|
||||
size: Constants.SIZE_GET,
|
||||
size: window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getFocusResponse => {
|
||||
onGet(getFocusResponse, protyle, isPushBack ? [Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS, Constants.CB_GET_UNUNDO]);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ export const openMobileFileById = (id: string, action = [Constants.CB_GET_HL]) =
|
|||
addLoading(window.siyuan.mobileEditor.protyle);
|
||||
fetchPost("/api/filetree/getDoc", {
|
||||
id,
|
||||
size: action.includes(Constants.CB_GET_ALL) ? Constants.SIZE_GET_MAX : Constants.SIZE_GET,
|
||||
size: action.includes(Constants.CB_GET_ALL) ? Constants.SIZE_GET_MAX : window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
mode: action.includes(Constants.CB_GET_CONTEXT) ? 3 : 0,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, window.siyuan.mobileEditor.protyle, action);
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ export class MobileBacklinks {
|
|||
if (response.data.refRootID === window.siyuan.mobileEditor.protyle.block.rootID) {
|
||||
fetchPost("/api/filetree/getDoc", {
|
||||
id: window.siyuan.mobileEditor.protyle.block.id,
|
||||
size: Constants.SIZE_GET,
|
||||
size: window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, window.siyuan.mobileEditor.protyle);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export const netImg2LocalAssets = (protyle: IProtyle) => {
|
|||
fetchPost("/api/filetree/getDoc", {
|
||||
id: protyle.block.id,
|
||||
mode: 0,
|
||||
size: Constants.SIZE_GET,
|
||||
size: window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, protyle, [Constants.CB_GET_FOCUS], saveScroll(protyle, true));
|
||||
});
|
||||
|
|
@ -31,7 +31,7 @@ export const netImg2LocalAssets = (protyle: IProtyle) => {
|
|||
fetchPost("/api/filetree/getDoc", {
|
||||
id: item.editor.protyle.block.rootID,
|
||||
mode: 0,
|
||||
size: Constants.SIZE_GET,
|
||||
size: window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, item.editor.protyle, [Constants.CB_GET_FOCUS], saveScroll(protyle, true));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ export class Breadcrumb {
|
|||
fetchPost("/api/filetree/getDoc", {
|
||||
id: protyle.options.blockId,
|
||||
mode: 0,
|
||||
size: Constants.SIZE_GET,
|
||||
size: window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, protyle);
|
||||
});
|
||||
|
|
@ -78,7 +78,7 @@ export class Breadcrumb {
|
|||
fetchPost("/api/filetree/getDoc", {
|
||||
id: protyle.options.blockId,
|
||||
mode: 3,
|
||||
size: Constants.SIZE_GET,
|
||||
size: window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, protyle, [Constants.CB_GET_HL]);
|
||||
});
|
||||
|
|
@ -231,7 +231,7 @@ export class Breadcrumb {
|
|||
fetchPost("/api/filetree/getDoc", {
|
||||
id: protyle.block.id,
|
||||
mode: 0,
|
||||
size: Constants.SIZE_GET,
|
||||
size: window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, protyle, [Constants.CB_GET_FOCUS], saveScroll(protyle, true));
|
||||
});
|
||||
|
|
@ -241,7 +241,7 @@ export class Breadcrumb {
|
|||
fetchPost("/api/filetree/getDoc", {
|
||||
id: item.editor.protyle.block.rootID,
|
||||
mode: 0,
|
||||
size: Constants.SIZE_GET,
|
||||
size: window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, item.editor.protyle, [Constants.CB_GET_FOCUS], saveScroll(protyle, true));
|
||||
});
|
||||
|
|
@ -270,7 +270,7 @@ export class Breadcrumb {
|
|||
fetchPost("/api/filetree/getDoc", {
|
||||
id: protyle.block.showAll ? protyle.block.id : protyle.block.rootID,
|
||||
mode: 0,
|
||||
size: protyle.block.showAll ? Constants.SIZE_GET_MAX : Constants.SIZE_GET,
|
||||
size: protyle.block.showAll ? Constants.SIZE_GET_MAX : window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, protyle, protyle.block.showAll ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS], saveScroll(protyle, true), true);
|
||||
});
|
||||
|
|
@ -296,7 +296,7 @@ export class Breadcrumb {
|
|||
protyle.scroll.lastScrollTop = 0;
|
||||
fetchPost("/api/filetree/getDoc", {
|
||||
id: protyle.block.rootID,
|
||||
size: Constants.SIZE_GET,
|
||||
size: window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, protyle);
|
||||
window.siyuan.menus.menu.remove();
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ export class Protyle {
|
|||
if (this.protyle.block.showAll && data.cmd === "heading2doc" && !this.protyle.options.backlinkData) {
|
||||
fetchPost("/api/filetree/getDoc", {
|
||||
id: this.protyle.block.rootID,
|
||||
size: Constants.SIZE_GET,
|
||||
size: window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, this.protyle);
|
||||
});
|
||||
|
|
@ -167,7 +167,7 @@ export class Protyle {
|
|||
id: options.blockId,
|
||||
k: options.key || "",
|
||||
mode: (mergedOptions.action && mergedOptions.action.includes(Constants.CB_GET_CONTEXT)) ? 3 : 0, // 0: 仅当前 ID(默认值),1:向上 2:向下,3:上下都加载,4:加载最后
|
||||
size: mergedOptions.action?.includes(Constants.CB_GET_ALL) ? Constants.SIZE_GET_MAX : Constants.SIZE_GET,
|
||||
size: mergedOptions.action?.includes(Constants.CB_GET_ALL) ? Constants.SIZE_GET_MAX : window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, this.protyle, mergedOptions.action, options.scrollAttr);
|
||||
if (this.protyle.model) {
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => {
|
|||
id: protyle.wysiwyg.element.firstElementChild.getAttribute("data-node-id"),
|
||||
mode: 1,
|
||||
k: protyle.options.key || "",
|
||||
size: Constants.SIZE_GET,
|
||||
size: window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
protyle.contentElement.style.overflow = "";
|
||||
protyle.contentElement.style.width = "";
|
||||
|
|
@ -97,7 +97,7 @@ export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => {
|
|||
id: protyle.wysiwyg.element.lastElementChild.getAttribute("data-node-id"),
|
||||
mode: 2,
|
||||
k: protyle.options.key || "",
|
||||
size: Constants.SIZE_GET,
|
||||
size: window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, protyle, [Constants.CB_GET_APPEND, Constants.CB_GET_UNCHANGEID]);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ export class Scroll {
|
|||
index: parseInt(this.inputElement.value),
|
||||
id: protyle.block.parentID,
|
||||
mode: 0,
|
||||
size: Constants.SIZE_GET,
|
||||
size: window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, protyle, [Constants.CB_GET_FOCUSFIRST, Constants.CB_GET_UNCHANGEID]);
|
||||
});
|
||||
|
|
@ -59,7 +59,7 @@ export class Scroll {
|
|||
if (protyle.block.showAll) {
|
||||
this.element.classList.add("fn__none");
|
||||
} else {
|
||||
if (protyle.block.childBlockCount > Constants.SIZE_GET) {
|
||||
if (protyle.block.childBlockCount > window.siyuan.config.editor.dynamicLoadBlocks) {
|
||||
this.element.classList.remove("fn__none");
|
||||
} else {
|
||||
this.element.classList.add("fn__none");
|
||||
|
|
|
|||
|
|
@ -655,7 +655,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
});
|
||||
fetchPost("/api/filetree/getDoc", {
|
||||
id: protyle.block.id,
|
||||
size: Constants.SIZE_GET,
|
||||
size: window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, protyle);
|
||||
/// #if !MOBILE
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ const setHTML = (options: {
|
|||
id: protyle.wysiwyg.element.lastElementChild.getAttribute("data-node-id"),
|
||||
mode: 2,
|
||||
k: protyle.options.key || "",
|
||||
size: Constants.SIZE_GET,
|
||||
size: window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, protyle, [Constants.CB_GET_APPEND, Constants.CB_GET_UNCHANGEID]);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ export const reloadProtyle = (protyle: IProtyle) => {
|
|||
fetchPost("/api/filetree/getDoc", {
|
||||
id: protyle.block.showAll ? protyle.block.id : protyle.block.rootID,
|
||||
mode: 0,
|
||||
size: protyle.block.showAll ? Constants.SIZE_GET_MAX : Constants.SIZE_GET,
|
||||
size: protyle.block.showAll ? Constants.SIZE_GET_MAX : window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, protyle, protyle.block.showAll ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS], saveScroll(protyle, true), true);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1212,7 +1212,7 @@ export class WYSIWYG {
|
|||
id: protyle.wysiwyg.element.firstElementChild.getAttribute("data-node-id"),
|
||||
mode: 1,
|
||||
k: protyle.options.key || "",
|
||||
size: Constants.SIZE_GET,
|
||||
size: window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
preventGetTopHTML = false;
|
||||
onGet(getResponse, protyle, [Constants.CB_GET_BEFORE, Constants.CB_GET_UNCHANGEID]);
|
||||
|
|
|
|||
|
|
@ -462,7 +462,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
fetchPost("/api/filetree/getDoc", {
|
||||
id: protyle.block.rootID,
|
||||
mode: 0,
|
||||
size: Constants.SIZE_GET,
|
||||
size: window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, protyle, [Constants.CB_GET_FOCUS]);
|
||||
});
|
||||
|
|
@ -478,7 +478,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
fetchPost("/api/filetree/getDoc", {
|
||||
id: protyle.block.rootID,
|
||||
mode: 4,
|
||||
size: Constants.SIZE_GET,
|
||||
size: window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, protyle, [Constants.CB_GET_FOCUS]);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ const promiseTransaction = () => {
|
|||
id: protyle.wysiwyg.element.lastElementChild.getAttribute("data-node-id"),
|
||||
mode: 2,
|
||||
k: protyle.options.key || "",
|
||||
size: Constants.SIZE_GET,
|
||||
size: window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, protyle, [Constants.CB_GET_APPEND, Constants.CB_GET_UNCHANGEID]);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ export class Search extends Model {
|
|||
id,
|
||||
k: value,
|
||||
mode: foldResponse.data ? 0 : 3,
|
||||
size: foldResponse.data ? Constants.SIZE_GET_MAX : Constants.SIZE_GET,
|
||||
size: foldResponse.data ? Constants.SIZE_GET_MAX : window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, this.protyle.protyle, foldResponse.data ? [Constants.CB_GET_ALL, Constants.CB_GET_HTML] : [Constants.CB_GET_HL, Constants.CB_GET_HTML]);
|
||||
const matchElement = this.protyle.protyle.wysiwyg.element.querySelector(`div[data-node-id="${id}"] span[data-type="search-mark"]`);
|
||||
|
|
|
|||
|
|
@ -668,7 +668,7 @@ const getArticle = (options: {
|
|||
id: options.id,
|
||||
k: options.k,
|
||||
mode: foldResponse.data ? 0 : 3,
|
||||
size: foldResponse.data ? Constants.SIZE_GET_MAX : Constants.SIZE_GET,
|
||||
size: foldResponse.data ? Constants.SIZE_GET_MAX : window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, protyle.protyle, foldResponse.data ? [Constants.CB_GET_ALL, Constants.CB_GET_HTML] : [Constants.CB_GET_HL, Constants.CB_GET_HTML]);
|
||||
const matchElement = protyle.protyle.wysiwyg.element.querySelector(`div[data-node-id="${options.id}"] span[data-type="search-mark"]`);
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ const focusStack = async (stack: IBackStack) => {
|
|||
fetchPost("/api/filetree/getDoc", {
|
||||
id: stack.id,
|
||||
mode: stack.isZoom ? 0 : 3,
|
||||
size: stack.isZoom ? Constants.SIZE_GET_MAX : Constants.SIZE_GET,
|
||||
size: stack.isZoom ? Constants.SIZE_GET_MAX : window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, stack.protyle, [Constants.CB_GET_HTML]);
|
||||
Array.from(stack.protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${stack.id}"]`)).find(item => {
|
||||
|
|
@ -162,7 +162,7 @@ const focusStack = async (stack: IBackStack) => {
|
|||
fetchPost("/api/filetree/getDoc", {
|
||||
id: stack.id, // 忘记为什么要用 rootChildID 了,但用了会产生 https://github.com/siyuan-note/siyuan/issues/6004 问题
|
||||
mode: stack.isZoom ? 0 : 3,
|
||||
size: stack.isZoom ? Constants.SIZE_GET_MAX : Constants.SIZE_GET,
|
||||
size: stack.isZoom ? Constants.SIZE_GET_MAX : window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, stack.protyle, stack.isZoom ? [Constants.CB_GET_HTML, Constants.CB_GET_ALL] : [Constants.CB_GET_HTML]);
|
||||
Array.from(stack.protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${stack.id}"]`)).find(item => {
|
||||
|
|
|
|||
|
|
@ -816,7 +816,7 @@ const editKeydown = (event: KeyboardEvent) => {
|
|||
protyle.scroll.lastScrollTop = 0;
|
||||
fetchPost("/api/filetree/getDoc", {
|
||||
id: protyle.block.parentID,
|
||||
size: Constants.SIZE_GET,
|
||||
size: window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, protyle);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue