Vanessa 2023-09-14 09:56:13 +08:00
parent 6ffa2425d2
commit 1ec2e03846
6 changed files with 25 additions and 11 deletions

View file

@ -55,6 +55,7 @@ import {App} from "../../index";
import {commandPanel} from "../../plugin/commandPanel"; import {commandPanel} from "../../plugin/commandPanel";
import {toggleDockBar} from "../../layout/dock/util"; import {toggleDockBar} from "../../layout/dock/util";
import {workspaceMenu} from "../../menus/workspace"; import {workspaceMenu} from "../../menus/workspace";
import {resize} from "../../protyle/util/resize";
const switchDialogEvent = (app: App, event: MouseEvent) => { const switchDialogEvent = (app: App, event: MouseEvent) => {
event.preventDefault(); event.preventDefault();
@ -244,6 +245,7 @@ const editKeydown = (app: App, event: KeyboardEvent) => {
} }
if (matchHotKey(window.siyuan.config.keymap.editor.general.fullscreen.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.editor.general.fullscreen.custom, event)) {
fullscreen(protyle.element); fullscreen(protyle.element);
resize(protyle);
event.preventDefault(); event.preventDefault();
return true; return true;
} }

View file

@ -15,6 +15,7 @@ import {openFile} from "../editor/util";
/// #endif /// #endif
import {getDisplayName, movePathTo} from "../util/pathName"; import {getDisplayName, movePathTo} from "../util/pathName";
import {App} from "../index"; import {App} from "../index";
import {resize} from "../protyle/util/resize";
export const genCardHTML = (options: { export const genCardHTML = (options: {
id: string, id: string,
@ -198,6 +199,7 @@ export const bindCardEvent = (options: {
if (fullscreenElement) { if (fullscreenElement) {
fullscreen(options.element.querySelector(".card__main"), fullscreen(options.element.querySelector(".card__main"),
options.element.querySelector('[data-type="fullscreen"]')); options.element.querySelector('[data-type="fullscreen"]'));
resize(editor.protyle);
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();
return; return;

View file

@ -15,11 +15,12 @@ export class Dialog {
title?: string, title?: string,
transparent?: boolean, transparent?: boolean,
content: string, content: string,
width?: string width?: string,
height?: string, height?: string,
destroyCallback?: (options?: IObject) => void destroyCallback?: (options?: IObject) => void,
disableClose?: boolean disableClose?: boolean,
disableAnimation?: boolean disableAnimation?: boolean,
resizeCallback?: (type: string) => void
}) { }) {
this.disableClose = options.disableClose; this.disableClose = options.disableClose;
this.id = genUUID(); this.id = genUUID();
@ -61,7 +62,7 @@ export class Dialog {
}); });
} }
/// #if !MOBILE /// #if !MOBILE
moveResize(this.element.querySelector(".b3-dialog__container")); moveResize(this.element.querySelector(".b3-dialog__container"), options.resizeCallback);
/// #endif /// #endif
} }

View file

@ -71,8 +71,9 @@ export const fullscreen = (element: Element, btnElement?: Element) => {
window.siyuan.editorIsFullscreen = !isFullscreen; window.siyuan.editorIsFullscreen = !isFullscreen;
} }
getAllModels().editor.forEach(item => { getAllModels().editor.forEach(item => {
if (!element.isSameNode(item.element)) {
if (window.siyuan.editorIsFullscreen) { if (window.siyuan.editorIsFullscreen) {
if (!element.isSameNode(item.element) && item.element.classList.contains("fullscreen")) { if (item.element.classList.contains("fullscreen")) {
item.element.classList.remove("fullscreen"); item.element.classList.remove("fullscreen");
resize(item.editor.protyle); resize(item.editor.protyle);
} }
@ -80,6 +81,7 @@ export const fullscreen = (element: Element, btnElement?: Element) => {
item.element.classList.remove("fullscreen"); item.element.classList.remove("fullscreen");
resize(item.editor.protyle); resize(item.editor.protyle);
} }
}
}); });
/// #endif /// #endif
}; };

View file

@ -30,6 +30,7 @@ import {getNoContainerElement} from "../wysiwyg/getBlock";
import {openTitleMenu} from "../header/openTitleMenu"; import {openTitleMenu} from "../header/openTitleMenu";
import {emitOpenMenu} from "../../plugin/EventBus"; import {emitOpenMenu} from "../../plugin/EventBus";
import {isInAndroid} from "../util/compatibility"; import {isInAndroid} from "../util/compatibility";
import {resize} from "../util/resize";
export class Breadcrumb { export class Breadcrumb {
public element: HTMLElement; public element: HTMLElement;
@ -404,6 +405,7 @@ export class Breadcrumb {
label: window.siyuan.languages.fullscreen, label: window.siyuan.languages.fullscreen,
click: () => { click: () => {
fullscreen(protyle.element); fullscreen(protyle.element);
resize(protyle);
} }
}).element); }).element);
/// #endif /// #endif

View file

@ -90,6 +90,11 @@ export const openSearch = async (options: {
if (edit) { if (edit) {
edit.destroy(); edit.destroy();
} }
},
resizeCallback(type: string) {
if (type !== "d" && type !== "t" && edit) {
edit.resize();
}
} }
}); });
dialog.element.setAttribute("data-key", options.hotkey); dialog.element.setAttribute("data-key", options.hotkey);