Allow pasting inside screens on screens tab and fix icon overflow in nav items

This commit is contained in:
Andrew Kingston 2022-05-13 12:05:55 +01:00
parent 07098fee08
commit 58145d6bca
2 changed files with 21 additions and 4 deletions

View File

@ -135,8 +135,12 @@
padding-left: var(--spacing-l); padding-left: var(--spacing-l);
} }
/* Needed to fully display the actions icon */
.nav-item.scrollable .nav-item-content {
padding-right: 1px;
}
.icon { .icon {
font-size: 16px;
flex: 0 0 24px; flex: 0 0 24px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -164,9 +168,6 @@
.icon.arrow.opened { .icon.arrow.opened {
transform: rotate(90deg); transform: rotate(90deg);
} }
.icon + .icon {
/*margin-left: -4px;*/
}
.iconText { .iconText {
margin-top: 1px; margin-top: 1px;
font-size: var(--spectrum-global-dimension-font-size-50); font-size: var(--spectrum-global-dimension-font-size-50);

View File

@ -21,6 +21,15 @@
let screenDetailsModal let screenDetailsModal
$: screen = $store.screens.find(screen => screen._id === screenId) $: screen = $store.screens.find(screen => screen._id === screenId)
$: noPaste = !$store.componentToPaste
const pasteComponent = mode => {
try {
store.actions.components.paste(screen.props, mode)
} catch (error) {
notifications.error("Error saving component")
}
}
const duplicateScreen = () => { const duplicateScreen = () => {
screenDetailsModal.show() screenDetailsModal.show()
@ -69,6 +78,13 @@
<div slot="control" class="icon"> <div slot="control" class="icon">
<Icon size="S" hoverable name="MoreSmallList" /> <Icon size="S" hoverable name="MoreSmallList" />
</div> </div>
<MenuItem
icon="ShowOneLayer"
on:click={() => pasteComponent("inside")}
disabled={noPaste}
>
Paste inside
</MenuItem>
<MenuItem icon="Duplicate" on:click={duplicateScreen}>Duplicate</MenuItem> <MenuItem icon="Duplicate" on:click={duplicateScreen}>Duplicate</MenuItem>
<MenuItem icon="Delete" on:click={confirmDeleteDialog.show}>Delete</MenuItem> <MenuItem icon="Delete" on:click={confirmDeleteDialog.show}>Delete</MenuItem>
</ActionMenu> </ActionMenu>