This commit is contained in:
Vanessa 2023-08-15 16:55:32 +08:00
parent e87504e2b4
commit 09ed2b15ed
9 changed files with 35 additions and 31 deletions

View file

@ -614,8 +614,7 @@
"superBlock": "Super block",
"embedBlock": "Embed block",
"expand": "Expand",
"showDock": "Show Dock",
"hideDock": "Hide Dock",
"toggleDock": "Show/Hide Dock",
"notebookName": "Please enter a notebook name",
"moveToLeftTop": "Move to the Left Top",
"moveToLeftBottom": "Move to the Left Bottom",

View file

@ -614,8 +614,7 @@
"superBlock": "Superbloque",
"embedBlock": "Bloque incrustado",
"expand": "Expandir",
"showDock": "Mostrar Dock",
"hideDock": "Ocultar Dock",
"toggleDock": "Mostrar/ocultar Dock",
"notebookName": "Por favor, introduzca un nombre de cuaderno",
"moveToLeftTop": "Muéve a la parte superior izquierda",
"moveToLeftBottom": "Muéve a la parte inferior izquierda",

View file

@ -614,8 +614,7 @@
"superBlock": "Superblock",
"embedBlock": "Bloc intégré",
"expand": "Élargir",
"showDock": "Montrer le Dock",
"hideDock": "Cacher le Dock",
"toggleDock": "Afficher/masquer le Dock",
"notebookName": "Veuillez entrer un nom de carnet de notes",
"moveToLeftTop": "Déplacer vers la Gauche à Haut",
"moveToLeftBottom": "Déplacer vers la Gauche à Bas",

View file

@ -614,8 +614,7 @@
"superBlock": "超級塊",
"embedBlock": "嵌入塊",
"expand": "展開",
"showDock": "顯示停靠欄",
"hideDock": "隱藏停靠欄",
"toggleDock": "顯示/隱藏停靠欄",
"notebookName": "請輸入筆記本名稱",
"moveToLeftTop": "移動到左側上方",
"moveToLeftBottom": "移動到左側下方",

View file

@ -614,8 +614,7 @@
"superBlock": "超级块",
"embedBlock": "嵌入块",
"expand": "展开",
"showDock": "显示停靠栏",
"hideDock": "隐藏停靠栏",
"toggleDock": "显示/隐藏停靠栏",
"notebookName": "请输入笔记本名称",
"moveToLeftTop": "移动到左侧上方",
"moveToLeftBottom": "移动到左侧下方",

View file

@ -55,6 +55,7 @@ import {setPadding} from "../protyle/ui/initUI";
import {openRecentDocs} from "../business/openRecentDocs";
import {App} from "../index";
import {commandPanel} from "../plugin/commandPanel";
import {toggleDockBar} from "../layout/dock/util";
const getRightBlock = (element: HTMLElement, x: number, y: number) => {
let index = 1;
@ -635,6 +636,11 @@ export const globalShortcut = (app: App) => {
event.preventDefault();
return;
}
if (!isTabWindow && matchHotKey(window.siyuan.config.keymap.general.toggleDock.custom, event)) {
toggleDockBar(document.querySelector("#barDock use"));
event.preventDefault();
return;
}
if (!isTabWindow && !window.siyuan.config.readonly && matchHotKey(window.siyuan.config.keymap.general.config.custom, event)) {
openSetting(app);
event.preventDefault();

View file

@ -242,6 +242,7 @@ export abstract class Constants {
recentDocs: {default: "⌘E", custom: "⌘E"},
move: {default: "", custom: ""},
selectOpen1: {default: "", custom: ""},
toggleDock: {default: "", custom: ""},
},
editor: {
general: {

View file

@ -2,7 +2,7 @@ import {getAllModels} from "../getAll";
import {Tab} from "../Tab";
import {Graph} from "./Graph";
import {Outline} from "./Outline";
import {switchWnd} from "../util";
import {resizeTabs, switchWnd} from "../util";
import {Backlink} from "./Backlink";
export const openBacklink = (protyle: IProtyle) => {
@ -101,3 +101,21 @@ export const resetFloatDockSize = () => {
window.siyuan.layout.bottomDock.showDock(true);
}
};
export const toggleDockBar = (useElement:Element)=> {
const dockIsShow = useElement.getAttribute("xlink:href") === "#iconHideDock";
if (dockIsShow) {
useElement.setAttribute("xlink:href", "#iconDock");
} else {
useElement.setAttribute("xlink:href", "#iconHideDock");
}
document.querySelectorAll(".dock").forEach(item => {
if (dockIsShow) {
item.classList.add("fn__none");
} else if (item.querySelectorAll(".dock__item").length > 1) {
item.classList.remove("fn__none");
}
});
resizeTabs();
resetFloatDockSize();
}

View file

@ -9,13 +9,14 @@ import {getCurrentWindow} from "@electron/remote";
/// #endif
import {MenuItem} from "../menus/Menu";
import {Constants} from "../constants";
import {resetFloatDockSize} from "./dock/util";
import {toggleDockBar} from "./dock/util";
import {updateHotkeyTip} from "../protyle/util/compatibility";
export const initStatus = (isWindow = false) => {
/// #if !MOBILE
let barDockHTML = "";
if (!isWindow) {
barDockHTML = `<div id="barDock" class="toolbar__item b3-tooltips b3-tooltips__e${window.siyuan.config.readonly || isWindow ? " fn__none" : ""}" aria-label="${window.siyuan.config.uiLayout.hideDock ? window.siyuan.languages.showDock : window.siyuan.languages.hideDock}">
barDockHTML = `<div id="barDock" class="toolbar__item b3-tooltips b3-tooltips__e${window.siyuan.config.readonly || isWindow ? " fn__none" : ""}" aria-label="${window.siyuan.languages.toggleDock} ${updateHotkeyTip(window.siyuan.config.keymap.general.toggleDock.custom)}">
<svg>
<use xlink:href="#${window.siyuan.config.uiLayout.hideDock ? "iconDock" : "iconHideDock"}"></use>
</svg>
@ -33,24 +34,7 @@ export const initStatus = (isWindow = false) => {
let target = event.target as HTMLElement;
while (target.id !== "status") {
if (target.id === "barDock") {
const useElement = target.firstElementChild.firstElementChild;
const dockIsShow = useElement.getAttribute("xlink:href") === "#iconHideDock";
if (dockIsShow) {
useElement.setAttribute("xlink:href", "#iconDock");
target.setAttribute("aria-label", window.siyuan.languages.showDock);
} else {
useElement.setAttribute("xlink:href", "#iconHideDock");
target.setAttribute("aria-label", window.siyuan.languages.hideDock);
}
document.querySelectorAll(".dock").forEach(item => {
if (dockIsShow) {
item.classList.add("fn__none");
} else if (item.querySelectorAll(".dock__item").length > 1) {
item.classList.remove("fn__none");
}
});
resizeTabs();
resetFloatDockSize();
toggleDockBar(target.firstElementChild.firstElementChild);
event.stopPropagation();
break;
} else if (target.classList.contains("status__backgroundtask")) {