This commit is contained in:
parent
43391b761d
commit
5ea99c26f1
4 changed files with 25 additions and 20 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -37,6 +37,8 @@ import {unicode2Emoji} from "../emoji";
|
|||
import {closeWindow} from "../window/closeWin";
|
||||
import {setTitle} from "../dialog/processSystem";
|
||||
import {newCenterEmptyTab, resizeTabs} from "./tabUtil";
|
||||
import {fullscreen} from "../protyle/breadcrumb/action";
|
||||
import {setPadding} from "../protyle/ui/initUI";
|
||||
|
||||
export class Wnd {
|
||||
private app: App;
|
||||
|
@ -489,6 +491,10 @@ export class Wnd {
|
|||
resize,
|
||||
});
|
||||
}
|
||||
if (window.siyuan.editorIsFullscreen) {
|
||||
fullscreen(currentTab.model.editor.protyle.element);
|
||||
setPadding(currentTab.model.editor.protyle);
|
||||
}
|
||||
} else {
|
||||
updatePanelByEditor({
|
||||
protyle: undefined,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/// #if !MOBILE
|
||||
import {getAllModels} from "../../layout/getAll";
|
||||
import {getAllModels, getAllWnds} from "../../layout/getAll";
|
||||
/// #endif
|
||||
import {addLoading} from "../ui/initUI";
|
||||
import {fetchPost} from "../../util/fetch";
|
||||
|
@ -9,6 +9,8 @@ import {hasClosestByClassName} from "../util/hasClosest";
|
|||
import {reloadProtyle} from "../util/reload";
|
||||
import {resize} from "../util/resize";
|
||||
import {disabledProtyle, enableProtyle} from "../util/onGet";
|
||||
import {isWindow} from "../../util/functions";
|
||||
import {Wnd} from "../../layout/Wnd";
|
||||
|
||||
export const net2LocalAssets = (protyle: IProtyle, type: "Assets" | "Img") => {
|
||||
if (protyle.element.querySelector(".wysiwygLoading")) {
|
||||
|
@ -62,6 +64,20 @@ export const fullscreen = (element: Element, btnElement?: Element) => {
|
|||
}
|
||||
}
|
||||
return;
|
||||
} else if (isWindow()) {
|
||||
// 编辑器全屏
|
||||
/// #if !MOBILE
|
||||
const wndsTemp: Wnd[] = [];
|
||||
getAllWnds(window.siyuan.layout.layout, wndsTemp);
|
||||
wndsTemp.find(async item => {
|
||||
const headerElement = item.headersElement.parentElement;
|
||||
if (headerElement.getBoundingClientRect().top <= 0) {
|
||||
// @ts-ignore
|
||||
(headerElement.querySelector(".item--readonly .fn__flex-1") as HTMLElement).style.WebkitAppRegion = isFullscreen ? "drag" : "";
|
||||
return;
|
||||
}
|
||||
});
|
||||
/// #endif
|
||||
}
|
||||
/// #if !MOBILE
|
||||
if (element.classList.contains("protyle")) {
|
||||
|
|
Loading…
Add table
Reference in a new issue