mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 10:00:13 +01:00
This commit is contained in:
parent
f6f3ebbcb2
commit
08eda0b838
1 changed files with 16 additions and 10 deletions
|
|
@ -100,7 +100,7 @@ export class Wnd {
|
||||||
newFile(undefined, undefined, undefined, true);
|
newFile(undefined, undefined, undefined, true);
|
||||||
break;
|
break;
|
||||||
} else if (target.classList.contains("block__icon") && target.getAttribute("data-type") === "more") {
|
} else if (target.classList.contains("block__icon") && target.getAttribute("data-type") === "more") {
|
||||||
this.renderTabList(event);
|
this.renderTabList(target);
|
||||||
break;
|
break;
|
||||||
} else if (target.tagName === "LI" && target.getAttribute("data-id") && !pdfIsLoading(this.element)) {
|
} else if (target.tagName === "LI" && target.getAttribute("data-id") && !pdfIsLoading(this.element)) {
|
||||||
this.switchTab(target, true);
|
this.switchTab(target, true);
|
||||||
|
|
@ -555,7 +555,12 @@ export class Wnd {
|
||||||
/// #endif
|
/// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderTabList(event: MouseEvent) {
|
private renderTabList(target: HTMLElement) {
|
||||||
|
if (!window.siyuan.menus.menu.element.classList.contains("fn__none") &&
|
||||||
|
window.siyuan.menus.menu.element.getAttribute("data-name") === "tabList") {
|
||||||
|
window.siyuan.menus.menu.remove();
|
||||||
|
return;
|
||||||
|
}
|
||||||
window.siyuan.menus.menu.remove();
|
window.siyuan.menus.menu.remove();
|
||||||
window.siyuan.menus.menu.element.classList.add("b3-menu--list");
|
window.siyuan.menus.menu.element.classList.add("b3-menu--list");
|
||||||
Array.from(this.headersElement.children).forEach((item: HTMLElement) => {
|
Array.from(this.headersElement.children).forEach((item: HTMLElement) => {
|
||||||
|
|
@ -567,8 +572,8 @@ export class Wnd {
|
||||||
iconHTML: iconElement ? `<span class="b3-menu__icon">${iconElement.innerHTML}</span>` : "",
|
iconHTML: iconElement ? `<span class="b3-menu__icon">${iconElement.innerHTML}</span>` : "",
|
||||||
icon: graphicElement ? graphicElement.firstElementChild.getAttribute("xlink:href").substring(1) : "",
|
icon: graphicElement ? graphicElement.firstElementChild.getAttribute("xlink:href").substring(1) : "",
|
||||||
bind: (element) => {
|
bind: (element) => {
|
||||||
element.addEventListener("click", (event) => {
|
element.addEventListener("click", (itemEvent) => {
|
||||||
if (hasClosestByClassName(event.target as Element, "b3-menu__action")) {
|
if (hasClosestByClassName(itemEvent.target as Element, "b3-menu__action")) {
|
||||||
this.removeTab(item.getAttribute("data-id"));
|
this.removeTab(item.getAttribute("data-id"));
|
||||||
if (element.previousElementSibling || element.nextElementSibling) {
|
if (element.previousElementSibling || element.nextElementSibling) {
|
||||||
element.remove();
|
element.remove();
|
||||||
|
|
@ -580,18 +585,19 @@ export class Wnd {
|
||||||
this.showHeading();
|
this.showHeading();
|
||||||
window.siyuan.menus.menu.remove();
|
window.siyuan.menus.menu.remove();
|
||||||
}
|
}
|
||||||
event.preventDefault();
|
itemEvent.preventDefault();
|
||||||
event.stopPropagation();
|
itemEvent.stopPropagation();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
current: item.classList.contains("item--focus")
|
current: item.classList.contains("item--focus")
|
||||||
}).element);
|
}).element);
|
||||||
});
|
});
|
||||||
|
window.siyuan.menus.menu.element.setAttribute("data-name", "tabList");
|
||||||
|
const rect = target.getBoundingClientRect();
|
||||||
window.siyuan.menus.menu.popup({
|
window.siyuan.menus.menu.popup({
|
||||||
x: event.clientX,
|
x: rect.left + rect.width,
|
||||||
y: event.clientY,
|
y: rect.top + rect.height,
|
||||||
w: 16
|
}, true);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private removeOverCounter(oldFocusIndex?: number) {
|
private removeOverCounter(oldFocusIndex?: number) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue