Vanessa 2025-04-01 15:00:09 +08:00
parent d0ad863651
commit b222fdfac3
4 changed files with 13 additions and 6 deletions

View file

@ -8,7 +8,7 @@ import {escapeGreat, escapeHtml} from "../util/escape";
import {unicode2Emoji} from "../emoji";
import {fetchPost} from "../util/fetch";
import {hideTooltip, showTooltip} from "../dialog/tooltip";
import {isTouchDevice} from "../util/functions";
import {isTouchDevice, isWindow} from "../util/functions";
/// #if !BROWSER
import {openNewWindow} from "../window/openNewWindow";
import {ipcRenderer} from "electron";
@ -99,6 +99,9 @@ export class Tab {
tabElement.style.opacity = "0.38";
window.siyuan.dragElement = this.headElement;
}
if (isWindow() && this.headElement.getBoundingClientRect().top <= 0) {
((this.headElement.parentElement.parentElement.querySelector(".item--readonly .fn__flex-1") as HTMLElement).style as CSSStyleDeclarationElectron).WebkitAppRegion = "";
}
});
this.headElement.addEventListener("dragend", (event: DragEvent & { target: HTMLElement }) => {
const tabElement = hasClosestByTag(event.target, "LI");
@ -136,6 +139,9 @@ export class Tab {
}
});
}
if (isWindow() && this.headElement.getBoundingClientRect().top <= 0) {
((this.headElement.parentElement.parentElement.querySelector(".item--readonly .fn__flex-1") as HTMLElement).style as CSSStyleDeclarationElectron).WebkitAppRegion = "drag";
}
});
}

View file

@ -231,7 +231,6 @@ export class Wnd {
}
}
});
this.headersElement.parentElement.addEventListener("drop", function (event: DragEvent & {
target: HTMLElement
}) {

View file

@ -124,6 +124,10 @@ declare namespace CSS {
const highlights: Map<string, Highlight>;
}
interface CSSStyleDeclarationElectron extends CSSStyleDeclaration {
WebkitAppRegion: string
}
interface Window {
echarts: {
init(element: HTMLElement, theme?: string, options?: {

View file

@ -18,11 +18,9 @@ export const setTabPosition = () => {
const dragElement = headerElement.querySelector(".item--readonly .fn__flex-1") as HTMLElement;
if (rect.top <= 0) {
dragElement.style.height = dragElement.parentElement.clientHeight + "px";
// @ts-ignore
dragElement.style.WebkitAppRegion = "drag";
(dragElement.style as CSSStyleDeclarationElectron).WebkitAppRegion = "drag";
} else {
// @ts-ignore
dragElement.style.WebkitAppRegion = "";
(dragElement.style as CSSStyleDeclarationElectron).WebkitAppRegion = "";
}
const headersLastElement = headerElement.lastElementChild as HTMLElement;
if ("darwin" === window.siyuan.config.system.os) {