| @@ -1,4 +1,5 @@ | ||
| 1 | +import { useEditModeStore } from '@quick-edit/state/edit-mode'; | |
| 1 | 2 | import { create } from 'zustand'; |
| 2 | 3 | |
| 3 | 4 | export const useQuickEditStore = create((set, get) => ({ |
| 4 | 5 | hovered: null, |
| @@ -27,9 +28,13 @@ | ||
| 27 | 28 | setHovered: (target) => set({ hovered: target }), |
| 28 | 29 | setSelected: (target) => set({ selected: target, dirty: {}, error: null }), |
| 29 | 30 | clearSelected: () => set({ selected: null, dirty: {}, error: null }), |
| 30 | 31 | |
| 31 | - setAgentBlock: (agentBlock) => set({ agentBlock, agentBlockCode: null }), | |
| 32 | + setAgentBlock: (agentBlock) => { | |
| 33 | + // A staged block is invisible without the selection UI. | |
| 34 | + if (agentBlock) useEditModeStore.getState().setOn(true); | |
| 35 | + set({ agentBlock, agentBlockCode: null }); | |
| 36 | + }, | |
| 32 | 37 | setAgentBlockCode: (agentBlockCode) => set({ agentBlockCode }), |
| 33 | 38 | |
| 34 | 39 | setCommittedSelection: (committedSelection) => set({ committedSelection }), |
| 35 | 40 | |