mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 01:50:12 +01:00
🎨 https://github.com/siyuan-note/siyuan/issues/5066 click menu icon
This commit is contained in:
parent
fe3c6012c8
commit
839308173a
3 changed files with 24 additions and 7 deletions
|
|
@ -82,6 +82,16 @@ export class Menu {
|
|||
}
|
||||
}
|
||||
|
||||
public addSeparator() {
|
||||
this.addItem({type: "separator"});
|
||||
}
|
||||
|
||||
public addItem(option: IMenu) {
|
||||
const menuItem = new MenuItem(option);
|
||||
this.append(menuItem.element);
|
||||
return menuItem.element;
|
||||
}
|
||||
|
||||
public remove() {
|
||||
if (window.siyuan.menus.menu.removeCB) {
|
||||
window.siyuan.menus.menu.removeCB();
|
||||
|
|
@ -170,7 +180,7 @@ export class MenuItem {
|
|||
});
|
||||
}
|
||||
let html = `<span class="b3-menu__label">${options.label}</span>`;
|
||||
if (options.iconHTML) {
|
||||
if (typeof options.iconHTML === "string") {
|
||||
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}`;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue