mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-19 02:21:38 +08:00
This commit is contained in:
parent
391919ecd5
commit
fe63530325
@ -187,18 +187,6 @@ progressLoading: 400
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
&__window {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
display: flex;
|
||||
z-index: 502;
|
||||
|
||||
.toolbar__item {
|
||||
padding: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
#windowControls {
|
||||
top: 0;
|
||||
z-index: 502;
|
||||
@ -269,6 +257,23 @@ progressLoading: 400
|
||||
}
|
||||
}
|
||||
|
||||
&__window {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
display: flex;
|
||||
z-index: 502;
|
||||
|
||||
.toolbar__item {
|
||||
padding: 14.25px;
|
||||
|
||||
&:not(.toolbar__item--disabled):not(.toolbar__item--close):hover,
|
||||
&--active {
|
||||
background-color: var(--b3-theme-background-light);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&__text {
|
||||
font-size: 12px;
|
||||
max-width: 96px;
|
||||
|
@ -836,7 +836,7 @@ export const globalShortcut = () => {
|
||||
if (!floatDockLayoutElement.isSameNode(window.siyuan.layout.rightDock.layout.element)) {
|
||||
window.siyuan.layout.rightDock.hideDock();
|
||||
}
|
||||
} else if (!hasClosestByClassName(event.target, "dock")) {
|
||||
} else if (!hasClosestByClassName(event.target, "dock") && !isWindow()) {
|
||||
window.siyuan.layout.topDock.hideDock();
|
||||
window.siyuan.layout.bottomDock.hideDock();
|
||||
window.siyuan.layout.leftDock.hideDock();
|
||||
|
@ -30,7 +30,7 @@ import {replaceLocalPath} from "../editor/rename";
|
||||
import {workspaceMenu} from "../menus/workspace";
|
||||
import {getWorkspaceName} from "./noRelyPCFunction";
|
||||
import {setTabPosition} from "../window/setHeader";
|
||||
import { Tab } from "../layout/Tab";
|
||||
import {Tab} from "../layout/Tab";
|
||||
|
||||
const matchKeymap = (keymap: Record<string, IKeymapItem>, key1: "general" | "editor", key2?: "general" | "insert" | "heading" | "list" | "table") => {
|
||||
if (key1 === "general") {
|
||||
@ -357,7 +357,7 @@ export const initWindow = () => {
|
||||
});
|
||||
}
|
||||
ipcRenderer.on(Constants.SIYUAN_CLOSETAB, (e, ipcData) => {
|
||||
const tab = getInstanceById(ipcData);
|
||||
const tab = getInstanceById(ipcData);
|
||||
if (tab && tab instanceof Tab) {
|
||||
tab.parent.removeTab(ipcData);
|
||||
}
|
||||
@ -462,6 +462,25 @@ export const initWindow = () => {
|
||||
window.addEventListener("beforeunload", () => {
|
||||
currentWindow.off("focus", winOnFocus);
|
||||
}, false);
|
||||
if (isWindow()) {
|
||||
document.body.insertAdjacentHTML("beforeend", `<div class="toolbar__window">
|
||||
<div class="toolbar__item b3-tooltips b3-tooltips__sw" aria-label="${window.siyuan.languages.pin}" id="pinWindow">
|
||||
<svg>
|
||||
<use xlink:href="#iconPin"></use>
|
||||
</svg>
|
||||
</div></div>`);
|
||||
const pinElement = document.getElementById("pinWindow")
|
||||
pinElement.addEventListener("click", () => {
|
||||
pinElement.classList.toggle("toolbar__item--active")
|
||||
if (pinElement.classList.contains("toolbar__item--active")) {
|
||||
pinElement.setAttribute("aria-label", window.siyuan.languages.unpin);
|
||||
currentWindow.setAlwaysOnTop(true, "pop-up-menu")
|
||||
} else {
|
||||
pinElement.setAttribute("aria-label", window.siyuan.languages.pin);
|
||||
currentWindow.setAlwaysOnTop(false)
|
||||
}
|
||||
});
|
||||
}
|
||||
if ("darwin" === window.siyuan.config.system.os) {
|
||||
document.getElementById("drag")?.addEventListener("dblclick", () => {
|
||||
if (currentWindow.isMaximized()) {
|
||||
@ -515,7 +534,7 @@ export const initWindow = () => {
|
||||
</svg>
|
||||
</div>`;
|
||||
if (isWindow()) {
|
||||
document.body.insertAdjacentHTML("beforeend", `<div class="toolbar__window">${controlsHTML}</div>`);
|
||||
document.querySelector(".toolbar__window").insertAdjacentHTML("beforeend", controlsHTML);
|
||||
} else {
|
||||
document.getElementById("windowControls").innerHTML = controlsHTML;
|
||||
}
|
||||
|
@ -31,18 +31,21 @@ export const setTabPosition = () => {
|
||||
// @ts-ignore
|
||||
dragElement.style.WebkitAppRegion = "";
|
||||
}
|
||||
const headersLastElement = headerElement.lastElementChild as HTMLElement
|
||||
if ("darwin" === window.siyuan.config.system.os) {
|
||||
if (rect.top <= 0 && rect.left <= 0 && !getCurrentWindow().isFullScreen()) {
|
||||
item.headersElement.style.paddingLeft = "69px";
|
||||
headersLastElement.style.paddingRight = "42px";
|
||||
} else {
|
||||
item.headersElement.style.paddingLeft = "";
|
||||
headersLastElement.style.paddingRight = "";
|
||||
}
|
||||
} else {
|
||||
// 显示器缩放后像素存在小数点偏差 https://github.com/siyuan-note/siyuan/issues/7355
|
||||
if (rect.top <= 0 && rect.right + 8 >= window.innerWidth) {
|
||||
(headerElement.lastElementChild as HTMLElement).style.paddingRight = (42 * 3) + "px";
|
||||
headersLastElement.style.paddingRight = (42 * 4) + "px";
|
||||
} else {
|
||||
(headerElement.lastElementChild as HTMLElement).style.paddingRight = "";
|
||||
headersLastElement.style.paddingRight = "";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user