Skip to content

Commit

Permalink
fix: give editor focus when the user starts dragging the selection
Browse files Browse the repository at this point in the history
  • Loading branch information
josdejong committed May 20, 2022
1 parent ebc076a commit 9bd28db
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lib/components/modes/treemode/JSONNode.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
// when left-clicking inside the current selection, do nothing: it can be the start of dragging
if (isPathInsideSelection(context.getFullSelection(), path, anchorType)) {
if (event.button === 0) {
context.focus()
onDragSelectionStart(event)
}
Expand Down
1 change: 1 addition & 0 deletions src/lib/components/modes/treemode/TreeMode.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2061,6 +2061,7 @@
getFullState,
getFullSelection,
findElement,
focus,
onPatch: handlePatch,
onInsert: handleInsert,
onExpand: handleExpand,
Expand Down
1 change: 1 addition & 0 deletions src/lib/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@
* @property {() => JSON} getFullState
* @property {() => Selection} getFullSelection
* @property {(path: Path) => Element | null} findElement
* @property {() => void} focus
* @property {(operations: JSONPatchDocument, afterPatch?: AfterPatchCallback) => void} onPatch
* @property {(type: InsertType) => void} onInsert
* @property {(path: Path, expanded: boolean, recursive?: boolean = false) => void} onExpand
Expand Down

0 comments on commit 9bd28db

Please sign in to comment.