39 lines
1.3 KiB
Rust
39 lines
1.3 KiB
Rust
//! MNOTE 文档页面组件 (SSR)
|
|||
|
|
//!
|
||
|
|
//! 提供文档编辑器的服务器端渲染壳。
|
||
|
|
//! 外部手写 `<body>` 包装和 `<script>` 数据嵌入由路由 handler 处理。
|
||
|
|
|
||
|
|
use leptos::prelude::*;
|
||
|
|
use crate::ssr::pages::layout::PageLayout;
|
||
|
|
|
||
|
|
/// MNOTE 文档页面
|
||
|
|
///
|
||
|
|
/// 渲染文档编辑器的 SSR 壳结构:
|
||
|
|
/// - `<PageLayout current_nav="documents">`
|
||
|
|
/// - 标题区域
|
||
|
|
/// - 页面聚合快照标记
|
||
|
|
/// - 编辑器占位区
|
||
|
|
#[component]
|
||
|
|
pub fn DocumentPage(
|
||
|
|
/// 文档标题
|
||
|
|
title: String,
|
||
|
|
/// 侧栏页面树 HTML(可选)
|
||
|
|
#[prop(optional)]
|
||
|
|
sidebar_tree_html: Option<String>,
|
||
|
|
/// 工作区名称(可选)
|
||
|
|
#[prop(optional)]
|
||
|
|
workspace_name: Option<String>,
|
||
|
|
) -> impl IntoView {
|
||
|
|
view! {
|
||
|
|
<PageLayout current_nav="documents" sidebar_tree_html={sidebar_tree_html.unwrap_or_default()} workspace_name={workspace_name.unwrap_or_default()}>
|
||
|
|
<main class="document-shell" data-editor-host="leptos_tiptap_island">
|
||
|
|
<header class="document-shell-header">
|
||
|
|
<h1>{title}</h1>
|
||
|
|
</header>
|
||
|
|
<section data-page-aggregate-snapshot="mnote.page_aggregate.v1"></section>
|
||
|
|
<section id="mnote-editor-island" data-editor-host="leptos_tiptap_island"></section>
|
||
|
|
</main>
|
||
|
|
</PageLayout>
|
||
|
|
}
|
||
|
|
}
|