1
0
Fork 0
mirror of synced 2024-07-07 15:25:52 +12:00

Ensure the correct component is selected before executing component dropdown menu actions

This commit is contained in:
Andrew Kingston 2022-08-25 09:35:57 +01:00
parent 9870534581
commit e006cad2cf

View file

@ -2,9 +2,18 @@
import { store } from "builderStore"
import { ActionMenu, MenuItem, Icon } from "@budibase/bbui"
export let component
$: noPaste = !$store.componentToPaste
const keyboardEvent = (key, ctrlKey = false) => {
// Ensure this component is selected first
if (component._id !== $store.selectedComponentId) {
store.update(state => {
state.selectedComponentId = component._id
return state
})
}
document.dispatchEvent(new KeyboardEvent("keydown", { key, ctrlKey }))
}
</script>