cortex-react-components 2.12.8 → 2.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-VRE6VCHX.mjs → chunk-2BR55L74.mjs} +1 -1
- package/dist/{chunk-FYQBRCQM.mjs → chunk-2BRDNDUB.mjs} +1 -1
- package/dist/{chunk-ZMB6R6JX.mjs → chunk-2C4UDLVF.mjs} +1 -1
- package/dist/{chunk-D3B2YO7G.mjs → chunk-2XMVNXF6.mjs} +1 -1
- package/dist/{chunk-2OOJ4ZFB.mjs → chunk-3HNU2NYP.mjs} +1 -1
- package/dist/{chunk-HDKHF3EA.mjs → chunk-3NRXQBBS.mjs} +1 -1
- package/dist/{chunk-77PCUNUC.mjs → chunk-3Y7QG6VP.mjs} +1 -1
- package/dist/{chunk-EAFH3DTH.mjs → chunk-47OE4ZPY.mjs} +1 -1
- package/dist/{chunk-WDI7JGA6.mjs → chunk-4HHGVL3E.mjs} +1 -1
- package/dist/{chunk-QQVPLMPJ.mjs → chunk-4USR4WTH.mjs} +1 -1
- package/dist/{chunk-MO4HRQEL.mjs → chunk-5MWZTJYP.mjs} +1 -1
- package/dist/{chunk-XX4GSGRP.mjs → chunk-5NIEZE7A.mjs} +1 -1
- package/dist/chunk-5ROLUQ45.mjs +4 -0
- package/dist/{chunk-U67OTPTT.mjs → chunk-62G4REJ3.mjs} +1 -1
- package/dist/chunk-6LEH6XKI.mjs +4 -0
- package/dist/{chunk-BQQ4V4PX.mjs → chunk-75F3LJMX.mjs} +1 -1
- package/dist/{chunk-GNXLNZ6A.mjs → chunk-7FWAJQRH.mjs} +1 -1
- package/dist/{chunk-4SRUEQTP.mjs → chunk-7R47MHQE.mjs} +1 -1
- package/dist/{chunk-PTZT4QJW.mjs → chunk-AJQHGVZ5.mjs} +1 -1
- package/dist/{chunk-33XEFJDE.mjs → chunk-AOQPH32M.mjs} +1 -1
- package/dist/chunk-AQQCH7Z2.mjs +4 -0
- package/dist/chunk-ATBKMJU6.mjs +4 -0
- package/dist/{chunk-AZ4VR5JX.mjs → chunk-BVFUCOCP.mjs} +1 -1
- package/dist/{chunk-HKMNAXLM.mjs → chunk-C4RWEPVF.mjs} +1 -1
- package/dist/{chunk-OPLUKFRN.mjs → chunk-CXCDV7VP.mjs} +1 -1
- package/dist/{chunk-7OMPPFGG.mjs → chunk-CXOVEABI.mjs} +1 -1
- package/dist/chunk-DYIBFAK7.mjs +4 -0
- package/dist/{chunk-NO3FZ27F.mjs → chunk-E5LTCCBN.mjs} +1 -1
- package/dist/{chunk-R6AYIVIR.mjs → chunk-EM3T2XYC.mjs} +1 -1
- package/dist/chunk-EZC3YWSQ.mjs +1 -0
- package/dist/{chunk-NUHGPB5U.mjs → chunk-FDRX3CL2.mjs} +1 -1
- package/dist/{chunk-PNUBVBSR.mjs → chunk-FE7ZGUPU.mjs} +1 -1
- package/dist/chunk-FSCDCSVK.mjs +4 -0
- package/dist/{chunk-LVFMFRBR.mjs → chunk-FXO5SPBG.mjs} +1 -1
- package/dist/{chunk-F64CA5CH.mjs → chunk-GHOL5L32.mjs} +1 -1
- package/dist/{chunk-P6OSMPUQ.mjs → chunk-GTZJWMZR.mjs} +1 -1
- package/dist/chunk-I2PVJQQR.mjs +1 -0
- package/dist/chunk-I4GYQZGM.mjs +1 -0
- package/dist/chunk-J4QINTHR.mjs +4 -0
- package/dist/chunk-JCWFPKF3.mjs +4 -0
- package/dist/chunk-JDMIQLAZ.mjs +1 -0
- package/dist/{chunk-PXAMTME4.mjs → chunk-JMIUGRDN.mjs} +1 -1
- package/dist/chunk-K5MJYNCD.mjs +4 -0
- package/dist/{chunk-5BV4MHV6.mjs → chunk-KG3MNGT6.mjs} +1 -1
- package/dist/chunk-KO6JUP2L.mjs +4 -0
- package/dist/chunk-KPTGYVDM.mjs +4 -0
- package/dist/{chunk-JXIKSSGH.mjs → chunk-KZCIHFTM.mjs} +1 -1
- package/dist/{chunk-5FWH5YVM.mjs → chunk-LHO4WFYP.mjs} +1 -1
- package/dist/{chunk-O24GFE6Q.mjs → chunk-LJXTXROJ.mjs} +1 -1
- package/dist/chunk-MDBYZZXI.mjs +1 -0
- package/dist/chunk-MFE4VZPC.mjs +4 -0
- package/dist/{chunk-U3FYDDE2.mjs → chunk-NINFDOV5.mjs} +1 -1
- package/dist/chunk-P55W6AFU.mjs +1 -0
- package/dist/{chunk-MX3JKY3V.mjs → chunk-P7S6XFU4.mjs} +1 -1
- package/dist/chunk-PMJGTB6S.mjs +4 -0
- package/dist/chunk-POIHYOIP.mjs +4 -0
- package/dist/{chunk-ZSIYEVUV.mjs → chunk-PTGTIV55.mjs} +1 -1
- package/dist/chunk-R4SE63GR.mjs +4 -0
- package/dist/{chunk-GETYSIZV.mjs → chunk-RGOKBIQ5.mjs} +1 -1
- package/dist/{chunk-GAZHKHGB.mjs → chunk-RJGYVDOU.mjs} +1 -1
- package/dist/{chunk-YI5ZDAT5.mjs → chunk-RS4VD3ML.mjs} +1 -1
- package/dist/{chunk-IDG2O4B7.mjs → chunk-RSDUFAIB.mjs} +1 -1
- package/dist/{chunk-QG4CIWGQ.mjs → chunk-RXUCV64J.mjs} +1 -1
- package/dist/chunk-SGK4ZXKR.mjs +4 -0
- package/dist/chunk-SNTLCFXF.mjs +4 -0
- package/dist/{chunk-TDASZ6KO.mjs → chunk-TTWEHUP5.mjs} +1 -1
- package/dist/{chunk-2L2SAVX6.mjs → chunk-TVTTUSWM.mjs} +1 -1
- package/dist/{chunk-SRUG246N.mjs → chunk-TXVA6XJT.mjs} +1 -1
- package/dist/chunk-UAEEBFHJ.mjs +4 -0
- package/dist/chunk-UBJT7MPU.mjs +4 -0
- package/dist/{chunk-PWXCBW2H.mjs → chunk-USOGZB6R.mjs} +1 -1
- package/dist/{chunk-54K53IWE.mjs → chunk-UXOUJ5YO.mjs} +1 -1
- package/dist/{chunk-2GM2LPLB.mjs → chunk-WIRQ5IRT.mjs} +1 -1
- package/dist/{chunk-IJQC7T2R.mjs → chunk-WVP4YQCP.mjs} +1 -1
- package/dist/{chunk-UZSBX5GO.mjs → chunk-X3JZSN3W.mjs} +1 -1
- package/dist/{chunk-6WQXZ6IE.mjs → chunk-XADBBCGL.mjs} +1 -1
- package/dist/{chunk-VNYUNZ3M.mjs → chunk-XGIYNUGC.mjs} +1 -1
- package/dist/{chunk-3ANJOET7.mjs → chunk-ZEALRBXW.mjs} +1 -1
- package/dist/{chunk-O5P35LEY.mjs → chunk-ZFUP5NVF.mjs} +1 -1
- package/dist/chunk-ZKSZJI4F.mjs +4 -0
- package/dist/components/AdvancedComponents/user-selection.d.ts +1 -1
- package/dist/components/AdvancedComponents/user-selection.js +0 -1
- package/dist/components/AdvancedComponents/user-selection.mjs +1 -1
- package/dist/components/Blocks/Banner.mjs +1 -1
- package/dist/components/Blocks/CallToAction.mjs +1 -1
- package/dist/components/Blocks/CaseStudy.mjs +1 -1
- package/dist/components/Blocks/CollapsibleArea.mjs +1 -1
- package/dist/components/Blocks/Content.mjs +1 -1
- package/dist/components/Blocks/FeaturesBlock.mjs +1 -1
- package/dist/components/Blocks/ImageBlock.mjs +1 -1
- package/dist/components/Blocks/MediaBlock.mjs +1 -1
- package/dist/components/Blocks/RelatedPosts.mjs +1 -1
- package/dist/components/Blocks/RenderBlocks.mjs +1 -1
- package/dist/components/Blocks/ReusableContentBlock.mjs +1 -1
- package/dist/components/Blocks/index.mjs +1 -1
- package/dist/components/Cards/ContentCard.mjs +1 -1
- package/dist/components/Cards/EventCard.mjs +1 -1
- package/dist/components/Cards/FeatureCard.mjs +1 -1
- package/dist/components/Cards/index.mjs +1 -1
- package/dist/components/Chat/ChatCardTask.mjs +1 -1
- package/dist/components/Chat/ChatInterface.mjs +1 -1
- package/dist/components/Chat/ChatInterfaceMessages.mjs +1 -1
- package/dist/components/Chat/ChatMessage.mjs +1 -1
- package/dist/components/Chat/CopilotInterface.mjs +1 -1
- package/dist/components/Chat/demo-long-messages.mjs +1 -1
- package/dist/components/Chat/demo-tests.mjs +1 -1
- package/dist/components/Chat/demo.mjs +1 -1
- package/dist/components/Chat/example-usage.mjs +1 -1
- package/dist/components/Chat/example-with-vercel-ai.mjs +1 -1
- package/dist/components/Chat/index.mjs +1 -1
- package/dist/components/DigitalColleagues/AppSidebarLeft.mjs +1 -1
- package/dist/components/DigitalColleagues/MainPage.mjs +1 -1
- package/dist/components/DigitalColleagues/Pages/dashboardpage.mjs +1 -1
- package/dist/components/DigitalColleagues/Views/ColleaguesView.mjs +1 -1
- package/dist/components/DigitalColleagues/Views/KnowledgeView.mjs +1 -1
- package/dist/components/DigitalColleagues/Views/TeamsIndexView.mjs +1 -1
- package/dist/components/DigitalColleagues/Views/index.mjs +1 -1
- package/dist/components/DigitalColleagues/colleague-card.mjs +1 -1
- package/dist/components/DigitalColleagues/colleague-form.mjs +1 -1
- package/dist/components/DigitalColleagues/digital-colleague-clone.mjs +1 -1
- package/dist/components/DigitalColleagues/index.mjs +1 -1
- package/dist/components/DigitalColleagues/knowledge-search.mjs +1 -1
- package/dist/components/Foundary/AppSidebarLeft.css +1 -0
- package/dist/components/Foundary/AppSidebarLeft.d.ts +47 -0
- package/dist/components/Foundary/AppSidebarLeft.js +4 -0
- package/dist/components/Foundary/AppSidebarLeft.mjs +2 -0
- package/dist/components/Foundary/DashboardHeader.css +1 -0
- package/dist/components/Foundary/DashboardHeader.d.ts +8 -0
- package/dist/components/Foundary/DashboardHeader.js +4 -0
- package/dist/components/Foundary/DashboardHeader.mjs +1 -0
- package/dist/components/Foundary/DigitalColleageusLayout.css +1 -0
- package/dist/components/Foundary/DigitalColleageusLayout.d.ts +28 -0
- package/dist/components/Foundary/DigitalColleageusLayout.js +5 -0
- package/dist/components/Foundary/DigitalColleageusLayout.mjs +2 -0
- package/dist/components/Foundary/MainPage.css +1 -0
- package/dist/components/Foundary/MainPage.d.ts +3 -0
- package/dist/components/Foundary/MainPage.js +4 -0
- package/dist/components/Foundary/MainPage.mjs +2 -0
- package/dist/components/Foundary/ManagementSidebar.d.ts +8 -0
- package/dist/components/Foundary/ManagementSidebar.js +4 -0
- package/dist/components/Foundary/ManagementSidebar.mjs +2 -0
- package/dist/components/Foundary/Pages/dashboardpage.css +1 -0
- package/dist/components/Foundary/Pages/dashboardpage.d.ts +18 -0
- package/dist/components/Foundary/Pages/dashboardpage.js +5 -0
- package/dist/components/Foundary/Pages/dashboardpage.mjs +2 -0
- package/dist/components/Foundary/README-document-edit.js +238 -0
- package/dist/components/Foundary/README-document-edit.mjs +238 -0
- package/dist/components/Foundary/README-document-preview.js +210 -0
- package/dist/components/Foundary/README-document-preview.mjs +210 -0
- package/dist/components/Foundary/SearchableSelect.css +1 -0
- package/dist/components/Foundary/SearchableSelect.d.ts +16 -0
- package/dist/components/Foundary/SearchableSelect.js +4 -0
- package/dist/components/Foundary/SearchableSelect.mjs +1 -0
- package/dist/components/Foundary/Views/ColleaguesView.css +1 -0
- package/dist/components/Foundary/Views/ColleaguesView.d.ts +14 -0
- package/dist/components/Foundary/Views/ColleaguesView.js +5 -0
- package/dist/components/Foundary/Views/ColleaguesView.mjs +2 -0
- package/dist/components/Foundary/Views/KnowledgeView.css +1 -0
- package/dist/components/Foundary/Views/KnowledgeView.d.ts +11 -0
- package/dist/components/Foundary/Views/KnowledgeView.docs.js +308 -0
- package/dist/components/Foundary/Views/KnowledgeView.docs.mjs +308 -0
- package/dist/components/Foundary/Views/KnowledgeView.js +5 -0
- package/dist/components/Foundary/Views/KnowledgeView.mjs +1 -0
- package/dist/components/Foundary/Views/TeamsIndexView.css +1 -0
- package/dist/components/Foundary/Views/TeamsIndexView.d.ts +9 -0
- package/dist/components/Foundary/Views/TeamsIndexView.js +5 -0
- package/dist/components/Foundary/Views/TeamsIndexView.mjs +2 -0
- package/dist/components/Foundary/Views/index.css +1 -0
- package/dist/components/Foundary/Views/index.d.ts +7 -0
- package/dist/components/Foundary/Views/index.js +5 -0
- package/dist/components/Foundary/Views/index.mjs +1 -0
- package/dist/components/Foundary/colleague-card.css +1 -0
- package/dist/components/Foundary/colleague-card.d.ts +12 -0
- package/dist/components/Foundary/colleague-card.js +4 -0
- package/dist/components/Foundary/colleague-card.mjs +2 -0
- package/dist/components/Foundary/colleague-form.css +1 -0
- package/dist/components/Foundary/colleague-form.d.ts +14 -0
- package/dist/components/Foundary/colleague-form.js +4 -0
- package/dist/components/Foundary/colleague-form.mjs +2 -0
- package/dist/components/Foundary/colleague-type-selection.css +1 -0
- package/dist/components/Foundary/colleague-type-selection.d.ts +7 -0
- package/dist/components/Foundary/colleague-type-selection.js +4 -0
- package/dist/components/Foundary/colleague-type-selection.mjs +2 -0
- package/dist/components/Foundary/digital-colleague-clone.css +1 -0
- package/dist/components/Foundary/digital-colleague-clone.d.ts +9 -0
- package/dist/components/Foundary/digital-colleague-clone.js +4 -0
- package/dist/components/Foundary/digital-colleague-clone.mjs +2 -0
- package/dist/components/Foundary/digital-colleague-options.css +1 -0
- package/dist/components/Foundary/digital-colleague-options.d.ts +7 -0
- package/dist/components/Foundary/digital-colleague-options.js +4 -0
- package/dist/components/Foundary/digital-colleague-options.mjs +2 -0
- package/dist/components/Foundary/document-edit.css +1 -0
- package/dist/components/Foundary/document-edit.d.ts +10 -0
- package/dist/components/Foundary/document-edit.js +5 -0
- package/dist/components/Foundary/document-edit.mjs +2 -0
- package/dist/components/Foundary/document-preview-examples.css +1 -0
- package/dist/components/Foundary/document-preview-examples.d.ts +12 -0
- package/dist/components/Foundary/document-preview-examples.js +35 -0
- package/dist/components/Foundary/document-preview-examples.mjs +31 -0
- package/dist/components/Foundary/document-preview.css +1 -0
- package/dist/components/Foundary/document-preview.d.ts +18 -0
- package/dist/components/Foundary/document-preview.js +5 -0
- package/dist/components/Foundary/document-preview.mjs +2 -0
- package/dist/components/Foundary/index.css +1 -0
- package/dist/components/Foundary/index.d.ts +18 -0
- package/dist/components/Foundary/index.js +5 -0
- package/dist/components/Foundary/index.mjs +1 -0
- package/dist/components/Foundary/knowledge-browser.css +1 -0
- package/dist/components/Foundary/knowledge-browser.d.ts +13 -0
- package/dist/components/Foundary/knowledge-browser.js +5 -0
- package/dist/components/Foundary/knowledge-browser.mjs +2 -0
- package/dist/components/Foundary/knowledge-search.css +1 -0
- package/dist/components/Foundary/knowledge-search.d.ts +12 -0
- package/dist/components/Foundary/knowledge-search.js +5 -0
- package/dist/components/Foundary/knowledge-search.mjs +2 -0
- package/dist/components/Foundary/team-form.css +1 -0
- package/dist/components/Foundary/team-form.d.ts +24 -0
- package/dist/components/Foundary/team-form.js +5 -0
- package/dist/components/Foundary/team-form.mjs +2 -0
- package/dist/components/Foundary/test-data.d.ts +110 -0
- package/dist/components/Foundary/test-data.js +1 -0
- package/dist/components/Foundary/test-data.mjs +1 -0
- package/dist/components/Foundary/types.d.ts +939 -0
- package/dist/components/Foundary/types.js +1 -0
- package/dist/components/HeaderFooter/SectionHeading.mjs +1 -1
- package/dist/components/HeaderFooter/VideoHeader.mjs +1 -1
- package/dist/components/HeaderFooter/index.mjs +1 -1
- package/dist/components/Heros/HighImpact/index.mjs +1 -1
- package/dist/components/Heros/LowImpact/index.mjs +1 -1
- package/dist/components/Heros/MediumImpact/index.mjs +1 -1
- package/dist/components/Heros/PostHero/index.mjs +1 -1
- package/dist/components/Heros/RenderHero.mjs +1 -1
- package/dist/components/Heros/SectionHero/index.mjs +1 -1
- package/dist/components/Heros/index.mjs +1 -1
- package/dist/components/Layouts/OutputHeaderFooter.mjs +1 -1
- package/dist/components/Layouts/Print.mjs +1 -1
- package/dist/components/Layouts/SlideShow.mjs +1 -1
- package/dist/components/Layouts/index.mjs +1 -1
- package/dist/components/Menus/SidebarLeft.mjs +1 -1
- package/dist/components/Menus/SidebarRight.mjs +1 -1
- package/dist/components/Menus/index.mjs +1 -1
- package/dist/components/Other/index.mjs +1 -1
- package/dist/components/Payload/CollectionArchive/index.js +1 -1
- package/dist/components/Payload/CollectionArchive/index.mjs +1 -1
- package/dist/components/Payload/Media/index.mjs +1 -1
- package/dist/components/Payload/{Card → PayloadCard}/index.d.ts +1 -1
- package/dist/components/Payload/PayloadCard/index.js +4 -0
- package/dist/components/Payload/PayloadCard/index.mjs +2 -0
- package/dist/components/Payload/RichText/index.mjs +1 -1
- package/dist/components/Payload/RichText/serialize.mjs +1 -1
- package/dist/components/Payload/index.d.ts +1 -1
- package/dist/components/Payload/index.js +1 -1
- package/dist/components/Payload/index.mjs +1 -1
- package/dist/components/Projects/EpicFilter.mjs +1 -1
- package/dist/components/Projects/EpicsView.mjs +1 -1
- package/dist/components/Projects/KanbanBoardView.mjs +1 -1
- package/dist/components/Projects/KanbanColumn.mjs +1 -1
- package/dist/components/Projects/ProjectPage.mjs +1 -1
- package/dist/components/Projects/ProjectView.mjs +1 -1
- package/dist/components/Projects/ProjectsIndexView.mjs +1 -1
- package/dist/components/Projects/TasksView.mjs +1 -1
- package/dist/components/Projects/index.mjs +1 -1
- package/dist/components/Projects/project-card.mjs +1 -1
- package/dist/components/Projects/project-form.mjs +1 -1
- package/dist/components/dc-temp/dashboard-integration-example.mjs +1 -1
- package/dist/components/dc-temp/index.mjs +1 -1
- package/dist/components/index.d.ts +10 -10
- package/dist/components/index.js +16 -16
- package/dist/components/index.mjs +1 -1
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/index.js +1 -1
- package/dist/components/ui/index.mjs +1 -1
- package/dist/components/ui/sidebar.mjs +1 -1
- package/dist/index.js +18 -18
- package/dist/index.mjs +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/pages/Blog.js +1 -1
- package/dist/pages/Blog.mjs +1 -1
- package/dist/pages/Documentation.mjs +1 -1
- package/dist/pages/IndexPage.mjs +1 -1
- package/dist/pages/Intranet.mjs +1 -1
- package/dist/pages/LandingPage.mjs +1 -1
- package/dist/pages/Page.mjs +1 -1
- package/dist/pages/Publish.mjs +1 -1
- package/dist/pages/Website.mjs +1 -1
- package/dist/sections/AboutSection.mjs +1 -1
- package/dist/sections/BlogDetail.mjs +1 -1
- package/dist/sections/BlogList.mjs +1 -1
- package/dist/sections/BlogListSection.mjs +1 -1
- package/dist/sections/ContactSection.mjs +1 -1
- package/dist/sections/PageSections.mjs +1 -1
- package/dist/sections/PricingSection.mjs +1 -1
- package/dist/sections/ServiceDetail.mjs +1 -1
- package/dist/sections/ServiceDetailSection.mjs +1 -1
- package/dist/sections/ServiceSection.mjs +1 -1
- package/dist/sections/form/index.mjs +1 -1
- package/dist/sections/index.js +2 -2
- package/dist/sections/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-2RGAV55J.mjs +0 -4
- package/dist/chunk-4RX6WI4T.mjs +0 -5
- package/dist/chunk-GTK2SGS5.mjs +0 -1
- package/dist/chunk-I3E2TYYZ.mjs +0 -1
- package/dist/components/Payload/Card/index.js +0 -4
- package/dist/components/Payload/Card/index.mjs +0 -2
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
var a=`# Document Edit Component
|
|
2
|
+
|
|
3
|
+
The \`DocumentEdit\` component provides a comprehensive editing interface for knowledge documents with enhanced metadata management and intelligent suggestions.
|
|
4
|
+
|
|
5
|
+
## Key Features
|
|
6
|
+
|
|
7
|
+
### \u{1F3F7}\uFE0F Smart Metadata Management
|
|
8
|
+
- **Editable Key-Value Pairs**: Add, edit, and remove metadata fields dynamically
|
|
9
|
+
- **Context-based Suggestions**: Field names suggested from knowledge contexts and existing documents
|
|
10
|
+
- **Value Autocomplete**: Common values suggested for known metadata fields
|
|
11
|
+
- **Visual Guidance**: Shows which fields are commonly used for organization
|
|
12
|
+
|
|
13
|
+
### \u{1F517} Knowledge Context Integration
|
|
14
|
+
- **Context-aware Fields**: Suggests metadata keys based on knowledge context grouping rules
|
|
15
|
+
- **Organizational Alignment**: Helps maintain consistency with existing document organization
|
|
16
|
+
- **Cross-document Learning**: Learns from existing documents to suggest appropriate values
|
|
17
|
+
|
|
18
|
+
### \u{1F4DD} Enhanced Editing Experience
|
|
19
|
+
- **Streamlined Interface**: Clean, intuitive design focused on content creation
|
|
20
|
+
- **Rich Metadata**: Support for flexible metadata schemas
|
|
21
|
+
- **Format Support**: Works with markdown, MDX, rich text, and plain text formats
|
|
22
|
+
- **Real-time Validation**: Immediate feedback on changes
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
### Basic Usage
|
|
27
|
+
|
|
28
|
+
\`\`\`tsx
|
|
29
|
+
import { DocumentEdit } from './document-edit'
|
|
30
|
+
|
|
31
|
+
const document = {
|
|
32
|
+
id: '1',
|
|
33
|
+
title: 'My Document',
|
|
34
|
+
description: 'Document description',
|
|
35
|
+
format: 'markdown',
|
|
36
|
+
metadata: { category: 'Development' },
|
|
37
|
+
content: '# Hello World',
|
|
38
|
+
createdAt: new Date()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
<DocumentEdit
|
|
42
|
+
document={document}
|
|
43
|
+
onSave={(updatedDocument) => console.log('Saved:', updatedDocument)}
|
|
44
|
+
onCancel={() => console.log('Cancelled')}
|
|
45
|
+
/>
|
|
46
|
+
\`\`\`
|
|
47
|
+
|
|
48
|
+
### With Knowledge Context Support
|
|
49
|
+
|
|
50
|
+
\`\`\`tsx
|
|
51
|
+
import { DocumentEdit } from './document-edit'
|
|
52
|
+
|
|
53
|
+
const knowledgeContexts = [
|
|
54
|
+
{
|
|
55
|
+
id: 'development',
|
|
56
|
+
label: 'Development Docs',
|
|
57
|
+
menuConfig: {
|
|
58
|
+
groupBy: ['category', 'team', 'difficulty'],
|
|
59
|
+
sortBy: 'updatedAt'
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
const availableDocuments = [
|
|
65
|
+
// ... existing documents for learning metadata patterns
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
<DocumentEdit
|
|
69
|
+
document={document}
|
|
70
|
+
onSave={handleSave}
|
|
71
|
+
onCancel={handleCancel}
|
|
72
|
+
availableDocuments={availableDocuments}
|
|
73
|
+
knowledgeContexts={knowledgeContexts}
|
|
74
|
+
/>
|
|
75
|
+
\`\`\`
|
|
76
|
+
|
|
77
|
+
## Props
|
|
78
|
+
|
|
79
|
+
### DocumentEditProps
|
|
80
|
+
|
|
81
|
+
| Prop | Type | Default | Description |
|
|
82
|
+
|------|------|---------|-------------|
|
|
83
|
+
| \`document\` | \`KnowledgeDocument\` | - | The document to edit |
|
|
84
|
+
| \`onSave\` | \`(document: KnowledgeDocument) => void\` | - | Callback when document is saved |
|
|
85
|
+
| \`onCancel\` | \`() => void\` | - | Callback when editing is cancelled |
|
|
86
|
+
| \`availableDocuments\` | \`KnowledgeDocument[]\` | \`[]\` | Existing documents for metadata suggestions |
|
|
87
|
+
| \`knowledgeContexts\` | \`KnowledgeContext[]\` | \`[]\` | Knowledge contexts for field suggestions |
|
|
88
|
+
|
|
89
|
+
## Metadata Features
|
|
90
|
+
|
|
91
|
+
### Suggested Fields
|
|
92
|
+
|
|
93
|
+
The component automatically suggests metadata field names based on:
|
|
94
|
+
|
|
95
|
+
1. **Knowledge Context Grouping**: Fields used in \`menuConfig.groupBy\` arrays
|
|
96
|
+
2. **Existing Documents**: Fields found in \`metadata\` of available documents
|
|
97
|
+
3. **Common Patterns**: Frequently used organizational fields
|
|
98
|
+
|
|
99
|
+
Common suggested fields include:
|
|
100
|
+
- \`category\` - Document category (Development, Design, Management, etc.)
|
|
101
|
+
- \`type\` - Document type (Guide, Reference, Tutorial, etc.)
|
|
102
|
+
- \`team\` - Responsible team (Frontend, Backend, DevOps, etc.)
|
|
103
|
+
- \`difficulty\` - Complexity level (Beginner, Intermediate, Advanced)
|
|
104
|
+
- \`project\` - Associated project name
|
|
105
|
+
- \`priority\` - Priority level (High, Medium, Low)
|
|
106
|
+
|
|
107
|
+
### Value Suggestions
|
|
108
|
+
|
|
109
|
+
When editing metadata values:
|
|
110
|
+
- **Dropdown Selection**: Shows common values for known fields
|
|
111
|
+
- **Custom Input**: Option to enter custom values
|
|
112
|
+
- **Learning System**: Builds suggestions from existing document metadata
|
|
113
|
+
|
|
114
|
+
### Visual Feedback
|
|
115
|
+
|
|
116
|
+
- **Context Hints**: Shows which fields come from knowledge contexts
|
|
117
|
+
- **Value Previews**: Displays common values for each field
|
|
118
|
+
- **Empty State**: Helpful guidance when no metadata exists yet
|
|
119
|
+
|
|
120
|
+
## Integration Examples
|
|
121
|
+
|
|
122
|
+
### With Document Browser
|
|
123
|
+
|
|
124
|
+
\`\`\`tsx
|
|
125
|
+
function KnowledgeManager() {
|
|
126
|
+
const [selectedDocument, setSelectedDocument] = useState(null)
|
|
127
|
+
const [isEditing, setIsEditing] = useState(false)
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<div className="flex h-screen">
|
|
131
|
+
<KnowledgeBrowser
|
|
132
|
+
documents={documents}
|
|
133
|
+
contexts={knowledgeContexts}
|
|
134
|
+
onDocumentClick={setSelectedDocument}
|
|
135
|
+
/>
|
|
136
|
+
|
|
137
|
+
{isEditing ? (
|
|
138
|
+
<DocumentEdit
|
|
139
|
+
document={selectedDocument}
|
|
140
|
+
availableDocuments={documents}
|
|
141
|
+
knowledgeContexts={knowledgeContexts}
|
|
142
|
+
onSave={(doc) => {
|
|
143
|
+
updateDocument(doc)
|
|
144
|
+
setIsEditing(false)
|
|
145
|
+
}}
|
|
146
|
+
onCancel={() => setIsEditing(false)}
|
|
147
|
+
/>
|
|
148
|
+
) : (
|
|
149
|
+
<DocumentPreview
|
|
150
|
+
document={selectedDocument}
|
|
151
|
+
onEdit={() => setIsEditing(true)}
|
|
152
|
+
/>
|
|
153
|
+
)}
|
|
154
|
+
</div>
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
\`\`\`
|
|
158
|
+
|
|
159
|
+
### Custom Metadata Schema
|
|
160
|
+
|
|
161
|
+
\`\`\`tsx
|
|
162
|
+
// Define your organization's metadata schema
|
|
163
|
+
const metadataSchema = {
|
|
164
|
+
category: ['Development', 'Design', 'Management', 'Operations'],
|
|
165
|
+
priority: ['Critical', 'High', 'Medium', 'Low'],
|
|
166
|
+
team: ['Frontend', 'Backend', 'DevOps', 'Design', 'Product'],
|
|
167
|
+
status: ['Draft', 'Review', 'Approved', 'Published', 'Archived']
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Use with pre-populated documents that follow your schema
|
|
171
|
+
const documentsWithSchema = documents.map(doc => ({
|
|
172
|
+
...doc,
|
|
173
|
+
metadata: {
|
|
174
|
+
...doc.metadata,
|
|
175
|
+
category: doc.metadata?.category || 'Development',
|
|
176
|
+
priority: doc.metadata?.priority || 'Medium'
|
|
177
|
+
}
|
|
178
|
+
}))
|
|
179
|
+
\`\`\`
|
|
180
|
+
|
|
181
|
+
## Best Practices
|
|
182
|
+
|
|
183
|
+
### Metadata Consistency
|
|
184
|
+
1. **Define Schema Early**: Establish common metadata fields for your organization
|
|
185
|
+
2. **Use Knowledge Contexts**: Align metadata with how documents are organized
|
|
186
|
+
3. **Provide Examples**: Include sample documents with good metadata
|
|
187
|
+
4. **Regular Review**: Periodically review and standardize metadata usage
|
|
188
|
+
|
|
189
|
+
### User Experience
|
|
190
|
+
1. **Progressive Enhancement**: Start with basic fields, add more as needed
|
|
191
|
+
2. **Clear Labels**: Use descriptive field names that users understand
|
|
192
|
+
3. **Helpful Defaults**: Pre-populate common fields when possible
|
|
193
|
+
4. **Validation**: Provide feedback for required or invalid fields
|
|
194
|
+
|
|
195
|
+
### Performance
|
|
196
|
+
1. **Lazy Loading**: Load available documents only when needed
|
|
197
|
+
2. **Debounced Suggestions**: Avoid excessive API calls for suggestions
|
|
198
|
+
3. **Efficient Filtering**: Optimize metadata value lookups
|
|
199
|
+
4. **Caching**: Cache frequently used metadata patterns
|
|
200
|
+
|
|
201
|
+
## Migration from Tags
|
|
202
|
+
|
|
203
|
+
If migrating from a tag-based system:
|
|
204
|
+
|
|
205
|
+
\`\`\`tsx
|
|
206
|
+
// Convert tags to metadata
|
|
207
|
+
function convertTagsToMetadata(document) {
|
|
208
|
+
const metadata = { ...document.metadata }
|
|
209
|
+
|
|
210
|
+
if (document.tags) {
|
|
211
|
+
// Convert common tag patterns to structured metadata
|
|
212
|
+
document.tags.forEach(tag => {
|
|
213
|
+
if (['beginner', 'intermediate', 'advanced'].includes(tag)) {
|
|
214
|
+
metadata.difficulty = tag
|
|
215
|
+
} else if (['frontend', 'backend', 'devops'].includes(tag)) {
|
|
216
|
+
metadata.team = tag
|
|
217
|
+
} else if (['guide', 'reference', 'tutorial'].includes(tag)) {
|
|
218
|
+
metadata.type = tag
|
|
219
|
+
}
|
|
220
|
+
// Add remaining tags as topics or keywords array
|
|
221
|
+
else {
|
|
222
|
+
metadata.topics = metadata.topics || []
|
|
223
|
+
metadata.topics.push(tag)
|
|
224
|
+
}
|
|
225
|
+
})
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return { ...document, metadata }
|
|
229
|
+
}
|
|
230
|
+
\`\`\`
|
|
231
|
+
|
|
232
|
+
## Related Components
|
|
233
|
+
|
|
234
|
+
- **DocumentPreview**: For viewing documents with metadata display
|
|
235
|
+
- **KnowledgeBrowser**: For browsing documents organized by metadata
|
|
236
|
+
- **KnowledgeSearch**: For searching documents by metadata fields
|
|
237
|
+
- **KnowledgeView**: For complete knowledge management interfaces
|
|
238
|
+
`;
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import"../../chunk-YEKQJ4YC.mjs";var a=`# Document Edit Component
|
|
2
|
+
|
|
3
|
+
The \`DocumentEdit\` component provides a comprehensive editing interface for knowledge documents with enhanced metadata management and intelligent suggestions.
|
|
4
|
+
|
|
5
|
+
## Key Features
|
|
6
|
+
|
|
7
|
+
### \u{1F3F7}\uFE0F Smart Metadata Management
|
|
8
|
+
- **Editable Key-Value Pairs**: Add, edit, and remove metadata fields dynamically
|
|
9
|
+
- **Context-based Suggestions**: Field names suggested from knowledge contexts and existing documents
|
|
10
|
+
- **Value Autocomplete**: Common values suggested for known metadata fields
|
|
11
|
+
- **Visual Guidance**: Shows which fields are commonly used for organization
|
|
12
|
+
|
|
13
|
+
### \u{1F517} Knowledge Context Integration
|
|
14
|
+
- **Context-aware Fields**: Suggests metadata keys based on knowledge context grouping rules
|
|
15
|
+
- **Organizational Alignment**: Helps maintain consistency with existing document organization
|
|
16
|
+
- **Cross-document Learning**: Learns from existing documents to suggest appropriate values
|
|
17
|
+
|
|
18
|
+
### \u{1F4DD} Enhanced Editing Experience
|
|
19
|
+
- **Streamlined Interface**: Clean, intuitive design focused on content creation
|
|
20
|
+
- **Rich Metadata**: Support for flexible metadata schemas
|
|
21
|
+
- **Format Support**: Works with markdown, MDX, rich text, and plain text formats
|
|
22
|
+
- **Real-time Validation**: Immediate feedback on changes
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
### Basic Usage
|
|
27
|
+
|
|
28
|
+
\`\`\`tsx
|
|
29
|
+
import { DocumentEdit } from './document-edit'
|
|
30
|
+
|
|
31
|
+
const document = {
|
|
32
|
+
id: '1',
|
|
33
|
+
title: 'My Document',
|
|
34
|
+
description: 'Document description',
|
|
35
|
+
format: 'markdown',
|
|
36
|
+
metadata: { category: 'Development' },
|
|
37
|
+
content: '# Hello World',
|
|
38
|
+
createdAt: new Date()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
<DocumentEdit
|
|
42
|
+
document={document}
|
|
43
|
+
onSave={(updatedDocument) => console.log('Saved:', updatedDocument)}
|
|
44
|
+
onCancel={() => console.log('Cancelled')}
|
|
45
|
+
/>
|
|
46
|
+
\`\`\`
|
|
47
|
+
|
|
48
|
+
### With Knowledge Context Support
|
|
49
|
+
|
|
50
|
+
\`\`\`tsx
|
|
51
|
+
import { DocumentEdit } from './document-edit'
|
|
52
|
+
|
|
53
|
+
const knowledgeContexts = [
|
|
54
|
+
{
|
|
55
|
+
id: 'development',
|
|
56
|
+
label: 'Development Docs',
|
|
57
|
+
menuConfig: {
|
|
58
|
+
groupBy: ['category', 'team', 'difficulty'],
|
|
59
|
+
sortBy: 'updatedAt'
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
const availableDocuments = [
|
|
65
|
+
// ... existing documents for learning metadata patterns
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
<DocumentEdit
|
|
69
|
+
document={document}
|
|
70
|
+
onSave={handleSave}
|
|
71
|
+
onCancel={handleCancel}
|
|
72
|
+
availableDocuments={availableDocuments}
|
|
73
|
+
knowledgeContexts={knowledgeContexts}
|
|
74
|
+
/>
|
|
75
|
+
\`\`\`
|
|
76
|
+
|
|
77
|
+
## Props
|
|
78
|
+
|
|
79
|
+
### DocumentEditProps
|
|
80
|
+
|
|
81
|
+
| Prop | Type | Default | Description |
|
|
82
|
+
|------|------|---------|-------------|
|
|
83
|
+
| \`document\` | \`KnowledgeDocument\` | - | The document to edit |
|
|
84
|
+
| \`onSave\` | \`(document: KnowledgeDocument) => void\` | - | Callback when document is saved |
|
|
85
|
+
| \`onCancel\` | \`() => void\` | - | Callback when editing is cancelled |
|
|
86
|
+
| \`availableDocuments\` | \`KnowledgeDocument[]\` | \`[]\` | Existing documents for metadata suggestions |
|
|
87
|
+
| \`knowledgeContexts\` | \`KnowledgeContext[]\` | \`[]\` | Knowledge contexts for field suggestions |
|
|
88
|
+
|
|
89
|
+
## Metadata Features
|
|
90
|
+
|
|
91
|
+
### Suggested Fields
|
|
92
|
+
|
|
93
|
+
The component automatically suggests metadata field names based on:
|
|
94
|
+
|
|
95
|
+
1. **Knowledge Context Grouping**: Fields used in \`menuConfig.groupBy\` arrays
|
|
96
|
+
2. **Existing Documents**: Fields found in \`metadata\` of available documents
|
|
97
|
+
3. **Common Patterns**: Frequently used organizational fields
|
|
98
|
+
|
|
99
|
+
Common suggested fields include:
|
|
100
|
+
- \`category\` - Document category (Development, Design, Management, etc.)
|
|
101
|
+
- \`type\` - Document type (Guide, Reference, Tutorial, etc.)
|
|
102
|
+
- \`team\` - Responsible team (Frontend, Backend, DevOps, etc.)
|
|
103
|
+
- \`difficulty\` - Complexity level (Beginner, Intermediate, Advanced)
|
|
104
|
+
- \`project\` - Associated project name
|
|
105
|
+
- \`priority\` - Priority level (High, Medium, Low)
|
|
106
|
+
|
|
107
|
+
### Value Suggestions
|
|
108
|
+
|
|
109
|
+
When editing metadata values:
|
|
110
|
+
- **Dropdown Selection**: Shows common values for known fields
|
|
111
|
+
- **Custom Input**: Option to enter custom values
|
|
112
|
+
- **Learning System**: Builds suggestions from existing document metadata
|
|
113
|
+
|
|
114
|
+
### Visual Feedback
|
|
115
|
+
|
|
116
|
+
- **Context Hints**: Shows which fields come from knowledge contexts
|
|
117
|
+
- **Value Previews**: Displays common values for each field
|
|
118
|
+
- **Empty State**: Helpful guidance when no metadata exists yet
|
|
119
|
+
|
|
120
|
+
## Integration Examples
|
|
121
|
+
|
|
122
|
+
### With Document Browser
|
|
123
|
+
|
|
124
|
+
\`\`\`tsx
|
|
125
|
+
function KnowledgeManager() {
|
|
126
|
+
const [selectedDocument, setSelectedDocument] = useState(null)
|
|
127
|
+
const [isEditing, setIsEditing] = useState(false)
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<div className="flex h-screen">
|
|
131
|
+
<KnowledgeBrowser
|
|
132
|
+
documents={documents}
|
|
133
|
+
contexts={knowledgeContexts}
|
|
134
|
+
onDocumentClick={setSelectedDocument}
|
|
135
|
+
/>
|
|
136
|
+
|
|
137
|
+
{isEditing ? (
|
|
138
|
+
<DocumentEdit
|
|
139
|
+
document={selectedDocument}
|
|
140
|
+
availableDocuments={documents}
|
|
141
|
+
knowledgeContexts={knowledgeContexts}
|
|
142
|
+
onSave={(doc) => {
|
|
143
|
+
updateDocument(doc)
|
|
144
|
+
setIsEditing(false)
|
|
145
|
+
}}
|
|
146
|
+
onCancel={() => setIsEditing(false)}
|
|
147
|
+
/>
|
|
148
|
+
) : (
|
|
149
|
+
<DocumentPreview
|
|
150
|
+
document={selectedDocument}
|
|
151
|
+
onEdit={() => setIsEditing(true)}
|
|
152
|
+
/>
|
|
153
|
+
)}
|
|
154
|
+
</div>
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
\`\`\`
|
|
158
|
+
|
|
159
|
+
### Custom Metadata Schema
|
|
160
|
+
|
|
161
|
+
\`\`\`tsx
|
|
162
|
+
// Define your organization's metadata schema
|
|
163
|
+
const metadataSchema = {
|
|
164
|
+
category: ['Development', 'Design', 'Management', 'Operations'],
|
|
165
|
+
priority: ['Critical', 'High', 'Medium', 'Low'],
|
|
166
|
+
team: ['Frontend', 'Backend', 'DevOps', 'Design', 'Product'],
|
|
167
|
+
status: ['Draft', 'Review', 'Approved', 'Published', 'Archived']
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Use with pre-populated documents that follow your schema
|
|
171
|
+
const documentsWithSchema = documents.map(doc => ({
|
|
172
|
+
...doc,
|
|
173
|
+
metadata: {
|
|
174
|
+
...doc.metadata,
|
|
175
|
+
category: doc.metadata?.category || 'Development',
|
|
176
|
+
priority: doc.metadata?.priority || 'Medium'
|
|
177
|
+
}
|
|
178
|
+
}))
|
|
179
|
+
\`\`\`
|
|
180
|
+
|
|
181
|
+
## Best Practices
|
|
182
|
+
|
|
183
|
+
### Metadata Consistency
|
|
184
|
+
1. **Define Schema Early**: Establish common metadata fields for your organization
|
|
185
|
+
2. **Use Knowledge Contexts**: Align metadata with how documents are organized
|
|
186
|
+
3. **Provide Examples**: Include sample documents with good metadata
|
|
187
|
+
4. **Regular Review**: Periodically review and standardize metadata usage
|
|
188
|
+
|
|
189
|
+
### User Experience
|
|
190
|
+
1. **Progressive Enhancement**: Start with basic fields, add more as needed
|
|
191
|
+
2. **Clear Labels**: Use descriptive field names that users understand
|
|
192
|
+
3. **Helpful Defaults**: Pre-populate common fields when possible
|
|
193
|
+
4. **Validation**: Provide feedback for required or invalid fields
|
|
194
|
+
|
|
195
|
+
### Performance
|
|
196
|
+
1. **Lazy Loading**: Load available documents only when needed
|
|
197
|
+
2. **Debounced Suggestions**: Avoid excessive API calls for suggestions
|
|
198
|
+
3. **Efficient Filtering**: Optimize metadata value lookups
|
|
199
|
+
4. **Caching**: Cache frequently used metadata patterns
|
|
200
|
+
|
|
201
|
+
## Migration from Tags
|
|
202
|
+
|
|
203
|
+
If migrating from a tag-based system:
|
|
204
|
+
|
|
205
|
+
\`\`\`tsx
|
|
206
|
+
// Convert tags to metadata
|
|
207
|
+
function convertTagsToMetadata(document) {
|
|
208
|
+
const metadata = { ...document.metadata }
|
|
209
|
+
|
|
210
|
+
if (document.tags) {
|
|
211
|
+
// Convert common tag patterns to structured metadata
|
|
212
|
+
document.tags.forEach(tag => {
|
|
213
|
+
if (['beginner', 'intermediate', 'advanced'].includes(tag)) {
|
|
214
|
+
metadata.difficulty = tag
|
|
215
|
+
} else if (['frontend', 'backend', 'devops'].includes(tag)) {
|
|
216
|
+
metadata.team = tag
|
|
217
|
+
} else if (['guide', 'reference', 'tutorial'].includes(tag)) {
|
|
218
|
+
metadata.type = tag
|
|
219
|
+
}
|
|
220
|
+
// Add remaining tags as topics or keywords array
|
|
221
|
+
else {
|
|
222
|
+
metadata.topics = metadata.topics || []
|
|
223
|
+
metadata.topics.push(tag)
|
|
224
|
+
}
|
|
225
|
+
})
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return { ...document, metadata }
|
|
229
|
+
}
|
|
230
|
+
\`\`\`
|
|
231
|
+
|
|
232
|
+
## Related Components
|
|
233
|
+
|
|
234
|
+
- **DocumentPreview**: For viewing documents with metadata display
|
|
235
|
+
- **KnowledgeBrowser**: For browsing documents organized by metadata
|
|
236
|
+
- **KnowledgeSearch**: For searching documents by metadata fields
|
|
237
|
+
- **KnowledgeView**: For complete knowledge management interfaces
|
|
238
|
+
`;export{a as default};
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
var r=`# Document Preview Component
|
|
2
|
+
|
|
3
|
+
The \`DocumentPreview\` component displays knowledge documents with support for multiple file formats and custom renderers.
|
|
4
|
+
|
|
5
|
+
## Supported Formats
|
|
6
|
+
|
|
7
|
+
- **Markdown** (\`.md\`) - Standard markdown with basic formatting
|
|
8
|
+
- **MDX** (\`.mdx\`) - Markdown with embedded React components
|
|
9
|
+
- **RichText** - PayloadCMS rich text content
|
|
10
|
+
- **Text** (\`.txt\`) - Plain text with preserved formatting
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
### Basic Usage
|
|
15
|
+
|
|
16
|
+
\`\`\`tsx
|
|
17
|
+
import { DocumentPreview } from './document-preview'
|
|
18
|
+
|
|
19
|
+
const document = {
|
|
20
|
+
id: '1',
|
|
21
|
+
title: 'My Document',
|
|
22
|
+
format: 'markdown',
|
|
23
|
+
content: '# Hello World\\n\\nThis is **bold** text.',
|
|
24
|
+
createdAt: new Date()
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
<DocumentPreview document={document} />
|
|
28
|
+
\`\`\`
|
|
29
|
+
|
|
30
|
+
### With Custom Renderers
|
|
31
|
+
|
|
32
|
+
\`\`\`tsx
|
|
33
|
+
import { DocumentPreview } from './document-preview'
|
|
34
|
+
import ReactMarkdown from 'react-markdown'
|
|
35
|
+
import { RichText } from '@payloadcms/richtext-lexical/react'
|
|
36
|
+
|
|
37
|
+
const customRenderers = {
|
|
38
|
+
markdown: (content: string) => (
|
|
39
|
+
<div className="prose prose-slate dark:prose-invert max-w-none">
|
|
40
|
+
<ReactMarkdown>{content}</ReactMarkdown>
|
|
41
|
+
</div>
|
|
42
|
+
),
|
|
43
|
+
|
|
44
|
+
richtext: (content: string) => {
|
|
45
|
+
const richTextData = JSON.parse(content)
|
|
46
|
+
return (
|
|
47
|
+
<div className="prose prose-slate dark:prose-invert max-w-none">
|
|
48
|
+
<RichText data={richTextData} />
|
|
49
|
+
</div>
|
|
50
|
+
)
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
text: (content: string) => (
|
|
54
|
+
<pre className="whitespace-pre-wrap font-mono text-sm">
|
|
55
|
+
{content}
|
|
56
|
+
</pre>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
<DocumentPreview
|
|
61
|
+
document={document}
|
|
62
|
+
renderers={customRenderers}
|
|
63
|
+
editable={true}
|
|
64
|
+
onDocumentUpdate={(updatedDoc) => console.log('Updated:', updatedDoc)}
|
|
65
|
+
/>
|
|
66
|
+
\`\`\`
|
|
67
|
+
|
|
68
|
+
## Available Dependencies
|
|
69
|
+
|
|
70
|
+
The project already includes these useful dependencies for rendering:
|
|
71
|
+
|
|
72
|
+
- \`@mdx-js/react\` - For MDX rendering
|
|
73
|
+
- \`@payloadcms/richtext-lexical\` - For PayloadCMS RichText
|
|
74
|
+
- \`@tailwindcss/typography\` - For typography styling
|
|
75
|
+
|
|
76
|
+
## Custom Renderer Examples
|
|
77
|
+
|
|
78
|
+
### React Markdown
|
|
79
|
+
|
|
80
|
+
\`\`\`bash
|
|
81
|
+
npm install react-markdown remark-gfm rehype-highlight
|
|
82
|
+
\`\`\`
|
|
83
|
+
|
|
84
|
+
\`\`\`tsx
|
|
85
|
+
import ReactMarkdown from 'react-markdown'
|
|
86
|
+
import remarkGfm from 'remark-gfm'
|
|
87
|
+
import rehypeHighlight from 'rehype-highlight'
|
|
88
|
+
|
|
89
|
+
const markdownRenderer = (content: string) => (
|
|
90
|
+
<div className="prose prose-slate dark:prose-invert max-w-none">
|
|
91
|
+
<ReactMarkdown
|
|
92
|
+
remarkPlugins={[remarkGfm]}
|
|
93
|
+
rehypePlugins={[rehypeHighlight]}
|
|
94
|
+
>
|
|
95
|
+
{content}
|
|
96
|
+
</ReactMarkdown>
|
|
97
|
+
</div>
|
|
98
|
+
)
|
|
99
|
+
\`\`\`
|
|
100
|
+
|
|
101
|
+
### MDX with next-mdx-remote
|
|
102
|
+
|
|
103
|
+
\`\`\`bash
|
|
104
|
+
npm install next-mdx-remote
|
|
105
|
+
\`\`\`
|
|
106
|
+
|
|
107
|
+
\`\`\`tsx
|
|
108
|
+
import { MDXRemote } from 'next-mdx-remote'
|
|
109
|
+
import { serialize } from 'next-mdx-remote/serialize'
|
|
110
|
+
|
|
111
|
+
const mdxRenderer = async (content: string) => {
|
|
112
|
+
const mdxSource = await serialize(content)
|
|
113
|
+
return (
|
|
114
|
+
<div className="prose prose-slate dark:prose-invert max-w-none">
|
|
115
|
+
<MDXRemote {...mdxSource} />
|
|
116
|
+
</div>
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
\`\`\`
|
|
120
|
+
|
|
121
|
+
### PayloadCMS RichText
|
|
122
|
+
|
|
123
|
+
\`\`\`tsx
|
|
124
|
+
import { RichText } from '@payloadcms/richtext-lexical/react'
|
|
125
|
+
|
|
126
|
+
const richTextRenderer = (content: string) => {
|
|
127
|
+
try {
|
|
128
|
+
const richTextData = JSON.parse(content)
|
|
129
|
+
return (
|
|
130
|
+
<div className="prose prose-slate dark:prose-invert max-w-none">
|
|
131
|
+
<RichText data={richTextData} />
|
|
132
|
+
</div>
|
|
133
|
+
)
|
|
134
|
+
} catch (error) {
|
|
135
|
+
return (
|
|
136
|
+
<div className="text-red-500 text-sm">
|
|
137
|
+
Error parsing RichText content: {error.message}
|
|
138
|
+
</div>
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
\`\`\`
|
|
143
|
+
|
|
144
|
+
## Props
|
|
145
|
+
|
|
146
|
+
### DocumentPreview Props
|
|
147
|
+
|
|
148
|
+
| Prop | Type | Default | Description |
|
|
149
|
+
|------|------|---------|-------------|
|
|
150
|
+
| \`document\` | \`KnowledgeDocument\` | - | The document to display |
|
|
151
|
+
| \`editable\` | \`boolean\` | \`true\` | Whether the document can be edited |
|
|
152
|
+
| \`renderers\` | \`DocumentRenderers\` | - | Custom renderers for different formats |
|
|
153
|
+
| \`onDocumentUpdate\` | \`(doc: KnowledgeDocument) => void\` | - | Callback when document is updated |
|
|
154
|
+
|
|
155
|
+
### DocumentRenderers Type
|
|
156
|
+
|
|
157
|
+
\`\`\`tsx
|
|
158
|
+
interface DocumentRenderers {
|
|
159
|
+
markdown?: (content: string) => ReactNode
|
|
160
|
+
mdx?: (content: string) => ReactNode
|
|
161
|
+
richtext?: (content: string) => ReactNode
|
|
162
|
+
text?: (content: string) => ReactNode
|
|
163
|
+
}
|
|
164
|
+
\`\`\`
|
|
165
|
+
|
|
166
|
+
### KnowledgeDocument Type
|
|
167
|
+
|
|
168
|
+
\`\`\`tsx
|
|
169
|
+
interface KnowledgeDocument {
|
|
170
|
+
id: string
|
|
171
|
+
title: string
|
|
172
|
+
description?: string
|
|
173
|
+
metadata?: Record<string, any>
|
|
174
|
+
content?: string
|
|
175
|
+
format: 'markdown' | 'mdx' | 'richtext' | 'text'
|
|
176
|
+
tags?: string[]
|
|
177
|
+
createdAt: Date
|
|
178
|
+
updatedAt?: Date
|
|
179
|
+
}
|
|
180
|
+
\`\`\`
|
|
181
|
+
|
|
182
|
+
## Default Renderers
|
|
183
|
+
|
|
184
|
+
If no custom renderers are provided, the component uses built-in default renderers:
|
|
185
|
+
|
|
186
|
+
- **Markdown**: Basic HTML conversion with support for headings, bold, italic, and code
|
|
187
|
+
- **Text**: Monospace font with preserved whitespace
|
|
188
|
+
- **RichText**: Placeholder with raw content display
|
|
189
|
+
- **MDX**: Placeholder with basic markdown rendering
|
|
190
|
+
|
|
191
|
+
## Styling
|
|
192
|
+
|
|
193
|
+
The component uses Tailwind CSS classes and supports dark mode through CSS variables. Key styling features:
|
|
194
|
+
|
|
195
|
+
- Responsive design
|
|
196
|
+
- Typography classes from \`@tailwindcms/typography\`
|
|
197
|
+
- Dark mode support
|
|
198
|
+
- Smooth animations with Framer Motion
|
|
199
|
+
- Consistent spacing and borders
|
|
200
|
+
|
|
201
|
+
## Examples
|
|
202
|
+
|
|
203
|
+
Check out the Storybook stories for interactive examples:
|
|
204
|
+
|
|
205
|
+
- \`MarkdownWithCustomRenderer\` - Markdown with enhanced rendering
|
|
206
|
+
- \`TextFormat\` - Plain text documents
|
|
207
|
+
- \`RichTextFormat\` - PayloadCMS rich content
|
|
208
|
+
- \`MDXFormat\` - MDX with React components
|
|
209
|
+
- \`AllFormatsComparison\` - Side-by-side format comparison
|
|
210
|
+
`;
|