|
@@ -30,7 +30,7 @@ import {replaceLocalPath} from "../editor/rename";
|
|
import {workspaceMenu} from "../menus/workspace";
|
|
import {workspaceMenu} from "../menus/workspace";
|
|
import {getWorkspaceName} from "./noRelyPCFunction";
|
|
import {getWorkspaceName} from "./noRelyPCFunction";
|
|
import {setTabPosition} from "../window/setHeader";
|
|
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") => {
|
|
const matchKeymap = (keymap: Record<string, IKeymapItem>, key1: "general" | "editor", key2?: "general" | "insert" | "heading" | "list" | "table") => {
|
|
if (key1 === "general") {
|
|
if (key1 === "general") {
|
|
@@ -357,7 +357,7 @@ export const initWindow = () => {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
ipcRenderer.on(Constants.SIYUAN_CLOSETAB, (e, ipcData) => {
|
|
ipcRenderer.on(Constants.SIYUAN_CLOSETAB, (e, ipcData) => {
|
|
- const tab = getInstanceById(ipcData);
|
|
|
|
|
|
+ const tab = getInstanceById(ipcData);
|
|
if (tab && tab instanceof Tab) {
|
|
if (tab && tab instanceof Tab) {
|
|
tab.parent.removeTab(ipcData);
|
|
tab.parent.removeTab(ipcData);
|
|
}
|
|
}
|
|
@@ -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;
|
|
}
|
|
}
|