Skip to content

Commit

Permalink
fix: disable opening of color picker when editor is readOnly
Browse files Browse the repository at this point in the history
  • Loading branch information
josdejong committed Aug 21, 2021
1 parent 90273f8 commit 236ec7a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/components/modes/treemode/JSONValue.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
<BooleanToggle {path} {value} {onPatch} />
{/if}
{#if isColor(value)}
<Color {path} {value} {onPatch} />
<Color {path} {value} {onPatch} {readOnly} />
{/if}
{/if}

Expand Down
5 changes: 5 additions & 0 deletions src/lib/components/modes/treemode/value/Color.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
export let onPatch
export let path
export let value
export let readOnly
$: color = getColorCSS(value)
Expand All @@ -27,6 +28,10 @@
}
function openColorPicker(event) {
if (readOnly) {
return
}
// estimate of the color picker height
// we'll render the color picker on top
// when there is not enough space below, and there is enough space above
Expand Down

0 comments on commit 236ec7a

Please sign in to comment.