Fix indent in renderTree, remove first indents
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Peter Stuifzand 2020-07-09 22:16:17 +02:00
parent 243c5df043
commit 5d924744de

View File

@ -5,10 +5,15 @@ import copy from 'copy-text-to-clipboard'
function renderTree(tree)
{
if (!tree) return []
return _.flatMapDeep(tree, (item) => [
_.repeat(" ", item.indented) + item.text,
renderTree(item.children),
])
let recRenderTree = (tree, indent) => {
return _.flatMapDeep(tree, (item) => [
_.repeat(" ", item.indented-indent) + item.text,
recRenderTree(item.children, indent),
])
}
return recRenderTree(tree, tree[0].indented)
}
function connectContextMenu(editor) {