mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 00:38:49 +01:00
This commit is contained in:
parent
7604a0a930
commit
f687828a6b
14 changed files with 50 additions and 32 deletions
|
|
@ -294,8 +294,12 @@ document.body.insertAdjacentHTML('afterbegin', `<svg style="position: absolute;
|
|||
<symbol id="iconFont" viewBox="0 0 32 32">
|
||||
<path d="M31.68 28.16h-31.36c-0.176 0-0.32 0.144-0.32 0.32v3.2c0 0.176 0.144 0.32 0.32 0.32h31.36c0.176 0 0.32-0.144 0.32-0.32v-3.2c0-0.176-0.144-0.32-0.32-0.32zM5.668 24.96h3.4c0.168 0 0.32-0.108 0.372-0.272l2.148-6.64h8.768l2.128 6.64c0.052 0.16 0.2 0.272 0.372 0.272h3.564c0.044 0 0.088-0.008 0.128-0.020 0.154-0.054 0.262-0.198 0.262-0.367 0-0.046-0.008-0.091-0.023-0.132l0.001 0.003-8.324-24.18c-0.055-0.153-0.199-0.262-0.368-0.264h-4.092c-0.168 0-0.316 0.104-0.368 0.264l-8.336 24.18c-0.016 0.040-0.020 0.084-0.020 0.128-0.004 0.212 0.172 0.388 0.388 0.388zM15.904 4.316h0.164l3.352 10.552h-6.904l3.388-10.552z"></path>
|
||||
</symbol>
|
||||
<symbol id="iconUnpin" viewBox="0 0 32 32">
|
||||
<path d="M3.272 1.151l27.577 27.577-2.121 2.121-27.577-27.577z"></path>
|
||||
<path d="M22 14.5l3 3v1.311l-6-6v-8.811h-6v2.811l-4.5-4.5v-1.311h15v3h-1.5zM17.5 20.5v9l-1.5 1.5-1.5-1.5v-9h-7.5v-3l3-3v-6.446l3 3v4.721l-1.725 1.725h8.171l3 3z"></path>
|
||||
</symbol>
|
||||
<symbol id="iconPin" viewBox="0 0 32 32">
|
||||
<path d="M31.588 10.9l-10.486-10.486c-0.277-0.277-0.638-0.413-1-0.413s-0.723 0.136-1 0.413l-6.856 6.86c-0.519-0.060-1.043-0.085-1.566-0.085-3.115 0-6.23 1.026-8.788 3.077-0.324 0.261-0.529 0.658-0.529 1.103 0 0.39 0.158 0.744 0.414 1l7.732 7.732-9.167 9.158c-0.109 0.108-0.181 0.253-0.196 0.414l-0 0.003-0.145 1.583c-0.038 0.4 0.281 0.741 0.677 0.741 0.021 0 0.043 0 0.064-0.004l1.583-0.145c0.157-0.013 0.306-0.085 0.417-0.196l9.167-9.167 7.732 7.732c0.277 0.277 0.638 0.413 1 0.413 0.413 0 0.821-0.179 1.102-0.528 2.396-2.992 3.392-6.737 2.987-10.358l6.856-6.856c0.549-0.545 0.549-1.438 0-1.992zM22.562 17.59l-1.043 1.043 0.162 1.464c0.044 0.369 0.069 0.797 0.069 1.231 0 1.951-0.505 3.783-1.391 5.375l0.029-0.056-15.027-15.035c0.549-0.302 1.119-0.557 1.715-0.762 1.158-0.4 2.37-0.6 3.604-0.6 0.409 0 0.821 0.021 1.23 0.068l1.464 0.162 6.732-6.732 8.149 8.149-5.694 5.694z"></path>
|
||||
<path d="M22 14.5l3 3v3h-7.5v9l-1.5 1.5-1.5-1.5v-9h-7.5v-3l3-3v-10.5h-1.5v-3h15v3h-1.5v10.5zM11.275 17.5h9.45l-1.725-1.725v-11.775h-6v11.775l-1.725 1.725z"></path>
|
||||
</symbol>
|
||||
<symbol id="iconVIP" viewBox="0 0 32 32">
|
||||
<path d="M2.288 12.643l23.487 12.853c0.286 0.153 0.477 0.45 0.477 0.791 0 0.082-0.011 0.161-0.032 0.237l0.001-0.006c-0.119 0.395-0.479 0.678-0.905 0.678-0.004 0-0.009 0-0.013 0h-19.439c-0.958 0-1.766-0.684-1.885-1.595l-1.691-12.956z"></path>
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@
|
|||
"name": "ant",
|
||||
"author": "Vanessa",
|
||||
"url": "https://github.com/Vanessa219",
|
||||
"version": "1.27.0"
|
||||
"version": "1.28.0"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,12 @@
|
|||
</svg>
|
||||
iconArrowDown
|
||||
</div>
|
||||
<div>
|
||||
<svg>
|
||||
<use xlink:href="#iconUnpin"></use>
|
||||
</svg>
|
||||
iconUnpin
|
||||
</div>
|
||||
<div>
|
||||
<svg>
|
||||
<use xlink:href="#iconOpen"></use>
|
||||
|
|
|
|||
|
|
@ -289,8 +289,12 @@ document.body.insertAdjacentHTML('afterbegin', `<svg style="position: absolute;
|
|||
<path opacity="0.36" d="M0 24.667h32v5.333h-32v-5.333z"></path>
|
||||
<path d="M14.667 2l-7.333 18.667h3l1.493-4h8.333l1.493 4h3l-7.32-18.667h-2.667zM12.827 14l3.173-8.44 3.173 8.44h-6.347z"></path>
|
||||
</symbol>
|
||||
<symbol id="iconUnpin" viewBox="0 0 32 32">
|
||||
<path d="M3.272 1.151l27.577 27.577-2.121 2.121-27.577-27.577z"></path>
|
||||
<path d="M22 14.5l3 3v1.311l-6-6v-8.811h-6v2.811l-4.5-4.5v-1.311h15v3h-1.5zM17.5 20.5v9l-1.5 1.5-1.5-1.5v-9h-7.5v-3l3-3v-6.446l3 3v4.721l-1.725 1.725h8.171l3 3z"></path>
|
||||
</symbol>
|
||||
<symbol id="iconPin" viewBox="0 0 32 32">
|
||||
<path d="M19.2 3.2v8c0 1.792 0.592 3.456 1.6 4.8h-9.6c1.040-1.376 1.6-3.040 1.6-4.8v-8h6.4zM24 0h-16c-0.88 0-1.6 0.72-1.6 1.6s0.72 1.6 1.6 1.6c0 0 0 0 0 0h1.6v8c0 2.656-2.144 4.8-4.8 4.8v3.2h9.552v11.2l1.6 1.6 1.6-1.6v-11.2h9.648v-3.2c0 0 0 0 0 0-2.656 0-4.8-2.144-4.8-4.8v-8h1.6c0 0 0 0 0 0 0.88 0 1.6-0.72 1.6-1.6s-0.72-1.6-1.6-1.6v0z"></path>
|
||||
<path d="M22 14.5l3 3v3h-7.5v9l-1.5 1.5-1.5-1.5v-9h-7.5v-3l3-3v-10.5h-1.5v-3h15v3h-1.5v10.5zM11.275 17.5h9.45l-1.725-1.725v-11.775h-6v11.775l-1.725 1.725z"></path>
|
||||
</symbol>
|
||||
<symbol id="iconVIP" viewBox="0 0 32 32">
|
||||
<path d="M2.288 12.643l23.487 12.853c0.286 0.153 0.477 0.45 0.477 0.791 0 0.082-0.011 0.161-0.032 0.237l0.001-0.006c-0.119 0.395-0.479 0.678-0.905 0.678-0.004 0-0.009 0-0.013 0h-19.439c-0.958 0-1.766-0.684-1.885-1.595l-1.691-12.956z"></path>
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@
|
|||
"name": "material",
|
||||
"author": "Vanessa",
|
||||
"url": "https://github.com/Vanessa219",
|
||||
"version": "1.27.0"
|
||||
"version": "1.28.0"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,13 +80,13 @@ export class BlockPanel {
|
|||
const iconsElement = hasClosestByClassName(target, "block__icons");
|
||||
if (iconsElement) {
|
||||
const pingElement = iconsElement.querySelector('[data-type="pin"]');
|
||||
if (pingElement.classList.contains("block__icon--active")) {
|
||||
pingElement.classList.remove("block__icon--active");
|
||||
if (this.element.getAttribute("data-pin") === "true") {
|
||||
pingElement.setAttribute("aria-label", window.siyuan.languages.pin);
|
||||
pingElement.querySelector("use").setAttribute("xlink:href", "#iconPin");
|
||||
this.element.setAttribute("data-pin", "false");
|
||||
} else {
|
||||
pingElement.classList.add("block__icon--active");
|
||||
pingElement.setAttribute("aria-label", window.siyuan.languages.unpin);
|
||||
pingElement.querySelector("use").setAttribute("xlink:href", "#iconUnpin");
|
||||
this.element.setAttribute("data-pin", "true");
|
||||
}
|
||||
event.preventDefault();
|
||||
|
|
@ -105,13 +105,13 @@ export class BlockPanel {
|
|||
if (type === "close") {
|
||||
this.destroy();
|
||||
} else if (type === "pin") {
|
||||
if (target.classList.contains("block__icon--active")) {
|
||||
target.classList.remove("block__icon--active");
|
||||
if (this.element.getAttribute("data-pin") === "true") {
|
||||
target.setAttribute("aria-label", window.siyuan.languages.pin);
|
||||
target.querySelector("use").setAttribute("xlink:href", "#iconPin");
|
||||
this.element.setAttribute("data-pin", "false");
|
||||
} else {
|
||||
target.classList.add("block__icon--active");
|
||||
target.setAttribute("aria-label", window.siyuan.languages.unpin);
|
||||
target.querySelector("use").setAttribute("xlink:href", "#iconUnpin");
|
||||
this.element.setAttribute("data-pin", "true");
|
||||
}
|
||||
} else if (type === "open") {
|
||||
|
|
@ -134,8 +134,8 @@ export class BlockPanel {
|
|||
});
|
||||
}
|
||||
const pinElement = this.element.firstElementChild.querySelector('[data-type="pin"]');
|
||||
pinElement.classList.add("block__icon--active");
|
||||
pinElement.setAttribute("aria-label", window.siyuan.languages.unpin);
|
||||
pinElement.querySelector("use").setAttribute("xlink:href", "#iconUnpin");
|
||||
this.element.setAttribute("data-pin", "true");
|
||||
});
|
||||
/// #endif
|
||||
|
|
|
|||
|
|
@ -445,11 +445,12 @@ ${response.data.replace("%pages", "<span class=totalPages></span>").replace("%pa
|
|||
</div></div>`);
|
||||
const pinElement = document.getElementById("pinWindow");
|
||||
pinElement.addEventListener("click", () => {
|
||||
pinElement.classList.toggle("toolbar__item--active");
|
||||
if (pinElement.classList.contains("toolbar__item--active")) {
|
||||
if (pinElement.getAttribute("aria-label") === window.siyuan.languages.pin) {
|
||||
pinElement.querySelector("use").setAttribute("xlink:href", "#iconUnpin");
|
||||
pinElement.setAttribute("aria-label", window.siyuan.languages.unpin);
|
||||
ipcRenderer.send(Constants.SIYUAN_CMD, "setAlwaysOnTopTrue");
|
||||
} else {
|
||||
pinElement.querySelector("use").setAttribute("xlink:href", "#iconPin");
|
||||
pinElement.setAttribute("aria-label", window.siyuan.languages.pin);
|
||||
ipcRenderer.send(Constants.SIYUAN_CMD, "setAlwaysOnTopFalse");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,9 @@ export const moveResize = (element: HTMLElement, afterCB?: (type: string) => voi
|
|||
|
||||
documentSelf.ondragstart = () => false;
|
||||
|
||||
let hasMove = false;
|
||||
documentSelf.onmousemove = (moveEvent: MouseEvent) => {
|
||||
hasMove = true;
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -129,7 +131,7 @@ export const moveResize = (element: HTMLElement, afterCB?: (type: string) => voi
|
|||
documentSelf.ondragstart = null;
|
||||
documentSelf.onselectstart = null;
|
||||
documentSelf.onselect = null;
|
||||
if (afterCB) {
|
||||
if (hasMove && afterCB) {
|
||||
afterCB(type);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ export class Dock {
|
|||
}
|
||||
if (!showDock) {
|
||||
this.element.firstElementChild.innerHTML = `<span class="dock__item dock__item--pin b3-tooltips b3-tooltips__${this.getClassDirect(0)}" aria-label="${this.pin ? window.siyuan.languages.unpin : window.siyuan.languages.pin}">
|
||||
<svg><use xlink:href="#iconPin"></use></svg>
|
||||
<svg><use xlink:href="#icon${this.pin ? "Unpin" : "Pin"}"></use></svg>
|
||||
</span>`;
|
||||
this.element.classList.add("fn__none");
|
||||
} else {
|
||||
|
|
@ -125,6 +125,7 @@ export class Dock {
|
|||
} else if (target.classList.contains("dock__item")) {
|
||||
this.togglePin();
|
||||
target.setAttribute("aria-label", this.pin ? window.siyuan.languages.unpin : window.siyuan.languages.pin);
|
||||
target.querySelector("use").setAttribute("xlink:href", this.pin ? "#iconUnpin" : "#iconPin");
|
||||
event.preventDefault();
|
||||
break;
|
||||
}
|
||||
|
|
@ -698,7 +699,7 @@ export class Dock {
|
|||
}
|
||||
} else {
|
||||
this.element.firstElementChild.innerHTML = `${html}<span class="dock__item dock__item--pin b3-tooltips b3-tooltips__${this.getClassDirect(index)}" aria-label="${this.pin ? window.siyuan.languages.unpin : window.siyuan.languages.pin}">
|
||||
<svg><use xlink:href="#iconPin"></use></svg>
|
||||
<svg><use xlink:href="#icon${this.pin ? "Unpin" : "Pin"}"></use></svg>
|
||||
</span>`;
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@ export const setZoom = (type: "zoomIn" | "zoomOut" | "restore") => {
|
|||
|
||||
const openPlugin = (app: App, target: Element) => {
|
||||
const menu = new Menu("topBarPlugin");
|
||||
if(!isHuawei()) {
|
||||
if (!isHuawei()) {
|
||||
menu.addItem({
|
||||
icon: "iconSettings",
|
||||
label: window.siyuan.languages.manage,
|
||||
|
|
@ -322,7 +322,7 @@ const openPlugin = (app: App, target: Element) => {
|
|||
plugin.topBarIcons.forEach(item => {
|
||||
const hasUnpin = window.siyuan.storage[Constants.LOCAL_PLUGINTOPUNPIN].includes(item.id);
|
||||
const submenu = [{
|
||||
icon: "iconPin",
|
||||
icon: hasUnpin ? "iconPin" : "iconUnpin",
|
||||
label: hasUnpin ? window.siyuan.languages.pin : window.siyuan.languages.unpin,
|
||||
click() {
|
||||
if (hasUnpin) {
|
||||
|
|
|
|||
|
|
@ -1587,7 +1587,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
|
|||
}
|
||||
const isPinHead = nodeElement.getAttribute("custom-pinthead");
|
||||
menus.push({
|
||||
icon: "iconPin",
|
||||
icon: isPinHead ? "iconUnpin" : "iconPin",
|
||||
label: isPinHead ? window.siyuan.languages.unpinTableHead : window.siyuan.languages.pinTableHead,
|
||||
click: () => {
|
||||
const html = nodeElement.outerHTML;
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ export const initTabMenu = (app: App, tab: Tab) => {
|
|||
if (tab.headElement.classList.contains("item--pin")) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.unpin,
|
||||
icon: "iconPin",
|
||||
icon: "iconUnpin",
|
||||
click: () => {
|
||||
tab.unpin();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -801,7 +801,7 @@ export class Toolbar {
|
|||
} else if (isInlineMemo) {
|
||||
title = window.siyuan.languages.memo;
|
||||
}
|
||||
const isPin = this.subElement.querySelector('[data-type="pin"]')?.classList.contains("block__icon--active");
|
||||
const isPin = this.subElement.querySelector('[data-type="pin"]')?.getAttribute("aria-label") === window.siyuan.languages.unpin;
|
||||
const pinData: IObject = {};
|
||||
if (isPin) {
|
||||
const textElement = this.subElement.querySelector(".b3-text-field") as HTMLTextAreaElement;
|
||||
|
|
@ -824,7 +824,7 @@ export class Toolbar {
|
|||
<span class="fn__space${protyle.disabled ? " fn__none" : ""}"></span>
|
||||
<button data-type="export" class="block__icon block__icon--show b3-tooltips b3-tooltips__nw" aria-label="${window.siyuan.languages.export} ${window.siyuan.languages.image}"><svg><use xlink:href="#iconImage"></use></svg></button>
|
||||
<span class="fn__space"></span>
|
||||
<button data-type="pin" class="block__icon block__icon--show b3-tooltips b3-tooltips__nw${isPin ? " block__icon--active" : ""}" aria-label="${window.siyuan.languages.pin}"><svg><use xlink:href="#iconPin"></use></svg></button>
|
||||
<button data-type="pin" class="block__icon block__icon--show b3-tooltips b3-tooltips__nw" aria-label="${isPin ? window.siyuan.languages.unpin : window.siyuan.languages.pin}"><svg><use xlink:href="#icon${isPin ? "Unpin" : "Pin"}"></use></svg></button>
|
||||
<span class="fn__space"></span>
|
||||
<button data-type="close" class="block__icon block__icon--show b3-tooltips b3-tooltips__nw" aria-label="${window.siyuan.languages.close}"><svg style="width: 10px"><use xlink:href="#iconClose"></use></svg></button>
|
||||
</div>
|
||||
|
|
@ -859,11 +859,11 @@ export class Toolbar {
|
|||
if (!btnElement) {
|
||||
if (event.detail === 2) {
|
||||
const pingElement = headerElement.querySelector('[data-type="pin"]');
|
||||
if (pingElement.classList.contains("block__icon--active")) {
|
||||
pingElement.classList.remove("block__icon--active");
|
||||
if (pingElement.getAttribute("aria-label") === window.siyuan.languages.unpin) {
|
||||
pingElement.querySelector("svg use").setAttribute("xlink:href", "#iconPin");
|
||||
pingElement.setAttribute("aria-label", window.siyuan.languages.pin);
|
||||
} else {
|
||||
pingElement.classList.add("block__icon--active");
|
||||
pingElement.querySelector("svg use").setAttribute("xlink:href", "#iconUnpin");
|
||||
pingElement.setAttribute("aria-label", window.siyuan.languages.unpin);
|
||||
}
|
||||
event.preventDefault();
|
||||
|
|
@ -874,15 +874,15 @@ export class Toolbar {
|
|||
event.stopPropagation();
|
||||
switch (btnElement.getAttribute("data-type")) {
|
||||
case "close":
|
||||
this.subElement.querySelector('[data-type="pin"]').classList.remove("block__icon--active");
|
||||
this.subElement.querySelector('[data-type="pin"]').setAttribute("aria-label", window.siyuan.languages.pin);
|
||||
hideElements(["util"], protyle);
|
||||
break;
|
||||
case "pin":
|
||||
if (btnElement.classList.contains("block__icon--active")) {
|
||||
btnElement.classList.remove("block__icon--active");
|
||||
if (btnElement.getAttribute("aria-label") === window.siyuan.languages.unpin) {
|
||||
btnElement.querySelector("svg use").setAttribute("xlink:href", "#iconPin");
|
||||
btnElement.setAttribute("aria-label", window.siyuan.languages.pin);
|
||||
} else {
|
||||
btnElement.classList.add("block__icon--active");
|
||||
btnElement.querySelector("svg use").setAttribute("xlink:href", "#iconUnpin");
|
||||
btnElement.setAttribute("aria-label", window.siyuan.languages.unpin);
|
||||
}
|
||||
break;
|
||||
|
|
@ -937,7 +937,7 @@ export class Toolbar {
|
|||
/// #if !MOBILE
|
||||
moveResize(this.subElement, () => {
|
||||
const pinElement = headerElement.querySelector('[data-type="pin"]');
|
||||
pinElement.classList.add("block__icon--active");
|
||||
pinElement.querySelector("svg use").setAttribute("xlink:href", "#iconUnpin");
|
||||
pinElement.setAttribute("aria-label", window.siyuan.languages.unpin);
|
||||
this.subElement.firstElementChild.setAttribute("data-drag", "true");
|
||||
});
|
||||
|
|
@ -993,7 +993,7 @@ export class Toolbar {
|
|||
return;
|
||||
}
|
||||
if (event.key === "Escape" || matchHotKey("⌘↩", event)) {
|
||||
this.subElement.querySelector('[data-type="pin"]').classList.remove("block__icon--active");
|
||||
this.subElement.querySelector('[data-type="pin"]').setAttribute("aria-label", window.siyuan.languages.pin);
|
||||
hideElements(["util"], protyle);
|
||||
} else if (event.key === "Tab") {
|
||||
// https://github.com/siyuan-note/siyuan/issues/5270
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ export const hideElements = (panels: string[], protyle?: IProtyle, focusHide = f
|
|||
}
|
||||
if (protyle.toolbar && panels.includes("util")) {
|
||||
const pinElement = protyle.toolbar.subElement.querySelector('[data-type="pin"]');
|
||||
if (focusHide || !pinElement || (pinElement && !pinElement.classList.contains("block__icon--active"))) {
|
||||
if (focusHide || !pinElement || (pinElement && pinElement.getAttribute("aria-label") === window.siyuan.languages.pin)) {
|
||||
protyle.toolbar.subElement.classList.add("fn__none");
|
||||
if (protyle.toolbar.subElementCloseCB) {
|
||||
protyle.toolbar.subElementCloseCB();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue