Skip to content

Conversation

wll8
Copy link
Collaborator

@wll8 wll8 commented Oct 16, 2025

  • Add js-lite-rest dependency for local data storage
  • Refactor main.ts to initialize storex with posts and history
  • Create defaultData.ts to manage initial post data
  • Update store methods to use async storex operations
  • Add storex to global type definitions
  • Enhance CodemirrorEditor with history tracking via storex

把文章和文章历史分别保存到了 indexedDB 中。

image

为什么这样做?

因为当前使用的本地存储大多情况下可能只支持到 5M 体积。如果一篇文章有很多历史或添加了几张 base64 的图片,那么将会很快达到限制导致而出现问题。

为什么使用 lite-rest?

它以 restfull api 的形式进行内容操作,在提供便利性的同时,便于后期以 http 或其他形式(可通过中间件)进行扩展。
它实际上是类似 axios 的方法。只是没有先把 XMLHttpRequest 这部分后端交互放进去(因为没有后端),但依然拥有了除此之外的所有代码。例如请求和响应拦截、restfull 操作方法(例如 store.put("/posts/1"))。

以后是什么?

把所有 store 数据存取都异步化,以支持所有数据上云或平台化的可能性。

- Add js-lite-rest dependency for local data storage
- Refactor main.ts to initialize storex with posts and history
- Create defaultData.ts to manage initial post data
- Update store methods to use async storex operations
- Add storex to global type definitions
- Enhance CodemirrorEditor with history tracking via storex
Copy link

github-actions bot commented Oct 16, 2025

🎊 PR Preview has been successfully built and deployed to https://doocs-md-preview-pr-1062.surge.sh

@yanglbme yanglbme marked this pull request as draft October 16, 2025 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant