@jhits/plugin-blog 0.0.8 → 0.0.9
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/api/categories.d.ts +8 -0
- package/dist/api/categories.d.ts.map +1 -0
- package/dist/api/categories.js +30 -0
- package/dist/api/check-title.d.ts +8 -0
- package/dist/api/check-title.d.ts.map +1 -0
- package/dist/api/check-title.js +47 -0
- package/dist/api/config-handler.d.ts +21 -0
- package/dist/api/config-handler.d.ts.map +1 -0
- package/dist/api/config-handler.js +46 -0
- package/dist/api/handler.d.ts +42 -0
- package/dist/api/handler.d.ts.map +1 -0
- package/dist/api/handler.js +331 -0
- package/dist/api/index.d.ts +12 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +12 -0
- package/dist/api/route.d.ts +50 -0
- package/dist/api/route.d.ts.map +1 -0
- package/dist/api/route.js +69 -0
- package/dist/api/router.d.ts +27 -0
- package/dist/api/router.d.ts.map +1 -0
- package/dist/api/router.js +98 -0
- package/dist/api-server.d.ts +9 -0
- package/dist/api-server.d.ts.map +1 -0
- package/dist/api-server.js +9 -0
- package/dist/config.d.ts +14 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +156 -0
- package/dist/hooks/index.d.ts +8 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +7 -0
- package/dist/hooks/useBlog.d.ts +31 -0
- package/dist/hooks/useBlog.d.ts.map +1 -0
- package/dist/hooks/useBlog.js +57 -0
- package/dist/hooks/useBlogs.d.ts +39 -0
- package/dist/hooks/useBlogs.d.ts.map +1 -0
- package/dist/hooks/useBlogs.js +82 -0
- package/dist/hooks/useCategories.d.ts +9 -0
- package/dist/hooks/useCategories.d.ts.map +1 -0
- package/dist/hooks/useCategories.js +70 -0
- package/dist/index.d.ts +55 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +228 -0
- package/dist/index.server.d.ts +12 -0
- package/dist/index.server.d.ts.map +1 -0
- package/dist/index.server.js +10 -0
- package/dist/init.d.ts +40 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +41 -0
- package/dist/lib/blocks/BlockRenderer.d.ts +54 -0
- package/dist/lib/blocks/BlockRenderer.d.ts.map +1 -0
- package/dist/lib/blocks/BlockRenderer.js +54 -0
- package/dist/lib/blocks/index.d.ts +5 -0
- package/dist/lib/blocks/index.d.ts.map +1 -0
- package/dist/lib/blocks/index.js +4 -0
- package/dist/lib/config-storage.d.ts +30 -0
- package/dist/lib/config-storage.d.ts.map +1 -0
- package/dist/lib/config-storage.js +31 -0
- package/dist/lib/index.d.ts +8 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +7 -0
- package/dist/lib/layouts/blocks/ColumnsBlock.d.ts +25 -0
- package/dist/lib/layouts/blocks/ColumnsBlock.d.ts.map +1 -0
- package/dist/lib/layouts/blocks/ColumnsBlock.js +186 -0
- package/dist/lib/layouts/blocks/SectionBlock.d.ts +25 -0
- package/dist/lib/layouts/blocks/SectionBlock.d.ts.map +1 -0
- package/dist/lib/layouts/blocks/SectionBlock.js +44 -0
- package/dist/lib/layouts/blocks/index.d.ts +7 -0
- package/dist/lib/layouts/blocks/index.d.ts.map +1 -0
- package/dist/lib/layouts/blocks/index.js +6 -0
- package/dist/lib/layouts/index.d.ts +23 -0
- package/dist/lib/layouts/index.d.ts.map +1 -0
- package/dist/lib/layouts/index.js +45 -0
- package/dist/lib/layouts/registerLayoutBlocks.d.ts +9 -0
- package/dist/lib/layouts/registerLayoutBlocks.d.ts.map +1 -0
- package/dist/lib/layouts/registerLayoutBlocks.js +60 -0
- package/dist/lib/mappers/apiMapper.d.ts +66 -0
- package/dist/lib/mappers/apiMapper.d.ts.map +1 -0
- package/dist/lib/mappers/apiMapper.js +188 -0
- package/dist/lib/migration/index.d.ts +5 -0
- package/dist/lib/migration/index.d.ts.map +1 -0
- package/dist/lib/migration/index.js +4 -0
- package/dist/lib/migration/mapper.d.ts +37 -0
- package/dist/lib/migration/mapper.d.ts.map +1 -0
- package/dist/lib/migration/mapper.js +98 -0
- package/dist/lib/rich-text/RichTextEditor.d.ts +45 -0
- package/dist/lib/rich-text/RichTextEditor.d.ts.map +1 -0
- package/dist/lib/rich-text/RichTextEditor.js +556 -0
- package/dist/lib/rich-text/RichTextPreview.d.ts +16 -0
- package/dist/lib/rich-text/RichTextPreview.d.ts.map +1 -0
- package/dist/lib/rich-text/RichTextPreview.js +144 -0
- package/dist/lib/rich-text/index.d.ts +9 -0
- package/dist/lib/rich-text/index.d.ts.map +1 -0
- package/dist/lib/rich-text/index.js +6 -0
- package/dist/lib/utils/blockHelpers.d.ts +23 -0
- package/dist/lib/utils/blockHelpers.d.ts.map +1 -0
- package/dist/lib/utils/blockHelpers.js +65 -0
- package/dist/lib/utils/configValidation.d.ts +23 -0
- package/dist/lib/utils/configValidation.d.ts.map +1 -0
- package/dist/lib/utils/configValidation.js +111 -0
- package/dist/lib/utils/index.d.ts +7 -0
- package/dist/lib/utils/index.d.ts.map +1 -0
- package/dist/lib/utils/index.js +6 -0
- package/dist/lib/utils/slugify.d.ts +25 -0
- package/dist/lib/utils/slugify.d.ts.map +1 -0
- package/dist/lib/utils/slugify.js +65 -0
- package/dist/registry/BlockRegistry.d.ts +62 -0
- package/dist/registry/BlockRegistry.d.ts.map +1 -0
- package/dist/registry/BlockRegistry.js +112 -0
- package/dist/registry/index.d.ts +6 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +4 -0
- package/dist/state/EditorContext.d.ts +45 -0
- package/dist/state/EditorContext.d.ts.map +1 -0
- package/dist/state/EditorContext.js +215 -0
- package/dist/state/index.d.ts +7 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +6 -0
- package/dist/state/reducer.d.ts +11 -0
- package/dist/state/reducer.d.ts.map +1 -0
- package/dist/state/reducer.js +599 -0
- package/dist/state/types.d.ts +162 -0
- package/dist/state/types.d.ts.map +1 -0
- package/dist/state/types.js +27 -0
- package/dist/types/block.d.ts +221 -0
- package/dist/types/block.d.ts.map +1 -0
- package/dist/types/block.js +6 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/post.d.ts +136 -0
- package/dist/types/post.d.ts.map +1 -0
- package/dist/types/post.js +5 -0
- package/dist/utils/client.d.ts +48 -0
- package/dist/utils/client.d.ts.map +1 -0
- package/dist/utils/client.js +77 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +5 -0
- package/dist/views/CanvasEditor/BlockWrapper.d.ts +16 -0
- package/dist/views/CanvasEditor/BlockWrapper.d.ts.map +1 -0
- package/dist/views/CanvasEditor/BlockWrapper.js +285 -0
- package/dist/views/CanvasEditor/CanvasEditorView.d.ts +14 -0
- package/dist/views/CanvasEditor/CanvasEditorView.d.ts.map +1 -0
- package/dist/views/CanvasEditor/CanvasEditorView.js +215 -0
- package/dist/views/CanvasEditor/EditorBody.d.ts +22 -0
- package/dist/views/CanvasEditor/EditorBody.d.ts.map +1 -0
- package/dist/views/CanvasEditor/EditorBody.js +505 -0
- package/dist/views/CanvasEditor/EditorHeader.d.ts +18 -0
- package/dist/views/CanvasEditor/EditorHeader.d.ts.map +1 -0
- package/dist/views/CanvasEditor/EditorHeader.js +101 -0
- package/dist/views/CanvasEditor/LayoutContainer.d.ts +17 -0
- package/dist/views/CanvasEditor/LayoutContainer.d.ts.map +1 -0
- package/dist/views/CanvasEditor/LayoutContainer.js +222 -0
- package/dist/views/CanvasEditor/SaveConfirmationModal.d.ts +13 -0
- package/dist/views/CanvasEditor/SaveConfirmationModal.d.ts.map +1 -0
- package/dist/views/CanvasEditor/SaveConfirmationModal.js +78 -0
- package/dist/views/CanvasEditor/components/CustomBlockItem.d.ts +14 -0
- package/dist/views/CanvasEditor/components/CustomBlockItem.d.ts.map +1 -0
- package/dist/views/CanvasEditor/components/CustomBlockItem.js +44 -0
- package/dist/views/CanvasEditor/components/EditorCanvas.d.ts +29 -0
- package/dist/views/CanvasEditor/components/EditorCanvas.d.ts.map +1 -0
- package/dist/views/CanvasEditor/components/EditorCanvas.js +32 -0
- package/dist/views/CanvasEditor/components/EditorLibrary.d.ts +7 -0
- package/dist/views/CanvasEditor/components/EditorLibrary.d.ts.map +1 -0
- package/dist/views/CanvasEditor/components/EditorLibrary.js +25 -0
- package/dist/views/CanvasEditor/components/EditorSidebar.d.ts +13 -0
- package/dist/views/CanvasEditor/components/EditorSidebar.d.ts.map +1 -0
- package/dist/views/CanvasEditor/components/EditorSidebar.js +19 -0
- package/dist/views/CanvasEditor/components/ErrorBanner.d.ts +6 -0
- package/dist/views/CanvasEditor/components/ErrorBanner.d.ts.map +1 -0
- package/dist/views/CanvasEditor/components/ErrorBanner.js +8 -0
- package/dist/views/CanvasEditor/components/FeaturedMediaSection.d.ts +25 -0
- package/dist/views/CanvasEditor/components/FeaturedMediaSection.d.ts.map +1 -0
- package/dist/views/CanvasEditor/components/FeaturedMediaSection.js +199 -0
- package/dist/views/CanvasEditor/components/LibraryItem.d.ts +14 -0
- package/dist/views/CanvasEditor/components/LibraryItem.d.ts.map +1 -0
- package/dist/views/CanvasEditor/components/LibraryItem.js +43 -0
- package/dist/views/CanvasEditor/components/PrivacySettingsSection.d.ts +15 -0
- package/dist/views/CanvasEditor/components/PrivacySettingsSection.d.ts.map +1 -0
- package/dist/views/CanvasEditor/components/PrivacySettingsSection.js +70 -0
- package/dist/views/CanvasEditor/components/index.d.ts +21 -0
- package/dist/views/CanvasEditor/components/index.d.ts.map +1 -0
- package/dist/views/CanvasEditor/components/index.js +12 -0
- package/dist/views/CanvasEditor/hooks/index.d.ts +10 -0
- package/dist/views/CanvasEditor/hooks/index.d.ts.map +1 -0
- package/dist/views/CanvasEditor/hooks/index.js +9 -0
- package/dist/views/CanvasEditor/hooks/useHeroBlock.d.ts +8 -0
- package/dist/views/CanvasEditor/hooks/useHeroBlock.d.ts.map +1 -0
- package/dist/views/CanvasEditor/hooks/useHeroBlock.js +90 -0
- package/dist/views/CanvasEditor/hooks/useKeyboardShortcuts.d.ts +3 -0
- package/dist/views/CanvasEditor/hooks/useKeyboardShortcuts.d.ts.map +1 -0
- package/dist/views/CanvasEditor/hooks/useKeyboardShortcuts.js +119 -0
- package/dist/views/CanvasEditor/hooks/usePostLoader.d.ts +5 -0
- package/dist/views/CanvasEditor/hooks/usePostLoader.d.ts.map +1 -0
- package/dist/views/CanvasEditor/hooks/usePostLoader.js +32 -0
- package/dist/views/CanvasEditor/hooks/useRegisteredBlocks.d.ts +2 -0
- package/dist/views/CanvasEditor/hooks/useRegisteredBlocks.d.ts.map +1 -0
- package/dist/views/CanvasEditor/hooks/useRegisteredBlocks.js +47 -0
- package/dist/views/CanvasEditor/hooks/useUnsavedChanges.d.ts +25 -0
- package/dist/views/CanvasEditor/hooks/useUnsavedChanges.d.ts.map +1 -0
- package/dist/views/CanvasEditor/hooks/useUnsavedChanges.js +285 -0
- package/dist/views/CanvasEditor/index.d.ts +16 -0
- package/dist/views/CanvasEditor/index.d.ts.map +1 -0
- package/dist/views/CanvasEditor/index.js +9 -0
- package/dist/views/PostManager/EmptyState.d.ts +10 -0
- package/dist/views/PostManager/EmptyState.d.ts.map +1 -0
- package/dist/views/PostManager/EmptyState.js +12 -0
- package/dist/views/PostManager/PostActionsMenu.d.ts +12 -0
- package/dist/views/PostManager/PostActionsMenu.d.ts.map +1 -0
- package/dist/views/PostManager/PostActionsMenu.js +58 -0
- package/dist/views/PostManager/PostCards.d.ts +15 -0
- package/dist/views/PostManager/PostCards.d.ts.map +1 -0
- package/dist/views/PostManager/PostCards.js +77 -0
- package/dist/views/PostManager/PostFilters.d.ts +16 -0
- package/dist/views/PostManager/PostFilters.d.ts.map +1 -0
- package/dist/views/PostManager/PostFilters.js +10 -0
- package/dist/views/PostManager/PostManagerView.d.ts +11 -0
- package/dist/views/PostManager/PostManagerView.d.ts.map +1 -0
- package/dist/views/PostManager/PostManagerView.js +179 -0
- package/dist/views/PostManager/PostStats.d.ts +11 -0
- package/dist/views/PostManager/PostStats.d.ts.map +1 -0
- package/dist/views/PostManager/PostStats.js +46 -0
- package/dist/views/PostManager/PostTable.d.ts +15 -0
- package/dist/views/PostManager/PostTable.d.ts.map +1 -0
- package/dist/views/PostManager/PostTable.js +77 -0
- package/dist/views/PostManager/index.d.ts +12 -0
- package/dist/views/PostManager/index.d.ts.map +1 -0
- package/dist/views/PostManager/index.js +11 -0
- package/dist/views/Preview/PreviewBridgeView.d.ts +12 -0
- package/dist/views/Preview/PreviewBridgeView.d.ts.map +1 -0
- package/dist/views/Preview/PreviewBridgeView.js +11 -0
- package/dist/views/Preview/index.d.ts +6 -0
- package/dist/views/Preview/index.d.ts.map +1 -0
- package/dist/views/Preview/index.js +4 -0
- package/dist/views/Settings/SettingsView.d.ts +10 -0
- package/dist/views/Settings/SettingsView.d.ts.map +1 -0
- package/dist/views/Settings/SettingsView.js +113 -0
- package/dist/views/Settings/index.d.ts +6 -0
- package/dist/views/Settings/index.d.ts.map +1 -0
- package/dist/views/Settings/index.js +4 -0
- package/dist/views/SlugSEO/SlugSEOManagerView.d.ts +12 -0
- package/dist/views/SlugSEO/SlugSEOManagerView.d.ts.map +1 -0
- package/dist/views/SlugSEO/SlugSEOManagerView.js +11 -0
- package/dist/views/SlugSEO/index.d.ts +6 -0
- package/dist/views/SlugSEO/index.d.ts.map +1 -0
- package/dist/views/SlugSEO/index.js +4 -0
- package/package.json +59 -59
- package/src/hooks/index.d.ts +8 -0
- package/src/hooks/index.d.ts.map +1 -0
- package/src/hooks/index.js +7 -0
- package/src/hooks/useBlog.d.ts +31 -0
- package/src/hooks/useBlog.d.ts.map +1 -0
- package/src/hooks/useBlog.js +57 -0
- package/src/hooks/useBlogs.d.ts +39 -0
- package/src/hooks/useBlogs.d.ts.map +1 -0
- package/src/hooks/useBlogs.js +82 -0
- package/src/hooks/useCategories.d.ts +9 -0
- package/src/hooks/useCategories.d.ts.map +1 -0
- package/src/hooks/useCategories.js +70 -0
- package/src/index.d.ts +55 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +228 -0
- package/src/init.d.ts +40 -0
- package/src/init.d.ts.map +1 -0
- package/src/init.js +41 -0
- package/src/lib/blocks/BlockRenderer.d.ts +54 -0
- package/src/lib/blocks/BlockRenderer.d.ts.map +1 -0
- package/src/lib/blocks/BlockRenderer.js +54 -0
- package/src/lib/config-storage.d.ts +30 -0
- package/src/lib/config-storage.d.ts.map +1 -0
- package/src/lib/config-storage.js +31 -0
- package/src/lib/layouts/blocks/ColumnsBlock.d.ts +25 -0
- package/src/lib/layouts/blocks/ColumnsBlock.d.ts.map +1 -0
- package/src/lib/layouts/blocks/ColumnsBlock.js +182 -0
- package/src/lib/layouts/blocks/SectionBlock.d.ts +25 -0
- package/src/lib/layouts/blocks/SectionBlock.d.ts.map +1 -0
- package/src/lib/layouts/blocks/SectionBlock.js +44 -0
- package/src/lib/layouts/index.d.ts +23 -0
- package/src/lib/layouts/index.d.ts.map +1 -0
- package/src/lib/layouts/index.js +45 -0
- package/src/lib/layouts/registerLayoutBlocks.d.ts +9 -0
- package/src/lib/layouts/registerLayoutBlocks.d.ts.map +1 -0
- package/src/lib/layouts/registerLayoutBlocks.js +60 -0
- package/src/lib/mappers/apiMapper.d.ts +66 -0
- package/src/lib/mappers/apiMapper.d.ts.map +1 -0
- package/src/lib/mappers/apiMapper.js +191 -0
- package/src/lib/rich-text/RichTextEditor.d.ts +45 -0
- package/src/lib/rich-text/RichTextEditor.d.ts.map +1 -0
- package/src/lib/rich-text/RichTextEditor.js +564 -0
- package/src/lib/rich-text/RichTextPreview.d.ts +16 -0
- package/src/lib/rich-text/RichTextPreview.d.ts.map +1 -0
- package/src/lib/rich-text/RichTextPreview.js +144 -0
- package/src/lib/rich-text/index.d.ts +9 -0
- package/src/lib/rich-text/index.d.ts.map +1 -0
- package/src/lib/rich-text/index.js +6 -0
- package/src/lib/utils/blockHelpers.d.ts +23 -0
- package/src/lib/utils/blockHelpers.d.ts.map +1 -0
- package/src/lib/utils/blockHelpers.js +65 -0
- package/src/lib/utils/configValidation.d.ts +23 -0
- package/src/lib/utils/configValidation.d.ts.map +1 -0
- package/src/lib/utils/configValidation.js +113 -0
- package/src/registry/BlockRegistry.d.ts +62 -0
- package/src/registry/BlockRegistry.d.ts.map +1 -0
- package/src/registry/BlockRegistry.js +112 -0
- package/src/registry/index.d.ts +6 -0
- package/src/registry/index.d.ts.map +1 -0
- package/src/registry/index.js +4 -0
- package/src/state/EditorContext.d.ts +45 -0
- package/src/state/EditorContext.d.ts.map +1 -0
- package/src/state/EditorContext.js +215 -0
- package/src/state/index.d.ts +7 -0
- package/src/state/index.d.ts.map +1 -0
- package/src/state/index.js +6 -0
- package/src/state/reducer.d.ts +11 -0
- package/src/state/reducer.d.ts.map +1 -0
- package/src/state/reducer.js +443 -0
- package/src/state/types.d.ts +162 -0
- package/src/state/types.d.ts.map +1 -0
- package/src/state/types.js +27 -0
- package/src/types/block.d.ts +221 -0
- package/src/types/block.d.ts.map +1 -0
- package/src/types/block.js +6 -0
- package/src/types/index.d.ts +8 -0
- package/src/types/index.d.ts.map +1 -0
- package/src/types/index.js +5 -0
- package/src/types/post.d.ts +136 -0
- package/src/types/post.d.ts.map +1 -0
- package/src/types/post.js +5 -0
- package/src/utils/client.d.ts +48 -0
- package/src/utils/client.d.ts.map +1 -0
- package/src/utils/client.js +77 -0
- package/src/views/CanvasEditor/BlockWrapper.d.ts +16 -0
- package/src/views/CanvasEditor/BlockWrapper.d.ts.map +1 -0
- package/src/views/CanvasEditor/BlockWrapper.js +276 -0
- package/src/views/CanvasEditor/CanvasEditorView.d.ts +14 -0
- package/src/views/CanvasEditor/CanvasEditorView.d.ts.map +1 -0
- package/src/views/CanvasEditor/CanvasEditorView.js +209 -0
- package/src/views/CanvasEditor/EditorBody.d.ts +22 -0
- package/src/views/CanvasEditor/EditorBody.d.ts.map +1 -0
- package/src/views/CanvasEditor/EditorBody.js +505 -0
- package/src/views/CanvasEditor/EditorHeader.d.ts +18 -0
- package/src/views/CanvasEditor/EditorHeader.d.ts.map +1 -0
- package/src/views/CanvasEditor/EditorHeader.js +101 -0
- package/src/views/CanvasEditor/LayoutContainer.d.ts +17 -0
- package/src/views/CanvasEditor/LayoutContainer.d.ts.map +1 -0
- package/src/views/CanvasEditor/LayoutContainer.js +222 -0
- package/src/views/CanvasEditor/SaveConfirmationModal.d.ts +13 -0
- package/src/views/CanvasEditor/SaveConfirmationModal.d.ts.map +1 -0
- package/src/views/CanvasEditor/SaveConfirmationModal.js +78 -0
- package/src/views/CanvasEditor/components/CustomBlockItem.d.ts +14 -0
- package/src/views/CanvasEditor/components/CustomBlockItem.d.ts.map +1 -0
- package/src/views/CanvasEditor/components/CustomBlockItem.js +44 -0
- package/src/views/CanvasEditor/components/EditorCanvas.d.ts +29 -0
- package/src/views/CanvasEditor/components/EditorCanvas.d.ts.map +1 -0
- package/src/views/CanvasEditor/components/EditorCanvas.js +32 -0
- package/src/views/CanvasEditor/components/EditorLibrary.d.ts +7 -0
- package/src/views/CanvasEditor/components/EditorLibrary.d.ts.map +1 -0
- package/src/views/CanvasEditor/components/EditorLibrary.js +25 -0
- package/src/views/CanvasEditor/components/EditorSidebar.d.ts +13 -0
- package/src/views/CanvasEditor/components/EditorSidebar.d.ts.map +1 -0
- package/src/views/CanvasEditor/components/EditorSidebar.js +20 -0
- package/src/views/CanvasEditor/components/ErrorBanner.d.ts +6 -0
- package/src/views/CanvasEditor/components/ErrorBanner.d.ts.map +1 -0
- package/src/views/CanvasEditor/components/ErrorBanner.js +8 -0
- package/src/views/CanvasEditor/components/FeaturedMediaSection.d.ts +25 -0
- package/src/views/CanvasEditor/components/FeaturedMediaSection.d.ts.map +1 -0
- package/src/views/CanvasEditor/components/FeaturedMediaSection.js +182 -0
- package/src/views/CanvasEditor/components/LibraryItem.d.ts +14 -0
- package/src/views/CanvasEditor/components/LibraryItem.d.ts.map +1 -0
- package/src/views/CanvasEditor/components/LibraryItem.js +43 -0
- package/src/views/CanvasEditor/components/PrivacySettingsSection.d.ts +15 -0
- package/src/views/CanvasEditor/components/PrivacySettingsSection.d.ts.map +1 -0
- package/src/views/CanvasEditor/components/PrivacySettingsSection.js +63 -0
- package/src/views/CanvasEditor/components/index.d.ts +21 -0
- package/src/views/CanvasEditor/components/index.d.ts.map +1 -0
- package/src/views/CanvasEditor/components/index.js +12 -0
- package/src/views/CanvasEditor/hooks/index.d.ts +10 -0
- package/src/views/CanvasEditor/hooks/index.d.ts.map +1 -0
- package/src/views/CanvasEditor/hooks/index.js +9 -0
- package/src/views/CanvasEditor/hooks/useHeroBlock.d.ts +8 -0
- package/src/views/CanvasEditor/hooks/useHeroBlock.d.ts.map +1 -0
- package/src/views/CanvasEditor/hooks/useHeroBlock.js +79 -0
- package/src/views/CanvasEditor/hooks/useKeyboardShortcuts.d.ts +3 -0
- package/src/views/CanvasEditor/hooks/useKeyboardShortcuts.d.ts.map +1 -0
- package/src/views/CanvasEditor/hooks/useKeyboardShortcuts.js +114 -0
- package/src/views/CanvasEditor/hooks/usePostLoader.d.ts +5 -0
- package/src/views/CanvasEditor/hooks/usePostLoader.d.ts.map +1 -0
- package/src/views/CanvasEditor/hooks/usePostLoader.js +32 -0
- package/src/views/CanvasEditor/hooks/useRegisteredBlocks.d.ts +2 -0
- package/src/views/CanvasEditor/hooks/useRegisteredBlocks.d.ts.map +1 -0
- package/src/views/CanvasEditor/hooks/useRegisteredBlocks.js +47 -0
- package/src/views/CanvasEditor/hooks/useUnsavedChanges.d.ts +25 -0
- package/src/views/CanvasEditor/hooks/useUnsavedChanges.d.ts.map +1 -0
- package/src/views/CanvasEditor/hooks/useUnsavedChanges.js +285 -0
- package/src/views/CanvasEditor/index.d.ts +16 -0
- package/src/views/CanvasEditor/index.d.ts.map +1 -0
- package/src/views/CanvasEditor/index.js +9 -0
- package/src/views/PostManager/EmptyState.d.ts +10 -0
- package/src/views/PostManager/EmptyState.d.ts.map +1 -0
- package/src/views/PostManager/EmptyState.js +12 -0
- package/src/views/PostManager/PostActionsMenu.d.ts +12 -0
- package/src/views/PostManager/PostActionsMenu.d.ts.map +1 -0
- package/src/views/PostManager/PostActionsMenu.js +58 -0
- package/src/views/PostManager/PostCards.d.ts +15 -0
- package/src/views/PostManager/PostCards.d.ts.map +1 -0
- package/src/views/PostManager/PostCards.js +79 -0
- package/src/views/PostManager/PostFilters.d.ts +16 -0
- package/src/views/PostManager/PostFilters.d.ts.map +1 -0
- package/src/views/PostManager/PostFilters.js +10 -0
- package/src/views/PostManager/PostManagerView.d.ts +11 -0
- package/src/views/PostManager/PostManagerView.d.ts.map +1 -0
- package/src/views/PostManager/PostManagerView.js +174 -0
- package/src/views/PostManager/PostStats.d.ts +11 -0
- package/src/views/PostManager/PostStats.d.ts.map +1 -0
- package/src/views/PostManager/PostStats.js +46 -0
- package/src/views/PostManager/PostTable.d.ts +15 -0
- package/src/views/PostManager/PostTable.d.ts.map +1 -0
- package/src/views/PostManager/PostTable.js +79 -0
- package/src/views/PostManager/index.d.ts +12 -0
- package/src/views/PostManager/index.d.ts.map +1 -0
- package/src/views/PostManager/index.js +11 -0
- package/src/views/Preview/PreviewBridgeView.d.ts +12 -0
- package/src/views/Preview/PreviewBridgeView.d.ts.map +1 -0
- package/src/views/Preview/PreviewBridgeView.js +11 -0
- package/src/views/Preview/index.d.ts +6 -0
- package/src/views/Preview/index.d.ts.map +1 -0
- package/src/views/Preview/index.js +4 -0
- package/src/views/Settings/SettingsView.d.ts +10 -0
- package/src/views/Settings/SettingsView.d.ts.map +1 -0
- package/src/views/Settings/SettingsView.js +111 -0
- package/src/views/Settings/index.d.ts +6 -0
- package/src/views/Settings/index.d.ts.map +1 -0
- package/src/views/Settings/index.js +4 -0
- package/src/views/SlugSEO/SlugSEOManagerView.d.ts +12 -0
- package/src/views/SlugSEO/SlugSEOManagerView.d.ts.map +1 -0
- package/src/views/SlugSEO/SlugSEOManagerView.js +11 -0
- package/src/views/SlugSEO/index.d.ts +6 -0
- package/src/views/SlugSEO/index.d.ts.map +1 -0
- package/src/views/SlugSEO/index.js +4 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rich Text Preview Component
|
|
3
|
+
* Renders HTML content with client-provided styles
|
|
4
|
+
* Also supports plain text with formatting markers using the plugin-content parser
|
|
5
|
+
*/
|
|
6
|
+
'use client';
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { parse, useParserConfig } from '@jhits/plugin-content';
|
|
10
|
+
/**
|
|
11
|
+
* Check if content is HTML or plain text with formatting markers
|
|
12
|
+
*/
|
|
13
|
+
function isHtmlContent(content) {
|
|
14
|
+
// If content contains HTML tags, it's HTML
|
|
15
|
+
if (/<[a-z][\s\S]*>/i.test(content)) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
// If content contains HTML entities, it's likely HTML
|
|
19
|
+
if (/&[a-z]+;/i.test(content)) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
// Otherwise, it's plain text (potentially with formatting markers)
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
export function RichTextPreview({ content, formatting, className = '', }) {
|
|
26
|
+
// Handle empty content
|
|
27
|
+
if (!content || content.trim() === '') {
|
|
28
|
+
return _jsx("div", { className: className, children: "\u00A0" });
|
|
29
|
+
}
|
|
30
|
+
// Get parser config from context (provided by client app)
|
|
31
|
+
const parserConfig = useParserConfig();
|
|
32
|
+
// Check if content is HTML or plain text
|
|
33
|
+
const isHtml = isHtmlContent(content);
|
|
34
|
+
// If it's plain text, use the parser from plugin-content
|
|
35
|
+
if (!isHtml) {
|
|
36
|
+
const parsedContent = parse(content, false, parserConfig);
|
|
37
|
+
return (_jsx("div", { className: className, children: parsedContent }));
|
|
38
|
+
}
|
|
39
|
+
// Otherwise, continue with HTML rendering logic
|
|
40
|
+
// Apply client-provided styles to HTML content
|
|
41
|
+
const applyStyles = (html) => {
|
|
42
|
+
if (!(formatting === null || formatting === void 0 ? void 0 : formatting.styles))
|
|
43
|
+
return html;
|
|
44
|
+
const styles = formatting.styles;
|
|
45
|
+
let styledHtml = html;
|
|
46
|
+
// Apply bold style - handle both <strong> and <b> tags
|
|
47
|
+
if (styles.bold) {
|
|
48
|
+
// Replace <strong> tags
|
|
49
|
+
styledHtml = styledHtml.replace(/<strong\b([^>]*)>/gi, (match, attrs) => {
|
|
50
|
+
// Check if class already exists
|
|
51
|
+
if (attrs && attrs.includes('class=')) {
|
|
52
|
+
return match.replace(/class="([^"]*)"/, `class="$1 ${styles.bold}"`);
|
|
53
|
+
}
|
|
54
|
+
return `<strong class="${styles.bold}">`;
|
|
55
|
+
});
|
|
56
|
+
// Replace <b> tags
|
|
57
|
+
styledHtml = styledHtml.replace(/<b\b([^>]*)>/gi, (match, attrs) => {
|
|
58
|
+
if (attrs && attrs.includes('class=')) {
|
|
59
|
+
return match.replace(/class="([^"]*)"/, `class="$1 ${styles.bold}"`);
|
|
60
|
+
}
|
|
61
|
+
return `<b class="${styles.bold}">`;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
// Apply italic style - handle both <em> and <i> tags
|
|
65
|
+
if (styles.italic) {
|
|
66
|
+
styledHtml = styledHtml.replace(/<em\b([^>]*)>/gi, (match, attrs) => {
|
|
67
|
+
if (attrs && attrs.includes('class=')) {
|
|
68
|
+
return match.replace(/class="([^"]*)"/, `class="$1 ${styles.italic}"`);
|
|
69
|
+
}
|
|
70
|
+
return `<em class="${styles.italic}">`;
|
|
71
|
+
});
|
|
72
|
+
styledHtml = styledHtml.replace(/<i\b([^>]*)>/gi, (match, attrs) => {
|
|
73
|
+
if (attrs && attrs.includes('class=')) {
|
|
74
|
+
return match.replace(/class="([^"]*)"/, `class="$1 ${styles.italic}"`);
|
|
75
|
+
}
|
|
76
|
+
return `<i class="${styles.italic}">`;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
// Apply underline style
|
|
80
|
+
if (styles.underline) {
|
|
81
|
+
styledHtml = styledHtml.replace(/<u\b([^>]*)>/gi, (match, attrs) => {
|
|
82
|
+
if (attrs && attrs.includes('class=')) {
|
|
83
|
+
return match.replace(/class="([^"]*)"/, `class="$1 ${styles.underline}"`);
|
|
84
|
+
}
|
|
85
|
+
return `<u class="${styles.underline}">`;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
// Apply link style
|
|
89
|
+
if (styles.link) {
|
|
90
|
+
styledHtml = styledHtml.replace(/<a\b([^>]*)>/gi, (match, attrs) => {
|
|
91
|
+
if (attrs && attrs.includes('class=')) {
|
|
92
|
+
return match.replace(/class="([^"]*)"/, `class="$1 ${styles.link}"`);
|
|
93
|
+
}
|
|
94
|
+
return match.replace('>', ` class="${styles.link}">`);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
// Apply color classes to spans (preserve existing classes)
|
|
98
|
+
if (styles.colorClasses) {
|
|
99
|
+
Object.entries(styles.colorClasses).forEach(([color, colorClass]) => {
|
|
100
|
+
// Match spans that might have the color class already or need it added
|
|
101
|
+
const regex = new RegExp(`<span([^>]*)class="([^"]*)"([^>]*)>`, 'gi');
|
|
102
|
+
styledHtml = styledHtml.replace(regex, (match, beforeAttrs, existingClasses, afterAttrs) => {
|
|
103
|
+
// Don't add if class already exists
|
|
104
|
+
if (existingClasses.includes(colorClass)) {
|
|
105
|
+
return match;
|
|
106
|
+
}
|
|
107
|
+
// Add the color class
|
|
108
|
+
return `<span${beforeAttrs}class="${existingClasses} ${colorClass}"${afterAttrs}>`;
|
|
109
|
+
});
|
|
110
|
+
// Also handle spans without class attribute
|
|
111
|
+
const regexNoClass = new RegExp(`<span([^>]*)>`, 'gi');
|
|
112
|
+
styledHtml = styledHtml.replace(regexNoClass, (match, attrs) => {
|
|
113
|
+
// Only add if this span doesn't already have a class and we're looking for a specific color
|
|
114
|
+
if (!attrs.includes('class=')) {
|
|
115
|
+
return match.replace('>', ` class="${colorClass}">`);
|
|
116
|
+
}
|
|
117
|
+
return match;
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return styledHtml;
|
|
122
|
+
};
|
|
123
|
+
const styledContent = formatting ? applyStyles(content) : content;
|
|
124
|
+
// For rendering, we'll use a ref to set innerHTML only on the client side
|
|
125
|
+
// This avoids SSR issues while still allowing HTML rendering
|
|
126
|
+
const contentRef = React.useRef(null);
|
|
127
|
+
React.useEffect(() => {
|
|
128
|
+
if (contentRef.current && styledContent) {
|
|
129
|
+
contentRef.current.innerHTML = styledContent;
|
|
130
|
+
}
|
|
131
|
+
}, [styledContent]);
|
|
132
|
+
// For server-side rendering, render plain text
|
|
133
|
+
if (typeof window === 'undefined') {
|
|
134
|
+
const textContent = styledContent
|
|
135
|
+
.replace(/<[^>]*>/g, '')
|
|
136
|
+
.replace(/ /g, ' ')
|
|
137
|
+
.replace(/&/g, '&')
|
|
138
|
+
.replace(/</g, '<')
|
|
139
|
+
.replace(/>/g, '>')
|
|
140
|
+
.replace(/"/g, '"');
|
|
141
|
+
return (_jsx("div", { className: className, children: textContent || '\u00A0' }));
|
|
142
|
+
}
|
|
143
|
+
return (_jsx("div", { ref: contentRef, className: className }));
|
|
144
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rich Text Utilities
|
|
3
|
+
* Export rich text editor and preview components
|
|
4
|
+
*/
|
|
5
|
+
export { RichTextEditor } from './RichTextEditor';
|
|
6
|
+
export { RichTextPreview } from './RichTextPreview';
|
|
7
|
+
export type { RichTextFormattingConfig, RichTextEditorProps } from './RichTextEditor';
|
|
8
|
+
export type { RichTextPreviewProps } from './RichTextPreview';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACtF,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Block Helper Utilities
|
|
3
|
+
* Functions for working with blocks, including nested structures
|
|
4
|
+
*/
|
|
5
|
+
import { Block } from '../../types/block';
|
|
6
|
+
/**
|
|
7
|
+
* Get child blocks from a container block
|
|
8
|
+
* Handles both Block[] and string[] formats
|
|
9
|
+
*/
|
|
10
|
+
export declare function getChildBlocks(block: Block, allBlocks?: Block[]): Block[];
|
|
11
|
+
/**
|
|
12
|
+
* Check if a block is a container (has children or is marked as container)
|
|
13
|
+
*/
|
|
14
|
+
export declare function isContainerBlock(block: Block, blockRegistry: {
|
|
15
|
+
get: (type: string) => {
|
|
16
|
+
isContainer?: boolean;
|
|
17
|
+
} | undefined;
|
|
18
|
+
}): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Find a block by ID recursively (including nested blocks)
|
|
21
|
+
*/
|
|
22
|
+
export declare function findBlockById(blocks: Block[], id: string): Block | null;
|
|
23
|
+
//# sourceMappingURL=blockHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blockHelpers.d.ts","sourceRoot":"","sources":["blockHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,GAAE,KAAK,EAAO,GAAG,KAAK,EAAE,CAiC7E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE;IAAE,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK;QAAE,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS,CAAA;CAAE,GAAG,OAAO,CAGvI;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAavE"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Block Helper Utilities
|
|
3
|
+
* Functions for working with blocks, including nested structures
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Get child blocks from a container block
|
|
7
|
+
* Handles both Block[] and string[] formats
|
|
8
|
+
*/
|
|
9
|
+
export function getChildBlocks(block, allBlocks = []) {
|
|
10
|
+
if (!block.children || block.children.length === 0) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
// If children are Block objects, return them directly
|
|
14
|
+
if (block.children.length > 0 && typeof block.children[0] === 'object' && 'id' in block.children[0]) {
|
|
15
|
+
return block.children;
|
|
16
|
+
}
|
|
17
|
+
// If children are IDs, resolve them from allBlocks (recursively search nested blocks)
|
|
18
|
+
const childIds = block.children;
|
|
19
|
+
const resolvedBlocks = [];
|
|
20
|
+
function findBlockRecursive(blocks, id) {
|
|
21
|
+
for (const b of blocks) {
|
|
22
|
+
if (b.id === id)
|
|
23
|
+
return b;
|
|
24
|
+
if (b.children && Array.isArray(b.children) && b.children.length > 0) {
|
|
25
|
+
if (typeof b.children[0] === 'object') {
|
|
26
|
+
const found = findBlockRecursive(b.children, id);
|
|
27
|
+
if (found)
|
|
28
|
+
return found;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
childIds.forEach(id => {
|
|
35
|
+
const found = findBlockRecursive(allBlocks, id);
|
|
36
|
+
if (found)
|
|
37
|
+
resolvedBlocks.push(found);
|
|
38
|
+
});
|
|
39
|
+
return resolvedBlocks;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Check if a block is a container (has children or is marked as container)
|
|
43
|
+
*/
|
|
44
|
+
export function isContainerBlock(block, blockRegistry) {
|
|
45
|
+
const definition = blockRegistry.get(block.type);
|
|
46
|
+
return (definition === null || definition === void 0 ? void 0 : definition.isContainer) === true || (block.children !== undefined && block.children.length > 0);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Find a block by ID recursively (including nested blocks)
|
|
50
|
+
*/
|
|
51
|
+
export function findBlockById(blocks, id) {
|
|
52
|
+
for (const block of blocks) {
|
|
53
|
+
if (block.id === id) {
|
|
54
|
+
return block;
|
|
55
|
+
}
|
|
56
|
+
if (block.children && Array.isArray(block.children) && block.children.length > 0) {
|
|
57
|
+
if (typeof block.children[0] === 'object') {
|
|
58
|
+
const found = findBlockById(block.children, id);
|
|
59
|
+
if (found)
|
|
60
|
+
return found;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin Configuration Validation Utilities
|
|
3
|
+
* Validates plugin configuration and custom blocks
|
|
4
|
+
*/
|
|
5
|
+
import { ClientBlockDefinition } from '../../types/block';
|
|
6
|
+
/**
|
|
7
|
+
* Check if a route requires the hero block
|
|
8
|
+
*/
|
|
9
|
+
export declare function routeRequiresHeroBlock(route: string): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Find hero block definition in custom blocks
|
|
12
|
+
*/
|
|
13
|
+
export declare function findHeroBlock(customBlocks: ClientBlockDefinition[]): ClientBlockDefinition | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Hook to validate hero block configuration
|
|
16
|
+
* Only validates for routes that require it, and waits for customBlocks to load
|
|
17
|
+
*
|
|
18
|
+
* @param route - Current route (e.g., 'posts', 'editor', 'new')
|
|
19
|
+
* @param customBlocks - Array of custom block definitions
|
|
20
|
+
* @param propsCustomBlocks - Custom blocks from props (for immediate validation)
|
|
21
|
+
*/
|
|
22
|
+
export declare function useHeroBlockValidation(route: string, customBlocks: ClientBlockDefinition[], propsCustomBlocks?: ClientBlockDefinition[]): void;
|
|
23
|
+
//# sourceMappingURL=configValidation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configValidation.d.ts","sourceRoot":"","sources":["configValidation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAO1D;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,YAAY,EAAE,qBAAqB,EAAE,GAAG,qBAAqB,GAAG,SAAS,CAEtG;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAClC,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,qBAAqB,EAAE,EACrC,iBAAiB,CAAC,EAAE,qBAAqB,EAAE,GAC5C,IAAI,CAgGN"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin Configuration Validation Utilities
|
|
3
|
+
* Validates plugin configuration and custom blocks
|
|
4
|
+
*/
|
|
5
|
+
import { useEffect, useState, useMemo } from 'react';
|
|
6
|
+
/**
|
|
7
|
+
* Routes that require the hero block to be defined
|
|
8
|
+
*/
|
|
9
|
+
const ROUTES_REQUIRING_HERO_BLOCK = ['editor', 'new', 'preview'];
|
|
10
|
+
/**
|
|
11
|
+
* Check if a route requires the hero block
|
|
12
|
+
*/
|
|
13
|
+
export function routeRequiresHeroBlock(route) {
|
|
14
|
+
return ROUTES_REQUIRING_HERO_BLOCK.includes(route);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Find hero block definition in custom blocks
|
|
18
|
+
*/
|
|
19
|
+
export function findHeroBlock(customBlocks) {
|
|
20
|
+
return customBlocks.find(block => block.type === 'hero');
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Hook to validate hero block configuration
|
|
24
|
+
* Only validates for routes that require it, and waits for customBlocks to load
|
|
25
|
+
*
|
|
26
|
+
* @param route - Current route (e.g., 'posts', 'editor', 'new')
|
|
27
|
+
* @param customBlocks - Array of custom block definitions
|
|
28
|
+
* @param propsCustomBlocks - Custom blocks from props (for immediate validation)
|
|
29
|
+
*/
|
|
30
|
+
export function useHeroBlockValidation(route, customBlocks, propsCustomBlocks) {
|
|
31
|
+
const needsHeroBlock = useMemo(() => routeRequiresHeroBlock(route), [route]);
|
|
32
|
+
const heroBlockDefinition = useMemo(() => {
|
|
33
|
+
// Only search for hero block if route needs it
|
|
34
|
+
return needsHeroBlock ? findHeroBlock(customBlocks) : undefined;
|
|
35
|
+
}, [customBlocks, needsHeroBlock]);
|
|
36
|
+
// Track if we've given customBlocks time to load from window global
|
|
37
|
+
// This prevents false errors when customBlocks are loaded asynchronously
|
|
38
|
+
// Only track this if we actually need the hero block
|
|
39
|
+
const [hasCheckedForBlocks, setHasCheckedForBlocks] = useState(false);
|
|
40
|
+
// Give window global a chance to load before validating
|
|
41
|
+
// Only do this if the route needs the hero block
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
// Early return: Skip all validation logic if route doesn't need hero block
|
|
45
|
+
if (!needsHeroBlock) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (typeof window === 'undefined') {
|
|
49
|
+
setHasCheckedForBlocks(true); // Server-side, no need to wait
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
// If props are provided, we can validate immediately
|
|
53
|
+
if (propsCustomBlocks && propsCustomBlocks.length > 0) {
|
|
54
|
+
setHasCheckedForBlocks(true);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
// Check if window global is already available
|
|
58
|
+
if ((_b = (_a = window.__JHITS_PLUGIN_PROPS__) === null || _a === void 0 ? void 0 : _a['plugin-blog']) === null || _b === void 0 ? void 0 : _b.customBlocks) {
|
|
59
|
+
setHasCheckedForBlocks(true);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
// Retry mechanism: check multiple times with increasing delays
|
|
63
|
+
// This handles the case where BlogPluginInit's useEffect runs after BlogPlugin mounts
|
|
64
|
+
// BlogPluginInit runs initBlogPlugin in useEffect, which may execute after BlogPlugin's first render
|
|
65
|
+
let attempt = 0;
|
|
66
|
+
const maxAttempts = 6;
|
|
67
|
+
const delays = [50, 100, 200, 300, 500, 1000]; // Progressive delays: total ~2.15s
|
|
68
|
+
const timers = [];
|
|
69
|
+
const checkWithRetry = () => {
|
|
70
|
+
var _a, _b;
|
|
71
|
+
const windowGlobal = (_b = (_a = window.__JHITS_PLUGIN_PROPS__) === null || _a === void 0 ? void 0 : _a['plugin-blog']) === null || _b === void 0 ? void 0 : _b.customBlocks;
|
|
72
|
+
if (windowGlobal && windowGlobal.length > 0) {
|
|
73
|
+
// Found it! Mark as checked
|
|
74
|
+
setHasCheckedForBlocks(true);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (attempt < maxAttempts) {
|
|
78
|
+
const timer = setTimeout(() => {
|
|
79
|
+
attempt++;
|
|
80
|
+
checkWithRetry();
|
|
81
|
+
}, delays[attempt]);
|
|
82
|
+
timers.push(timer);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
// After all retries, mark as checked (even if not found)
|
|
86
|
+
// This prevents infinite waiting and allows validation to proceed
|
|
87
|
+
setHasCheckedForBlocks(true);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
// Start checking
|
|
91
|
+
checkWithRetry();
|
|
92
|
+
// Cleanup all timers
|
|
93
|
+
return () => {
|
|
94
|
+
timers.forEach(timer => clearTimeout(timer));
|
|
95
|
+
};
|
|
96
|
+
}, [propsCustomBlocks, needsHeroBlock]);
|
|
97
|
+
// Validate that Hero block is required (only for editor routes, and only after we've checked for blocks)
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
// Early return if route doesn't need hero block - no validation needed
|
|
100
|
+
if (!needsHeroBlock) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
// Only validate if:
|
|
104
|
+
// 1. We're in a route that needs the hero block (already checked above)
|
|
105
|
+
// 2. We've given customBlocks time to load (hasCheckedForBlocks is true)
|
|
106
|
+
// 3. The hero block is still not found
|
|
107
|
+
if (hasCheckedForBlocks && !heroBlockDefinition) {
|
|
108
|
+
console.error('[BlogPlugin] Hero block is REQUIRED but not found in customBlocks. ' +
|
|
109
|
+
'Please define a block with type: "hero" in your blog config. ' +
|
|
110
|
+
`Current route: "${route}"`);
|
|
111
|
+
}
|
|
112
|
+
}, [heroBlockDefinition, needsHeroBlock, hasCheckedForBlocks, route]);
|
|
113
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Block Registry
|
|
3
|
+
* Dynamic registry for all block types in the system
|
|
4
|
+
* Multi-Tenant Architecture: Blocks are provided by client applications
|
|
5
|
+
*
|
|
6
|
+
* The registry is a singleton that starts empty and is populated by client apps
|
|
7
|
+
*/
|
|
8
|
+
import { BlockTypeDefinition, BlockRegistry as IBlockRegistry, ClientBlockDefinition } from '../types/block';
|
|
9
|
+
/**
|
|
10
|
+
* Dynamic Block Registry Implementation
|
|
11
|
+
* No default blocks - all blocks must be registered by client applications
|
|
12
|
+
*/
|
|
13
|
+
declare class BlockRegistryImpl implements IBlockRegistry {
|
|
14
|
+
private _types;
|
|
15
|
+
get types(): Map<string, BlockTypeDefinition>;
|
|
16
|
+
/**
|
|
17
|
+
* Register a single block type
|
|
18
|
+
*/
|
|
19
|
+
register(definition: BlockTypeDefinition): void;
|
|
20
|
+
/**
|
|
21
|
+
* Register multiple client blocks at once
|
|
22
|
+
* This is the primary method for client applications to register their blocks
|
|
23
|
+
*/
|
|
24
|
+
registerClientBlocks(definitions: ClientBlockDefinition[]): void;
|
|
25
|
+
/**
|
|
26
|
+
* Get block type definition by type string
|
|
27
|
+
*/
|
|
28
|
+
get(type: string): BlockTypeDefinition | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Get all registered block types
|
|
31
|
+
*/
|
|
32
|
+
getAll(): BlockTypeDefinition[];
|
|
33
|
+
/**
|
|
34
|
+
* Get block types filtered by category
|
|
35
|
+
*/
|
|
36
|
+
getByCategory(category: BlockTypeDefinition['category']): BlockTypeDefinition[];
|
|
37
|
+
/**
|
|
38
|
+
* Check if a block type is registered
|
|
39
|
+
*/
|
|
40
|
+
has(type: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Unregister a block type (useful for testing or dynamic loading)
|
|
43
|
+
*/
|
|
44
|
+
unregister(type: string): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Clear all registered block types
|
|
47
|
+
* Useful for testing or resetting the registry
|
|
48
|
+
*/
|
|
49
|
+
clear(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Get count of registered blocks
|
|
52
|
+
*/
|
|
53
|
+
getCount(): number;
|
|
54
|
+
}
|
|
55
|
+
export declare const blockRegistry: BlockRegistryImpl;
|
|
56
|
+
export {};
|
|
57
|
+
/**
|
|
58
|
+
* NOTE: No default blocks are registered automatically.
|
|
59
|
+
* Client applications must call registerClientBlocks() to populate the registry.
|
|
60
|
+
* This ensures the editor is a true "shell" without hardcoded blocks.
|
|
61
|
+
*/
|
|
62
|
+
//# sourceMappingURL=BlockRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlockRegistry.d.ts","sourceRoot":"","sources":["BlockRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACH,mBAAmB,EACnB,aAAa,IAAI,cAAc,EAC/B,qBAAqB,EACxB,MAAM,gBAAgB,CAAC;AAExB;;;GAGG;AACH,cAAM,iBAAkB,YAAW,cAAc;IAC7C,OAAO,CAAC,MAAM,CAA+C;IAE7D,IAAI,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAE5C;IAED;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,mBAAmB,GAAG,IAAI;IAa/C;;;OAGG;IACH,oBAAoB,CAAC,WAAW,EAAE,qBAAqB,EAAE,GAAG,IAAI;IAmChE;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS;IAIlD;;OAEG;IACH,MAAM,IAAI,mBAAmB,EAAE;IAI/B;;OAEG;IACH,aAAa,CAAC,QAAQ,EAAE,mBAAmB,CAAC,UAAU,CAAC,GAAG,mBAAmB,EAAE;IAI/E;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIjC;;;OAGG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,QAAQ,IAAI,MAAM;CAGrB;AAGD,eAAO,MAAM,aAAa,mBAA0B,CAAC;;AAErD;;;;GAIG"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Block Registry
|
|
3
|
+
* Dynamic registry for all block types in the system
|
|
4
|
+
* Multi-Tenant Architecture: Blocks are provided by client applications
|
|
5
|
+
*
|
|
6
|
+
* The registry is a singleton that starts empty and is populated by client apps
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Dynamic Block Registry Implementation
|
|
10
|
+
* No default blocks - all blocks must be registered by client applications
|
|
11
|
+
*/
|
|
12
|
+
class BlockRegistryImpl {
|
|
13
|
+
constructor() {
|
|
14
|
+
this._types = new Map();
|
|
15
|
+
}
|
|
16
|
+
get types() {
|
|
17
|
+
return this._types;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Register a single block type
|
|
21
|
+
*/
|
|
22
|
+
register(definition) {
|
|
23
|
+
// Validate that components are provided
|
|
24
|
+
if (!definition.components || !definition.components.Edit || !definition.components.Preview) {
|
|
25
|
+
throw new Error(`Block type "${definition.type}" must provide both Edit and Preview components. ` +
|
|
26
|
+
`Use registerClientBlocks() for client-provided blocks.`);
|
|
27
|
+
}
|
|
28
|
+
// Silently overwrite if already registered (expected in React 18 Strict Mode)
|
|
29
|
+
this._types.set(definition.type, definition);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Register multiple client blocks at once
|
|
33
|
+
* This is the primary method for client applications to register their blocks
|
|
34
|
+
*/
|
|
35
|
+
registerClientBlocks(definitions) {
|
|
36
|
+
for (const def of definitions) {
|
|
37
|
+
// Validate required fields
|
|
38
|
+
if (!def.type || !def.name || !def.components) {
|
|
39
|
+
console.error('Invalid block definition:', def);
|
|
40
|
+
throw new Error('Block definition must have: type, name, and components (with Edit and Preview)');
|
|
41
|
+
}
|
|
42
|
+
// Validate components
|
|
43
|
+
if (!def.components.Edit || !def.components.Preview) {
|
|
44
|
+
throw new Error(`Block "${def.type}" must provide both Edit and Preview components in the components object`);
|
|
45
|
+
}
|
|
46
|
+
// Convert ClientBlockDefinition to BlockTypeDefinition
|
|
47
|
+
const blockDefinition = {
|
|
48
|
+
type: def.type,
|
|
49
|
+
name: def.name,
|
|
50
|
+
description: def.description,
|
|
51
|
+
icon: def.icon || def.components.Icon,
|
|
52
|
+
defaultData: def.defaultData,
|
|
53
|
+
validate: def.validate,
|
|
54
|
+
isContainer: def.isContainer,
|
|
55
|
+
allowedChildren: def.allowedChildren,
|
|
56
|
+
category: def.category || 'custom',
|
|
57
|
+
components: def.components,
|
|
58
|
+
};
|
|
59
|
+
this.register(blockDefinition);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Get block type definition by type string
|
|
64
|
+
*/
|
|
65
|
+
get(type) {
|
|
66
|
+
return this._types.get(type);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Get all registered block types
|
|
70
|
+
*/
|
|
71
|
+
getAll() {
|
|
72
|
+
return Array.from(this._types.values());
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get block types filtered by category
|
|
76
|
+
*/
|
|
77
|
+
getByCategory(category) {
|
|
78
|
+
return this.getAll().filter(block => block.category === category);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Check if a block type is registered
|
|
82
|
+
*/
|
|
83
|
+
has(type) {
|
|
84
|
+
return this._types.has(type);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Unregister a block type (useful for testing or dynamic loading)
|
|
88
|
+
*/
|
|
89
|
+
unregister(type) {
|
|
90
|
+
return this._types.delete(type);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Clear all registered block types
|
|
94
|
+
* Useful for testing or resetting the registry
|
|
95
|
+
*/
|
|
96
|
+
clear() {
|
|
97
|
+
this._types.clear();
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Get count of registered blocks
|
|
101
|
+
*/
|
|
102
|
+
getCount() {
|
|
103
|
+
return this._types.size;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// Singleton instance - starts empty, populated by client apps
|
|
107
|
+
export const blockRegistry = new BlockRegistryImpl();
|
|
108
|
+
/**
|
|
109
|
+
* NOTE: No default blocks are registered automatically.
|
|
110
|
+
* Client applications must call registerClientBlocks() to populate the registry.
|
|
111
|
+
* This ensures the editor is a true "shell" without hardcoded blocks.
|
|
112
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EACR,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,GAChB,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Editor Context
|
|
3
|
+
* React Context for managing editor state
|
|
4
|
+
* Multi-Tenant: Accepts custom blocks from client applications
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { EditorContextValue, EditorState } from './types';
|
|
8
|
+
import { Block } from '../types/block';
|
|
9
|
+
import { ClientBlockDefinition } from '../types/block';
|
|
10
|
+
/**
|
|
11
|
+
* Editor Provider Props
|
|
12
|
+
*/
|
|
13
|
+
export interface EditorProviderProps {
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
/** Initial state (optional) */
|
|
16
|
+
initialState?: Partial<EditorState>;
|
|
17
|
+
/** Callback when save is triggered */
|
|
18
|
+
onSave?: (state: EditorState, heroBlock?: Block | null) => Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Custom blocks from client application
|
|
21
|
+
* These blocks will be registered in the BlockRegistry on mount
|
|
22
|
+
*/
|
|
23
|
+
customBlocks?: ClientBlockDefinition[];
|
|
24
|
+
/** Enable dark mode for content area and wrappers (default: true) */
|
|
25
|
+
darkMode?: boolean;
|
|
26
|
+
/** Background colors for the editor */
|
|
27
|
+
backgroundColors?: {
|
|
28
|
+
/** Background color for light mode (REQUIRED) */
|
|
29
|
+
light: string;
|
|
30
|
+
/** Background color for dark mode (optional) */
|
|
31
|
+
dark?: string;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Editor Provider
|
|
36
|
+
* Provides editor state and actions to child components
|
|
37
|
+
* Automatically registers client-provided blocks on mount
|
|
38
|
+
*/
|
|
39
|
+
export declare function EditorProvider({ children, initialState, onSave, customBlocks, darkMode, backgroundColors }: EditorProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
/**
|
|
41
|
+
* Hook to access editor context
|
|
42
|
+
* @throws Error if used outside EditorProvider
|
|
43
|
+
*/
|
|
44
|
+
export declare function useEditor(): EditorContextValue;
|
|
45
|
+
//# sourceMappingURL=EditorContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditorContext.d.ts","sourceRoot":"","sources":["EditorContext.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAmG,MAAM,OAAO,CAAC;AAExH,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAoC,MAAM,SAAS,CAAC;AAC5F,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAMvD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,+BAA+B;IAC/B,YAAY,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IACpC,sCAAsC;IACtC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,KAAK,GAAG,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzE;;;OAGG;IACH,YAAY,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACvC,qEAAqE;IACrE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uCAAuC;IACvC,gBAAgB,CAAC,EAAE;QACf,iDAAiD;QACjD,KAAK,EAAE,MAAM,CAAC;QACd,gDAAgD;QAChD,IAAI,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;CACL;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAC3B,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,YAAiB,EACjB,QAAe,EACf,gBAAgB,EACnB,EAAE,mBAAmB,2CAqNrB;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,kBAAkB,CAM9C"}
|