feat(docs): S-DOCS3 page embed block — inline doc preview in tiptap#247
Merged
AngryJay91 merged 2 commits intomainfrom Apr 15, 2026
Merged
feat(docs): S-DOCS3 page embed block — inline doc preview in tiptap#247AngryJay91 merged 2 commits intomainfrom
AngryJay91 merged 2 commits intomainfrom
Conversation
Add PageEmbedExtension Tiptap node allowing any document to embed another page as a clickable preview card inside the editor. AC coverage: - Slash command trigger (/Page Embed) inserts embed block - Inline picker: enter doc slug/ID → fetches /api/docs/[id] → renders icon + title + slug preview; click navigates via onNavigate - Graceful fallback: 404/network error shows "Document unavailable" with Change button to re-pick - Circular embed detection: docId === currentDocId shows error state (prevents A embedding A) - isCircularEmbed() pure function — 7 unit tests, all green - Type check 0 errors, 728/728 tests pass Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
**BLOCKER 1: /api/docs/[id] 엔드포인트 mismatch 해결**
- GET /api/docs/preview?q=<slug-or-uuid> 신설
- slug 또는 UUID 모두 허용 (UUID 정규식 판별)
- RBAC: getAuthContext + project_id 스코프
- { id, title, icon, slug, embedChain } 반환
- DocsService.getDocPreview(projectId, q) 추가
- page-embed-node.tsx fetchDoc: /api/docs/${id} → /api/docs/preview?q=
**BLOCKER 2: 간접 순환 임베드 감지 (A→B→A)**
- isCircularEmbed 시그니처 확장: embedChain 파라미터 추가
- 직접: docId === currentDocId
- 간접: embedChain.includes(currentDocId)
- preview 엔드포인트에서 BFS로 임베드 체인 수집 (maxDepth=5)
- extractEmbedIds(): HTML에서 data-doc-id 파싱
- collectTransitiveEmbeds(): Supabase BFS traversal
- fetchDoc에서 간접 cycle 감지 시 error 상태 설정
**🟡 markdown round-trip 보존**
- content-converter.ts: pageEmbed turndown rule 추가
- <div data-page-embed> → raw HTML 보존 (attr 유지)
**테스트: 28/28 pass, type-check FULL TURBO**
- isCircularEmbed 7→15케이스 (직접 7 + 간접 8)
- preview route: 7케이스 (401/429/400/404/slug/uuid/embedChain)
- extractEmbedIds: 6케이스
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PageEmbedExtensionTiptap node with React node view for embedding pages inside docs/Page Embedtriggers the block; inline picker accepts doc slug or ID/api/docs/[id]→ renders icon + title + slug preview card; click navigates viaonNavigateisCircularEmbed(docId, currentDocId)prevents A embedding A; error state rendered when triggeredDocEditorgainscurrentDocIdandonNavigateprops;DocsShellClientwires both fromselectedDoc.id+handleSelectDocAC checklist
/slugpreview, click navigatesisCircularEmbed— 7 cases, all greenTest plan
/Page Embedin an open doc — picker input renderscurrentDocId) → circular error state rendersisCircularEmbedunit test: 7/7 pass🤖 Generated with Claude Code