few bugfixes

This commit is contained in:
Michael Shanks 2020-06-01 11:04:32 +01:00
parent 94742974b2
commit 50ecfba395
2 changed files with 13 additions and 6 deletions

View File

@ -347,7 +347,7 @@ const addChildComponent = store => (componentToAdd, presetName) => {
return state return state
} }
const component = getComponentDefinition(componentToAdd) const component = getComponentDefinition(state, componentToAdd)
const presetProps = presetName ? component.presets[presetName] : {} const presetProps = presetName ? component.presets[presetName] : {}

View File

@ -11,13 +11,15 @@ export let component
let confirmDeleteDialog let confirmDeleteDialog
let dropdownEl let dropdownEl
$: dropdown = UIkit.dropdown(dropdownEl, { mode: "click", offset: 0, pos: "bottom-right" }); $: dropdown = UIkit.dropdown(dropdownEl, { mode: "click", offset: 0, pos: "bottom-right", "delay-hide": 0, animation: false });
$: dropdown && UIkit.util.on(dropdown, "shown", () => hidden = false)
$: noChildrenAllowed = !component || getComponentDefinition($store, component._component).children === false $: noChildrenAllowed = !component || getComponentDefinition($store, component._component).children === false
$: noPaste = !$store.componentToPaste || $store.componentToPaste._id === component._id $: noPaste = !$store.componentToPaste || $store.componentToPaste._id === component._id
const lastPartOfName = c => (c ? last(c._component.split("/")) : "") const lastPartOfName = c => (c ? last(c._component.split("/")) : "")
const showDropdown = () => {
dropdown.show() const hideDropdown = () => {
dropdown.hide()
} }
</script> </script>
@ -26,7 +28,7 @@ const showDropdown = () => {
<button> <button>
<MoreIcon /> <MoreIcon />
</button> </button>
<ul class="menu" bind:this={dropdownEl} on:mouseout={() => dropdown.hide()} on:click={() => dropdown.hide()}> <ul class="menu" bind:this={dropdownEl} on:click={hideDropdown}>
<li on:click={() => confirmDeleteDialog.show()}>Delete</li> <li on:click={() => confirmDeleteDialog.show()}>Delete</li>
<li on:click={() => store.moveUpComponent(component)}>Move up</li> <li on:click={() => store.moveUpComponent(component)}>Move up</li>
<li on:click={() => store.moveDownComponent(component)}>Move down</li> <li on:click={() => store.moveDownComponent(component)}>Move down</li>
@ -56,13 +58,18 @@ const showDropdown = () => {
z-index:9; z-index:9;
} }
.hidden {
display: none;
}
.root button { .root button {
border-style: none; border-style: none;
border-radius: 2px; border-radius: 2px;
padding: 5px; padding: 5px;
background: transparent; background: transparent;
cursor: pointer; cursor: pointer;
color: var(--button-text) color: var(--button-text);
outline: none;
} }
.menu { .menu {