Skip to content

Commit

Permalink
chore: fix Apply button in JSONEditorModal not working
Browse files Browse the repository at this point in the history
  • Loading branch information
josdejong committed Jul 15, 2024
1 parent b1fd963 commit 222af37
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions src/lib/components/modals/JSONEditorModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -167,34 +167,22 @@
function handleChange(updatedContent: Content) {
debug('handleChange', updatedContent)
const updatedState = {
...currentState,
content: updatedContent
}
stack = [...initial(stack), updatedState]
updateState((state) => ({ ...state, content: updatedContent }))
}
function handleChangeSelection(newSelection: JSONEditorSelection | undefined) {
debug('handleChangeSelection', newSelection)
const updatedState = {
...currentState,
selection: newSelection
}
stack = [...initial(stack), updatedState]
updateState((state) => ({ ...state, selection: newSelection }))
}
function handleChangeMode(newMode: Mode) {
debug('handleChangeMode', newMode)
updateState((state) => ({ ...state, mode: newMode }))
}
const updatedState = {
...currentState,
mode: newMode
}
function updateState(callback: (state: ModalState) => ModalState) {
const state = last(stack) as ModalState
const updatedState = callback(state)
stack = [...initial(stack), updatedState]
}
Expand Down

0 comments on commit 222af37

Please sign in to comment.