Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions resources/css/components/page-tree.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
}
.tree-node {
@apply dark:pb-0.25;
transition: opacity var(--starting-style-transition-duration);
transition-delay: calc(sibling-index() * var(--starting-style-sibling-delay));
@starting-style {
opacity: 0;
/* We only want to animate tree nodes on page load. We don't want to animate child nodes when toggling them open, less it looks glitchy and feels unresponsive. */
&:not(.page-tree--has-been-interacted-with &) {
transition: opacity var(--starting-style-transition-duration);
transition-delay: calc(sibling-index() * var(--starting-style-sibling-delay));
@starting-style {
opacity: 0;
}
}
}
.page-tree-branch {
Expand Down
12 changes: 10 additions & 2 deletions resources/js/components/structures/PageTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</div>
</div>
</ui-panel-header>
<div v-if="!loading" class="page-tree">
<div v-if="!loading" class="page-tree" :class="{ 'page-tree--has-been-interacted-with': hasToggled }">
<Draggable
ref="tree"
v-model="treeData"
Expand Down Expand Up @@ -54,7 +54,7 @@
:editable="editable"
:root="isRoot(stat)"
@edit="$emit('edit-page', node, $event)"
@toggle-open="stat.open = !stat.open"
@toggle-open="toggleBranch(stat)"
@removed="pageRemoved"
@branch-clicked="$emit('branch-clicked', node)"
class="mb-px"
Expand Down Expand Up @@ -127,6 +127,7 @@ export default {
treeData: [],
collapsedState: [],
discardingChanges: false,
hasToggled: false,
};
},

Expand Down Expand Up @@ -364,6 +365,13 @@ export default {
stat.open = !this.collapsedState.includes(stat.data.id);
return stat;
},

toggleBranch(stat) {
stat.open = !stat.open;
if (!this.hasToggled) {
this.hasToggled = true;
}
},
},
};
</script>