mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-19 10:30:45 +08:00
This commit is contained in:
parent
391919ecd5
commit
fe63530325
@ -187,18 +187,6 @@ progressLoading: 400
|
|||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__window {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
display: flex;
|
|
||||||
z-index: 502;
|
|
||||||
|
|
||||||
.toolbar__item {
|
|
||||||
padding: 14px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#windowControls {
|
#windowControls {
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 502;
|
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 {
|
&__text {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
max-width: 96px;
|
max-width: 96px;
|
||||||
|
@ -836,7 +836,7 @@ export const globalShortcut = () => {
|
|||||||
if (!floatDockLayoutElement.isSameNode(window.siyuan.layout.rightDock.layout.element)) {
|
if (!floatDockLayoutElement.isSameNode(window.siyuan.layout.rightDock.layout.element)) {
|
||||||
window.siyuan.layout.rightDock.hideDock();
|
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.topDock.hideDock();
|
||||||
window.siyuan.layout.bottomDock.hideDock();
|
window.siyuan.layout.bottomDock.hideDock();
|
||||||
window.siyuan.layout.leftDock.hideDock();
|
window.siyuan.layout.leftDock.hideDock();
|
||||||
|
@ -462,6 +462,25 @@ export const initWindow = () => {
|
|||||||
window.addEventListener("beforeunload", () => {
|
window.addEventListener("beforeunload", () => {
|
||||||
currentWindow.off("focus", winOnFocus);
|
currentWindow.off("focus", winOnFocus);
|
||||||
}, false);
|
}, 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) {
|
if ("darwin" === window.siyuan.config.system.os) {
|
||||||
document.getElementById("drag")?.addEventListener("dblclick", () => {
|
document.getElementById("drag")?.addEventListener("dblclick", () => {
|
||||||
if (currentWindow.isMaximized()) {
|
if (currentWindow.isMaximized()) {
|
||||||
@ -515,7 +534,7 @@ export const initWindow = () => {
|
|||||||
</svg>
|
</svg>
|
||||||
</div>`;
|
</div>`;
|
||||||
if (isWindow()) {
|
if (isWindow()) {
|
||||||
document.body.insertAdjacentHTML("beforeend", `<div class="toolbar__window">${controlsHTML}</div>`);
|
document.querySelector(".toolbar__window").insertAdjacentHTML("beforeend", controlsHTML);
|
||||||
} else {
|
} else {
|
||||||
document.getElementById("windowControls").innerHTML = controlsHTML;
|
document.getElementById("windowControls").innerHTML = controlsHTML;
|
||||||
}
|
}
|
||||||
|
@ -31,18 +31,21 @@ export const setTabPosition = () => {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
dragElement.style.WebkitAppRegion = "";
|
dragElement.style.WebkitAppRegion = "";
|
||||||
}
|
}
|
||||||
|
const headersLastElement = headerElement.lastElementChild as HTMLElement
|
||||||
if ("darwin" === window.siyuan.config.system.os) {
|
if ("darwin" === window.siyuan.config.system.os) {
|
||||||
if (rect.top <= 0 && rect.left <= 0 && !getCurrentWindow().isFullScreen()) {
|
if (rect.top <= 0 && rect.left <= 0 && !getCurrentWindow().isFullScreen()) {
|
||||||
item.headersElement.style.paddingLeft = "69px";
|
item.headersElement.style.paddingLeft = "69px";
|
||||||
|
headersLastElement.style.paddingRight = "42px";
|
||||||
} else {
|
} else {
|
||||||
item.headersElement.style.paddingLeft = "";
|
item.headersElement.style.paddingLeft = "";
|
||||||
|
headersLastElement.style.paddingRight = "";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 显示器缩放后像素存在小数点偏差 https://github.com/siyuan-note/siyuan/issues/7355
|
// 显示器缩放后像素存在小数点偏差 https://github.com/siyuan-note/siyuan/issues/7355
|
||||||
if (rect.top <= 0 && rect.right + 8 >= window.innerWidth) {
|
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 {
|
} else {
|
||||||
(headerElement.lastElementChild as HTMLElement).style.paddingRight = "";
|
headersLastElement.style.paddingRight = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user