Skip to content

Commit

Permalink
fix: editor losing focus after toggling a boolean value
Browse files Browse the repository at this point in the history
  • Loading branch information
josdejong committed May 20, 2022
1 parent 42fe818 commit ea52484
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/lib/plugins/value/components/BooleanToggle.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
import { faCheckSquare, faSquare } from '@fortawesome/free-regular-svg-icons'
import { compileJSONPointer } from 'immutable-json-patch'
import Icon from 'svelte-awesome'
import { SELECTION_TYPE } from '../../../logic/selection.js'
export let path
export let value
export let readOnly
export let onPatch
export let onSelect
function toggleBooleanValue(event) {
event.stopPropagation()
Expand All @@ -24,6 +26,8 @@
value: !value
}
])
onSelect({ type: SELECTION_TYPE.VALUE, path })
}
</script>

Expand Down
2 changes: 1 addition & 1 deletion src/lib/plugins/value/renderValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function renderValue({
if (!isEditing && isBoolean(value)) {
renderers.push({
component: BooleanToggle,
props: { path, value, readOnly, onPatch }
props: { path, value, readOnly, onPatch, onSelect }
})
}

Expand Down
4 changes: 4 additions & 0 deletions src/routes/development.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -516,4 +516,8 @@ See https://github.com/sveltejs/kit/issues/981
label {
white-space: nowrap;
}
:global(.jse-main.jse-focus) {
box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.24);
}
</style>

0 comments on commit ea52484

Please sign in to comment.