mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 18:10:12 +01:00
🎨 menu
This commit is contained in:
parent
e4b14a12c6
commit
a3af4cf722
3 changed files with 3 additions and 8 deletions
|
|
@ -94,11 +94,6 @@ export const initBar = (app: App) => {
|
||||||
} else {
|
} else {
|
||||||
toolbarElement.dispatchEvent(new CustomEvent("click", {detail: itemId}));
|
toolbarElement.dispatchEvent(new CustomEvent("click", {detail: itemId}));
|
||||||
}
|
}
|
||||||
if (!window.siyuan.menus.menu.element.classList.contains("fn__none") &&
|
|
||||||
window.siyuan.menus.menu.element.getAttribute("data-name") === "barmore") {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -179,11 +179,11 @@ export class MenuItem {
|
||||||
if (this.element.getAttribute("disabled")) {
|
if (this.element.getAttribute("disabled")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const result = options.click(this.element);
|
options.click(this.element);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
if (typeof result === "undefined" || !result) {
|
if (this.element.parentElement) {
|
||||||
window.siyuan.menus.menu.remove();
|
window.siyuan.menus.menu.remove();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
2
app/src/types/index.d.ts
vendored
2
app/src/types/index.d.ts
vendored
|
|
@ -724,7 +724,7 @@ declare interface IModels {
|
||||||
|
|
||||||
declare interface IMenu {
|
declare interface IMenu {
|
||||||
label?: string,
|
label?: string,
|
||||||
click?: (element: HTMLElement) => boolean | void,
|
click?: (element: HTMLElement) => void,
|
||||||
type?: "separator" | "submenu" | "readonly",
|
type?: "separator" | "submenu" | "readonly",
|
||||||
accelerator?: string,
|
accelerator?: string,
|
||||||
action?: string,
|
action?: string,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue