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", "superBlock": "Super block",
"embedBlock": "Embed block", "embedBlock": "Embed block",
"expand": "Expand", "expand": "Expand",
"showDock": "Show Dock", "toggleDock": "Show/Hide Dock",
"hideDock": "Hide Dock",
"notebookName": "Please enter a notebook name", "notebookName": "Please enter a notebook name",
"moveToLeftTop": "Move to the Left Top", "moveToLeftTop": "Move to the Left Top",
"moveToLeftBottom": "Move to the Left Bottom", "moveToLeftBottom": "Move to the Left Bottom",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@ import {getAllModels} from "../getAll";
import {Tab} from "../Tab"; import {Tab} from "../Tab";
import {Graph} from "./Graph"; import {Graph} from "./Graph";
import {Outline} from "./Outline"; import {Outline} from "./Outline";
import {switchWnd} from "../util"; import {resizeTabs, switchWnd} from "../util";
import {Backlink} from "./Backlink"; import {Backlink} from "./Backlink";
export const openBacklink = (protyle: IProtyle) => { export const openBacklink = (protyle: IProtyle) => {
@ -101,3 +101,21 @@ export const resetFloatDockSize = () => {
window.siyuan.layout.bottomDock.showDock(true); 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 /// #endif
import {MenuItem} from "../menus/Menu"; import {MenuItem} from "../menus/Menu";
import {Constants} from "../constants"; 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) => { export const initStatus = (isWindow = false) => {
/// #if !MOBILE /// #if !MOBILE
let barDockHTML = ""; let barDockHTML = "";
if (!isWindow) { 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> <svg>
<use xlink:href="#${window.siyuan.config.uiLayout.hideDock ? "iconDock" : "iconHideDock"}"></use> <use xlink:href="#${window.siyuan.config.uiLayout.hideDock ? "iconDock" : "iconHideDock"}"></use>
</svg> </svg>
@ -33,24 +34,7 @@ export const initStatus = (isWindow = false) => {
let target = event.target as HTMLElement; let target = event.target as HTMLElement;
while (target.id !== "status") { while (target.id !== "status") {
if (target.id === "barDock") { if (target.id === "barDock") {
const useElement = target.firstElementChild.firstElementChild; toggleDockBar(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();
event.stopPropagation(); event.stopPropagation();
break; break;
} else if (target.classList.contains("status__backgroundtask")) { } else if (target.classList.contains("status__backgroundtask")) {