Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: fix https://github.com/siyuan-note/siyuan/issues/10369

Vanessa5ea99c26f171
diff --git a/app/src/editor/index.ts b/app/src/editor/index.ts
index f2ee93a016..aa255142de 100644
--- a/app/src/editor/index.ts
+++ b/app/src/editor/index.ts
@@ -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
diff --git a/app/src/editor/util.ts b/app/src/editor/util.ts
index fda90999e7..49f14803dd 100644
--- a/app/src/editor/util.ts
+++ b/app/src/editor/util.ts
@@ -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;
diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.ts
index abab03063e..1d3e9cf481 100644
--- a/app/src/layout/Wnd.ts
+++ b/app/src/layout/Wnd.ts
@@ -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,
diff --git a/app/src/protyle/breadcrumb/action.ts b/app/src/protyle/breadcrumb/action.ts
index 68d8e6ef46..f0bd667f38 100644
--- a/app/src/protyle/breadcrumb/action.ts
+++ b/app/src/protyle/breadcrumb/action.ts
@@ -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")) {