Skip to content

Commit

Permalink
fix: #315 cannot paste text in the search box input field in tree mode
Browse files Browse the repository at this point in the history
  • Loading branch information
josdejong committed Sep 28, 2023
1 parent f00acd6 commit a9a2dc3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/lib/components/modes/tablemode/TableMode.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@
setTimeout(() => {
setTimeout(() => {
// for example when clicking on the empty area in the main menu
if (!hasFocus && !isChildOfNodeName(event.target as Element, 'BUTTON')) {
if ((!hasFocus && !isChildOfNodeName(event.target, 'BUTTON')) || event.target.nodeName === 'DIV') {
focus()
}
})
Expand Down Expand Up @@ -1708,7 +1708,6 @@
class:no-main-menu={!mainMenuBar}
on:mousedown={handleMouseDown}
on:keydown={handleKeyDown}
on:paste={handlePaste}
on:contextmenu={handleContextMenu}
bind:this={refJsonEditor}
>
Expand All @@ -1730,10 +1729,11 @@
<label class="jse-hidden-input-label">
<input
type="text"
readonly="readonly"
readonly={true}
tabindex="-1"
class="jse-hidden-input"
bind:this={refHiddenInput}
on:paste={handlePaste}
/>
</label>
{#if containsValidArray}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/modes/treemode/TreeMode.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -1820,7 +1820,7 @@
// TODO: ugly to have two setTimeout here. Without it, hiddenInput will blur
setTimeout(() => {
setTimeout(() => {
if (!hasFocus && !isChildOfNodeName(event.target, 'BUTTON')) {
if ((!hasFocus && !isChildOfNodeName(event.target, 'BUTTON')) || event.target.nodeName === 'DIV') {
// for example when clicking on the empty area in the main menu
focus()
Expand Down Expand Up @@ -2106,7 +2106,6 @@
class:no-main-menu={!mainMenuBar}
on:keydown={handleKeyDown}
on:mousedown={handleMouseDown}
on:paste={handlePaste}
on:contextmenu={handleContextMenu}
bind:this={refJsonEditor}
>
Expand Down Expand Up @@ -2147,6 +2146,7 @@
tabindex="-1"
class="jse-hidden-input"
bind:this={refHiddenInput}
on:paste={handlePaste}
/>
</label>
{#if json === undefined}
Expand Down

0 comments on commit a9a2dc3

Please sign in to comment.