mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 10:00:13 +01:00
This commit is contained in:
parent
8143c58cf5
commit
010a3eb002
4 changed files with 17 additions and 1 deletions
|
|
@ -104,9 +104,15 @@
|
||||||
align-self: center;
|
align-self: center;
|
||||||
height: 14px;
|
height: 14px;
|
||||||
width: 14px;
|
width: 14px;
|
||||||
|
line-height: 14px;
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
color: var(--b3-theme-on-surface);
|
color: var(--b3-theme-on-surface);
|
||||||
|
|
||||||
|
& > svg {
|
||||||
|
height: 14px;
|
||||||
|
width: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
&--arrow {
|
&--arrow {
|
||||||
margin: 0 0 0 8px;
|
margin: 0 0 0 8px;
|
||||||
height: 10px;
|
height: 10px;
|
||||||
|
|
|
||||||
|
|
@ -456,8 +456,12 @@ export class Wnd {
|
||||||
private renderTabList(event: MouseEvent) {
|
private renderTabList(event: MouseEvent) {
|
||||||
window.siyuan.menus.menu.remove()
|
window.siyuan.menus.menu.remove()
|
||||||
Array.from(this.headersElement.children).forEach((item: HTMLElement) => {
|
Array.from(this.headersElement.children).forEach((item: HTMLElement) => {
|
||||||
|
const iconElement = item.querySelector(".item__icon")
|
||||||
|
const graphicElement = item.querySelector(".item__graphic")
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
label: item.querySelector(".item__text").textContent,
|
label: item.querySelector(".item__text").textContent,
|
||||||
|
iconHTML: iconElement ? `<span class="b3-menu__icon">${iconElement.innerHTML}</span>` : "",
|
||||||
|
icon: graphicElement ? graphicElement.firstElementChild.getAttribute("xlink:href").substring(1) : "",
|
||||||
click: () => {
|
click: () => {
|
||||||
this.switchTab(item, true);
|
this.switchTab(item, true);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,12 @@ export class MenuItem {
|
||||||
window.siyuan.menus.menu.remove();
|
window.siyuan.menus.menu.remove();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
let html = `<svg class="b3-menu__icon${["HTML (SiYuan)", window.siyuan.languages.template].includes(options.label) ? " ft__error" : ""}" style="${options.icon === "iconClose" ? "height:10px;" : ""}"><use xlink:href="#${options.icon || ""}"></use></svg><span class="b3-menu__label">${options.label}</span>`;
|
let html = `<span class="b3-menu__label">${options.label}</span>`;
|
||||||
|
if (options.iconHTML) {
|
||||||
|
html = options.iconHTML + html;
|
||||||
|
} else {
|
||||||
|
html = `<svg class="b3-menu__icon${["HTML (SiYuan)", window.siyuan.languages.template].includes(options.label) ? " ft__error" : ""}" style="${options.icon === "iconClose" ? "height:10px;" : ""}"><use xlink:href="#${options.icon || ""}"></use></svg>${html}`;
|
||||||
|
}
|
||||||
if (options.accelerator) {
|
if (options.accelerator) {
|
||||||
html += `<span class="b3-menu__accelerator">${updateHotkeyTip(options.accelerator)}</span>`;
|
html += `<span class="b3-menu__accelerator">${updateHotkeyTip(options.accelerator)}</span>`;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
1
app/src/types/index.d.ts
vendored
1
app/src/types/index.d.ts
vendored
|
|
@ -472,6 +472,7 @@ declare interface IMenu {
|
||||||
submenu?: IMenu[]
|
submenu?: IMenu[]
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
icon?: string
|
icon?: string
|
||||||
|
iconHTML?: string
|
||||||
current?: boolean
|
current?: boolean
|
||||||
bind?: (element: HTMLElement) => void
|
bind?: (element: HTMLElement) => void
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue