@jhits/plugin-blog 0.0.8 → 0.0.10
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 +4 -4
- 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,599 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Editor Reducer
|
|
3
|
+
* Pure function that handles state transitions
|
|
4
|
+
*/
|
|
5
|
+
import { initialEditorState } from './types';
|
|
6
|
+
/**
|
|
7
|
+
* Generate a unique block ID
|
|
8
|
+
*/
|
|
9
|
+
function generateBlockId() {
|
|
10
|
+
// Use crypto.randomUUID if available, otherwise fallback to timestamp-based
|
|
11
|
+
if (typeof crypto !== 'undefined' && crypto.randomUUID) {
|
|
12
|
+
return crypto.randomUUID();
|
|
13
|
+
}
|
|
14
|
+
return `block-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Clone a block with a new ID
|
|
18
|
+
*/
|
|
19
|
+
function cloneBlock(block) {
|
|
20
|
+
return {
|
|
21
|
+
...block,
|
|
22
|
+
id: generateBlockId(),
|
|
23
|
+
data: { ...block.data },
|
|
24
|
+
meta: block.meta ? { ...block.meta } : undefined,
|
|
25
|
+
children: block.children ? (Array.isArray(block.children[0])
|
|
26
|
+
? block.children.map(cloneBlock)
|
|
27
|
+
: [...block.children]) : undefined,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Find a block by ID recursively (including nested blocks)
|
|
32
|
+
*/
|
|
33
|
+
function findBlockById(blocks, id) {
|
|
34
|
+
for (const block of blocks) {
|
|
35
|
+
if (block.id === id) {
|
|
36
|
+
return block;
|
|
37
|
+
}
|
|
38
|
+
if (block.children && Array.isArray(block.children) && block.children.length > 0) {
|
|
39
|
+
// Check if children are Block objects or IDs
|
|
40
|
+
if (typeof block.children[0] === 'object') {
|
|
41
|
+
const found = findBlockById(block.children, id);
|
|
42
|
+
if (found)
|
|
43
|
+
return found;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Update blocks recursively to add a block to a container
|
|
51
|
+
*/
|
|
52
|
+
function addBlockToContainer(blocks, containerId, newBlock, index) {
|
|
53
|
+
return blocks.map(block => {
|
|
54
|
+
// Check if this is the container (exact match or column container like "block-123-col-0")
|
|
55
|
+
const isContainer = block.id === containerId;
|
|
56
|
+
const isColumnContainer = containerId.startsWith(`${block.id}-col-`);
|
|
57
|
+
if (isContainer) {
|
|
58
|
+
// Direct container match
|
|
59
|
+
const currentChildren = Array.isArray(block.children)
|
|
60
|
+
? (typeof block.children[0] === 'object'
|
|
61
|
+
? block.children
|
|
62
|
+
: [])
|
|
63
|
+
: [];
|
|
64
|
+
const updatedChildren = [...currentChildren];
|
|
65
|
+
if (index !== undefined && index >= 0 && index <= updatedChildren.length) {
|
|
66
|
+
updatedChildren.splice(index, 0, newBlock);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
updatedChildren.push(newBlock);
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
...block,
|
|
73
|
+
children: updatedChildren,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
else if (isColumnContainer) {
|
|
77
|
+
// Column container - extract column index and store in block meta
|
|
78
|
+
const columnIndex = parseInt(containerId.split('-col-')[1] || '0', 10);
|
|
79
|
+
newBlock.meta = {
|
|
80
|
+
...newBlock.meta,
|
|
81
|
+
columnIndex,
|
|
82
|
+
};
|
|
83
|
+
const currentChildren = Array.isArray(block.children)
|
|
84
|
+
? (typeof block.children[0] === 'object'
|
|
85
|
+
? block.children
|
|
86
|
+
: [])
|
|
87
|
+
: [];
|
|
88
|
+
const updatedChildren = [...currentChildren];
|
|
89
|
+
if (index !== undefined && index >= 0 && index <= updatedChildren.length) {
|
|
90
|
+
updatedChildren.splice(index, 0, newBlock);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
updatedChildren.push(newBlock);
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
...block,
|
|
97
|
+
children: updatedChildren,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
// Recursively search nested blocks
|
|
101
|
+
if (block.children && Array.isArray(block.children) && block.children.length > 0) {
|
|
102
|
+
if (typeof block.children[0] === 'object') {
|
|
103
|
+
return {
|
|
104
|
+
...block,
|
|
105
|
+
children: addBlockToContainer(block.children, containerId, newBlock, index),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return block;
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Update blocks recursively to update a nested block
|
|
114
|
+
*/
|
|
115
|
+
function updateNestedBlock(blocks, id, data) {
|
|
116
|
+
return blocks.map(block => {
|
|
117
|
+
if (block.id === id) {
|
|
118
|
+
return {
|
|
119
|
+
...block,
|
|
120
|
+
data: { ...block.data, ...data },
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
if (block.children && Array.isArray(block.children) && block.children.length > 0) {
|
|
124
|
+
if (typeof block.children[0] === 'object') {
|
|
125
|
+
return {
|
|
126
|
+
...block,
|
|
127
|
+
children: updateNestedBlock(block.children, id, data),
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return block;
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Update blocks recursively to delete a nested block
|
|
136
|
+
*/
|
|
137
|
+
function deleteNestedBlock(blocks, id) {
|
|
138
|
+
return blocks
|
|
139
|
+
.filter(block => block.id !== id)
|
|
140
|
+
.map(block => {
|
|
141
|
+
if (block.children && Array.isArray(block.children) && block.children.length > 0) {
|
|
142
|
+
if (typeof block.children[0] === 'object') {
|
|
143
|
+
return {
|
|
144
|
+
...block,
|
|
145
|
+
children: deleteNestedBlock(block.children, id),
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return block;
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Find and remove a block from wherever it is (root or nested)
|
|
154
|
+
*/
|
|
155
|
+
function removeBlockFromTree(blocks, blockId) {
|
|
156
|
+
let removedBlock = null;
|
|
157
|
+
console.log('[removeBlockFromTree] Searching for block:', {
|
|
158
|
+
blockId,
|
|
159
|
+
rootBlocks: blocks.map(b => ({ id: b.id, type: b.type })),
|
|
160
|
+
});
|
|
161
|
+
// First check root level
|
|
162
|
+
const rootIndex = blocks.findIndex(b => b.id === blockId);
|
|
163
|
+
if (rootIndex !== -1) {
|
|
164
|
+
removedBlock = blocks[rootIndex];
|
|
165
|
+
console.log('[removeBlockFromTree] Found at root level:', {
|
|
166
|
+
blockId,
|
|
167
|
+
index: rootIndex,
|
|
168
|
+
block: { id: removedBlock.id, type: removedBlock.type },
|
|
169
|
+
});
|
|
170
|
+
return {
|
|
171
|
+
updatedBlocks: blocks.filter((_, i) => i !== rootIndex),
|
|
172
|
+
removedBlock,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
// Then check nested blocks
|
|
176
|
+
const updatedBlocks = blocks.map(block => {
|
|
177
|
+
if (block.children && Array.isArray(block.children) && block.children.length > 0) {
|
|
178
|
+
if (typeof block.children[0] === 'object') {
|
|
179
|
+
const children = block.children;
|
|
180
|
+
const childIndex = children.findIndex(b => b.id === blockId);
|
|
181
|
+
if (childIndex !== -1) {
|
|
182
|
+
removedBlock = children[childIndex];
|
|
183
|
+
console.log('[removeBlockFromTree] Found in nested container:', {
|
|
184
|
+
blockId,
|
|
185
|
+
containerId: block.id,
|
|
186
|
+
containerType: block.type,
|
|
187
|
+
childIndex,
|
|
188
|
+
block: { id: removedBlock.id, type: removedBlock.type },
|
|
189
|
+
});
|
|
190
|
+
return {
|
|
191
|
+
...block,
|
|
192
|
+
children: children.filter((_, i) => i !== childIndex),
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
// Recursively search nested children
|
|
196
|
+
const { updatedBlocks: updatedChildren, removedBlock: foundBlock } = removeBlockFromTree(children, blockId);
|
|
197
|
+
if (foundBlock) {
|
|
198
|
+
removedBlock = foundBlock;
|
|
199
|
+
console.log('[removeBlockFromTree] Found in deeper nesting:', {
|
|
200
|
+
blockId,
|
|
201
|
+
containerId: block.id,
|
|
202
|
+
block: { id: removedBlock.id, type: removedBlock.type },
|
|
203
|
+
});
|
|
204
|
+
return {
|
|
205
|
+
...block,
|
|
206
|
+
children: updatedChildren,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return block;
|
|
212
|
+
});
|
|
213
|
+
if (!removedBlock) {
|
|
214
|
+
console.warn('[removeBlockFromTree] Block not found in tree:', { blockId });
|
|
215
|
+
}
|
|
216
|
+
return { updatedBlocks, removedBlock };
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Update blocks recursively to move a nested block within the same container
|
|
220
|
+
*/
|
|
221
|
+
function moveNestedBlock(blocks, containerId, blockId, newIndex) {
|
|
222
|
+
return blocks.map(block => {
|
|
223
|
+
if (block.id === containerId && block.children && Array.isArray(block.children)) {
|
|
224
|
+
const children = typeof block.children[0] === 'object'
|
|
225
|
+
? block.children
|
|
226
|
+
: [];
|
|
227
|
+
const currentIndex = children.findIndex(b => b.id === blockId);
|
|
228
|
+
if (currentIndex !== -1 && newIndex >= 0 && newIndex < children.length) {
|
|
229
|
+
const updatedChildren = [...children];
|
|
230
|
+
const [movedBlock] = updatedChildren.splice(currentIndex, 1);
|
|
231
|
+
updatedChildren.splice(newIndex, 0, movedBlock);
|
|
232
|
+
return {
|
|
233
|
+
...block,
|
|
234
|
+
children: updatedChildren,
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
if (block.children && Array.isArray(block.children) && block.children.length > 0) {
|
|
239
|
+
if (typeof block.children[0] === 'object') {
|
|
240
|
+
return {
|
|
241
|
+
...block,
|
|
242
|
+
children: moveNestedBlock(block.children, containerId, blockId, newIndex),
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return block;
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Move a block to a container (handles cross-container moves)
|
|
251
|
+
*/
|
|
252
|
+
function moveBlockToContainer(blocks, blockId, containerId, newIndex) {
|
|
253
|
+
console.log('[moveBlockToContainer] Starting move:', {
|
|
254
|
+
blockId,
|
|
255
|
+
containerId,
|
|
256
|
+
newIndex,
|
|
257
|
+
});
|
|
258
|
+
// First, find and remove the block from wherever it is
|
|
259
|
+
const { updatedBlocks, removedBlock } = removeBlockFromTree(blocks, blockId);
|
|
260
|
+
if (!removedBlock) {
|
|
261
|
+
// Block not found, return unchanged
|
|
262
|
+
console.warn('[moveBlockToContainer] Block not found, cannot move');
|
|
263
|
+
return blocks;
|
|
264
|
+
}
|
|
265
|
+
console.log('[moveBlockToContainer] Block removed, now adding to container:', {
|
|
266
|
+
removedBlock: { id: removedBlock.id, type: removedBlock.type },
|
|
267
|
+
containerId,
|
|
268
|
+
newIndex,
|
|
269
|
+
});
|
|
270
|
+
// Handle column containers
|
|
271
|
+
const isColumnContainer = containerId.includes('-col-');
|
|
272
|
+
if (isColumnContainer) {
|
|
273
|
+
const [parentId, columnPart] = containerId.split('-col-');
|
|
274
|
+
const columnIndex = parseInt(columnPart || '0', 10);
|
|
275
|
+
removedBlock.meta = {
|
|
276
|
+
...removedBlock.meta,
|
|
277
|
+
columnIndex,
|
|
278
|
+
};
|
|
279
|
+
console.log('[moveBlockToContainer] Setting column index:', { columnIndex });
|
|
280
|
+
}
|
|
281
|
+
// Now add the block to the target container
|
|
282
|
+
const result = addBlockToContainer(updatedBlocks, containerId, removedBlock, newIndex);
|
|
283
|
+
console.log('[moveBlockToContainer] Move complete:', {
|
|
284
|
+
resultBlocks: result.map(b => ({ id: b.id, type: b.type })),
|
|
285
|
+
});
|
|
286
|
+
return result;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Editor Reducer
|
|
290
|
+
* Handles all state transitions for the editor
|
|
291
|
+
*/
|
|
292
|
+
export function editorReducer(state, action) {
|
|
293
|
+
switch (action.type) {
|
|
294
|
+
case 'SET_BLOCKS':
|
|
295
|
+
return {
|
|
296
|
+
...state,
|
|
297
|
+
blocks: action.payload,
|
|
298
|
+
isDirty: true,
|
|
299
|
+
};
|
|
300
|
+
case 'ADD_BLOCK': {
|
|
301
|
+
const { block, index, containerId } = action.payload;
|
|
302
|
+
const newBlock = {
|
|
303
|
+
...block,
|
|
304
|
+
id: block.id || generateBlockId(),
|
|
305
|
+
};
|
|
306
|
+
// If containerId is provided, add to container's children
|
|
307
|
+
if (containerId) {
|
|
308
|
+
const updatedBlocks = addBlockToContainer(state.blocks, containerId, newBlock, index);
|
|
309
|
+
return {
|
|
310
|
+
...state,
|
|
311
|
+
blocks: updatedBlocks,
|
|
312
|
+
selectedBlockId: newBlock.id,
|
|
313
|
+
isDirty: true,
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
// Otherwise, add to root level
|
|
317
|
+
const newBlocks = [...state.blocks];
|
|
318
|
+
if (index !== undefined && index >= 0 && index <= newBlocks.length) {
|
|
319
|
+
newBlocks.splice(index, 0, newBlock);
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
newBlocks.push(newBlock);
|
|
323
|
+
}
|
|
324
|
+
return {
|
|
325
|
+
...state,
|
|
326
|
+
blocks: newBlocks,
|
|
327
|
+
selectedBlockId: newBlock.id,
|
|
328
|
+
isDirty: true,
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
case 'UPDATE_BLOCK': {
|
|
332
|
+
const { id, data } = action.payload;
|
|
333
|
+
// Check if block is at root level
|
|
334
|
+
const rootBlock = state.blocks.find(block => block.id === id);
|
|
335
|
+
if (rootBlock) {
|
|
336
|
+
const newBlocks = state.blocks.map(block => block.id === id
|
|
337
|
+
? {
|
|
338
|
+
...block,
|
|
339
|
+
data: { ...block.data, ...data },
|
|
340
|
+
}
|
|
341
|
+
: block);
|
|
342
|
+
return {
|
|
343
|
+
...state,
|
|
344
|
+
blocks: newBlocks,
|
|
345
|
+
isDirty: true,
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
// Otherwise, update nested block
|
|
349
|
+
const newBlocks = updateNestedBlock(state.blocks, id, data);
|
|
350
|
+
return {
|
|
351
|
+
...state,
|
|
352
|
+
blocks: newBlocks,
|
|
353
|
+
isDirty: true,
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
case 'DELETE_BLOCK': {
|
|
357
|
+
const { id } = action.payload;
|
|
358
|
+
// Check if block is at root level
|
|
359
|
+
const rootBlock = state.blocks.find(block => block.id === id);
|
|
360
|
+
if (rootBlock) {
|
|
361
|
+
const newBlocks = state.blocks.filter(block => block.id !== id);
|
|
362
|
+
const wasSelected = state.selectedBlockId === id;
|
|
363
|
+
return {
|
|
364
|
+
...state,
|
|
365
|
+
blocks: newBlocks,
|
|
366
|
+
selectedBlockId: wasSelected ? null : state.selectedBlockId,
|
|
367
|
+
isDirty: true,
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
// Otherwise, delete nested block
|
|
371
|
+
const newBlocks = deleteNestedBlock(state.blocks, id);
|
|
372
|
+
const wasSelected = state.selectedBlockId === id;
|
|
373
|
+
return {
|
|
374
|
+
...state,
|
|
375
|
+
blocks: newBlocks,
|
|
376
|
+
selectedBlockId: wasSelected ? null : state.selectedBlockId,
|
|
377
|
+
isDirty: true,
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
case 'DUPLICATE_BLOCK': {
|
|
381
|
+
const { id } = action.payload;
|
|
382
|
+
const blockIndex = state.blocks.findIndex(block => block.id === id);
|
|
383
|
+
if (blockIndex === -1) {
|
|
384
|
+
return state;
|
|
385
|
+
}
|
|
386
|
+
const blockToDuplicate = state.blocks[blockIndex];
|
|
387
|
+
const duplicatedBlock = cloneBlock(blockToDuplicate);
|
|
388
|
+
const newBlocks = [...state.blocks];
|
|
389
|
+
newBlocks.splice(blockIndex + 1, 0, duplicatedBlock);
|
|
390
|
+
return {
|
|
391
|
+
...state,
|
|
392
|
+
blocks: newBlocks,
|
|
393
|
+
selectedBlockId: duplicatedBlock.id,
|
|
394
|
+
isDirty: true,
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
case 'MOVE_BLOCK': {
|
|
398
|
+
const { id, newIndex, containerId: rawContainerId } = action.payload;
|
|
399
|
+
// Normalize 'root' string to undefined
|
|
400
|
+
const containerId = rawContainerId === 'root' || rawContainerId === undefined ? undefined : rawContainerId;
|
|
401
|
+
console.log('[Reducer] MOVE_BLOCK action:', {
|
|
402
|
+
blockId: id,
|
|
403
|
+
newIndex,
|
|
404
|
+
rawContainerId,
|
|
405
|
+
normalizedContainerId: containerId || 'root',
|
|
406
|
+
currentRootBlocks: state.blocks.map(b => ({ id: b.id, type: b.type, hasChildren: !!b.children })),
|
|
407
|
+
});
|
|
408
|
+
// If containerId is provided (and not 'root'), move to/within container
|
|
409
|
+
if (containerId) {
|
|
410
|
+
// First check if block is already in this container
|
|
411
|
+
const containerBlock = findBlockById(state.blocks, containerId);
|
|
412
|
+
console.log('[Reducer] Container lookup:', {
|
|
413
|
+
containerId,
|
|
414
|
+
found: !!containerBlock,
|
|
415
|
+
hasChildren: containerBlock?.children ? Array.isArray(containerBlock.children) : false,
|
|
416
|
+
});
|
|
417
|
+
if (containerBlock && containerBlock.children && Array.isArray(containerBlock.children)) {
|
|
418
|
+
const children = typeof containerBlock.children[0] === 'object'
|
|
419
|
+
? containerBlock.children
|
|
420
|
+
: [];
|
|
421
|
+
const currentIndex = children.findIndex(b => b.id === id);
|
|
422
|
+
console.log('[Reducer] Block in container check:', {
|
|
423
|
+
blockId: id,
|
|
424
|
+
currentIndex,
|
|
425
|
+
containerChildren: children.map(b => ({ id: b.id, type: b.type })),
|
|
426
|
+
});
|
|
427
|
+
if (currentIndex !== -1) {
|
|
428
|
+
// Block is already in this container - move within container
|
|
429
|
+
console.log('[Reducer] Moving within container');
|
|
430
|
+
const newBlocks = moveNestedBlock(state.blocks, containerId, id, newIndex);
|
|
431
|
+
console.log('[Reducer] After move within container:', {
|
|
432
|
+
newRootBlocks: newBlocks.map(b => ({ id: b.id, type: b.type })),
|
|
433
|
+
});
|
|
434
|
+
return {
|
|
435
|
+
...state,
|
|
436
|
+
blocks: newBlocks,
|
|
437
|
+
isDirty: true,
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
// Block is not in this container - move it from wherever it is (root or nested)
|
|
442
|
+
console.log('[Reducer] Moving block to container from elsewhere');
|
|
443
|
+
const newBlocks = moveBlockToContainer(state.blocks, id, containerId, newIndex);
|
|
444
|
+
console.log('[Reducer] After move to container:', {
|
|
445
|
+
newRootBlocks: newBlocks.map(b => ({ id: b.id, type: b.type })),
|
|
446
|
+
});
|
|
447
|
+
return {
|
|
448
|
+
...state,
|
|
449
|
+
blocks: newBlocks,
|
|
450
|
+
isDirty: true,
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
// Moving to root level (containerId is undefined)
|
|
454
|
+
const currentIndex = state.blocks.findIndex(block => block.id === id);
|
|
455
|
+
console.log('[Reducer] Moving to root level:', {
|
|
456
|
+
blockId: id,
|
|
457
|
+
currentIndex,
|
|
458
|
+
isInRoot: currentIndex !== -1,
|
|
459
|
+
newIndex,
|
|
460
|
+
rootBlocksCount: state.blocks.length,
|
|
461
|
+
});
|
|
462
|
+
if (currentIndex !== -1) {
|
|
463
|
+
// Block is already at root level - move within root
|
|
464
|
+
if (newIndex < 0 || newIndex >= state.blocks.length) {
|
|
465
|
+
console.warn('[Reducer] Invalid newIndex for root move:', { newIndex, blocksLength: state.blocks.length });
|
|
466
|
+
return state;
|
|
467
|
+
}
|
|
468
|
+
console.log('[Reducer] Moving within root level');
|
|
469
|
+
const newBlocks = [...state.blocks];
|
|
470
|
+
const [movedBlock] = newBlocks.splice(currentIndex, 1);
|
|
471
|
+
newBlocks.splice(newIndex, 0, movedBlock);
|
|
472
|
+
console.log('[Reducer] After move within root:', {
|
|
473
|
+
newRootBlocks: newBlocks.map(b => ({ id: b.id, type: b.type })),
|
|
474
|
+
});
|
|
475
|
+
return {
|
|
476
|
+
...state,
|
|
477
|
+
blocks: newBlocks,
|
|
478
|
+
isDirty: true,
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
// Block is nested somewhere - move it to root level
|
|
482
|
+
console.log('[Reducer] Block is nested, removing from tree and adding to root');
|
|
483
|
+
const { updatedBlocks, removedBlock } = removeBlockFromTree(state.blocks, id);
|
|
484
|
+
console.log('[Reducer] Block removal result:', {
|
|
485
|
+
removedBlock: removedBlock ? { id: removedBlock.id, type: removedBlock.type } : null,
|
|
486
|
+
updatedBlocksCount: updatedBlocks.length,
|
|
487
|
+
});
|
|
488
|
+
if (removedBlock) {
|
|
489
|
+
// Clear any nested metadata (like columnIndex)
|
|
490
|
+
const cleanedBlock = {
|
|
491
|
+
...removedBlock,
|
|
492
|
+
meta: removedBlock.meta ? {
|
|
493
|
+
...removedBlock.meta,
|
|
494
|
+
columnIndex: undefined,
|
|
495
|
+
} : undefined,
|
|
496
|
+
};
|
|
497
|
+
const newBlocks = [...updatedBlocks];
|
|
498
|
+
if (newIndex >= 0 && newIndex <= newBlocks.length) {
|
|
499
|
+
newBlocks.splice(newIndex, 0, cleanedBlock);
|
|
500
|
+
}
|
|
501
|
+
else {
|
|
502
|
+
newBlocks.push(cleanedBlock);
|
|
503
|
+
}
|
|
504
|
+
console.log('[Reducer] After move nested to root:', {
|
|
505
|
+
newRootBlocks: newBlocks.map(b => ({ id: b.id, type: b.type })),
|
|
506
|
+
insertedAt: newIndex >= 0 && newIndex <= updatedBlocks.length ? newIndex : newBlocks.length - 1,
|
|
507
|
+
});
|
|
508
|
+
return {
|
|
509
|
+
...state,
|
|
510
|
+
blocks: newBlocks,
|
|
511
|
+
isDirty: true,
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
console.warn('[Reducer] Block not found in tree:', { blockId: id });
|
|
515
|
+
return state;
|
|
516
|
+
}
|
|
517
|
+
case 'SET_TITLE':
|
|
518
|
+
return {
|
|
519
|
+
...state,
|
|
520
|
+
title: action.payload,
|
|
521
|
+
isDirty: true,
|
|
522
|
+
};
|
|
523
|
+
case 'SET_SLUG':
|
|
524
|
+
return {
|
|
525
|
+
...state,
|
|
526
|
+
slug: action.payload,
|
|
527
|
+
isDirty: true,
|
|
528
|
+
};
|
|
529
|
+
case 'SET_SEO':
|
|
530
|
+
return {
|
|
531
|
+
...state,
|
|
532
|
+
seo: { ...state.seo, ...action.payload },
|
|
533
|
+
isDirty: true,
|
|
534
|
+
};
|
|
535
|
+
case 'SET_METADATA':
|
|
536
|
+
return {
|
|
537
|
+
...state,
|
|
538
|
+
metadata: { ...state.metadata, ...action.payload },
|
|
539
|
+
isDirty: true,
|
|
540
|
+
};
|
|
541
|
+
case 'SET_STATUS':
|
|
542
|
+
return {
|
|
543
|
+
...state,
|
|
544
|
+
status: action.payload,
|
|
545
|
+
isDirty: true,
|
|
546
|
+
};
|
|
547
|
+
case 'SET_FOCUS_MODE':
|
|
548
|
+
return {
|
|
549
|
+
...state,
|
|
550
|
+
focusMode: action.payload,
|
|
551
|
+
};
|
|
552
|
+
case 'SELECT_BLOCK':
|
|
553
|
+
return {
|
|
554
|
+
...state,
|
|
555
|
+
selectedBlockId: action.payload,
|
|
556
|
+
};
|
|
557
|
+
case 'SET_DRAGGED_BLOCK':
|
|
558
|
+
return {
|
|
559
|
+
...state,
|
|
560
|
+
draggedBlockId: action.payload,
|
|
561
|
+
};
|
|
562
|
+
case 'LOAD_POST': {
|
|
563
|
+
const post = action.payload;
|
|
564
|
+
return {
|
|
565
|
+
...state,
|
|
566
|
+
blocks: post.blocks,
|
|
567
|
+
title: post.title,
|
|
568
|
+
slug: post.slug,
|
|
569
|
+
seo: post.seo,
|
|
570
|
+
metadata: post.metadata,
|
|
571
|
+
status: post.publication.status,
|
|
572
|
+
postId: post.id,
|
|
573
|
+
isDirty: false,
|
|
574
|
+
selectedBlockId: null,
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
case 'RESET_EDITOR':
|
|
578
|
+
return {
|
|
579
|
+
...initialEditorState,
|
|
580
|
+
};
|
|
581
|
+
case 'MARK_CLEAN':
|
|
582
|
+
return {
|
|
583
|
+
...state,
|
|
584
|
+
isDirty: false,
|
|
585
|
+
};
|
|
586
|
+
case 'MARK_DIRTY':
|
|
587
|
+
return {
|
|
588
|
+
...state,
|
|
589
|
+
isDirty: true,
|
|
590
|
+
};
|
|
591
|
+
case 'UNDO':
|
|
592
|
+
case 'REDO':
|
|
593
|
+
case 'SAVE_HISTORY':
|
|
594
|
+
// These are handled by the context, not the reducer
|
|
595
|
+
return state;
|
|
596
|
+
default:
|
|
597
|
+
return state;
|
|
598
|
+
}
|
|
599
|
+
}
|