From 002453cc922a7f4e91c894a30bb4169f31182ead Mon Sep 17 00:00:00 2001 From: Jos de Jong Date: Sat, 10 Oct 2020 14:22:00 +0200 Subject: [PATCH] Expand first item of an array by default --- src/components/treemode/TreeMode.svelte | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/treemode/TreeMode.svelte b/src/components/treemode/TreeMode.svelte index 5d5a188..dffcdd0 100644 --- a/src/components/treemode/TreeMode.svelte +++ b/src/components/treemode/TreeMode.svelte @@ -67,7 +67,13 @@ findRootPath let selection = null let clipboard = null - $: state = syncState(doc, state, [], (path) => path.length < 1) + $: state = syncState(doc, state, [], (path) => { + return path.length < 1 + ? true + : (path.length === 1 && path[0] === 0) // first item of an array? + ? true + : false + }) $: validationErrorsList = validate ? validate(doc) : [] $: validationErrors = mapValidationErrors(validationErrorsList)