Skip to content

Commit

Permalink
fix: let "Remove" remove the whole item/entry when a key or value is …
Browse files Browse the repository at this point in the history
…selected
  • Loading branch information
josdejong committed Apr 28, 2021
1 parent 2694b61 commit ca1bcec
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/modes/treemode/TreeMode.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,20 @@
return
}
// in case of a selected key or value, we change the selection to the whole
// entry to remove this, we do not want to clear a key or value only.
const removeSelection = (selection.type === SELECTION_TYPE.KEY || selection.type === SELECTION_TYPE.VALUE)
? createSelection(json, state, {
type: SELECTION_TYPE.MULTI,
anchorPath: selection.anchorPath,
focusPath: selection.focusPath
})
: selection
const {
operations,
newSelection
} = createRemoveOperations(json, state, selection)
} = createRemoveOperations(json, state, removeSelection)
debug('remove', { operations, selection, newSelection })
Expand Down

0 comments on commit ca1bcec

Please sign in to comment.