Expand description
评论草稿 localStorage 持久化(仅在 WASM 端实际读写)。 评论草稿在浏览器 localStorage 中的持久化支持。
注意:所有 localStorage 读写均通过 #[cfg(target_arch = "wasm32")] 限定,
仅在 WASM 前端生效;服务端渲染(SSR)路径下这些函数会返回 None 或空操作。
Structs§
- Author
Info - 评论作者信息。
- Pending
Comment - 待发布评论草稿。
Constants§
- AUTHOR_
KEY 🔒 - localStorage 中用于存储评论作者信息的键名。
- PENDING_
KEY 🔒 - localStorage 中用于存储待发布评论草稿的键名。
- TTL_
DAYS 🔒 - 待发布评论草稿的过期时间(天)。
Functions§
- is_
expired 🔒 - 判断给定存储时间是否已经过期。
- load_
all_ 🔒pending - 加载全部待发布评论草稿映射。
- load_
author - 从 localStorage 读取评论作者信息。
- load_
pending_ comments - 加载指定文章下所有未过期的待发布评论草稿。
- prune_
all_ expired - 清理所有文章中已过期的待发布评论草稿。
- read_
storage 🔒 - 从 localStorage 读取指定键的值。
- remove_
pending_ ids - 从指定文章的草稿列表中移除指定 ID 的评论。
- render_
pending_ content - 将待发布评论的 Markdown 内容渲染为安全的 HTML(纯文本 + 换行转
<br>)。 - save_
author - 保存评论作者信息到 localStorage。
- save_
pending_ comment - 将一条待发布评论草稿保存到指定文章的草稿列表中。
- write_
storage 🔒 - 将值写入 localStorage 指定键。
Type Aliases§
- Pending
Map 🔒 - 按文章 ID 组织的待发布评论草稿映射。