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

View file

@ -26,6 +26,11 @@
--b3-font-family-emoji: "Segoe UI Emoji", "Segoe UI Symbol", "Segoe UI", "Apple Color Emoji", "Twemoji Mozilla", "Noto Color Emoji", "Android Emoji"; --b3-font-family-emoji: "Segoe UI Emoji", "Segoe UI Symbol", "Segoe UI", "Apple Color Emoji", "Twemoji Mozilla", "Noto Color Emoji", "Android Emoji";
--b3-font-family-math: KaTeX_Math; --b3-font-family-math: KaTeX_Math;
/* 顶部工具栏 */
--b3-toolbar-background: #292a2d;
--b3-toolbar-blur-background: #3f4041;
--b3-toolbar-color: #9aa0a6;
/* 线条 */ /* 线条 */
--b3-border-color: rgba(0, 0, 0, .06); --b3-border-color: rgba(0, 0, 0, .06);

View file

@ -26,8 +26,13 @@
--b3-font-family-emoji: "Segoe UI Emoji", "Segoe UI Symbol", "Segoe UI", "Apple Color Emoji", "Twemoji Mozilla", "Noto Color Emoji", "Android Emoji"; --b3-font-family-emoji: "Segoe UI Emoji", "Segoe UI Symbol", "Segoe UI", "Apple Color Emoji", "Twemoji Mozilla", "Noto Color Emoji", "Android Emoji";
--b3-font-family-math: KaTeX_Math; --b3-font-family-math: KaTeX_Math;
/* 顶部工具栏 */
--b3-toolbar-background: #292a2d;
--b3-toolbar-blur-background: #3f4041;
--b3-toolbar-color: #9aa0a6;
/* 线条 */ /* 线条 */
--b3-border-color: rgba(230, 230, 230, .06); --b3-border-color: #0e0f10;
/* 滚动条 */ /* 滚动条 */
--b3-scroll-color: rgba(230, 230, 230, .2); --b3-scroll-color: rgba(230, 230, 230, .2);

View file

@ -95,10 +95,6 @@
height: 30px; height: 30px;
flex-shrink: 0; flex-shrink: 0;
&--active {
background-color: var(--b3-list-hover);
}
&--border { &--border {
background-color: var(--b3-theme-surface); background-color: var(--b3-theme-surface);
} }

View file

@ -1,7 +1,7 @@
.layout { .layout {
&__wnd--active { &__wnd--active {
.layout-tab-bar .item--focus { .layout-tab-bar .item--focus {
box-shadow: inset 0 2px 0 0 var(--b3-theme-background-light) !important; box-shadow: inset 0 -2px 0 0 var(--b3-theme-primary) !important;
& > .item__text { & > .item__text {
color: var(--b3-theme-on-background); color: var(--b3-theme-on-background);
@ -9,6 +9,17 @@
} }
} }
&__tab--active {
.b3-list--background .b3-list-item--focus:not(.dragover):not(.dragover__top):not(.dragover__bottom) {
background-color: var(--b3-theme-primary-lightest);
}
.graph__svg,
.inbox__list {
background-color: var(--b3-theme-background);
}
}
&__resize { &__resize {
cursor: row-resize; cursor: row-resize;
margin: -3px 0; margin: -3px 0;
@ -130,7 +141,6 @@
&:hover:not(.item--focus):not(.item--readonly) { &:hover:not(.item--focus):not(.item--readonly) {
background-color: var(--b3-list-hover); background-color: var(--b3-list-hover);
box-shadow: none; box-shadow: none;
border-radius: 4px 4px 0 0;
.item__text::after { .item__text::after {
background: linear-gradient(90deg, rgba(0, 0, 0, 0.001), var(--b3-list-hover)); background: linear-gradient(90deg, rgba(0, 0, 0, 0.001), var(--b3-list-hover));
@ -160,7 +170,6 @@
&--focus { &--focus {
background-color: var(--b3-theme-background); background-color: var(--b3-theme-background);
box-shadow: none !important; box-shadow: none !important;
border-radius: 4px 4px 0 0;
.item__text::after { .item__text::after {
background: linear-gradient(90deg, rgba(0, 0, 0, 0.001), var(--b3-theme-background)); background: linear-gradient(90deg, rgba(0, 0, 0, 0.001), var(--b3-theme-background));

View file

@ -8,6 +8,7 @@
&:hover:not(.b3-list-item--focus), &:hover:not(.b3-list-item--focus),
&--focus:not(.dragover):not(.dragover__top):not(.dragover__bottom) { &--focus:not(.dragover):not(.dragover__top):not(.dragover__bottom) {
background-color: var(--b3-list-hover); background-color: var(--b3-list-hover);
border-radius: 4px;
} }
} }

View file

@ -168,7 +168,7 @@
padding: 4px; padding: 4px;
line-height: 16px; line-height: 16px;
height: 16px; height: 16px;
border-radius: 2px; border-radius: 4px;
margin: 3px 0; margin: 3px 0;
color: var(--b3-theme-on-surface); color: var(--b3-theme-on-surface);
max-width: 70%; max-width: 70%;

View file

@ -19,6 +19,10 @@ body {
max-height: 100%; max-height: 100%;
overflow: hidden; overflow: hidden;
&.body--blur .toolbar {
background: var(--b3-toolbar-blur-background);
}
&.body--win32 { &.body--win32 {
-webkit-font-smoothing: auto; -webkit-font-smoothing: auto;
@ -26,10 +30,6 @@ body {
padding-left: 0; padding-left: 0;
} }
&.body--blur {
border-top-color: var(--b3-theme-surface);
}
.fullscreen { .fullscreen {
& > .protyle-breadcrumb, & > .protyle-breadcrumb,
& > .block__icons { & > .block__icons {

View file

@ -1,6 +1,6 @@
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 10px; width: 8px;
height: 10px; height: 8px;
} }
::-webkit-scrollbar-corner { ::-webkit-scrollbar-corner {
@ -10,10 +10,10 @@
::-webkit-scrollbar-thumb { ::-webkit-scrollbar-thumb {
box-sizing: content-box; box-sizing: content-box;
border: 3px solid transparent; border: 3px solid transparent;
border-radius: 1024px; border-radius: 4px;
box-shadow: inset 0 0 6px 6px var(--b3-scroll-color); box-shadow: inset 0 0 4px 4px var(--b3-scroll-color);
&:hover { &:hover {
border-width: 1.5px; border-width: 1px;
} }
} }

View file

@ -159,11 +159,12 @@ progressLoading: 400
} }
.toolbar { .toolbar {
background-color: #292a2d; background-color: var(--b3-toolbar-background);
box-sizing: border-box; box-sizing: border-box;
height: 42px; height: 42px;
line-height: 22px; line-height: 22px;
padding-left: 84px; padding-left: 84px;
box-shadow: inset 0px -1px 1px 0px var(--b3-border-color);
&--browser { &--browser {
padding-left: 0; padding-left: 0;
@ -183,7 +184,7 @@ progressLoading: 400
#drag { #drag {
-webkit-app-region: drag; -webkit-app-region: drag;
font-size: 14px; font-size: 14px;
color: #9aa0a6; color: var(--b3-toolbar-color);
user-select: none; user-select: none;
text-align: center; text-align: center;
white-space: nowrap; white-space: nowrap;
@ -193,7 +194,7 @@ progressLoading: 400
&__item { &__item {
flex-shrink: 0; flex-shrink: 0;
cursor: pointer; cursor: pointer;
color: #9aa0a6; color: var(--b3-toolbar-color);
padding: 12px; padding: 12px;
box-sizing: border-box; box-sizing: border-box;
transition: var(--b3-transition); transition: var(--b3-transition);

View file

@ -233,7 +233,7 @@ export class Backlink extends Model {
if (this.type === "local") { if (this.type === "local") {
setPanelFocus(this.element.parentElement.parentElement); setPanelFocus(this.element.parentElement.parentElement);
} else { } else {
setPanelFocus(this.element.firstElementChild); setPanelFocus(this.element);
} }
let target = event.target as HTMLElement; let target = event.target as HTMLElement;
while (target && !target.isEqualNode(this.element)) { while (target && !target.isEqualNode(this.element)) {
@ -298,7 +298,7 @@ export class Backlink extends Model {
this.searchBacklinks(true); this.searchBacklinks(true);
if (this.type === "pin") { if (this.type === "pin") {
setPanelFocus(this.element.firstElementChild); setPanelFocus(this.element);
} }
} }

View file

@ -178,7 +178,7 @@ export class Bookmark extends Model {
this.tree.expandAll(); this.tree.expandAll();
}); });
this.element.addEventListener("click", (event) => { this.element.addEventListener("click", (event) => {
setPanelFocus(this.element.firstElementChild); setPanelFocus(this.element);
let target = event.target as HTMLElement; let target = event.target as HTMLElement;
while (target && !target.isEqualNode(this.element)) { while (target && !target.isEqualNode(this.element)) {
if (target.classList.contains("block__icon")) { if (target.classList.contains("block__icon")) {
@ -197,7 +197,7 @@ export class Bookmark extends Model {
}); });
this.update(); this.update();
setPanelFocus(this.element.firstElementChild); setPanelFocus(this.element);
} }
public update() { public update() {

View file

@ -93,7 +93,7 @@ export class Files extends Model {
this.element = this.actionsElement.nextElementSibling as HTMLElement; this.element = this.actionsElement.nextElementSibling as HTMLElement;
this.closeElement = options.tab.panelElement.lastElementChild as HTMLElement; this.closeElement = options.tab.panelElement.lastElementChild as HTMLElement;
this.closeElement.addEventListener("click", (event) => { this.closeElement.addEventListener("click", (event) => {
setPanelFocus(this.actionsElement); setPanelFocus(this.element.parentElement);
let target = event.target as HTMLElement; let target = event.target as HTMLElement;
while (target && !target.isEqualNode(this.closeElement)) { while (target && !target.isEqualNode(this.closeElement)) {
const type = target.getAttribute("data-type"); const type = target.getAttribute("data-type");
@ -180,7 +180,7 @@ export class Files extends Model {
} }
target = target.parentElement; target = target.parentElement;
} }
setPanelFocus(this.actionsElement); setPanelFocus(this.element.parentElement);
}); });
let clickTimeout: number; let clickTimeout: number;
this.element.addEventListener("click", (event) => { this.element.addEventListener("click", (event) => {
@ -245,7 +245,7 @@ export class Files extends Model {
} }
} else if (target.getAttribute("data-type") === "navigation-root") { } else if (target.getAttribute("data-type") === "navigation-root") {
this.getLeaf(target, notebookId); this.getLeaf(target, notebookId);
setPanelFocus(this.actionsElement); setPanelFocus(this.element.parentElement);
} }
}, Constants.TIMEOUT_DBLCLICK); }, Constants.TIMEOUT_DBLCLICK);
} else if (event.detail === 2) { } else if (event.detail === 2) {
@ -262,7 +262,7 @@ export class Files extends Model {
} }
} }
if (needFocus) { if (needFocus) {
setPanelFocus(this.actionsElement); setPanelFocus(this.element.parentElement);
} }
}); });
// b3-list-item--focus 样式会遮挡拖拽排序的上下线条 // b3-list-item--focus 样式会遮挡拖拽排序的上下线条
@ -467,7 +467,7 @@ export class Files extends Model {
newElement.classList.remove("dragover", "dragover__bottom", "dragover__top"); newElement.classList.remove("dragover", "dragover__bottom", "dragover__top");
}); });
this.init(); this.init();
setPanelFocus(this.actionsElement); setPanelFocus(this.element.parentElement);
} }
private genNotebook(item: INotebook) { private genNotebook(item: INotebook) {

View file

@ -293,7 +293,7 @@ export class Graph extends Model {
if (this.type === "local") { if (this.type === "local") {
setPanelFocus(this.element.parentElement.parentElement); setPanelFocus(this.element.parentElement.parentElement);
} else { } else {
setPanelFocus(this.element.firstElementChild); setPanelFocus(this.element);
} }
let target = event.target as HTMLElement; let target = event.target as HTMLElement;
while (target && !target.isEqualNode(this.element)) { while (target && !target.isEqualNode(this.element)) {
@ -364,7 +364,7 @@ export class Graph extends Model {
}); });
this.searchGraph(options.type !== "global"); this.searchGraph(options.type !== "global");
if (this.type !== "local") { if (this.type !== "local") {
setPanelFocus(this.element.firstElementChild); setPanelFocus(this.element);
} }
} }

View file

@ -54,7 +54,7 @@ export class Inbox extends Model {
const detailsElement = this.element.querySelector(".inbox__details"); const detailsElement = this.element.querySelector(".inbox__details");
const selectAllElement = this.element.querySelector(".block__icons input") as HTMLInputElement; const selectAllElement = this.element.querySelector(".block__icons input") as HTMLInputElement;
this.element.addEventListener("click", (event: MouseEvent) => { this.element.addEventListener("click", (event: MouseEvent) => {
setPanelFocus(this.element.firstElementChild); setPanelFocus(this.element);
let target = event.target as HTMLElement; let target = event.target as HTMLElement;
while (target && !target.isEqualNode(this.element)) { while (target && !target.isEqualNode(this.element)) {
const typeElement = hasClosestByAttribute(target, "data-type", null); const typeElement = hasClosestByAttribute(target, "data-type", null);
@ -160,7 +160,7 @@ ${(Lute.New()).MarkdownStr("", data.shorthandContent)}
} }
); );
this.update(); this.update();
setPanelFocus(this.element.firstElementChild); setPanelFocus(this.element);
} }
private updateAction() { private updateAction() {

View file

@ -121,7 +121,7 @@ export class Outline extends Model {
if (this.type === "local") { if (this.type === "local") {
setPanelFocus(options.tab.panelElement.parentElement.parentElement); setPanelFocus(options.tab.panelElement.parentElement.parentElement);
} else { } else {
setPanelFocus(options.tab.panelElement.firstElementChild); setPanelFocus(options.tab.panelElement);
} }
let target = event.target as HTMLElement; let target = event.target as HTMLElement;
while (target && !target.isEqualNode(options.tab.panelElement)) { while (target && !target.isEqualNode(options.tab.panelElement)) {
@ -163,7 +163,7 @@ export class Outline extends Model {
}); });
if (this.type === "pin") { if (this.type === "pin") {
setPanelFocus(options.tab.panelElement.firstElementChild); setPanelFocus(options.tab.panelElement);
} }
} }

View file

@ -130,7 +130,7 @@ export class Tag extends Model {
this.tree.expandAll(); this.tree.expandAll();
}); });
this.element.addEventListener("click", (event: MouseEvent) => { this.element.addEventListener("click", (event: MouseEvent) => {
setPanelFocus(this.element.firstElementChild); setPanelFocus(this.element);
let target = event.target as HTMLElement; let target = event.target as HTMLElement;
while (target && !target.isEqualNode(this.element)) { while (target && !target.isEqualNode(this.element)) {
if (target.classList.contains("block__icon")) { if (target.classList.contains("block__icon")) {
@ -202,7 +202,7 @@ export class Tag extends Model {
} }
}); });
this.update(); this.update();
setPanelFocus(this.element.firstElementChild); setPanelFocus(this.element);
} }
private update() { private update() {

View file

@ -92,7 +92,7 @@ export class Dock {
public toggleModel(type: TDockType, show = false, close = false) { public toggleModel(type: TDockType, show = false, close = false) {
const target = this.element.querySelector(`[data-type="${type}"]`) as HTMLElement; const target = this.element.querySelector(`[data-type="${type}"]`) as HTMLElement;
if (show && target.classList.contains("dock__item--active")) { if (show && target.classList.contains("dock__item--active")) {
target.classList.remove("dock__item--active"); target.classList.remove("dock__item--active", "dock__item--activefocus");
} }
const index = parseInt(target.getAttribute("data-index")); const index = parseInt(target.getAttribute("data-index"));
const wnd = this.layout.children[index] as Wnd; const wnd = this.layout.children[index] as Wnd;
@ -101,8 +101,8 @@ export class Dock {
let needFocus = false; let needFocus = false;
Array.from(wnd.element.querySelector(".layout-tab-container").children).find(item => { Array.from(wnd.element.querySelector(".layout-tab-container").children).find(item => {
if (item.getAttribute("data-id") === target.getAttribute("data-id")) { if (item.getAttribute("data-id") === target.getAttribute("data-id")) {
if (!item.firstElementChild.classList.contains("block__icons--active")) { if (!item.classList.contains("layout__tab--active")) {
setPanelFocus(item.firstElementChild); setPanelFocus(item);
needFocus = true; needFocus = true;
} }
return true; return true;
@ -113,7 +113,7 @@ export class Dock {
} }
} }
target.classList.remove("dock__item--active"); target.classList.remove("dock__item--active", "dock__item--activefocus");
// dock 隐藏 // dock 隐藏
if (this.element.querySelectorAll(".dock__item--active").length === 0) { if (this.element.querySelectorAll(".dock__item--active").length === 0) {
if (this.position === "Left" || this.position === "Right") { if (this.position === "Left" || this.position === "Right") {
@ -128,9 +128,9 @@ export class Dock {
} }
} else { } else {
this.element.querySelectorAll(`.dock__item--active[data-index="${index}"]`).forEach(item => { this.element.querySelectorAll(`.dock__item--active[data-index="${index}"]`).forEach(item => {
item.classList.remove("dock__item--active"); item.classList.remove("dock__item--active", "dock__item--activefocus");
}); });
target.classList.add("dock__item--active"); target.classList.add("dock__item--active", "dock__item--activefocus");
if (!target.getAttribute("data-id")) { if (!target.getAttribute("data-id")) {
let editor: Protyle; let editor: Protyle;
const models = getAllModels(); const models = getAllModels();
@ -226,7 +226,7 @@ export class Dock {
Array.from(wnd.element.querySelector(".layout-tab-container").children).forEach(item => { Array.from(wnd.element.querySelector(".layout-tab-container").children).forEach(item => {
if (item.getAttribute("data-id") === target.getAttribute("data-id")) { if (item.getAttribute("data-id") === target.getAttribute("data-id")) {
item.classList.remove("fn__none"); item.classList.remove("fn__none");
setPanelFocus(item.firstElementChild); setPanelFocus(item);
} else { } else {
item.classList.add("fn__none"); item.classList.add("fn__none");
} }

View file

@ -28,11 +28,11 @@ import {pdfResize} from "../asset/renderAssets";
import {Backlink} from "./dock/Backlink"; import {Backlink} from "./dock/Backlink";
export const setPanelFocus = (element: Element) => { export const setPanelFocus = (element: Element) => {
if (element.classList.contains("block__icons--active") || element.classList.contains("layout__wnd--active")) { if (element.classList.contains("layout__tab--active") || element.classList.contains("layout__wnd--active")) {
return; return;
} }
document.querySelectorAll(".block__icons--active").forEach(item => { document.querySelectorAll(".layout__tab--active").forEach(item => {
item.classList.remove("block__icons--active"); item.classList.remove("layout__tab--active");
}); });
document.querySelectorAll(".dock__item--activefocus").forEach(item => { document.querySelectorAll(".dock__item--activefocus").forEach(item => {
item.classList.remove("dock__item--activefocus"); item.classList.remove("dock__item--activefocus");
@ -40,10 +40,12 @@ export const setPanelFocus = (element: Element) => {
document.querySelectorAll(".layout__wnd--active").forEach(item => { document.querySelectorAll(".layout__wnd--active").forEach(item => {
item.classList.remove("layout__wnd--active"); item.classList.remove("layout__wnd--active");
}); });
if (element.classList.contains("block__icons")) { if (element.getAttribute("data-type") === "wnd") {
element.classList.add("block__icons--active"); element.classList.add("layout__wnd--active");
} else {
element.classList.add("layout__tab--active");
["file", "inbox", "backlink", "tag", "bookmark", "graph", "globalGraph", "outline"].find(item => { ["file", "inbox", "backlink", "tag", "bookmark", "graph", "globalGraph", "outline"].find(item => {
if (element.parentElement.classList.contains("sy__" + item)) { if (element.classList.contains("sy__" + item)) {
document.querySelector(`.dock__item[data-type="${item}"]`).classList.add("dock__item--activefocus"); document.querySelector(`.dock__item[data-type="${item}"]`).classList.add("dock__item--activefocus");
return true; return true;
} }
@ -55,8 +57,6 @@ export const setPanelFocus = (element: Element) => {
editElement.blur(); editElement.blur();
} }
} }
} else {
element.classList.add("layout__wnd--active");
} }
}; };

View file

@ -195,8 +195,8 @@ export class Protyle {
updatePanelByEditor(this.protyle, false); updatePanelByEditor(this.protyle, false);
} else { } else {
// 悬浮层应移除其余面板高亮,否则按键会被面板监听到 // 悬浮层应移除其余面板高亮,否则按键会被面板监听到
document.querySelectorAll(".block__icons--active").forEach(item => { document.querySelectorAll(".layout__tab--active").forEach(item => {
item.classList.remove("block__icons--active"); item.classList.remove("layout__tab--active");
}); });
document.querySelectorAll(".layout__wnd--active").forEach(item => { document.querySelectorAll(".layout__wnd--active").forEach(item => {
item.classList.remove("layout__wnd--active"); item.classList.remove("layout__wnd--active");

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))) { 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) { if (!activePanelElement) {
Array.from(document.querySelectorAll(".layout__wnd--active .layout-tab-container > div")).forEach(item => { Array.from(document.querySelectorAll(".layout__wnd--active .layout-tab-container > div")).forEach(item => {
if (!item.classList.contains("fn__none")) { 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) { if (matchHotKey(window.siyuan.config.keymap.general.closeTab.custom, event) && !event.repeat) {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
let activeTabElement = document.querySelector(".block__icons--active"); let activeTabElement = document.querySelector(".layout__tab--active");
if (activeTabElement && activeTabElement.getBoundingClientRect().width > 0) { if (activeTabElement && activeTabElement.getBoundingClientRect().width > 0) {
let type: TDockType; let type: TDockType;
Array.from(activeTabElement.parentElement.classList).find(item => { Array.from(activeTabElement.classList).find(item => {
if (item.startsWith("sy__")) { if (item.startsWith("sy__")) {
type = item.replace("sy__", "") as TDockType; type = item.replace("sy__", "") as TDockType;
return true; return true;
@ -756,9 +756,9 @@ const editKeydown = (event: KeyboardEvent) => {
} }
protyle = editor.editor.protyle; protyle = editor.editor.protyle;
} }
const activePanelElement = document.querySelector(".block__icons--active"); const activePanelElement = document.querySelector(".layout__tab--active");
let isFileFocus = false; let isFileFocus = false;
if (activePanelElement && activePanelElement.parentElement.classList.contains("sy__file")) { if (activePanelElement && activePanelElement.classList.contains("sy__file")) {
isFileFocus = true; isFileFocus = true;
} }
let searchKey = ""; let searchKey = "";
@ -858,7 +858,7 @@ const fileTreeKeydown = (event: KeyboardEvent) => {
dockFile.toggleModel("file", true); dockFile.toggleModel("file", true);
return; return;
} }
if (!files.element.previousElementSibling.classList.contains("block__icons--active")) { if (!files.element.parentElement.classList.contains("layout__tab--active")) {
return false; return false;
} }
let liElement = files.element.querySelector(".b3-list-item--focus"); 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 {mountHelp, newDailyNote} from "./mount";
import {MenuItem} from "../menus/Menu"; import {MenuItem} from "../menus/Menu";
import {initAssets, loadAssets, renderSnippet, setInlineStyle, setMode} from "./assets"; import {initAssets, loadAssets, renderSnippet, setInlineStyle, setMode} from "./assets";
import {goBack, goForward} from "./backForward";
import {getOpenNotebookCount} from "./pathName"; import {getOpenNotebookCount} from "./pathName";
import {openFileById} from "../editor/util"; import {openFileById} from "../editor/util";
import {focusByRange} from "../protyle/util/selection"; import {focusByRange} from "../protyle/util/selection";
@ -314,6 +313,9 @@ const initWindow = () => {
/// #if !BROWSER /// #if !BROWSER
const currentWindow = getCurrentWindow(); const currentWindow = getCurrentWindow();
currentWindow.on("focus", winOnFocus); currentWindow.on("focus", winOnFocus);
currentWindow.on("blur", () => {
document.body.classList.add("body--blur");
});
ipcRenderer.on(Constants.SIYUAN_OPENURL, (event, url) => { ipcRenderer.on(Constants.SIYUAN_OPENURL, (event, url) => {
if (!/^siyuan:\/\/blocks\/\d{14}-\w{7}/.test(url)) { if (!/^siyuan:\/\/blocks\/\d{14}-\w{7}/.test(url)) {
return; return;
@ -505,10 +507,6 @@ const initWindow = () => {
maxBtnElement.style.display = "none"; maxBtnElement.style.display = "none";
}); });
currentWindow.on("leave-full-screen", toggleMaxRestoreButtons); currentWindow.on("leave-full-screen", toggleMaxRestoreButtons);
currentWindow.on("blur", () => {
document.body.classList.add("body--blur");
});
const minBtnElement = document.getElementById("minWindow"); const minBtnElement = document.getElementById("minWindow");
const closeBtnElement = document.getElementById("closeWindow"); const closeBtnElement = document.getElementById("closeWindow");
minBtnElement.addEventListener("click", () => { minBtnElement.addEventListener("click", () => {