Skip to content

Commit

Permalink
implement shift tree folding (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
Crauzer authored Mar 19, 2023
1 parent d78df6a commit 4b5e5d0
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions Obsidian/Shared/TreeWadItem.razor
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@
private void OnRowDoubleClick(MouseEventArgs e)
{
if (this.Item is WadFolderModel folder)
OnToggleExpand();
ToggleExpand();

this.Root.RefreshState();
}

private void OnCheckedChanged(bool value)
Expand All @@ -156,12 +158,24 @@
this.Root.RefreshState();
}

private void OnToggleExpand()
private void OnToggleExpand(MouseEventArgs e)
{
this.Item.IsExpanded = !this.Item.IsExpanded;
ToggleExpand();

if (e.ShiftKey)
{
foreach (WadItemModel item in this.Item.TraverseFlattenedItems())
item.IsExpanded = this.Item.IsExpanded;
}

this.Root.RefreshState();
}

private void ToggleExpand()
{
this.Item.IsExpanded = !this.Item.IsExpanded;
}

private async Task CopyNameToClipboard()
{
await this.JsRuntime.InvokeVoidAsync("navigator.clipboard.writeText", this.Item.Name);
Expand Down

0 comments on commit 4b5e5d0

Please sign in to comment.