Skip to content

Commit

Permalink
fix: add missing property onSelect to interface `JSONEditorPropsOpt…
Browse files Browse the repository at this point in the history
…ional`
  • Loading branch information
josdejong committed Feb 27, 2024
1 parent 1380980 commit 4087e3f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/components/JSONEditor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
import ModalRef from '../components/modals/ModalRef.svelte'
import type { Open, Callbacks, Component } from 'svelte-simple-modal'
import type { OnRenderContextMenu } from '$lib/types.js'
import { cloneDeep } from 'lodash-es'
// TODO: document how to enable debugging in the readme: localStorage.debug="jsoneditor:*", then reload
const debug = createDebug('jsoneditor:JSONEditor')
Expand Down Expand Up @@ -89,7 +90,7 @@
export let onChangeQueryLanguage: OnChangeQueryLanguage = noop
export let onChange: OnChange = null
export let onSelect: OnSelect = noop
export let onSelect: OnSelect | null = null
export let onRenderValue: OnRenderValue = renderValue
export let onClassName: OnClassName = () => undefined
export let onRenderMenu: OnRenderMenu = noop
Expand Down Expand Up @@ -288,7 +289,9 @@
function handleSelect(updatedSelection: JSONEditorSelection | null) {
selection = updatedSelection
onSelect(updatedSelection)
if (onSelect) {
onSelect(cloneDeep(updatedSelection))
}
}
function handleFocus() {
Expand Down
1 change: 1 addition & 0 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ export interface JSONEditorPropsOptional {
onRenderMenu?: OnRenderMenu
onRenderContextMenu?: OnRenderContextMenu
onChangeMode?: OnChangeMode
onSelect?: OnSelect
onError?: OnError
onFocus?: OnFocus
onBlur?: OnBlur
Expand Down

0 comments on commit 4087e3f

Please sign in to comment.