Vanessa 2023-12-09 12:09:46 +08:00
parent e14ca5799b
commit 73505073e6
12 changed files with 42 additions and 59 deletions

View file

@ -19,9 +19,9 @@ export class Editor extends Model {
app: App,
tab: Tab,
blockId: string,
rootId?: string, // 使用 rootId 会优先使用本地 filepositon 定位
mode?: TEditorMode,
action?: string[],
scrollAttr?: IScrollAttr
}) {
super({
app: options.app,
@ -38,19 +38,19 @@ export class Editor extends Model {
private initProtyle(options: {
blockId: string,
action?: string[]
rootId?: string,
mode?: TEditorMode,
scrollAttr?: IScrollAttr
}) {
this.editor = new Protyle(this.app, this.element, {
action: options.action || [],
blockId: options.blockId,
rootId: options.rootId,
mode: options.mode,
render: {
title: true,
background: true,
scroll: true,
},
scrollAttr: options.scrollAttr,
typewriterMode: true,
after: (editor) => {
if (window.siyuan.editorIsFullscreen) {

View file

@ -277,7 +277,7 @@ export const openFile = async (options: IOpenFileOptions) => {
createdTab = newTab(options);
wnd.addTab(createdTab);
if (unUpdateTab && options.removeCurrentTab) {
wnd.removeTab(unUpdateTab.id, false, true, false);
wnd.removeTab(unUpdateTab.id, false, false);
}
} else {
createdTab = newTab(options);
@ -306,7 +306,6 @@ const getUnInitTab = (options: IOpenFileOptions) => {
} else {
initObj.action = options.action;
}
delete initObj.scrollAttr;
item.headElement.setAttribute("data-initdata", JSON.stringify(initObj));
item.parent.switchTab(item.headElement);
return true;