mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-08-09 15:30:16 -03:00
fix(ui): hide context menu separator with no visible items
This commit is contained in:
@@ -54,9 +54,25 @@ export class GlobalContextMenu extends BaseContextMenu {
|
||||
rematchRecipesItem?.classList.add('hidden');
|
||||
}
|
||||
|
||||
this._updateSeparatorVisibility();
|
||||
|
||||
super.showMenu(x, y, contextOrigin);
|
||||
}
|
||||
|
||||
_updateSeparatorVisibility() {
|
||||
const children = Array.from(this.menu.children);
|
||||
const isVisible = (el) => el.classList.contains('context-menu-item') && !el.classList.contains('hidden');
|
||||
|
||||
children.forEach((el, index) => {
|
||||
if (!el.classList.contains('context-menu-separator')) {
|
||||
return;
|
||||
}
|
||||
const hasVisibleBefore = children.slice(0, index).some(isVisible);
|
||||
const hasVisibleAfter = children.slice(index + 1).some(isVisible);
|
||||
el.classList.toggle('hidden', !(hasVisibleBefore && hasVisibleAfter));
|
||||
});
|
||||
}
|
||||
|
||||
handleMenuAction(action, menuItem) {
|
||||
switch (action) {
|
||||
case 'cleanup-example-images-folders':
|
||||
|
||||
Reference in New Issue
Block a user