File tree 3 files changed +16
-13
lines changed
3 files changed +16
-13
lines changed Original file line number Diff line number Diff line change 730
730
setTimeout (() => {
731
731
setTimeout (() => {
732
732
// for example when clicking on the empty area in the main menu
733
- if (
734
- (! hasFocus && ! isChildOfNodeName (event .target , ' BUTTON' )) ||
735
- event .target .nodeName === ' DIV'
736
- ) {
733
+ if (! hasFocus && ! isChildOfNodeName (event .target , ' BUTTON' )) {
737
734
focus ()
738
735
}
739
736
})
Original file line number Diff line number Diff line change 1820
1820
// TODO: ugly to have two setTimeout here. Without it, hiddenInput will blur
1821
1821
setTimeout (() => {
1822
1822
setTimeout (() => {
1823
- if (
1824
- (! hasFocus && ! isChildOfNodeName (event .target , ' BUTTON' )) ||
1825
- event .target .nodeName === ' DIV'
1826
- ) {
1823
+ if (! hasFocus && ! isChildOfNodeName (event .target , ' BUTTON' )) {
1827
1824
// for example when clicking on the empty area in the main menu
1828
1825
focus ()
1829
1826
2164
2161
focus ()
2165
2162
handleInsertCharacter (' [' )
2166
2163
}}
2164
+ onClick ={() => {
2165
+ // FIXME: this is a workaround for the editor not putting the focus on refHiddenInput
2166
+ // when clicking in the welcome screen (only occurs in 'tree' mode,
2167
+ // so you cannot paste a document from clipboard.
2168
+ focus ()
2169
+ }}
2167
2170
/>
2168
2171
{:else }
2169
2172
<Message
Original file line number Diff line number Diff line change 4
4
export let readOnly: boolean
5
5
export let onCreateArray: () => void
6
6
export let onCreateObject: () => void
7
+ export let onClick: () => void
7
8
</script >
8
9
9
- <div class =" jse-welcome" >
10
+ <div class ="jse-welcome" on:click ={() => onClick ()} role = " none " >
10
11
<div class =" jse-space jse-before" />
11
12
<div class =" jse-contents" >
12
13
<div class =" jse-welcome-title" >Empty document</div >
13
14
{#if ! readOnly }
14
15
<div class =" jse-welcome-info" >
15
16
You can paste clipboard data using <b >Ctrl+V</b >, or use the following options:
16
17
</div >
17
- <button title ={" Create an empty JSON object (press '{')" } on:click ={() => onCreateObject ()}
18
- >Create object</button
18
+ <button
19
+ title ={" Create an empty JSON object (press '{')" }
20
+ on:click |stopPropagation ={() => onCreateObject ()}>Create object</button
19
21
>
20
- <button title ={" Create an empty JSON array (press '[')" } on:click ={() => onCreateArray ()}
21
- >Create array</button
22
+ <button
23
+ title ={" Create an empty JSON array (press '[')" }
24
+ on:click |stopPropagation ={() => onCreateArray ()}>Create array</button
22
25
>
23
26
{/if }
24
27
</div >
You can’t perform that action at this time.
0 commit comments