mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-07 16:04:19 +01:00
This commit is contained in:
parent
33f8def8ce
commit
3464708aae
5 changed files with 30 additions and 27 deletions
|
|
@ -34,17 +34,27 @@ export class Menu {
|
|||
return this.menu.addItem(option);
|
||||
}
|
||||
|
||||
addSeparator(index?: number, ignore = false, id?: string) {
|
||||
if (ignore) {
|
||||
addSeparator(options?: number | {
|
||||
index?: number,
|
||||
id?: string,
|
||||
ignore?: boolean
|
||||
}, ignoreParam = false) {
|
||||
// 兼容 3.1.24 之前的版本 addSeparator(index?: number, ignore?: boolean): HTMLElement;
|
||||
let id: string;
|
||||
let index: number;
|
||||
let ignore = false;
|
||||
if (typeof options === "object") {
|
||||
ignore = options.ignore || false;
|
||||
index = options.index;
|
||||
id = options.id;
|
||||
} else if (typeof options === "number") {
|
||||
index = options;
|
||||
ignore = ignoreParam;
|
||||
}
|
||||
if (ignore || this.isOpen) {
|
||||
return;
|
||||
}
|
||||
if (this.isOpen) {
|
||||
return;
|
||||
}
|
||||
if (id) {
|
||||
return this.menu.addSeparator(index, id);
|
||||
}
|
||||
return this.menu.addSeparator(index);
|
||||
return this.menu.addItem({id, type: "separator", index});
|
||||
}
|
||||
|
||||
open(options: IPosition) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue