mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 16:40:13 +01:00
♻️ rm hasContext
This commit is contained in:
parent
e40bc18d86
commit
d2a6c03d52
27 changed files with 31 additions and 92 deletions
|
|
@ -190,7 +190,6 @@ export class BlockPanel {
|
||||||
const index = parseInt(editorElement.getAttribute("data-index"));
|
const index = parseInt(editorElement.getAttribute("data-index"));
|
||||||
const editor = new Protyle(editorElement, {
|
const editor = new Protyle(editorElement, {
|
||||||
blockId: this.nodeIds[index],
|
blockId: this.nodeIds[index],
|
||||||
hasContext: false,
|
|
||||||
defId: this.defIds[index] ||this.defIds[0] || "",
|
defId: this.defIds[index] ||this.defIds[0] || "",
|
||||||
action: [Constants.CB_GET_ALL],
|
action: [Constants.CB_GET_ALL],
|
||||||
render: {
|
render: {
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ export class Editor extends Model {
|
||||||
tab: Tab,
|
tab: Tab,
|
||||||
blockId: string,
|
blockId: string,
|
||||||
mode?: TEditorMode,
|
mode?: TEditorMode,
|
||||||
hasContext?: boolean
|
|
||||||
action?: string[]
|
action?: string[]
|
||||||
}) {
|
}) {
|
||||||
super({
|
super({
|
||||||
|
|
@ -30,7 +29,6 @@ export class Editor extends Model {
|
||||||
|
|
||||||
private initProtyle(options: {
|
private initProtyle(options: {
|
||||||
blockId: string,
|
blockId: string,
|
||||||
hasContext?: boolean
|
|
||||||
action?: string[]
|
action?: string[]
|
||||||
mode?: TEditorMode,
|
mode?: TEditorMode,
|
||||||
}) {
|
}) {
|
||||||
|
|
@ -38,7 +36,6 @@ export class Editor extends Model {
|
||||||
action: options.action,
|
action: options.action,
|
||||||
blockId: options.blockId,
|
blockId: options.blockId,
|
||||||
mode: options.mode,
|
mode: options.mode,
|
||||||
hasContext: options.hasContext,
|
|
||||||
render: {
|
render: {
|
||||||
title: true,
|
title: true,
|
||||||
background: true,
|
background: true,
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ export const openFileById = (options: {
|
||||||
id: string,
|
id: string,
|
||||||
position?: string,
|
position?: string,
|
||||||
mode?: TEditorMode,
|
mode?: TEditorMode,
|
||||||
hasContext?: boolean,
|
|
||||||
action?: string[]
|
action?: string[]
|
||||||
keepCursor?: boolean
|
keepCursor?: boolean
|
||||||
zoomIn?: boolean
|
zoomIn?: boolean
|
||||||
|
|
@ -50,7 +49,6 @@ export const openFileById = (options: {
|
||||||
rootID: data.data.rootID,
|
rootID: data.data.rootID,
|
||||||
position: options.position,
|
position: options.position,
|
||||||
mode: options.mode,
|
mode: options.mode,
|
||||||
hasContext: options.hasContext,
|
|
||||||
action: options.action,
|
action: options.action,
|
||||||
zoomIn: options.zoomIn,
|
zoomIn: options.zoomIn,
|
||||||
keepCursor: options.keepCursor
|
keepCursor: options.keepCursor
|
||||||
|
|
@ -200,7 +198,7 @@ const switchEditor = (editor: Editor, options: IOpenFileOptions, allModels: IMod
|
||||||
if ((!nodeElement || nodeElement?.clientHeight === 0) && options.id !== options.rootID) {
|
if ((!nodeElement || nodeElement?.clientHeight === 0) && options.id !== options.rootID) {
|
||||||
fetchPost("/api/filetree/getDoc", {
|
fetchPost("/api/filetree/getDoc", {
|
||||||
id: options.id,
|
id: options.id,
|
||||||
mode: options.hasContext ? 3 : 0,
|
mode: (options.action && !options.action.includes(Constants.CB_GET_ALL)) ? 3 : 0,
|
||||||
size: Constants.SIZE_GET,
|
size: Constants.SIZE_GET,
|
||||||
}, getResponse => {
|
}, getResponse => {
|
||||||
onGet(getResponse, editor.editor.protyle, options.action);
|
onGet(getResponse, editor.editor.protyle, options.action);
|
||||||
|
|
@ -274,7 +272,6 @@ const newTab = (options: IOpenFileOptions) => {
|
||||||
tab,
|
tab,
|
||||||
blockId: options.id,
|
blockId: options.id,
|
||||||
mode: options.mode,
|
mode: options.mode,
|
||||||
hasContext: options.hasContext,
|
|
||||||
action: options.action,
|
action: options.action,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -333,7 +333,6 @@ export class Wnd {
|
||||||
} else {
|
} else {
|
||||||
openFileById({
|
openFileById({
|
||||||
id: keepCursorId,
|
id: keepCursorId,
|
||||||
hasContext: true,
|
|
||||||
action: [Constants.CB_GET_FOCUS]
|
action: [Constants.CB_GET_FOCUS]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -137,14 +137,12 @@ export class Backlinks extends Model {
|
||||||
click(element: HTMLElement) {
|
click(element: HTMLElement) {
|
||||||
openFileById({
|
openFileById({
|
||||||
id: element.getAttribute("data-node-id"),
|
id: element.getAttribute("data-node-id"),
|
||||||
hasContext: true,
|
|
||||||
action: [Constants.CB_GET_FOCUS]
|
action: [Constants.CB_GET_FOCUS]
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
ctrlClick(element: HTMLElement) {
|
ctrlClick(element: HTMLElement) {
|
||||||
openFileById({
|
openFileById({
|
||||||
id: element.getAttribute("data-node-id"),
|
id: element.getAttribute("data-node-id"),
|
||||||
hasContext: true,
|
|
||||||
keepCursor: true,
|
keepCursor: true,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -152,7 +150,6 @@ export class Backlinks extends Model {
|
||||||
openFileById({
|
openFileById({
|
||||||
id: element.getAttribute("data-node-id"),
|
id: element.getAttribute("data-node-id"),
|
||||||
position: "right",
|
position: "right",
|
||||||
hasContext: true,
|
|
||||||
action: [Constants.CB_GET_FOCUS]
|
action: [Constants.CB_GET_FOCUS]
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -160,7 +157,6 @@ export class Backlinks extends Model {
|
||||||
openFileById({
|
openFileById({
|
||||||
id: element.getAttribute("data-node-id"),
|
id: element.getAttribute("data-node-id"),
|
||||||
position: "bottom",
|
position: "bottom",
|
||||||
hasContext: true,
|
|
||||||
action: [Constants.CB_GET_FOCUS]
|
action: [Constants.CB_GET_FOCUS]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -191,7 +187,6 @@ export class Backlinks extends Model {
|
||||||
} else {
|
} else {
|
||||||
openFileById({
|
openFileById({
|
||||||
id: element.getAttribute("data-node-id"),
|
id: element.getAttribute("data-node-id"),
|
||||||
hasContext: true,
|
|
||||||
action: [Constants.CB_GET_FOCUS]
|
action: [Constants.CB_GET_FOCUS]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -199,7 +194,6 @@ export class Backlinks extends Model {
|
||||||
ctrlClick(element: HTMLElement) {
|
ctrlClick(element: HTMLElement) {
|
||||||
openFileById({
|
openFileById({
|
||||||
id: element.getAttribute("data-node-id"),
|
id: element.getAttribute("data-node-id"),
|
||||||
hasContext: true,
|
|
||||||
keepCursor: true,
|
keepCursor: true,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -207,7 +201,6 @@ export class Backlinks extends Model {
|
||||||
openFileById({
|
openFileById({
|
||||||
id: element.getAttribute("data-node-id"),
|
id: element.getAttribute("data-node-id"),
|
||||||
position: "right",
|
position: "right",
|
||||||
hasContext: true,
|
|
||||||
action: [Constants.CB_GET_FOCUS]
|
action: [Constants.CB_GET_FOCUS]
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -215,7 +208,6 @@ export class Backlinks extends Model {
|
||||||
openFileById({
|
openFileById({
|
||||||
id: element.getAttribute("data-node-id"),
|
id: element.getAttribute("data-node-id"),
|
||||||
position: "bottom",
|
position: "bottom",
|
||||||
hasContext: true,
|
|
||||||
action: [Constants.CB_GET_FOCUS]
|
action: [Constants.CB_GET_FOCUS]
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,6 @@ export class Bookmark extends Model {
|
||||||
fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
|
fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
|
||||||
openFileById({
|
openFileById({
|
||||||
id,
|
id,
|
||||||
hasContext: !foldResponse.data,
|
|
||||||
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS],
|
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -152,7 +151,6 @@ export class Bookmark extends Model {
|
||||||
ctrlClick(element: HTMLElement) {
|
ctrlClick(element: HTMLElement) {
|
||||||
openFileById({
|
openFileById({
|
||||||
id: element.getAttribute("data-node-id"),
|
id: element.getAttribute("data-node-id"),
|
||||||
hasContext: true,
|
|
||||||
keepCursor: true,
|
keepCursor: true,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -160,7 +158,6 @@ export class Bookmark extends Model {
|
||||||
openFileById({
|
openFileById({
|
||||||
id: element.getAttribute("data-node-id"),
|
id: element.getAttribute("data-node-id"),
|
||||||
position: "right",
|
position: "right",
|
||||||
hasContext: true,
|
|
||||||
action: [Constants.CB_GET_FOCUS]
|
action: [Constants.CB_GET_FOCUS]
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -168,7 +165,6 @@ export class Bookmark extends Model {
|
||||||
openFileById({
|
openFileById({
|
||||||
id: element.getAttribute("data-node-id"),
|
id: element.getAttribute("data-node-id"),
|
||||||
position: "bottom",
|
position: "bottom",
|
||||||
hasContext: true,
|
|
||||||
action: [Constants.CB_GET_FOCUS]
|
action: [Constants.CB_GET_FOCUS]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -598,14 +598,12 @@ export class Graph extends Model {
|
||||||
openFileById({
|
openFileById({
|
||||||
id: node.id,
|
id: node.id,
|
||||||
position: "bottom",
|
position: "bottom",
|
||||||
hasContext: true,
|
|
||||||
action: [Constants.CB_GET_FOCUS]
|
action: [Constants.CB_GET_FOCUS]
|
||||||
});
|
});
|
||||||
} else if (window.siyuan.altIsPressed) {
|
} else if (window.siyuan.altIsPressed) {
|
||||||
openFileById({
|
openFileById({
|
||||||
id: node.id,
|
id: node.id,
|
||||||
position: "right",
|
position: "right",
|
||||||
hasContext: true,
|
|
||||||
action: [Constants.CB_GET_FOCUS]
|
action: [Constants.CB_GET_FOCUS]
|
||||||
});
|
});
|
||||||
} else if (window.siyuan.ctrlIsPressed) {
|
} else if (window.siyuan.ctrlIsPressed) {
|
||||||
|
|
@ -614,7 +612,7 @@ export class Graph extends Model {
|
||||||
nodeIds: [node.id],
|
nodeIds: [node.id],
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
openFileById({id: node.id, hasContext: true, action: [Constants.CB_GET_FOCUS]});
|
openFileById({id: node.id, action: [Constants.CB_GET_FOCUS]});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,6 @@ export class Outline extends Model {
|
||||||
fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
|
fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
|
||||||
openFileById({
|
openFileById({
|
||||||
id,
|
id,
|
||||||
hasContext: !foldResponse.data,
|
|
||||||
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_SETID],
|
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_SETID],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,6 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
||||||
fetchPost("/api/block/checkBlockFold", {id: refBlockId}, (foldResponse) => {
|
fetchPost("/api/block/checkBlockFold", {id: refBlockId}, (foldResponse) => {
|
||||||
openFileById({
|
openFileById({
|
||||||
id: refBlockId,
|
id: refBlockId,
|
||||||
hasContext: !foldResponse.data,
|
|
||||||
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_HL],
|
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_HL],
|
||||||
keepCursor: true,
|
keepCursor: true,
|
||||||
zoomIn: foldResponse.data
|
zoomIn: foldResponse.data
|
||||||
|
|
@ -106,7 +105,6 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
||||||
openFileById({
|
openFileById({
|
||||||
id: refBlockId,
|
id: refBlockId,
|
||||||
position: "right",
|
position: "right",
|
||||||
hasContext: !foldResponse.data,
|
|
||||||
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS],
|
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS],
|
||||||
zoomIn: foldResponse.data
|
zoomIn: foldResponse.data
|
||||||
});
|
});
|
||||||
|
|
@ -122,7 +120,6 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
||||||
openFileById({
|
openFileById({
|
||||||
id: refBlockId,
|
id: refBlockId,
|
||||||
position: "bottom",
|
position: "bottom",
|
||||||
hasContext: !foldResponse.data,
|
|
||||||
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS],
|
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS],
|
||||||
zoomIn: foldResponse.data
|
zoomIn: foldResponse.data
|
||||||
});
|
});
|
||||||
|
|
@ -357,14 +354,12 @@ export const zoomOut = (protyle: IProtyle, id: string, focusId?: string, isPushB
|
||||||
if (window.siyuan.mobileEditor) {
|
if (window.siyuan.mobileEditor) {
|
||||||
window.localStorage.setItem(Constants.LOCAL_DOCINFO, JSON.stringify({
|
window.localStorage.setItem(Constants.LOCAL_DOCINFO, JSON.stringify({
|
||||||
id,
|
id,
|
||||||
hasContext: id === protyle.block.rootID,
|
|
||||||
action: id === protyle.block.rootID ? [Constants.CB_GET_HL] : [Constants.CB_GET_ALL]
|
action: id === protyle.block.rootID ? [Constants.CB_GET_HL] : [Constants.CB_GET_ALL]
|
||||||
}));
|
}));
|
||||||
window.siyuan.backStack.push({
|
window.siyuan.backStack.push({
|
||||||
id: protyle.block.id,
|
id: protyle.block.id,
|
||||||
scrollTop: protyle.contentElement.scrollTop,
|
scrollTop: protyle.contentElement.scrollTop,
|
||||||
callback: id === protyle.block.rootID ? [Constants.CB_GET_HL] : [Constants.CB_GET_ALL],
|
callback: id === protyle.block.rootID ? [Constants.CB_GET_HL] : [Constants.CB_GET_ALL],
|
||||||
hasContext: false
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
fetchPost("/api/filetree/getDoc", {
|
fetchPost("/api/filetree/getDoc", {
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@ import {hasClosestByAttribute} from "../protyle/util/hasClosest";
|
||||||
import {setEditMode} from "../protyle/util/setEditMode";
|
import {setEditMode} from "../protyle/util/setEditMode";
|
||||||
import {hideElements} from "../protyle/ui/hideElements";
|
import {hideElements} from "../protyle/ui/hideElements";
|
||||||
|
|
||||||
export const openMobileFileById = (id: string, hasContext?: boolean, action = [Constants.CB_GET_HL], pushStack = true) => {
|
export const openMobileFileById = (id: string, action = [Constants.CB_GET_HL], pushStack = true) => {
|
||||||
window.localStorage.setItem(Constants.LOCAL_DOCINFO, JSON.stringify({id, hasContext, action}));
|
window.localStorage.setItem(Constants.LOCAL_DOCINFO, JSON.stringify({id, action}));
|
||||||
if (window.siyuan.mobileEditor) {
|
if (window.siyuan.mobileEditor) {
|
||||||
hideElements(["toolbar", "hint", "util"], window.siyuan.mobileEditor.protyle);
|
hideElements(["toolbar", "hint", "util"], window.siyuan.mobileEditor.protyle);
|
||||||
if (window.siyuan.mobileEditor.protyle.contentElement.classList.contains("fn__none")) {
|
if (window.siyuan.mobileEditor.protyle.contentElement.classList.contains("fn__none")) {
|
||||||
|
|
@ -32,7 +32,7 @@ export const openMobileFileById = (id: string, hasContext?: boolean, action = [C
|
||||||
window.siyuan.backStack.push({
|
window.siyuan.backStack.push({
|
||||||
id,
|
id,
|
||||||
scrollTop: window.siyuan.mobileEditor.protyle.contentElement.scrollTop,
|
scrollTop: window.siyuan.mobileEditor.protyle.contentElement.scrollTop,
|
||||||
hasContext
|
callback: action,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
focusBlock(blockElement);
|
focusBlock(blockElement);
|
||||||
|
|
@ -53,7 +53,7 @@ export const openMobileFileById = (id: string, hasContext?: boolean, action = [C
|
||||||
fetchPost("/api/filetree/getDoc", {
|
fetchPost("/api/filetree/getDoc", {
|
||||||
id,
|
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 : Constants.SIZE_GET,
|
||||||
mode: hasContext ? 3 : 0,
|
mode: !action.includes(Constants.CB_GET_ALL) ? 3 : 0,
|
||||||
}, getResponse => {
|
}, getResponse => {
|
||||||
onGet(getResponse, window.siyuan.mobileEditor.protyle, action);
|
onGet(getResponse, window.siyuan.mobileEditor.protyle, action);
|
||||||
window.siyuan.mobileEditor.protyle.breadcrumb.render(window.siyuan.mobileEditor.protyle);
|
window.siyuan.mobileEditor.protyle.breadcrumb.render(window.siyuan.mobileEditor.protyle);
|
||||||
|
|
@ -63,7 +63,6 @@ export const openMobileFileById = (id: string, hasContext?: boolean, action = [C
|
||||||
window.siyuan.mobileEditor = new Protyle(document.getElementById("editor"), {
|
window.siyuan.mobileEditor = new Protyle(document.getElementById("editor"), {
|
||||||
blockId: id,
|
blockId: id,
|
||||||
action,
|
action,
|
||||||
hasContext: hasContext,
|
|
||||||
render: {
|
render: {
|
||||||
background: true,
|
background: true,
|
||||||
gutter: true,
|
gutter: true,
|
||||||
|
|
@ -89,8 +88,7 @@ export const openMobileFileById = (id: string, hasContext?: boolean, action = [C
|
||||||
window.siyuan.backStack.push({
|
window.siyuan.backStack.push({
|
||||||
id,
|
id,
|
||||||
scrollTop: window.siyuan.mobileEditor.protyle.contentElement.scrollTop,
|
scrollTop: window.siyuan.mobileEditor.protyle.contentElement.scrollTop,
|
||||||
callback: [Constants.CB_GET_HL],
|
callback: action,
|
||||||
hasContext
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ window.goBack = () => {
|
||||||
}
|
}
|
||||||
previousBackStack = window.siyuan.backStack.pop();
|
previousBackStack = window.siyuan.backStack.pop();
|
||||||
const item = window.siyuan.backStack[window.siyuan.backStack.length - 1];
|
const item = window.siyuan.backStack[window.siyuan.backStack.length - 1];
|
||||||
openMobileFileById(item.id, item.hasContext, item.callback, false);
|
openMobileFileById(item.id, item.callback, false);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.siyuan.mobileEditor.protyle.contentElement.scrollTo({
|
window.siyuan.mobileEditor.protyle.contentElement.scrollTo({
|
||||||
top: previousBackStack?.scrollTop || 0,
|
top: previousBackStack?.scrollTop || 0,
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ export class MobileBacklinks {
|
||||||
element: this.element.querySelector(".backlinkList") as HTMLElement,
|
element: this.element.querySelector(".backlinkList") as HTMLElement,
|
||||||
data: null,
|
data: null,
|
||||||
click(element: HTMLElement) {
|
click(element: HTMLElement) {
|
||||||
openMobileFileById(element.getAttribute("data-node-id"), true, [Constants.CB_GET_FOCUS]);
|
openMobileFileById(element.getAttribute("data-node-id"), [Constants.CB_GET_FOCUS]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.mTree = new Tree({
|
this.mTree = new Tree({
|
||||||
|
|
@ -73,7 +73,7 @@ export class MobileBacklinks {
|
||||||
}).element);
|
}).element);
|
||||||
window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY});
|
window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY});
|
||||||
} else {
|
} else {
|
||||||
openMobileFileById(element.getAttribute("data-node-id"), true, [Constants.CB_GET_FOCUS]);
|
openMobileFileById(element.getAttribute("data-node-id"), [Constants.CB_GET_FOCUS]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
blockExtHTML: '<span class="b3-list-item__action"><svg><use xlink:href="#iconMore"></use></svg></span>'
|
blockExtHTML: '<span class="b3-list-item__action"><svg><use xlink:href="#iconMore"></use></svg></span>'
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ export class MobileBookmarks {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
openMobileFileById(id, true, [Constants.CB_GET_FOCUS]);
|
openMobileFileById(id, [Constants.CB_GET_FOCUS]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
blockExtHTML: '<span class="b3-list-item__action" data-type="remove"><svg><use xlink:href="#iconTrashcan"></use></svg></span>',
|
blockExtHTML: '<span class="b3-list-item__action" data-type="remove"><svg><use xlink:href="#iconTrashcan"></use></svg></span>',
|
||||||
|
|
|
||||||
|
|
@ -28,20 +28,9 @@ export class MobileOutline {
|
||||||
data: null,
|
data: null,
|
||||||
click: (element: HTMLElement) => {
|
click: (element: HTMLElement) => {
|
||||||
const id = element.getAttribute("data-node-id");
|
const id = element.getAttribute("data-node-id");
|
||||||
const targetElement = window.siyuan.mobileEditor.protyle.wysiwyg.element.querySelector(`[data-node-id="${id}"]`);
|
fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
|
||||||
if (targetElement) {
|
openMobileFileById(id,foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_SETID]);
|
||||||
targetElement.scrollIntoView();
|
});
|
||||||
focusBlock(targetElement);
|
|
||||||
window.siyuan.backStack.push({
|
|
||||||
id,
|
|
||||||
scrollTop: window.siyuan.mobileEditor.protyle.contentElement.scrollTop,
|
|
||||||
hasContext: true
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
|
|
||||||
openMobileFileById(id, !foldResponse.data, foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_SETID]);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.element.firstElementChild.querySelector('[data-type="collapse"]').addEventListener(getEventName(), () => {
|
this.element.firstElementChild.querySelector('[data-type="collapse"]').addEventListener(getEventName(), () => {
|
||||||
|
|
|
||||||
|
|
@ -114,11 +114,11 @@ export const initFramework = () => {
|
||||||
const localDoc = JSON.parse(window.localStorage.getItem(Constants.LOCAL_DOCINFO) || '{"id": ""}');
|
const localDoc = JSON.parse(window.localStorage.getItem(Constants.LOCAL_DOCINFO) || '{"id": ""}');
|
||||||
fetchPost("/api/block/checkBlockExist", {id: localDoc.id}, existResponse => {
|
fetchPost("/api/block/checkBlockExist", {id: localDoc.id}, existResponse => {
|
||||||
if (existResponse.data) {
|
if (existResponse.data) {
|
||||||
openMobileFileById(localDoc.id, localDoc.hasContext, localDoc.action);
|
openMobileFileById(localDoc.id, localDoc.action);
|
||||||
} else {
|
} else {
|
||||||
fetchPost("/api/block/getRecentUpdatedBlocks", {}, (response) => {
|
fetchPost("/api/block/getRecentUpdatedBlocks", {}, (response) => {
|
||||||
if (response.data.length !== 0) {
|
if (response.data.length !== 0) {
|
||||||
openMobileFileById(response.data[0].id, true);
|
openMobileFileById(response.data[0].id);
|
||||||
} else {
|
} else {
|
||||||
setEmpty();
|
setEmpty();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ export const popSearch = (modelElement: HTMLElement, modelMainElement: HTMLEleme
|
||||||
preventScroll(window.siyuan.mobileEditor.protyle);
|
preventScroll(window.siyuan.mobileEditor.protyle);
|
||||||
}
|
}
|
||||||
fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
|
fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
|
||||||
openMobileFileById(id, !foldResponse.data, foldResponse.data ? [Constants.CB_GET_ALL, Constants.CB_GET_HL] : [Constants.CB_GET_HL]);
|
openMobileFileById(id,foldResponse.data ? [Constants.CB_GET_ALL, Constants.CB_GET_HL] : [Constants.CB_GET_HL]);
|
||||||
});
|
});
|
||||||
closePanel();
|
closePanel();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ export const handleTouchEnd = () => {
|
||||||
const item = forwardStack.pop();
|
const item = forwardStack.pop();
|
||||||
item.scrollTop = window.siyuan.mobileEditor.protyle.contentElement.scrollTop;
|
item.scrollTop = window.siyuan.mobileEditor.protyle.contentElement.scrollTop;
|
||||||
window.siyuan.backStack.push(item);
|
window.siyuan.backStack.push(item);
|
||||||
openMobileFileById(item.id, item.hasContext, item.callback, false);
|
openMobileFileById(item.id, item.callback, false);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.siyuan.mobileEditor.protyle.contentElement.scrollTo({
|
window.siyuan.mobileEditor.protyle.contentElement.scrollTo({
|
||||||
top: window.siyuan.backStack[window.siyuan.backStack.length - 2]?.scrollTop || 0,
|
top: window.siyuan.backStack[window.siyuan.backStack.length - 2]?.scrollTop || 0,
|
||||||
|
|
@ -49,7 +49,7 @@ export const handleTouchEnd = () => {
|
||||||
const item = window.siyuan.backStack.pop();
|
const item = window.siyuan.backStack.pop();
|
||||||
item.scrollTop = window.siyuan.mobileEditor.protyle.contentElement.scrollTop;
|
item.scrollTop = window.siyuan.mobileEditor.protyle.contentElement.scrollTop;
|
||||||
forwardStack.push(item);
|
forwardStack.push(item);
|
||||||
openMobileFileById(item.id, item.hasContext, item.callback, false);
|
openMobileFileById(item.id, item.callback, false);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.siyuan.mobileEditor.protyle.contentElement.scrollTo({
|
window.siyuan.mobileEditor.protyle.contentElement.scrollTo({
|
||||||
top: forwardStack[forwardStack.length - 2]?.scrollTop || 0,
|
top: forwardStack[forwardStack.length - 2]?.scrollTop || 0,
|
||||||
|
|
|
||||||
|
|
@ -506,11 +506,10 @@ ${unicode2Emoji(emoji.unicode, true)}</button>`;
|
||||||
}, () => {
|
}, () => {
|
||||||
insertHTML(genEmptyBlock(false, false, `<span data-type="block-ref" data-id="${newSubDocId}" data-subtype="d">Untitled</span>`), protyle);
|
insertHTML(genEmptyBlock(false, false, `<span data-type="block-ref" data-id="${newSubDocId}" data-subtype="d">Untitled</span>`), protyle);
|
||||||
/// #if MOBILE
|
/// #if MOBILE
|
||||||
openMobileFileById(newSubDocId, true);
|
openMobileFileById(newSubDocId);
|
||||||
/// #else
|
/// #else
|
||||||
openFileById({
|
openFileById({
|
||||||
id: newSubDocId,
|
id: newSubDocId,
|
||||||
hasContext: true,
|
|
||||||
action: [Constants.CB_GET_HL]
|
action: [Constants.CB_GET_HL]
|
||||||
});
|
});
|
||||||
/// #endif
|
/// #endif
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,7 @@ class Protyle {
|
||||||
fetchPost("/api/filetree/getDoc", {
|
fetchPost("/api/filetree/getDoc", {
|
||||||
id: options.blockId,
|
id: options.blockId,
|
||||||
k: options.key || "",
|
k: options.key || "",
|
||||||
mode: options.hasContext ? 3 : 0, // 0: 仅当前 ID,1:向上 2:向下,3:上下都加载,4:加载最后
|
mode: (options.action && !options.action.includes(Constants.CB_GET_ALL)) ? 3 : 0, // 0: 仅当前 ID(默认值),1:向上 2:向下,3:上下都加载,4:加载最后
|
||||||
size: options.action?.includes(Constants.CB_GET_ALL) ? Constants.SIZE_GET_MAX : Constants.SIZE_GET,
|
size: options.action?.includes(Constants.CB_GET_ALL) ? Constants.SIZE_GET_MAX : Constants.SIZE_GET,
|
||||||
}, getResponse => {
|
}, getResponse => {
|
||||||
onGet(getResponse, this.protyle, options.action);
|
onGet(getResponse, this.protyle, options.action);
|
||||||
|
|
|
||||||
|
|
@ -1357,13 +1357,12 @@ export class WYSIWYG {
|
||||||
|
|
||||||
fetchPost("/api/block/checkBlockFold", {id: refBlockId}, (foldResponse) => {
|
fetchPost("/api/block/checkBlockFold", {id: refBlockId}, (foldResponse) => {
|
||||||
/// #if MOBILE
|
/// #if MOBILE
|
||||||
openMobileFileById(refBlockId, !foldResponse.data, foldResponse.data ? [Constants.CB_GET_ALL, Constants.CB_GET_HL] : [Constants.CB_GET_HL]);
|
openMobileFileById(refBlockId, foldResponse.data ? [Constants.CB_GET_ALL, Constants.CB_GET_HL] : [Constants.CB_GET_HL]);
|
||||||
/// #else
|
/// #else
|
||||||
if (window.siyuan.shiftIsPressed) {
|
if (window.siyuan.shiftIsPressed) {
|
||||||
openFileById({
|
openFileById({
|
||||||
id: refBlockId,
|
id: refBlockId,
|
||||||
position: "bottom",
|
position: "bottom",
|
||||||
hasContext: !foldResponse.data,
|
|
||||||
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS],
|
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS],
|
||||||
zoomIn: foldResponse.data
|
zoomIn: foldResponse.data
|
||||||
});
|
});
|
||||||
|
|
@ -1371,14 +1370,12 @@ export class WYSIWYG {
|
||||||
openFileById({
|
openFileById({
|
||||||
id: refBlockId,
|
id: refBlockId,
|
||||||
position: "right",
|
position: "right",
|
||||||
hasContext: !foldResponse.data,
|
|
||||||
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS],
|
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS],
|
||||||
zoomIn: foldResponse.data
|
zoomIn: foldResponse.data
|
||||||
});
|
});
|
||||||
} else if (window.siyuan.ctrlIsPressed) {
|
} else if (window.siyuan.ctrlIsPressed) {
|
||||||
openFileById({
|
openFileById({
|
||||||
id: refBlockId,
|
id: refBlockId,
|
||||||
hasContext: !foldResponse.data,
|
|
||||||
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_HL],
|
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_HL],
|
||||||
keepCursor: true,
|
keepCursor: true,
|
||||||
zoomIn: foldResponse.data
|
zoomIn: foldResponse.data
|
||||||
|
|
@ -1386,7 +1383,6 @@ export class WYSIWYG {
|
||||||
} else {
|
} else {
|
||||||
openFileById({
|
openFileById({
|
||||||
id: refBlockId,
|
id: refBlockId,
|
||||||
hasContext: !foldResponse.data,
|
|
||||||
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS],
|
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS],
|
||||||
zoomIn: foldResponse.data
|
zoomIn: foldResponse.data
|
||||||
});
|
});
|
||||||
|
|
@ -1488,13 +1484,12 @@ export class WYSIWYG {
|
||||||
if (embedItemElement) {
|
if (embedItemElement) {
|
||||||
const embedId = embedItemElement.getAttribute("data-id");
|
const embedId = embedItemElement.getAttribute("data-id");
|
||||||
/// #if MOBILE
|
/// #if MOBILE
|
||||||
openMobileFileById(embedId, false, [Constants.CB_GET_ALL]);
|
openMobileFileById(embedId, [Constants.CB_GET_ALL]);
|
||||||
/// #else
|
/// #else
|
||||||
if (window.siyuan.shiftIsPressed) {
|
if (window.siyuan.shiftIsPressed) {
|
||||||
openFileById({
|
openFileById({
|
||||||
id: embedId,
|
id: embedId,
|
||||||
position: "bottom",
|
position: "bottom",
|
||||||
hasContext: false,
|
|
||||||
action: [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL],
|
action: [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL],
|
||||||
zoomIn: true
|
zoomIn: true
|
||||||
});
|
});
|
||||||
|
|
@ -1502,14 +1497,12 @@ export class WYSIWYG {
|
||||||
openFileById({
|
openFileById({
|
||||||
id: embedId,
|
id: embedId,
|
||||||
position: "right",
|
position: "right",
|
||||||
hasContext: false,
|
|
||||||
action: [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL],
|
action: [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL],
|
||||||
zoomIn: true
|
zoomIn: true
|
||||||
});
|
});
|
||||||
} else if (window.siyuan.ctrlIsPressed) {
|
} else if (window.siyuan.ctrlIsPressed) {
|
||||||
openFileById({
|
openFileById({
|
||||||
id: embedId,
|
id: embedId,
|
||||||
hasContext: false,
|
|
||||||
action: [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL],
|
action: [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL],
|
||||||
keepCursor: true,
|
keepCursor: true,
|
||||||
zoomIn: true
|
zoomIn: true
|
||||||
|
|
|
||||||
|
|
@ -1532,7 +1532,6 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
// 打开块引和编辑器中引用、反链、书签中点击事件需保持一致,都加载上下文
|
// 打开块引和编辑器中引用、反链、书签中点击事件需保持一致,都加载上下文
|
||||||
openFileById({
|
openFileById({
|
||||||
id,
|
id,
|
||||||
hasContext: true,
|
|
||||||
keepCursor: true,
|
keepCursor: true,
|
||||||
});
|
});
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -1542,7 +1541,6 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
openFileById({
|
openFileById({
|
||||||
id,
|
id,
|
||||||
position: "right",
|
position: "right",
|
||||||
hasContext: true,
|
|
||||||
action: [Constants.CB_GET_FOCUS]
|
action: [Constants.CB_GET_FOCUS]
|
||||||
});
|
});
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -1552,7 +1550,6 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
openFileById({
|
openFileById({
|
||||||
id,
|
id,
|
||||||
position: "bottom",
|
position: "bottom",
|
||||||
hasContext: true,
|
|
||||||
action: [Constants.CB_GET_FOCUS]
|
action: [Constants.CB_GET_FOCUS]
|
||||||
});
|
});
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
|
||||||
|
|
@ -116,8 +116,7 @@ export class Search extends Model {
|
||||||
fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
|
fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
|
||||||
openFileById({
|
openFileById({
|
||||||
id,
|
id,
|
||||||
hasContext: !foldResponse.data,
|
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS],
|
||||||
action: [Constants.CB_GET_FOCUS],
|
|
||||||
zoomIn: foldResponse.data,
|
zoomIn: foldResponse.data,
|
||||||
position: "right",
|
position: "right",
|
||||||
});
|
});
|
||||||
|
|
@ -136,8 +135,7 @@ export class Search extends Model {
|
||||||
fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
|
fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
|
||||||
openFileById({
|
openFileById({
|
||||||
id,
|
id,
|
||||||
hasContext: !foldResponse.data,
|
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS],
|
||||||
action: [Constants.CB_GET_FOCUS],
|
|
||||||
zoomIn: foldResponse.data
|
zoomIn: foldResponse.data
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -198,7 +196,7 @@ export class Search extends Model {
|
||||||
} else {
|
} else {
|
||||||
this.protyle = new Protyle(this.element.querySelector("#searchPreview") as HTMLElement, {
|
this.protyle = new Protyle(this.element.querySelector("#searchPreview") as HTMLElement, {
|
||||||
blockId: id,
|
blockId: id,
|
||||||
hasContext: !foldResponse.data,
|
action: foldResponse.data ? [Constants.CB_GET_HL, Constants.CB_GET_ALL] : [Constants.CB_GET_HL],
|
||||||
key: value,
|
key: value,
|
||||||
render: {
|
render: {
|
||||||
gutter: true,
|
gutter: true,
|
||||||
|
|
|
||||||
|
|
@ -468,8 +468,7 @@ export const openSearch = async (hotkey: string, key?: string, notebookId?: stri
|
||||||
fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
|
fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
|
||||||
openFileById({
|
openFileById({
|
||||||
id,
|
id,
|
||||||
hasContext: !foldResponse.data,
|
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS],
|
||||||
action: [Constants.CB_GET_FOCUS],
|
|
||||||
zoomIn: foldResponse.data
|
zoomIn: foldResponse.data
|
||||||
});
|
});
|
||||||
dialog.destroy();
|
dialog.destroy();
|
||||||
|
|
@ -592,8 +591,7 @@ export const openSearch = async (hotkey: string, key?: string, notebookId?: stri
|
||||||
fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
|
fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
|
||||||
openFileById({
|
openFileById({
|
||||||
id,
|
id,
|
||||||
hasContext: !foldResponse.data,
|
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS],
|
||||||
action: [Constants.CB_GET_FOCUS],
|
|
||||||
zoomIn: foldResponse.data,
|
zoomIn: foldResponse.data,
|
||||||
position: "right"
|
position: "right"
|
||||||
});
|
});
|
||||||
|
|
@ -616,8 +614,7 @@ export const openSearch = async (hotkey: string, key?: string, notebookId?: stri
|
||||||
fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
|
fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
|
||||||
openFileById({
|
openFileById({
|
||||||
id,
|
id,
|
||||||
hasContext: !foldResponse.data,
|
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS],
|
||||||
action: [Constants.CB_GET_FOCUS],
|
|
||||||
zoomIn: foldResponse.data
|
zoomIn: foldResponse.data
|
||||||
});
|
});
|
||||||
dialog.destroy();
|
dialog.destroy();
|
||||||
|
|
@ -646,7 +643,7 @@ const getArticle = (options: {
|
||||||
if (!protyle) {
|
if (!protyle) {
|
||||||
protyle = new Protyle(options.dialog.element.querySelector("#searchPreview") as HTMLElement, {
|
protyle = new Protyle(options.dialog.element.querySelector("#searchPreview") as HTMLElement, {
|
||||||
blockId: options.id,
|
blockId: options.id,
|
||||||
hasContext: !foldResponse.data,
|
action: foldResponse.data ? [Constants.CB_GET_HL, Constants.CB_GET_ALL] : [Constants.CB_GET_HL],
|
||||||
key: options.k,
|
key: options.k,
|
||||||
render: {
|
render: {
|
||||||
gutter: true,
|
gutter: true,
|
||||||
|
|
|
||||||
2
app/src/types/index.d.ts
vendored
2
app/src/types/index.d.ts
vendored
|
|
@ -48,7 +48,6 @@ interface IPdfAnno {
|
||||||
interface IBackStack {
|
interface IBackStack {
|
||||||
id: string,
|
id: string,
|
||||||
scrollTop?: number,
|
scrollTop?: number,
|
||||||
hasContext?: boolean,
|
|
||||||
callback?: string[],
|
callback?: string[],
|
||||||
position?: { start: number, end: number }
|
position?: { start: number, end: number }
|
||||||
protyle?: IProtyle,
|
protyle?: IProtyle,
|
||||||
|
|
@ -157,7 +156,6 @@ declare interface IOpenFileOptions {
|
||||||
position?: string, // file 或者 asset,打开位置
|
position?: string, // file 或者 asset,打开位置
|
||||||
page?: number | string, // asset
|
page?: number | string, // asset
|
||||||
mode?: TEditorMode // file
|
mode?: TEditorMode // file
|
||||||
hasContext?: boolean // file,是否带上下文
|
|
||||||
action?: string[]
|
action?: string[]
|
||||||
keepCursor?: boolean // file,是否跳转到新 tab 上
|
keepCursor?: boolean // file,是否跳转到新 tab 上
|
||||||
zoomIn?: boolean // 是否缩放
|
zoomIn?: boolean // 是否缩放
|
||||||
|
|
|
||||||
1
app/src/types/protyle.d.ts
vendored
1
app/src/types/protyle.d.ts
vendored
|
|
@ -345,7 +345,6 @@ interface IOptions {
|
||||||
action?: string[],
|
action?: string[],
|
||||||
mode?: TEditorMode,
|
mode?: TEditorMode,
|
||||||
blockId: string
|
blockId: string
|
||||||
hasContext?: boolean
|
|
||||||
key?: string
|
key?: string
|
||||||
defId?: string
|
defId?: string
|
||||||
render?: {
|
render?: {
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ export const newFile = (notebookId?: string, currentPath?: string, open?: boolea
|
||||||
}, () => {
|
}, () => {
|
||||||
/// #if !MOBILE
|
/// #if !MOBILE
|
||||||
if (open) {
|
if (open) {
|
||||||
openFileById({id, hasContext: true, action: [Constants.CB_GET_HL]});
|
openFileById({id, action: [Constants.CB_GET_HL]});
|
||||||
}
|
}
|
||||||
/// #endif
|
/// #endif
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -342,7 +342,6 @@ const initWindow = () => {
|
||||||
}
|
}
|
||||||
openFileById({
|
openFileById({
|
||||||
id: url.substr(16, 22),
|
id: url.substr(16, 22),
|
||||||
hasContext: true,
|
|
||||||
action: [Constants.CB_GET_FOCUS],
|
action: [Constants.CB_GET_FOCUS],
|
||||||
zoomIn: getSearch("focus", url) === "1"
|
zoomIn: getSearch("focus", url) === "1"
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue