Skip to content

Commit

Permalink
fix: paste as JSON helper message not working
Browse files Browse the repository at this point in the history
  • Loading branch information
josdejong committed May 20, 2022
1 parent 9bd28db commit 0f803b2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/lib/components/controls/Message.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<button
type="button"
on:click={action.onClick}
on:mousedown={action.onMouseDown}
class="jse-button jse-action jse-primary"
title={action.title}
disabled={action.disabled}
Expand Down
8 changes: 7 additions & 1 deletion src/lib/components/modes/treemode/TreeMode.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -1968,6 +1968,7 @@
}
async function handleParsePastedJson() {
debug('apply pasted json', pastedJson)
const { path, contents } = pastedJson
// exit edit mode
Expand Down Expand Up @@ -1995,6 +1996,7 @@
}
function handleClearPastedJson() {
debug('clear pasted json')
pastedJson = undefined
}
Expand Down Expand Up @@ -2184,7 +2186,11 @@
{
icon: faWrench,
text: 'Paste as JSON instead',
onClick: handleParsePastedJson
// We use mousedown here instead of click: this message pops up
// whilst the user is editing a value. When clicking this button,
// the actual value is applied and the event is not propagated
// and an onClick on this button never happens.
onMouseDown: handleParsePastedJson
},
{
text: 'Leave as is',
Expand Down

0 comments on commit 0f803b2

Please sign in to comment.