refactor: remove Tiptap editor dependency and legacy JSON format support from wiki components

This commit is contained in:
taDuc
2026-05-15 00:04:44 +07:00
parent 57e3d6b3e5
commit 3682f25282
10 changed files with 30 additions and 1402 deletions
+1 -1
View File
@@ -113,7 +113,7 @@ Các file nên đọc trước:
Các điểm dễ làm hỏng:
- sanitize link của Quill
- compatibility với doc dạng HTML/Tiptap JSON/plain text
- compatibility với doc dạng HTML/plain text
- slug links nội bộ
- sentinel `__missing__`
-1
View File
@@ -218,7 +218,6 @@ Các khả năng đang có:
Storage thực tế của `doc`:
- format mới: HTML string
- format cũ tương thích: Tiptap JSON string
- plaintext fallback
### Internal wiki link
+2 -7
View File
@@ -8,18 +8,16 @@ Wiki trong UHM editor hiện chạy qua hai phần:
## 1. Storage format của wiki doc
Field `doc` trong `WikiSnapshot` hiện là `string | null`.
Frontend đang hỗ trợ ba dạng:
Frontend hiện hỗ trợ hai dạng:
- HTML string
- JSON string kiểu Tiptap cũ
- plain text fallback
Quy ước hiện tại:
- format ghi mới từ editor Quill là HTML
- Tiptap JSON chỉ còn để tương thích dữ liệu cũ
`normalizeWikiDocForQuill()``normalizeWikiContentToHtml()` là hai hàm quan trọng cho compatibility này.
`normalizeWikiDocForQuill()``normalizeWikiContentToHtml()` hiện chỉ xử lý HTML hoặc plain text.
## 2. Editor hiện dùng Quill, không dùng Tiptap
@@ -42,8 +40,6 @@ Toolbar hiện có:
- `image`
- `clean`
Trang `app/user/wikieditor/page.tsx` vẫn dùng Tiptap, nhưng đó là trang riêng và không phải wiki editor chính của project UHM.
## 3. Tạo, sửa và xóa wiki trong project editor
`WikiSidebarPanel` hỗ trợ:
@@ -89,7 +85,6 @@ Export hiện chỉ là download text từ `wikiDocHtml`.
Định dạng file được đoán từ nội dung hiện tại:
- bắt đầu bằng `<` -> `html`
- bắt đầu bằng `{` hoặc `[` -> `json`
- còn lại -> `txt`
Đây là export client-side, không có API export chuyên biệt.