Vanessa 2024-02-18 18:27:09 +08:00
parent 43391b761d
commit 5ea99c26f1
4 changed files with 25 additions and 20 deletions

View file

@ -2,13 +2,12 @@ import {Tab} from "../layout/Tab";
import {Protyle} from "../protyle";
import {Model} from "../layout/Model";
import {setPadding} from "../protyle/ui/initUI";
import {getAllModels} from "../layout/getAll";
/// #if !BROWSER
import {setModelsHash} from "../window/setHeader";
/// #endif
import {countBlockWord} from "../layout/status";
import {App} from "../index";
import {resize} from "../protyle/util/resize";
import {fullscreen} from "../protyle/breadcrumb/action";
export class Editor extends Model {
public element: HTMLElement;
@ -54,14 +53,8 @@ export class Editor extends Model {
typewriterMode: true,
after: (editor) => {
if (window.siyuan.editorIsFullscreen) {
editor.protyle.element.classList.add("fullscreen");
fullscreen(editor.protyle.element);
setPadding(editor.protyle);
getAllModels().editor.forEach(item => {
if (!editor.protyle.element.isSameNode(item.element) && item.element.classList.contains("fullscreen")) {
item.element.classList.remove("fullscreen");
resize(item.editor.protyle);
}
});
}
countBlockWord([], editor.protyle.block.rootID);
/// #if !BROWSER

View file

@ -323,16 +323,6 @@ const getUnInitTab = (options: IOpenFileOptions) => {
};
const switchEditor = (editor: Editor, options: IOpenFileOptions, allModels: IModels) => {
allModels.editor.forEach((item) => {
if (!item.element.isSameNode(editor.element) && window.siyuan.editorIsFullscreen && item.element.classList.contains("fullscreen")) {
item.element.classList.remove("fullscreen");
resize(item.editor.protyle);
}
});
if (window.siyuan.editorIsFullscreen) {
editor.element.classList.add("fullscreen");
resize(editor.editor.protyle);
}
if (options.keepCursor) {
editor.parent.headElement.setAttribute("keep-cursor", options.id);
return true;