ctx menu - open in new window

This commit is contained in:
SPRINX0\prochazka
2024-11-26 14:19:20 +01:00
parent bc9df9750f
commit 92992d1e95
2 changed files with 27 additions and 1 deletions

View File

@@ -826,6 +826,12 @@
onClick: () => { onClick: () => {
databaseObjectMenuClickHandler(data, menu); databaseObjectMenuClickHandler(data, menu);
}, },
iconAlt: menu.defaultActionId ? 'icon open-in-new' : null,
onClickAlt: menu.defaultActionId
? () => {
databaseObjectMenuClickHandler(data, { ...menu, forceNewTab: true, defaultActionId: null });
}
: null,
}; };
} }

View File

@@ -85,6 +85,13 @@
if (item.onClick) item.onClick(); if (item.onClick) item.onClick();
} }
function handleClickAlt(e, item) {
if (item.disabled) return;
dispatchClose();
if (onCloseParent) onCloseParent();
if (item.onClickAlt) item.onClickAlt();
}
onMount(() => { onMount(() => {
fixPopupPlacement(element); fixPopupPlacement(element);
}); });
@@ -128,6 +135,11 @@
{#if item.keyText} {#if item.keyText}
<span class="keyText">{formatKeyText(item.keyText)}</span> <span class="keyText">{formatKeyText(item.keyText)}</span>
{/if} {/if}
{#if item.iconAlt}
<span class="alt-icon" on:click={e => handleClickAlt(e, item)}>
<FontIcon icon={item.iconAlt} />
</span>
{/if}
{#if item.submenu} {#if item.submenu}
<div class="menu-right"> <div class="menu-right">
<FontIcon icon="icon menu-right" /> <FontIcon icon="icon menu-right" />
@@ -166,7 +178,7 @@
cursor: default; cursor: default;
white-space: nowrap; white-space: nowrap;
overflow-y: auto; overflow-y: auto;
max-height: calc(100% - 20px) max-height: calc(100% - 20px);
} }
.keyText { .keyText {
@@ -205,4 +217,12 @@
position: relative; position: relative;
left: 15px; left: 15px;
} }
.alt-icon:hover {
cursor: pointer;
}
.alt-icon:hover {
color: var(--theme-font-hover);
}
</style> </style>