Ensure the correct component is selected before executing component dropdown menu actions
This commit is contained in:
parent
9870534581
commit
e006cad2cf
|
@ -2,9 +2,18 @@
|
||||||
import { store } from "builderStore"
|
import { store } from "builderStore"
|
||||||
import { ActionMenu, MenuItem, Icon } from "@budibase/bbui"
|
import { ActionMenu, MenuItem, Icon } from "@budibase/bbui"
|
||||||
|
|
||||||
|
export let component
|
||||||
|
|
||||||
$: noPaste = !$store.componentToPaste
|
$: noPaste = !$store.componentToPaste
|
||||||
|
|
||||||
const keyboardEvent = (key, ctrlKey = false) => {
|
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 }))
|
document.dispatchEvent(new KeyboardEvent("keydown", { key, ctrlKey }))
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue