Skip to content

Commit a9a2dc3

Browse files
committedSep 28, 2023
fix: #315 cannot paste text in the search box input field in tree mode
1 parent f00acd6 commit a9a2dc3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed
 

‎src/lib/components/modes/tablemode/TableMode.svelte

+3-3
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@
730730
setTimeout(() => {
731731
setTimeout(() => {
732732
// for example when clicking on the empty area in the main menu
733-
if (!hasFocus && !isChildOfNodeName(event.target as Element, 'BUTTON')) {
733+
if ((!hasFocus && !isChildOfNodeName(event.target, 'BUTTON')) || event.target.nodeName === 'DIV') {
734734
focus()
735735
}
736736
})
@@ -1708,7 +1708,6 @@
17081708
class:no-main-menu={!mainMenuBar}
17091709
on:mousedown={handleMouseDown}
17101710
on:keydown={handleKeyDown}
1711-
on:paste={handlePaste}
17121711
on:contextmenu={handleContextMenu}
17131712
bind:this={refJsonEditor}
17141713
>
@@ -1730,10 +1729,11 @@
17301729
<label class="jse-hidden-input-label">
17311730
<input
17321731
type="text"
1733-
readonly="readonly"
1732+
readonly={true}
17341733
tabindex="-1"
17351734
class="jse-hidden-input"
17361735
bind:this={refHiddenInput}
1736+
on:paste={handlePaste}
17371737
/>
17381738
</label>
17391739
{#if containsValidArray}

‎src/lib/components/modes/treemode/TreeMode.svelte

+2-2
Original file line numberDiff line numberDiff line change
@@ -1820,7 +1820,7 @@
18201820
// TODO: ugly to have two setTimeout here. Without it, hiddenInput will blur
18211821
setTimeout(() => {
18221822
setTimeout(() => {
1823-
if (!hasFocus && !isChildOfNodeName(event.target, 'BUTTON')) {
1823+
if ((!hasFocus && !isChildOfNodeName(event.target, 'BUTTON')) || event.target.nodeName === 'DIV') {
18241824
// for example when clicking on the empty area in the main menu
18251825
focus()
18261826
@@ -2106,7 +2106,6 @@
21062106
class:no-main-menu={!mainMenuBar}
21072107
on:keydown={handleKeyDown}
21082108
on:mousedown={handleMouseDown}
2109-
on:paste={handlePaste}
21102109
on:contextmenu={handleContextMenu}
21112110
bind:this={refJsonEditor}
21122111
>
@@ -2147,6 +2146,7 @@
21472146
tabindex="-1"
21482147
class="jse-hidden-input"
21492148
bind:this={refHiddenInput}
2149+
on:paste={handlePaste}
21502150
/>
21512151
</label>
21522152
{#if json === undefined}

0 commit comments

Comments
 (0)
Please sign in to comment.