Implement Rust web sidebar title and tree interactions

This commit is contained in:
lix-2026
2026-04-30 05:46:36 +08:00
parent 559c5ce652
commit 3cc090ba5e
35 changed files with 3029 additions and 424 deletions
@@ -19,6 +19,8 @@ pub fn DocumentPage(
title: String,
/// 文档 id
document_id: String,
/// 工作区 id
workspace_id: String,
/// 侧栏页面树 HTML(可选)
#[prop(optional)]
sidebar_tree_html: Option<String>,
@@ -44,10 +46,27 @@ pub fn DocumentPage(
.unwrap_or_else(|| "个人空间".to_string());
view! {
<PageLayout current_nav="documents" sidebar_tree_html={sidebar_tree_html.unwrap_or_default()} workspace_name={workspace_name.unwrap_or_default()} workspace_sidebar_html={workspace_sidebar_html.unwrap_or_default()} topbar_title={title.clone()}>
<main class="document-shell" data-editor-host="leptos_tiptap_island" data-document-id={document_id.clone()}>
<main class="document-shell" data-editor-host="leptos_tiptap_island" data-document-id={document_id.clone()} data-workspace-id={workspace_id.clone()}>
<header class="document-shell-header">
<div class="document-page-icon" aria-hidden="true">""</div>
<h1>{title}</h1>
<div class="document-page-icon" aria-hidden="true">
<svg class="mnote-symbol mnote-symbol--document" data-icon="home" viewBox="0 0 24 24" focusable="false">
<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>
</svg>
</div>
<h1 class="document-title-heading">
<textarea
id="mnote-page-title-input"
class="document-title-input"
aria-label="页面标题"
data-page-title-input="true"
data-document-id={document_id.clone()}
data-workspace-id={workspace_id.clone()}
data-title-endpoint="/api/documents/title"
rows="1"
>{title.clone()}</textarea>
</h1>
<div class="document-shell-meta" aria-label="页面元信息">
<span><span aria-hidden="true">""</span>{workspace_label}</span>
<span><span aria-hidden="true">""</span>"已同步"</span>