This commit is contained in:
Vanessa 2022-06-01 16:50:52 +08:00
parent 848ffce5e8
commit 3b24075f7e
5 changed files with 29 additions and 5 deletions

View file

@ -1,5 +1,11 @@
document.body.insertAdjacentHTML('afterBegin', `<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" xmlns="http://www.w3.org/2000/svg">
<defs>
<symbol id="iconHideDock" viewBox="0 0 32 32">
<path d="M16.015 6.545l-2.924 3.636h5.818l-2.895-3.636zM24.727 13.091v5.818l3.636-2.895-3.636-2.924zM7.273 13.091l-3.636 2.924 3.636 2.895v-5.818zM18.909 21.818h-5.818l2.924 3.636 2.895-3.636zM29.091 2.909h-26.182c-1.6 0-2.909 1.309-2.909 2.909v20.364c0 1.6 1.309 2.909 2.909 2.909h26.182c1.6 0 2.909-1.309 2.909-2.909v-20.364c0-1.6-1.309-2.909-2.909-2.909zM29.091 26.196h-26.182v-20.393h26.182v20.393z"></path>
</symbol>
<symbol id="iconDock" viewBox="0 0 32 32">
<path d="M28.8 3.2h-25.6c-1.76 0-3.2 1.44-3.2 3.2v19.2c0 1.76 1.44 3.2 3.2 3.2h25.6c1.76 0 3.2-1.44 3.2-3.2v-19.2c0-1.76-1.44-3.2-3.2-3.2zM3.2 25.6v-19.2h1.6v19.2h-1.6zM8 25.6v-19.2h16v19.2h-16zM28.8 25.6h-1.6v-19.2h1.6v19.2z"></path>
</symbol>
<symbol id="iconInbox" viewBox="0 0 32 32">
<path d="M30.857 3.429h-29.714c-0.632 0-1.143 0.511-1.143 1.143v22.857c0 0.632 0.511 1.143 1.143 1.143h29.714c0.632 0 1.143-0.511 1.143-1.143v-22.857c0-0.632-0.511-1.143-1.143-1.143zM29.429 7.386v18.614h-26.857v-18.614l-0.986-0.768 1.404-1.804 1.529 1.189h22.968l1.529-1.189 1.404 1.804-0.989 0.768zM27.486 6l-11.486 8.929-13.014-10.118-1.404 1.804 0.986 0.768 12.2 9.486c0.335 0.262 0.762 0.421 1.227 0.421s0.892-0.158 1.231-0.424l-0.004 0.003 13.193-10.25-1.404-1.804-1.525 1.186z"></path>
</symbol>

View file

@ -28,6 +28,18 @@
<body>
<h2>SiYuan</h2>
<div class="fn__clear">
<div>
<svg>
<use xlink:href="#iconDock"></use>
</svg>
iconDock
</div>
<div>
<svg>
<use xlink:href="#iconHideDock"></use>
</svg>
iconHideDock
</div>
<div>
<svg>
<use xlink:href="#iconInbox"></use>

View file

@ -1,5 +1,11 @@
document.body.insertAdjacentHTML('afterbegin', `
<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" xmlns="http://www.w3.org/2000/svg"><defs>
<symbol id="iconHideDock" viewBox="0 0 32 32">
<path d="M16.015 6.545l-2.924 3.636h5.818l-2.895-3.636zM24.727 13.091v5.818l3.636-2.895-3.636-2.924zM7.273 13.091l-3.636 2.924 3.636 2.895v-5.818zM18.909 21.818h-5.818l2.924 3.636 2.895-3.636zM29.091 2.909h-26.182c-1.6 0-2.909 1.309-2.909 2.909v20.364c0 1.6 1.309 2.909 2.909 2.909h26.182c1.6 0 2.909-1.309 2.909-2.909v-20.364c0-1.6-1.309-2.909-2.909-2.909zM29.091 26.196h-26.182v-20.393h26.182v20.393z"></path>
</symbol>
<symbol id="iconDock" viewBox="0 0 32 32">
<path d="M28.8 3.2h-25.6c-1.76 0-3.2 1.44-3.2 3.2v19.2c0 1.76 1.44 3.2 3.2 3.2h25.6c1.76 0 3.2-1.44 3.2-3.2v-19.2c0-1.76-1.44-3.2-3.2-3.2zM3.2 25.6v-19.2h1.6v19.2h-1.6zM8 25.6v-19.2h16v19.2h-16zM28.8 25.6h-1.6v-19.2h1.6v19.2z"></path>
</symbol>
<symbol id="iconInbox" viewBox="0 0 32 32">
<path d="M32 6.4c0-1.76-1.44-3.2-3.2-3.2h-25.6c-1.76 0-3.2 1.44-3.2 3.2v19.2c0 1.76 1.44 3.2 3.2 3.2h25.6c1.76 0 3.2-1.44 3.2-3.2v-19.2zM28.8 6.4l-12.8 8-12.8-8h25.6zM28.8 25.6h-25.6v-16l12.8 8 12.8-8v16z"></path>
</symbol>

View file

@ -131,7 +131,7 @@ export const exportLayout = (reload: boolean, cb?: () => void) => {
return;
}
const layoutJSON: any = {
hideDock: useElement.getAttribute("xlink:href") !== "#iconMax",
hideDock: useElement.getAttribute("xlink:href") === "#iconDock",
layout: {},
top: dockToJSON(window.siyuan.layout.topDock),
bottom: dockToJSON(window.siyuan.layout.bottomDock),

View file

@ -164,7 +164,7 @@ const initBar = () => {
</div>
<div id="barDock" class="toolbar__item b3-tooltips b3-tooltips__s${window.siyuan.config.readonly ? " fn__none" : ""}" aria-label="${window.siyuan.config.uiLayout.hideDock ? window.siyuan.languages.showDock : window.siyuan.languages.hideDock}">
<svg>
<use xlink:href="#${window.siyuan.config.uiLayout.hideDock ? "iconRestore" : "iconMax"}"></use>
<use xlink:href="#${window.siyuan.config.uiLayout.hideDock ? "iconDock" : "iconHideDock"}"></use>
</svg>
</div>
<div id="barThemeMode" class="toolbar__item b3-tooltips b3-tooltips__se${window.siyuan.config.appearance.mode === 1 ? " toolbar__item--active" : ""}" aria-label="${window.siyuan.languages.darkMode}">
@ -246,12 +246,12 @@ const initBar = () => {
const barDockElement = document.getElementById("barDock");
const useElement = document.querySelector("#barDock use");
barDockElement.addEventListener("click", () => {
const dockIsShow = useElement.getAttribute("xlink:href") === "#iconMax";
const dockIsShow = useElement.getAttribute("xlink:href") === "#iconHideDock";
if (dockIsShow) {
useElement.setAttribute("xlink:href", "#iconRestore");
useElement.setAttribute("xlink:href", "#iconDock");
barDockElement.setAttribute("aria-label", window.siyuan.languages.showDock);
} else {
useElement.setAttribute("xlink:href", "#iconMax");
useElement.setAttribute("xlink:href", "#iconHideDock");
barDockElement.setAttribute("aria-label", window.siyuan.languages.hideDock);
}
document.querySelectorAll(".dock").forEach(item => {