Skip to content

Commit c9016f8

Browse files
authored
view: use refTo node in list view if it exists (#146)
1 parent 123c833 commit c9016f8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/view/list.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,20 @@ import { OutlineNode } from "../ui/outline.tsx";
33

44
export default {
55
view({attrs: {workbench, path}}) {
6+
let node = path.node;
7+
if (path.node.refTo) {
8+
node = path.node.refTo;
9+
}
610
return (
711
<div class="list-view">
812
<div class="fields">
9-
{(path.node.getLinked("Fields").length > 0) &&
10-
path.node.getLinked("Fields").map(n => <OutlineNode key={n.id} workbench={workbench} path={path.append(n)} />)
13+
{(node.getLinked("Fields").length > 0) &&
14+
node.getLinked("Fields").map(n => <OutlineNode key={n.id} workbench={workbench} path={path.append(n)} />)
1115
}
1216
</div>
1317
<div class="children">
14-
{(path.node.childCount > 0)
15-
?path.node.children.map(n => <OutlineNode key={n.id} workbench={workbench} path={path.append(n)} />)
18+
{(node.childCount > 0)
19+
?node.children.map(n => <OutlineNode key={n.id} workbench={workbench} path={path.append(n)} />)
1620
:<NewNode workbench={workbench} path={path} />
1721
}
1822
</div>

0 commit comments

Comments
 (0)