收敛树命令与投影切换

This commit is contained in:
lix-2026
2026-04-30 06:58:17 +08:00
parent 3cc090ba5e
commit 8c895b3dc0
16 changed files with 980 additions and 281 deletions
+7 -19
View File
@@ -321,7 +321,7 @@ mod tests {
assert!(html.contains("/documents/doc_root?workspaceId=ws_demo"));
assert!(html.contains("data-testid=\"wolai-sidebar-create-page\""));
assert!(html.contains("data-mnote-action=\"create-page\""));
assert!(html.contains("class=\"mnote-symbol"));
assert!(html.contains("class=\"material-symbols-outlined"));
assert!(html.contains("data-icon=\"home\""));
assert!(html.contains("data-icon=\"star\""));
assert!(html.contains("data-icon=\"delete\""));
@@ -485,28 +485,16 @@ fn item_icon_name(icon: Option<&str>) -> &'static str {
fn render_symbol(icon: &str, class_name: &str) -> String {
let icon = item_icon_name(Some(icon));
let body = match icon {
"delete" => {
r#"<path d="M5 6h14"></path><path d="M9 6V4h6v2"></path><path d="M8 6l1 14h6l1-14"></path><path d="M10.5 10v6"></path><path d="M13.5 10v6"></path>"#
}
"folder_open" => {
r#"<path d="M3.5 6.5h6l2 2h9"></path><path d="M4 8.5v9.5h14.5l2-7.5H7l-3 7.5"></path>"#
}
"inventory_2" => {
r#"<path d="M4 6h16v4H4z"></path><path d="M6 10v9h12v-9"></path><path d="M9 14h6"></path>"#
}
"star" => {
r#"<path d="m12 3 2.5 5.2 5.7.8-4.1 4 1 5.7-5.1-2.7-5.1 2.7 1-5.7-4.1-4 5.7-.8z"></path>"#
}
_ => {
r#"<path d="M4 10.5 12 3l8 7.5"></path><path d="M6.5 9.5V21h11V9.5"></path><path d="M9.5 21v-6h5v6"></path>"#
}
let filled_class = if icon == "star" || icon == "home" {
" material-symbols-filled"
} else {
""
};
format!(
r#"<svg class="mnote-symbol {}" data-icon="{}" viewBox="0 0 24 24" aria-hidden="true" focusable="false">{}</svg>"#,
r#"<span class="material-symbols-outlined{} {}" data-icon="{}" aria-hidden="true"></span>"#,
filled_class,
escape_html(class_name),
escape_html(icon),
body
)
}