@jhits/plugin-blog 0.0.7 → 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 -55
- 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/utils/index.ts +0 -2
- 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,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":["../../src/registry/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":["../../src/state/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"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Editor Context
|
|
3
|
+
* React Context for managing editor state
|
|
4
|
+
* Multi-Tenant: Accepts custom blocks from client applications
|
|
5
|
+
*/
|
|
6
|
+
'use client';
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
import { createContext, useContext, useReducer, useCallback, useMemo, useEffect, useRef, useState } from 'react';
|
|
9
|
+
import { editorReducer } from './reducer';
|
|
10
|
+
import { initialEditorState } from './types';
|
|
11
|
+
import { blockRegistry } from '../registry/BlockRegistry';
|
|
12
|
+
import { registerLayoutBlocks } from '../lib/layouts/registerLayoutBlocks';
|
|
13
|
+
// Create the context
|
|
14
|
+
const EditorContext = createContext(null);
|
|
15
|
+
/**
|
|
16
|
+
* Editor Provider
|
|
17
|
+
* Provides editor state and actions to child components
|
|
18
|
+
* Automatically registers client-provided blocks on mount
|
|
19
|
+
*/
|
|
20
|
+
export function EditorProvider({ children, initialState, onSave, customBlocks = [], darkMode = true, backgroundColors }) {
|
|
21
|
+
// Register core layout blocks on mount
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
registerLayoutBlocks();
|
|
24
|
+
}, []);
|
|
25
|
+
// Register client blocks on mount
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (customBlocks && customBlocks.length > 0) {
|
|
28
|
+
try {
|
|
29
|
+
blockRegistry.registerClientBlocks(customBlocks);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
console.error('[EditorContext] Failed to register custom blocks:', error);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}, [customBlocks]);
|
|
36
|
+
const [state, dispatch] = useReducer(editorReducer, { ...initialEditorState, ...initialState });
|
|
37
|
+
// Use a ref to always have access to the latest state in callbacks
|
|
38
|
+
const stateRef = useRef(state);
|
|
39
|
+
stateRef.current = state;
|
|
40
|
+
// History state for undo/redo
|
|
41
|
+
const [history, setHistory] = useState([]);
|
|
42
|
+
const [historyIndex, setHistoryIndex] = useState(-1);
|
|
43
|
+
const isRestoringRef = useRef(false);
|
|
44
|
+
const MAX_HISTORY = 50; // Limit history to prevent memory issues
|
|
45
|
+
// Save current state to history after state changes (but not during undo/redo)
|
|
46
|
+
// Debounce history updates to avoid excessive re-renders
|
|
47
|
+
const historyTimeoutRef = useRef(null);
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (isRestoringRef.current) {
|
|
50
|
+
isRestoringRef.current = false;
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
// Clear existing timeout
|
|
54
|
+
if (historyTimeoutRef.current) {
|
|
55
|
+
clearTimeout(historyTimeoutRef.current);
|
|
56
|
+
}
|
|
57
|
+
// Debounce history updates to reduce re-renders
|
|
58
|
+
historyTimeoutRef.current = setTimeout(() => {
|
|
59
|
+
// Save current state to history
|
|
60
|
+
setHistory(prev => {
|
|
61
|
+
const newHistory = [...prev];
|
|
62
|
+
// Remove any future history if we're not at the end
|
|
63
|
+
if (historyIndex < newHistory.length - 1) {
|
|
64
|
+
newHistory.splice(historyIndex + 1);
|
|
65
|
+
}
|
|
66
|
+
// Add current state
|
|
67
|
+
newHistory.push({ ...state });
|
|
68
|
+
// Limit history size
|
|
69
|
+
if (newHistory.length > MAX_HISTORY) {
|
|
70
|
+
newHistory.shift();
|
|
71
|
+
return newHistory;
|
|
72
|
+
}
|
|
73
|
+
return newHistory;
|
|
74
|
+
});
|
|
75
|
+
setHistoryIndex(prev => {
|
|
76
|
+
const newIndex = prev + 1;
|
|
77
|
+
return newIndex >= MAX_HISTORY ? MAX_HISTORY - 1 : newIndex;
|
|
78
|
+
});
|
|
79
|
+
}, 300); // Debounce by 300ms
|
|
80
|
+
return () => {
|
|
81
|
+
if (historyTimeoutRef.current) {
|
|
82
|
+
clearTimeout(historyTimeoutRef.current);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}, [state.blocks, state.title, state.slug, state.seo, state.metadata, state.status, historyIndex]);
|
|
86
|
+
// Helper: Add a new block (supports nested containers)
|
|
87
|
+
const addBlock = useCallback((type, index, containerId) => {
|
|
88
|
+
const blockDefinition = blockRegistry.get(type);
|
|
89
|
+
if (!blockDefinition) {
|
|
90
|
+
console.warn(`Block type "${type}" not found in registry. Available types:`, blockRegistry.getAll().map(b => b.type).join(', '));
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const newBlock = {
|
|
94
|
+
id: `block-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
|
|
95
|
+
type,
|
|
96
|
+
data: { ...blockDefinition.defaultData },
|
|
97
|
+
};
|
|
98
|
+
dispatch({ type: 'ADD_BLOCK', payload: { block: newBlock, index, containerId } });
|
|
99
|
+
}, []);
|
|
100
|
+
// Helper: Update a block
|
|
101
|
+
const updateBlock = useCallback((id, data) => {
|
|
102
|
+
dispatch({ type: 'UPDATE_BLOCK', payload: { id, data } });
|
|
103
|
+
}, []);
|
|
104
|
+
// Helper: Delete a block
|
|
105
|
+
const deleteBlock = useCallback((id) => {
|
|
106
|
+
dispatch({ type: 'DELETE_BLOCK', payload: { id } });
|
|
107
|
+
}, []);
|
|
108
|
+
// Helper: Duplicate a block
|
|
109
|
+
const duplicateBlock = useCallback((id) => {
|
|
110
|
+
dispatch({ type: 'DUPLICATE_BLOCK', payload: { id } });
|
|
111
|
+
}, []);
|
|
112
|
+
// Helper: Move a block (supports nested containers)
|
|
113
|
+
const moveBlock = useCallback((id, newIndex, containerId) => {
|
|
114
|
+
dispatch({ type: 'MOVE_BLOCK', payload: { id, newIndex, containerId } });
|
|
115
|
+
}, []);
|
|
116
|
+
// Helper: Load a post
|
|
117
|
+
const loadPost = useCallback((post) => {
|
|
118
|
+
dispatch({ type: 'LOAD_POST', payload: post });
|
|
119
|
+
}, []);
|
|
120
|
+
// Helper: Reset editor
|
|
121
|
+
const resetEditor = useCallback(() => {
|
|
122
|
+
dispatch({ type: 'RESET_EDITOR' });
|
|
123
|
+
}, []);
|
|
124
|
+
// Helper: Save
|
|
125
|
+
// Uses stateRef to always get the latest state, avoiding stale closure issues
|
|
126
|
+
const save = useCallback(async (heroBlock) => {
|
|
127
|
+
if (onSave) {
|
|
128
|
+
// Use stateRef.current to get the absolute latest state
|
|
129
|
+
// This ensures we don't have stale closure issues with React state updates
|
|
130
|
+
await onSave(stateRef.current, heroBlock);
|
|
131
|
+
dispatch({ type: 'MARK_CLEAN' });
|
|
132
|
+
}
|
|
133
|
+
}, [onSave]);
|
|
134
|
+
// Helper: Undo
|
|
135
|
+
const undo = useCallback(() => {
|
|
136
|
+
if (historyIndex > 0 && history.length > 0) {
|
|
137
|
+
const previousState = history[historyIndex - 1];
|
|
138
|
+
if (previousState) {
|
|
139
|
+
isRestoringRef.current = true;
|
|
140
|
+
setHistoryIndex(prev => prev - 1);
|
|
141
|
+
dispatch({ type: 'LOAD_POST', payload: {
|
|
142
|
+
id: previousState.postId || '',
|
|
143
|
+
title: previousState.title,
|
|
144
|
+
slug: previousState.slug,
|
|
145
|
+
blocks: previousState.blocks,
|
|
146
|
+
seo: previousState.seo,
|
|
147
|
+
publication: {
|
|
148
|
+
status: previousState.status,
|
|
149
|
+
authorId: undefined,
|
|
150
|
+
},
|
|
151
|
+
metadata: previousState.metadata,
|
|
152
|
+
createdAt: new Date().toISOString(),
|
|
153
|
+
updatedAt: new Date().toISOString(),
|
|
154
|
+
} });
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}, [history, historyIndex, dispatch]);
|
|
158
|
+
// Helper: Redo
|
|
159
|
+
const redo = useCallback(() => {
|
|
160
|
+
if (historyIndex < history.length - 1) {
|
|
161
|
+
const nextState = history[historyIndex + 1];
|
|
162
|
+
if (nextState) {
|
|
163
|
+
isRestoringRef.current = true;
|
|
164
|
+
setHistoryIndex(prev => prev + 1);
|
|
165
|
+
dispatch({ type: 'LOAD_POST', payload: {
|
|
166
|
+
id: nextState.postId || '',
|
|
167
|
+
title: nextState.title,
|
|
168
|
+
slug: nextState.slug,
|
|
169
|
+
blocks: nextState.blocks,
|
|
170
|
+
seo: nextState.seo,
|
|
171
|
+
publication: {
|
|
172
|
+
status: nextState.status,
|
|
173
|
+
authorId: undefined,
|
|
174
|
+
},
|
|
175
|
+
metadata: nextState.metadata,
|
|
176
|
+
createdAt: new Date().toISOString(),
|
|
177
|
+
updatedAt: new Date().toISOString(),
|
|
178
|
+
} });
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}, [history, historyIndex, dispatch]);
|
|
182
|
+
// Memoize the context value
|
|
183
|
+
const value = useMemo(() => ({
|
|
184
|
+
state,
|
|
185
|
+
dispatch,
|
|
186
|
+
darkMode,
|
|
187
|
+
backgroundColors,
|
|
188
|
+
helpers: {
|
|
189
|
+
addBlock,
|
|
190
|
+
updateBlock,
|
|
191
|
+
deleteBlock,
|
|
192
|
+
duplicateBlock,
|
|
193
|
+
moveBlock,
|
|
194
|
+
loadPost,
|
|
195
|
+
resetEditor,
|
|
196
|
+
save,
|
|
197
|
+
undo,
|
|
198
|
+
redo,
|
|
199
|
+
},
|
|
200
|
+
canUndo: historyIndex > 0 && history.length > 0,
|
|
201
|
+
canRedo: historyIndex < history.length - 1,
|
|
202
|
+
}), [state, dispatch, darkMode, backgroundColors, addBlock, updateBlock, deleteBlock, duplicateBlock, moveBlock, loadPost, resetEditor, save, undo, redo, historyIndex, history.length]);
|
|
203
|
+
return _jsx(EditorContext.Provider, { value: value, children: children });
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Hook to access editor context
|
|
207
|
+
* @throws Error if used outside EditorProvider
|
|
208
|
+
*/
|
|
209
|
+
export function useEditor() {
|
|
210
|
+
const context = useContext(EditorContext);
|
|
211
|
+
if (!context) {
|
|
212
|
+
throw new Error('useEditor must be used within an EditorProvider');
|
|
213
|
+
}
|
|
214
|
+
return context;
|
|
215
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/state/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Editor Reducer
|
|
3
|
+
* Pure function that handles state transitions
|
|
4
|
+
*/
|
|
5
|
+
import { EditorState, EditorAction } from './types';
|
|
6
|
+
/**
|
|
7
|
+
* Editor Reducer
|
|
8
|
+
* Handles all state transitions for the editor
|
|
9
|
+
*/
|
|
10
|
+
export declare function editorReducer(state: EditorState, action: EditorAction): EditorState;
|
|
11
|
+
//# sourceMappingURL=reducer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../src/state/reducer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAsB,MAAM,SAAS,CAAC;AAqUxE;;;GAGG;AACH,wBAAgB,aAAa,CACzB,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,YAAY,GACrB,WAAW,CAmWb"}
|