Collapse children on right move

This commit is contained in:
Ken Polizzi 2022-09-16 12:49:26 +02:00
parent 8b2d68d8a2
commit 36eea814f8

11
h-m-m
View file

@ -1636,7 +1636,6 @@ function export_html(&$mm)
message($mm, 'Exported as '.$mm['filename'].'.html'); message($mm, 'Exported as '.$mm['filename'].'.html');
copy_to_clipboard($mm, $mm['filename'].'.html'); copy_to_clipboard($mm, $mm['filename'].'.html');
} }
@ -1664,7 +1663,7 @@ function export_html_node(&$mm, $parent_id)
$output = $output =
"<details>" "<details>"
."<summary>" ."<summary>"
.$mm['nodes'][$parent_id]['title'] .$mm['nodes'][$parent_id]['title'] . ' (' . count($mm['nodes'][$parent_id]['children']) . ')'
."</summary>"; ."</summary>";
foreach ($mm['nodes'][$parent_id]['children'] as $cid) foreach ($mm['nodes'][$parent_id]['children'] as $cid)
@ -1837,7 +1836,13 @@ function change_active_node(&$mm, $direction)
if ($direction==move_right) if ($direction==move_right)
{ {
if ($node['is_leaf'] || ($node['collapsed'] ?? false) ) return; if ($node['is_leaf']) return;
// auto-unfold node on right move
if ($node['collapsed'] ?? false) {
toggle($mm);
$node = $mm['nodes'][ $mm['active_node'] ];
}
$distance = []; $distance = [];
foreach ($node['children'] as $cid) foreach ($node['children'] as $cid)