This commit is contained in:
Juergen Kunz
2025-06-26 20:20:34 +00:00
parent 9df4a09414
commit 10c43ecd59
7 changed files with 152 additions and 63 deletions

View File

@ -8,7 +8,7 @@ import {
css,
state,
} from '@design.estate/dees-element';
import { zIndexLayers } from '../00zindex.js';
import { zIndexRegistry } from '../00zindex.js';
import { type ISlashMenuItem } from './wysiwyg.types.js';
import { WysiwygShortcuts } from './wysiwyg.shortcuts.js';
@ -43,6 +43,9 @@ export class DeesSlashMenu extends DeesElement {
@state()
private selectedIndex: number = 0;
@state()
private menuZIndex: number = 1000;
private callback: ((type: string) => void) | null = null;
public static styles = [
@ -50,7 +53,6 @@ export class DeesSlashMenu extends DeesElement {
css`
:host {
position: fixed;
z-index: ${zIndexLayers.wysiwygMenus};
pointer-events: none;
}
@ -119,6 +121,9 @@ export class DeesSlashMenu extends DeesElement {
render(): TemplateResult {
if (!this.visible) return html``;
// Apply z-index to host element
this.style.zIndex = this.menuZIndex.toString();
const menuItems = this.getFilteredMenuItems();
return html`
@ -162,6 +167,11 @@ export class DeesSlashMenu extends DeesElement {
this.callback = callback;
this.filter = '';
this.selectedIndex = 0;
// Get z-index from registry
this.menuZIndex = zIndexRegistry.getNextZIndex();
zIndexRegistry.register(this, this.menuZIndex);
this.visible = true;
}
@ -170,6 +180,9 @@ export class DeesSlashMenu extends DeesElement {
this.callback = null;
this.filter = '';
this.selectedIndex = 0;
// Unregister from z-index registry
zIndexRegistry.unregister(this);
}
public updateFilter(filter: string): void {