Skip to content

Commit

Permalink
fix: do not show welcome options when editor is readOnly
Browse files Browse the repository at this point in the history
  • Loading branch information
josdejong committed Apr 6, 2022
1 parent 52f76b7 commit eb92d75
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/lib/components/modes/treemode/TreeMode.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -1992,7 +1992,7 @@
</label>
{#if json === undefined}
{#if text === '' || text === undefined}
<Welcome />
<Welcome {readOnly} />
{:else}
<Message
type="error"
Expand Down
18 changes: 12 additions & 6 deletions src/lib/components/modes/treemode/Welcome.svelte
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
<svelte:options immutable={true} />

<script>
export let readOnly
</script>

<div class="welcome">
<div class="space before" />
<div class="contents">
Empty document
<ul>
<li>Click inside the editor</li>
<li>Paste clipboard data using <span class="bold">Ctrl+V</span></li>
<li>Create a new object by typing <span class="bold">&lbrace;</span></li>
<li>Create a new array by typing <span class="bold">[</span></li>
</ul>
{#if !readOnly}
<ul>
<li>Click inside the editor</li>
<li>Paste clipboard data using <span class="bold">Ctrl+V</span></li>
<li>Create a new object by typing <span class="bold">&lbrace;</span></li>
<li>Create a new array by typing <span class="bold">[</span></li>
</ul>
{/if}
</div>
<div class="space after" />
</div>
Expand Down

0 comments on commit eb92d75

Please sign in to comment.