Vanessa 2022-10-14 22:29:40 +08:00
parent 8832304eeb
commit 19e2bd2ab8
21 changed files with 81 additions and 66 deletions

View file

@ -573,7 +573,7 @@ export const globalShortcut = () => {
// 面板折叠展开操作
if (!event.repeat && (matchHotKey(window.siyuan.config.keymap.editor.general.collapse.custom, event) || matchHotKey(window.siyuan.config.keymap.editor.general.expand.custom, event))) {
let activePanelElement = document.querySelector(".block__icons--active");
let activePanelElement = document.querySelector(".layout__tab--active");
if (!activePanelElement) {
Array.from(document.querySelectorAll(".layout__wnd--active .layout-tab-container > div")).forEach(item => {
if (!item.classList.contains("fn__none")) {
@ -602,10 +602,10 @@ export const globalShortcut = () => {
if (matchHotKey(window.siyuan.config.keymap.general.closeTab.custom, event) && !event.repeat) {
event.preventDefault();
event.stopPropagation();
let activeTabElement = document.querySelector(".block__icons--active");
let activeTabElement = document.querySelector(".layout__tab--active");
if (activeTabElement && activeTabElement.getBoundingClientRect().width > 0) {
let type: TDockType;
Array.from(activeTabElement.parentElement.classList).find(item => {
Array.from(activeTabElement.classList).find(item => {
if (item.startsWith("sy__")) {
type = item.replace("sy__", "") as TDockType;
return true;
@ -756,9 +756,9 @@ const editKeydown = (event: KeyboardEvent) => {
}
protyle = editor.editor.protyle;
}
const activePanelElement = document.querySelector(".block__icons--active");
const activePanelElement = document.querySelector(".layout__tab--active");
let isFileFocus = false;
if (activePanelElement && activePanelElement.parentElement.classList.contains("sy__file")) {
if (activePanelElement && activePanelElement.classList.contains("sy__file")) {
isFileFocus = true;
}
let searchKey = "";
@ -858,7 +858,7 @@ const fileTreeKeydown = (event: KeyboardEvent) => {
dockFile.toggleModel("file", true);
return;
}
if (!files.element.previousElementSibling.classList.contains("block__icons--active")) {
if (!files.element.parentElement.classList.contains("layout__tab--active")) {
return false;
}
let liElement = files.element.querySelector(".b3-list-item--focus");

View file

@ -15,7 +15,6 @@ import {fetchPost} from "./fetch";
import {mountHelp, newDailyNote} from "./mount";
import {MenuItem} from "../menus/Menu";
import {initAssets, loadAssets, renderSnippet, setInlineStyle, setMode} from "./assets";
import {goBack, goForward} from "./backForward";
import {getOpenNotebookCount} from "./pathName";
import {openFileById} from "../editor/util";
import {focusByRange} from "../protyle/util/selection";
@ -314,6 +313,9 @@ const initWindow = () => {
/// #if !BROWSER
const currentWindow = getCurrentWindow();
currentWindow.on("focus", winOnFocus);
currentWindow.on("blur", () => {
document.body.classList.add("body--blur");
});
ipcRenderer.on(Constants.SIYUAN_OPENURL, (event, url) => {
if (!/^siyuan:\/\/blocks\/\d{14}-\w{7}/.test(url)) {
return;
@ -505,10 +507,6 @@ const initWindow = () => {
maxBtnElement.style.display = "none";
});
currentWindow.on("leave-full-screen", toggleMaxRestoreButtons);
currentWindow.on("blur", () => {
document.body.classList.add("body--blur");
});
const minBtnElement = document.getElementById("minWindow");
const closeBtnElement = document.getElementById("closeWindow");
minBtnElement.addEventListener("click", () => {