open collapsibles if needed
This commit is contained in:
parent
7c29db40ee
commit
fa3099c4b0
2 changed files with 15 additions and 7 deletions
|
@ -12,7 +12,7 @@
|
||||||
import { get, type Readable } from 'svelte/store';
|
import { get, type Readable } from 'svelte/store';
|
||||||
import FileListNodeContent from './FileListNodeContent.svelte';
|
import FileListNodeContent from './FileListNodeContent.svelte';
|
||||||
import FileListNodeLabel from './FileListNodeLabel.svelte';
|
import FileListNodeLabel from './FileListNodeLabel.svelte';
|
||||||
import { getContext, onDestroy } from 'svelte';
|
import { afterUpdate, getContext } from 'svelte';
|
||||||
import {
|
import {
|
||||||
ListTrackSegmentItem,
|
ListTrackSegmentItem,
|
||||||
ListWaypointItem,
|
ListWaypointItem,
|
||||||
|
@ -46,15 +46,18 @@
|
||||||
: '';
|
: '';
|
||||||
|
|
||||||
const { verticalFileView } = settings;
|
const { verticalFileView } = settings;
|
||||||
const unsubscribe = selection.subscribe(($selection) => {
|
|
||||||
|
function openIfSelectedChild() {
|
||||||
if (collapsible && get(verticalFileView) && $selection.hasAnyChildren(item, false)) {
|
if (collapsible && get(verticalFileView) && $selection.hasAnyChildren(item, false)) {
|
||||||
collapsible.openNode();
|
collapsible.openNode();
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
onDestroy(() => {
|
if ($selection) {
|
||||||
unsubscribe();
|
openIfSelectedChild();
|
||||||
});
|
}
|
||||||
|
|
||||||
|
afterUpdate(openIfSelectedChild);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if node instanceof Map}
|
{#if node instanceof Map}
|
||||||
|
|
|
@ -198,8 +198,10 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let firstUpdateAfterMount = false;
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
createSortable();
|
createSortable();
|
||||||
|
firstUpdateAfterMount = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
afterUpdate(() => {
|
afterUpdate(() => {
|
||||||
|
@ -218,7 +220,10 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
syncFileOrder();
|
syncFileOrder();
|
||||||
updateFromSelection();
|
if (firstUpdateAfterMount) {
|
||||||
|
firstUpdateAfterMount = false;
|
||||||
|
updateFromSelection();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function getChangedIds() {
|
function getChangedIds() {
|
||||||
|
|
Loading…
Reference in a new issue