@jhits/plugin-blog 0.0.10 → 0.0.11
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/package.json +4 -5
- package/src/api/categories.ts +0 -43
- package/src/api/check-title.ts +0 -60
- package/src/api/config-handler.ts +0 -76
- package/src/api/handler.ts +0 -418
- package/src/api/index.ts +0 -33
- package/src/api/route.ts +0 -116
- package/src/api/router.ts +0 -128
- package/src/api-server.ts +0 -11
- package/src/config.ts +0 -161
- package/src/hooks/index.d.ts +0 -8
- package/src/hooks/index.d.ts.map +0 -1
- package/src/hooks/index.js +0 -7
- package/src/hooks/index.ts +0 -9
- package/src/hooks/useBlog.d.ts +0 -31
- package/src/hooks/useBlog.d.ts.map +0 -1
- package/src/hooks/useBlog.js +0 -57
- package/src/hooks/useBlog.ts +0 -85
- package/src/hooks/useBlogs.d.ts +0 -39
- package/src/hooks/useBlogs.d.ts.map +0 -1
- package/src/hooks/useBlogs.js +0 -82
- package/src/hooks/useBlogs.ts +0 -123
- package/src/hooks/useCategories.d.ts +0 -9
- package/src/hooks/useCategories.d.ts.map +0 -1
- package/src/hooks/useCategories.js +0 -70
- package/src/hooks/useCategories.ts +0 -76
- package/src/index.d.ts +0 -55
- package/src/index.d.ts.map +0 -1
- package/src/index.js +0 -228
- package/src/index.server.ts +0 -14
- package/src/index.tsx +0 -335
- package/src/init.d.ts +0 -40
- package/src/init.d.ts.map +0 -1
- package/src/init.js +0 -41
- package/src/init.tsx +0 -63
- package/src/lib/blocks/BlockRenderer.d.ts +0 -54
- package/src/lib/blocks/BlockRenderer.d.ts.map +0 -1
- package/src/lib/blocks/BlockRenderer.js +0 -54
- package/src/lib/blocks/BlockRenderer.tsx +0 -141
- package/src/lib/blocks/index.ts +0 -6
- package/src/lib/config-storage.d.ts +0 -30
- package/src/lib/config-storage.d.ts.map +0 -1
- package/src/lib/config-storage.js +0 -31
- package/src/lib/config-storage.ts +0 -65
- package/src/lib/index.ts +0 -9
- package/src/lib/layouts/blocks/ColumnsBlock.d.ts +0 -25
- package/src/lib/layouts/blocks/ColumnsBlock.d.ts.map +0 -1
- package/src/lib/layouts/blocks/ColumnsBlock.js +0 -182
- package/src/lib/layouts/blocks/ColumnsBlock.tsx +0 -298
- package/src/lib/layouts/blocks/ColumnsBlock.tsx.tmp +0 -81
- package/src/lib/layouts/blocks/SectionBlock.d.ts +0 -25
- package/src/lib/layouts/blocks/SectionBlock.d.ts.map +0 -1
- package/src/lib/layouts/blocks/SectionBlock.js +0 -44
- package/src/lib/layouts/blocks/SectionBlock.tsx +0 -104
- package/src/lib/layouts/blocks/index.ts +0 -8
- package/src/lib/layouts/index.d.ts +0 -23
- package/src/lib/layouts/index.d.ts.map +0 -1
- package/src/lib/layouts/index.js +0 -45
- package/src/lib/layouts/index.ts +0 -52
- package/src/lib/layouts/registerLayoutBlocks.d.ts +0 -9
- package/src/lib/layouts/registerLayoutBlocks.d.ts.map +0 -1
- package/src/lib/layouts/registerLayoutBlocks.js +0 -60
- package/src/lib/layouts/registerLayoutBlocks.ts +0 -64
- package/src/lib/mappers/apiMapper.d.ts +0 -66
- package/src/lib/mappers/apiMapper.d.ts.map +0 -1
- package/src/lib/mappers/apiMapper.js +0 -191
- package/src/lib/mappers/apiMapper.ts +0 -254
- package/src/lib/migration/index.ts +0 -6
- package/src/lib/migration/mapper.ts +0 -140
- package/src/lib/rich-text/RichTextEditor.d.ts +0 -45
- package/src/lib/rich-text/RichTextEditor.d.ts.map +0 -1
- package/src/lib/rich-text/RichTextEditor.js +0 -564
- package/src/lib/rich-text/RichTextEditor.tsx +0 -826
- package/src/lib/rich-text/RichTextPreview.d.ts +0 -16
- package/src/lib/rich-text/RichTextPreview.d.ts.map +0 -1
- package/src/lib/rich-text/RichTextPreview.js +0 -144
- package/src/lib/rich-text/RichTextPreview.tsx +0 -210
- package/src/lib/rich-text/index.d.ts +0 -9
- package/src/lib/rich-text/index.d.ts.map +0 -1
- package/src/lib/rich-text/index.js +0 -6
- package/src/lib/rich-text/index.ts +0 -10
- package/src/lib/utils/blockHelpers.d.ts +0 -23
- package/src/lib/utils/blockHelpers.d.ts.map +0 -1
- package/src/lib/utils/blockHelpers.js +0 -65
- package/src/lib/utils/blockHelpers.ts +0 -72
- package/src/lib/utils/configValidation.d.ts +0 -23
- package/src/lib/utils/configValidation.d.ts.map +0 -1
- package/src/lib/utils/configValidation.js +0 -113
- package/src/lib/utils/configValidation.ts +0 -137
- package/src/lib/utils/index.ts +0 -8
- package/src/lib/utils/slugify.ts +0 -79
- package/src/registry/BlockRegistry.d.ts +0 -62
- package/src/registry/BlockRegistry.d.ts.map +0 -1
- package/src/registry/BlockRegistry.js +0 -112
- package/src/registry/BlockRegistry.ts +0 -139
- package/src/registry/index.d.ts +0 -6
- package/src/registry/index.d.ts.map +0 -1
- package/src/registry/index.js +0 -4
- package/src/registry/index.ts +0 -11
- package/src/state/EditorContext.d.ts +0 -45
- package/src/state/EditorContext.d.ts.map +0 -1
- package/src/state/EditorContext.js +0 -215
- package/src/state/EditorContext.tsx +0 -283
- package/src/state/index.d.ts +0 -7
- package/src/state/index.d.ts.map +0 -1
- package/src/state/index.js +0 -6
- package/src/state/index.ts +0 -8
- package/src/state/reducer.d.ts +0 -11
- package/src/state/reducer.d.ts.map +0 -1
- package/src/state/reducer.js +0 -443
- package/src/state/reducer.ts +0 -694
- package/src/state/types.d.ts +0 -162
- package/src/state/types.d.ts.map +0 -1
- package/src/state/types.js +0 -27
- package/src/state/types.ts +0 -160
- package/src/types/block.d.ts +0 -221
- package/src/types/block.d.ts.map +0 -1
- package/src/types/block.js +0 -6
- package/src/types/block.ts +0 -269
- package/src/types/index.d.ts +0 -8
- package/src/types/index.d.ts.map +0 -1
- package/src/types/index.js +0 -5
- package/src/types/index.ts +0 -17
- package/src/types/post.d.ts +0 -136
- package/src/types/post.d.ts.map +0 -1
- package/src/types/post.js +0 -5
- package/src/types/post.ts +0 -169
- package/src/utils/client.d.ts +0 -48
- package/src/utils/client.d.ts.map +0 -1
- package/src/utils/client.js +0 -77
- package/src/utils/client.ts +0 -122
- package/src/utils/index.ts +0 -7
- package/src/views/CanvasEditor/BlockWrapper.d.ts +0 -16
- package/src/views/CanvasEditor/BlockWrapper.d.ts.map +0 -1
- package/src/views/CanvasEditor/BlockWrapper.js +0 -276
- package/src/views/CanvasEditor/BlockWrapper.tsx +0 -522
- package/src/views/CanvasEditor/CanvasEditorView.d.ts +0 -14
- package/src/views/CanvasEditor/CanvasEditorView.d.ts.map +0 -1
- package/src/views/CanvasEditor/CanvasEditorView.js +0 -209
- package/src/views/CanvasEditor/CanvasEditorView.tsx +0 -337
- package/src/views/CanvasEditor/EditorBody.d.ts +0 -22
- package/src/views/CanvasEditor/EditorBody.d.ts.map +0 -1
- package/src/views/CanvasEditor/EditorBody.js +0 -505
- package/src/views/CanvasEditor/EditorBody.tsx +0 -665
- package/src/views/CanvasEditor/EditorHeader.d.ts +0 -18
- package/src/views/CanvasEditor/EditorHeader.d.ts.map +0 -1
- package/src/views/CanvasEditor/EditorHeader.js +0 -101
- package/src/views/CanvasEditor/EditorHeader.tsx +0 -268
- package/src/views/CanvasEditor/LayoutContainer.d.ts +0 -17
- package/src/views/CanvasEditor/LayoutContainer.d.ts.map +0 -1
- package/src/views/CanvasEditor/LayoutContainer.js +0 -222
- package/src/views/CanvasEditor/LayoutContainer.tsx +0 -322
- package/src/views/CanvasEditor/SaveConfirmationModal.d.ts +0 -13
- package/src/views/CanvasEditor/SaveConfirmationModal.d.ts.map +0 -1
- package/src/views/CanvasEditor/SaveConfirmationModal.js +0 -78
- package/src/views/CanvasEditor/SaveConfirmationModal.tsx +0 -233
- package/src/views/CanvasEditor/components/CustomBlockItem.d.ts +0 -14
- package/src/views/CanvasEditor/components/CustomBlockItem.d.ts.map +0 -1
- package/src/views/CanvasEditor/components/CustomBlockItem.js +0 -44
- package/src/views/CanvasEditor/components/CustomBlockItem.tsx +0 -92
- package/src/views/CanvasEditor/components/EditorCanvas.d.ts +0 -29
- package/src/views/CanvasEditor/components/EditorCanvas.d.ts.map +0 -1
- package/src/views/CanvasEditor/components/EditorCanvas.js +0 -32
- package/src/views/CanvasEditor/components/EditorCanvas.tsx +0 -160
- package/src/views/CanvasEditor/components/EditorLibrary.d.ts +0 -7
- package/src/views/CanvasEditor/components/EditorLibrary.d.ts.map +0 -1
- package/src/views/CanvasEditor/components/EditorLibrary.js +0 -25
- package/src/views/CanvasEditor/components/EditorLibrary.tsx +0 -122
- package/src/views/CanvasEditor/components/EditorSidebar.d.ts +0 -13
- package/src/views/CanvasEditor/components/EditorSidebar.d.ts.map +0 -1
- package/src/views/CanvasEditor/components/EditorSidebar.js +0 -20
- package/src/views/CanvasEditor/components/EditorSidebar.tsx +0 -181
- package/src/views/CanvasEditor/components/ErrorBanner.d.ts +0 -6
- package/src/views/CanvasEditor/components/ErrorBanner.d.ts.map +0 -1
- package/src/views/CanvasEditor/components/ErrorBanner.js +0 -8
- package/src/views/CanvasEditor/components/ErrorBanner.tsx +0 -31
- package/src/views/CanvasEditor/components/FeaturedMediaSection.d.ts +0 -25
- package/src/views/CanvasEditor/components/FeaturedMediaSection.d.ts.map +0 -1
- package/src/views/CanvasEditor/components/FeaturedMediaSection.js +0 -182
- package/src/views/CanvasEditor/components/FeaturedMediaSection.tsx +0 -341
- package/src/views/CanvasEditor/components/LibraryItem.d.ts +0 -14
- package/src/views/CanvasEditor/components/LibraryItem.d.ts.map +0 -1
- package/src/views/CanvasEditor/components/LibraryItem.js +0 -43
- package/src/views/CanvasEditor/components/LibraryItem.tsx +0 -80
- package/src/views/CanvasEditor/components/PrivacySettingsSection.d.ts +0 -15
- package/src/views/CanvasEditor/components/PrivacySettingsSection.d.ts.map +0 -1
- package/src/views/CanvasEditor/components/PrivacySettingsSection.js +0 -63
- package/src/views/CanvasEditor/components/PrivacySettingsSection.tsx +0 -212
- package/src/views/CanvasEditor/components/index.d.ts +0 -21
- package/src/views/CanvasEditor/components/index.d.ts.map +0 -1
- package/src/views/CanvasEditor/components/index.js +0 -12
- package/src/views/CanvasEditor/components/index.ts +0 -28
- package/src/views/CanvasEditor/hooks/index.d.ts +0 -10
- package/src/views/CanvasEditor/hooks/index.d.ts.map +0 -1
- package/src/views/CanvasEditor/hooks/index.js +0 -9
- package/src/views/CanvasEditor/hooks/index.ts +0 -10
- package/src/views/CanvasEditor/hooks/useHeroBlock.d.ts +0 -8
- package/src/views/CanvasEditor/hooks/useHeroBlock.d.ts.map +0 -1
- package/src/views/CanvasEditor/hooks/useHeroBlock.js +0 -79
- package/src/views/CanvasEditor/hooks/useHeroBlock.ts +0 -103
- package/src/views/CanvasEditor/hooks/useKeyboardShortcuts.d.ts +0 -3
- package/src/views/CanvasEditor/hooks/useKeyboardShortcuts.d.ts.map +0 -1
- package/src/views/CanvasEditor/hooks/useKeyboardShortcuts.js +0 -114
- package/src/views/CanvasEditor/hooks/useKeyboardShortcuts.ts +0 -142
- package/src/views/CanvasEditor/hooks/usePostLoader.d.ts +0 -5
- package/src/views/CanvasEditor/hooks/usePostLoader.d.ts.map +0 -1
- package/src/views/CanvasEditor/hooks/usePostLoader.js +0 -32
- package/src/views/CanvasEditor/hooks/usePostLoader.ts +0 -39
- package/src/views/CanvasEditor/hooks/useRegisteredBlocks.d.ts +0 -2
- package/src/views/CanvasEditor/hooks/useRegisteredBlocks.d.ts.map +0 -1
- package/src/views/CanvasEditor/hooks/useRegisteredBlocks.js +0 -47
- package/src/views/CanvasEditor/hooks/useRegisteredBlocks.ts +0 -55
- package/src/views/CanvasEditor/hooks/useUnsavedChanges.d.ts +0 -25
- package/src/views/CanvasEditor/hooks/useUnsavedChanges.d.ts.map +0 -1
- package/src/views/CanvasEditor/hooks/useUnsavedChanges.js +0 -285
- package/src/views/CanvasEditor/hooks/useUnsavedChanges.ts +0 -339
- package/src/views/CanvasEditor/index.d.ts +0 -16
- package/src/views/CanvasEditor/index.d.ts.map +0 -1
- package/src/views/CanvasEditor/index.js +0 -9
- package/src/views/CanvasEditor/index.ts +0 -16
- package/src/views/PostManager/EmptyState.d.ts +0 -10
- package/src/views/PostManager/EmptyState.d.ts.map +0 -1
- package/src/views/PostManager/EmptyState.js +0 -12
- package/src/views/PostManager/EmptyState.tsx +0 -42
- package/src/views/PostManager/PostActionsMenu.d.ts +0 -12
- package/src/views/PostManager/PostActionsMenu.d.ts.map +0 -1
- package/src/views/PostManager/PostActionsMenu.js +0 -58
- package/src/views/PostManager/PostActionsMenu.tsx +0 -112
- package/src/views/PostManager/PostCards.d.ts +0 -15
- package/src/views/PostManager/PostCards.d.ts.map +0 -1
- package/src/views/PostManager/PostCards.js +0 -79
- package/src/views/PostManager/PostCards.tsx +0 -197
- package/src/views/PostManager/PostFilters.d.ts +0 -16
- package/src/views/PostManager/PostFilters.d.ts.map +0 -1
- package/src/views/PostManager/PostFilters.js +0 -10
- package/src/views/PostManager/PostFilters.tsx +0 -95
- package/src/views/PostManager/PostManagerView.d.ts +0 -11
- package/src/views/PostManager/PostManagerView.d.ts.map +0 -1
- package/src/views/PostManager/PostManagerView.js +0 -174
- package/src/views/PostManager/PostManagerView.tsx +0 -289
- package/src/views/PostManager/PostStats.d.ts +0 -11
- package/src/views/PostManager/PostStats.d.ts.map +0 -1
- package/src/views/PostManager/PostStats.js +0 -46
- package/src/views/PostManager/PostStats.tsx +0 -81
- package/src/views/PostManager/PostTable.d.ts +0 -15
- package/src/views/PostManager/PostTable.d.ts.map +0 -1
- package/src/views/PostManager/PostTable.js +0 -79
- package/src/views/PostManager/PostTable.tsx +0 -230
- package/src/views/PostManager/index.d.ts +0 -12
- package/src/views/PostManager/index.d.ts.map +0 -1
- package/src/views/PostManager/index.js +0 -11
- package/src/views/PostManager/index.ts +0 -15
- package/src/views/Preview/PreviewBridgeView.d.ts +0 -12
- package/src/views/Preview/PreviewBridgeView.d.ts.map +0 -1
- package/src/views/Preview/PreviewBridgeView.js +0 -11
- package/src/views/Preview/PreviewBridgeView.tsx +0 -64
- package/src/views/Preview/index.d.ts +0 -6
- package/src/views/Preview/index.d.ts.map +0 -1
- package/src/views/Preview/index.js +0 -4
- package/src/views/Preview/index.ts +0 -7
- package/src/views/Settings/SettingsView.d.ts +0 -10
- package/src/views/Settings/SettingsView.d.ts.map +0 -1
- package/src/views/Settings/SettingsView.js +0 -111
- package/src/views/Settings/SettingsView.tsx +0 -298
- package/src/views/Settings/index.d.ts +0 -6
- package/src/views/Settings/index.d.ts.map +0 -1
- package/src/views/Settings/index.js +0 -4
- package/src/views/Settings/index.ts +0 -7
- package/src/views/SlugSEO/SlugSEOManagerView.d.ts +0 -12
- package/src/views/SlugSEO/SlugSEOManagerView.d.ts.map +0 -1
- package/src/views/SlugSEO/SlugSEOManagerView.js +0 -11
- package/src/views/SlugSEO/SlugSEOManagerView.tsx +0 -94
- package/src/views/SlugSEO/index.d.ts +0 -6
- package/src/views/SlugSEO/index.d.ts.map +0 -1
- package/src/views/SlugSEO/index.js +0 -4
- package/src/views/SlugSEO/index.ts +0 -7
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CustomBlockItem.d.ts","sourceRoot":"","sources":["CustomBlockItem.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAGhD,MAAM,WAAW,oBAAoB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAC5B,SAAS,EACT,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,UAAU,EACb,EAAE,oBAAoB,2CAmEtB"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useState, useRef } from 'react';
|
|
4
|
-
import { GripVertical } from 'lucide-react';
|
|
5
|
-
/**
|
|
6
|
-
* Custom Block Item Component
|
|
7
|
-
* Draggable custom block from client registry and clickable to add at bottom
|
|
8
|
-
*/
|
|
9
|
-
export function CustomBlockItem({ blockType, name, description, icon, onAddBlock }) {
|
|
10
|
-
const [hasDragged, setHasDragged] = useState(false);
|
|
11
|
-
const mouseDownRef = useRef(null);
|
|
12
|
-
const handleDragStart = (e) => {
|
|
13
|
-
e.dataTransfer.setData('block-type', blockType);
|
|
14
|
-
e.dataTransfer.effectAllowed = 'move';
|
|
15
|
-
setHasDragged(true); // Mark as dragged when drag starts
|
|
16
|
-
};
|
|
17
|
-
const handleMouseDown = (e) => {
|
|
18
|
-
// Track mouse position on mousedown
|
|
19
|
-
mouseDownRef.current = { x: e.clientX, y: e.clientY };
|
|
20
|
-
setHasDragged(false); // Reset drag state
|
|
21
|
-
};
|
|
22
|
-
const handleMouseMove = (e) => {
|
|
23
|
-
// If mouse moved more than 5px, consider it a drag
|
|
24
|
-
if (mouseDownRef.current) {
|
|
25
|
-
const dx = Math.abs(e.clientX - mouseDownRef.current.x);
|
|
26
|
-
const dy = Math.abs(e.clientY - mouseDownRef.current.y);
|
|
27
|
-
if (dx > 5 || dy > 5) {
|
|
28
|
-
setHasDragged(true);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
const handleClick = (e) => {
|
|
33
|
-
// Only add block if we didn't drag
|
|
34
|
-
if (!hasDragged && onAddBlock) {
|
|
35
|
-
e.preventDefault();
|
|
36
|
-
e.stopPropagation();
|
|
37
|
-
onAddBlock(blockType);
|
|
38
|
-
}
|
|
39
|
-
// Reset state
|
|
40
|
-
mouseDownRef.current = null;
|
|
41
|
-
setTimeout(() => setHasDragged(false), 100);
|
|
42
|
-
};
|
|
43
|
-
return (_jsxs("div", { draggable: true, onDragStart: handleDragStart, onMouseDown: handleMouseDown, onMouseMove: handleMouseMove, onClick: handleClick, className: "p-4 rounded-xl border border-dashboard-border bg-dashboard-bg hover:border-primary cursor-pointer transition-all group", title: description, children: [_jsxs("div", { className: "flex items-center justify-between mb-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "text-neutral-500 dark:text-neutral-400 group-hover:text-primary dark:group-hover:text-primary transition-colors", children: icon }), _jsx("span", { className: "text-[10px] font-bold uppercase tracking-wider text-neutral-700 dark:text-neutral-300 group-hover:text-neutral-950 dark:group-hover:text-white transition-colors", children: name })] }), _jsx(GripVertical, { size: 12, className: "text-neutral-400 dark:text-neutral-500 group-hover:text-neutral-600 dark:group-hover:text-neutral-400" })] }), description && (_jsx("p", { className: "text-[9px] text-neutral-500 dark:text-neutral-400 leading-relaxed line-clamp-2", children: description }))] }));
|
|
44
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import React, { useState, useRef } from 'react';
|
|
4
|
-
import { GripVertical } from 'lucide-react';
|
|
5
|
-
|
|
6
|
-
export interface CustomBlockItemProps {
|
|
7
|
-
blockType: string;
|
|
8
|
-
name: string;
|
|
9
|
-
description?: string;
|
|
10
|
-
icon: React.ReactNode;
|
|
11
|
-
onAddBlock?: (blockType: string) => void;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Custom Block Item Component
|
|
16
|
-
* Draggable custom block from client registry and clickable to add at bottom
|
|
17
|
-
*/
|
|
18
|
-
export function CustomBlockItem({
|
|
19
|
-
blockType,
|
|
20
|
-
name,
|
|
21
|
-
description,
|
|
22
|
-
icon,
|
|
23
|
-
onAddBlock
|
|
24
|
-
}: CustomBlockItemProps) {
|
|
25
|
-
const [hasDragged, setHasDragged] = useState(false);
|
|
26
|
-
const mouseDownRef = useRef<{ x: number; y: number } | null>(null);
|
|
27
|
-
|
|
28
|
-
const handleDragStart = (e: React.DragEvent) => {
|
|
29
|
-
e.dataTransfer.setData('block-type', blockType);
|
|
30
|
-
e.dataTransfer.effectAllowed = 'move';
|
|
31
|
-
setHasDragged(true); // Mark as dragged when drag starts
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const handleMouseDown = (e: React.MouseEvent) => {
|
|
35
|
-
// Track mouse position on mousedown
|
|
36
|
-
mouseDownRef.current = { x: e.clientX, y: e.clientY };
|
|
37
|
-
setHasDragged(false); // Reset drag state
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const handleMouseMove = (e: React.MouseEvent) => {
|
|
41
|
-
// If mouse moved more than 5px, consider it a drag
|
|
42
|
-
if (mouseDownRef.current) {
|
|
43
|
-
const dx = Math.abs(e.clientX - mouseDownRef.current.x);
|
|
44
|
-
const dy = Math.abs(e.clientY - mouseDownRef.current.y);
|
|
45
|
-
if (dx > 5 || dy > 5) {
|
|
46
|
-
setHasDragged(true);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
const handleClick = (e: React.MouseEvent) => {
|
|
52
|
-
// Only add block if we didn't drag
|
|
53
|
-
if (!hasDragged && onAddBlock) {
|
|
54
|
-
e.preventDefault();
|
|
55
|
-
e.stopPropagation();
|
|
56
|
-
onAddBlock(blockType);
|
|
57
|
-
}
|
|
58
|
-
// Reset state
|
|
59
|
-
mouseDownRef.current = null;
|
|
60
|
-
setTimeout(() => setHasDragged(false), 100);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<div
|
|
65
|
-
draggable
|
|
66
|
-
onDragStart={handleDragStart}
|
|
67
|
-
onMouseDown={handleMouseDown}
|
|
68
|
-
onMouseMove={handleMouseMove}
|
|
69
|
-
onClick={handleClick}
|
|
70
|
-
className="p-4 rounded-xl border border-dashboard-border bg-dashboard-bg hover:border-primary cursor-pointer transition-all group"
|
|
71
|
-
title={description}
|
|
72
|
-
>
|
|
73
|
-
<div className="flex items-center justify-between mb-2">
|
|
74
|
-
<div className="flex items-center gap-2">
|
|
75
|
-
<div className="text-neutral-500 dark:text-neutral-400 group-hover:text-primary dark:group-hover:text-primary transition-colors">
|
|
76
|
-
{icon}
|
|
77
|
-
</div>
|
|
78
|
-
<span className="text-[10px] font-bold uppercase tracking-wider text-neutral-700 dark:text-neutral-300 group-hover:text-neutral-950 dark:group-hover:text-white transition-colors">
|
|
79
|
-
{name}
|
|
80
|
-
</span>
|
|
81
|
-
</div>
|
|
82
|
-
<GripVertical size={12} className="text-neutral-400 dark:text-neutral-500 group-hover:text-neutral-600 dark:group-hover:text-neutral-400" />
|
|
83
|
-
</div>
|
|
84
|
-
{description && (
|
|
85
|
-
<p className="text-[9px] text-neutral-500 dark:text-neutral-400 leading-relaxed line-clamp-2">
|
|
86
|
-
{description}
|
|
87
|
-
</p>
|
|
88
|
-
)}
|
|
89
|
-
</div>
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { Block } from '../../../types/block';
|
|
2
|
-
import type { BlockTypeDefinition } from '../../../types/block';
|
|
3
|
-
export interface EditorCanvasProps {
|
|
4
|
-
isPreviewMode: boolean;
|
|
5
|
-
heroBlock: Block | null;
|
|
6
|
-
heroBlockDefinition: BlockTypeDefinition | undefined;
|
|
7
|
-
contentBlocks: Block[];
|
|
8
|
-
title: string;
|
|
9
|
-
siteId: string;
|
|
10
|
-
locale: string;
|
|
11
|
-
darkMode: boolean;
|
|
12
|
-
backgroundColors?: {
|
|
13
|
-
light: string;
|
|
14
|
-
dark?: string;
|
|
15
|
-
};
|
|
16
|
-
featuredImage?: {
|
|
17
|
-
id?: string;
|
|
18
|
-
alt?: string;
|
|
19
|
-
};
|
|
20
|
-
onTitleChange: (title: string) => void;
|
|
21
|
-
onHeroBlockUpdate: (data: Partial<Block['data']>) => void;
|
|
22
|
-
onHeroBlockDelete: () => void;
|
|
23
|
-
onBlockAdd: (type: string, index: number, containerId?: string) => void;
|
|
24
|
-
onBlockUpdate: (id: string, data: Partial<Block['data']>) => void;
|
|
25
|
-
onBlockDelete: (id: string) => void;
|
|
26
|
-
onBlockMove: (id: string, newIndex: number, containerId?: string) => void;
|
|
27
|
-
}
|
|
28
|
-
export declare function EditorCanvas({ isPreviewMode, heroBlock, heroBlockDefinition, contentBlocks, title, siteId, locale, darkMode, backgroundColors, featuredImage, onTitleChange, onHeroBlockUpdate, onHeroBlockDelete, onBlockAdd, onBlockUpdate, onBlockDelete, onBlockMove, }: EditorCanvasProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
-
//# sourceMappingURL=EditorCanvas.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EditorCanvas.d.ts","sourceRoot":"","sources":["EditorCanvas.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,MAAM,WAAW,iBAAiB;IAC9B,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,KAAK,GAAG,IAAI,CAAC;IACxB,mBAAmB,EAAE,mBAAmB,GAAG,SAAS,CAAC;IACrD,aAAa,EAAE,KAAK,EAAE,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE;QACf,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,aAAa,CAAC,EAAE;QACZ,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,GAAG,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,iBAAiB,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,IAAI,CAAC;IAC1D,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACxE,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,IAAI,CAAC;IAClE,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7E;AAED,wBAAgB,YAAY,CAAC,EACzB,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,aAAa,EACb,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,aAAa,EACb,aAAa,EACb,WAAW,GACd,EAAE,iBAAiB,2CA0GnB"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { useRef, useEffect } from 'react';
|
|
4
|
-
import { BlockWrapper } from '../BlockWrapper';
|
|
5
|
-
import { EditorBody } from '../EditorBody';
|
|
6
|
-
import { BlockRenderer } from '../../../lib/blocks/BlockRenderer';
|
|
7
|
-
export function EditorCanvas({ isPreviewMode, heroBlock, heroBlockDefinition, contentBlocks, title, siteId, locale, darkMode, backgroundColors, featuredImage, onTitleChange, onHeroBlockUpdate, onHeroBlockDelete, onBlockAdd, onBlockUpdate, onBlockDelete, onBlockMove, }) {
|
|
8
|
-
const titleRef = useRef(null);
|
|
9
|
-
// Handle Title Auto-resize
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
if (titleRef.current) {
|
|
12
|
-
titleRef.current.style.height = 'auto';
|
|
13
|
-
titleRef.current.style.height = `${titleRef.current.scrollHeight}px`;
|
|
14
|
-
}
|
|
15
|
-
}, [title]);
|
|
16
|
-
return (_jsx("div", { className: "flex-1 overflow-y-auto overflow-x-hidden pb-40 px-6 custom-scrollbar selection:bg-primary/20 dark:selection:bg-primary/30 min-h-0", style: {
|
|
17
|
-
backgroundColor: backgroundColors
|
|
18
|
-
? (darkMode && backgroundColors.dark
|
|
19
|
-
? backgroundColors.dark
|
|
20
|
-
: backgroundColors.light)
|
|
21
|
-
: undefined,
|
|
22
|
-
}, children: _jsxs("div", { className: `mx-auto transition-all duration-500 max-w-7xl w-full`, children: [!isPreviewMode && heroBlockDefinition && heroBlock && (_jsx("div", { className: "mb-12", children: _jsx(BlockWrapper, { block: heroBlock, onUpdate: onHeroBlockUpdate, onDelete: onHeroBlockDelete, onMoveUp: () => { }, onMoveDown: () => { }, allBlocks: [heroBlock] }) })), isPreviewMode ? (_jsxs("div", { className: "space-y-8", children: [heroBlockDefinition && heroBlock && (_jsx(BlockRenderer, { block: heroBlock, context: {
|
|
23
|
-
siteId,
|
|
24
|
-
locale,
|
|
25
|
-
// Pass featured image as fallback for hero block
|
|
26
|
-
// Only pass id and alt - plugin-images handles transforms
|
|
27
|
-
fallbackImage: featuredImage ? {
|
|
28
|
-
id: featuredImage.id,
|
|
29
|
-
alt: featuredImage.alt,
|
|
30
|
-
} : undefined,
|
|
31
|
-
} })), !heroBlockDefinition && title && (_jsx("h1", { className: "text-5xl font-serif font-medium text-neutral-950 dark:text-white leading-tight mb-12", children: title })), contentBlocks.length > 0 ? (_jsx("div", { className: "space-y-8", children: contentBlocks.map((block) => (_jsx(BlockRenderer, { block: block, context: { siteId, locale } }, block.id))) })) : (_jsx("div", { className: "text-center py-20 text-neutral-400 dark:text-neutral-500", children: _jsx("p", { className: "text-sm", children: "No content blocks yet. Switch to Edit mode to add blocks." }) }))] })) : (_jsxs(_Fragment, { children: [!heroBlockDefinition && (_jsx("div", { className: "mb-12", children: _jsx("textarea", { ref: titleRef, rows: 1, value: title, onChange: (e) => onTitleChange(e.target.value), placeholder: "The title of your story...", className: "w-full bg-transparent border-none outline-none text-5xl font-serif font-medium placeholder:text-neutral-500 dark:placeholder:text-neutral-500 resize-none leading-tight transition-colors duration-300 text-neutral-950 dark:text-white" }) })), _jsx(EditorBody, { blocks: contentBlocks, darkMode: darkMode, backgroundColors: backgroundColors, onBlockAdd: onBlockAdd, onBlockUpdate: onBlockUpdate, onBlockDelete: onBlockDelete, onBlockMove: onBlockMove })] }))] }) }));
|
|
32
|
-
}
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import React, { useRef, useEffect } from 'react';
|
|
4
|
-
import { BlockWrapper } from '../BlockWrapper';
|
|
5
|
-
import { EditorBody } from '../EditorBody';
|
|
6
|
-
import { BlockRenderer } from '../../../lib/blocks/BlockRenderer';
|
|
7
|
-
import type { Block } from '../../../types/block';
|
|
8
|
-
import type { BlockTypeDefinition } from '../../../types/block';
|
|
9
|
-
|
|
10
|
-
export interface EditorCanvasProps {
|
|
11
|
-
isPreviewMode: boolean;
|
|
12
|
-
heroBlock: Block | null;
|
|
13
|
-
heroBlockDefinition: BlockTypeDefinition | undefined;
|
|
14
|
-
contentBlocks: Block[];
|
|
15
|
-
title: string;
|
|
16
|
-
siteId: string;
|
|
17
|
-
locale: string;
|
|
18
|
-
darkMode: boolean;
|
|
19
|
-
backgroundColors?: {
|
|
20
|
-
light: string;
|
|
21
|
-
dark?: string;
|
|
22
|
-
};
|
|
23
|
-
featuredImage?: {
|
|
24
|
-
id?: string; // Semantic ID - plugin-images handles transforms
|
|
25
|
-
alt?: string;
|
|
26
|
-
};
|
|
27
|
-
onTitleChange: (title: string) => void;
|
|
28
|
-
onHeroBlockUpdate: (data: Partial<Block['data']>) => void;
|
|
29
|
-
onHeroBlockDelete: () => void;
|
|
30
|
-
onBlockAdd: (type: string, index: number, containerId?: string) => void;
|
|
31
|
-
onBlockUpdate: (id: string, data: Partial<Block['data']>) => void;
|
|
32
|
-
onBlockDelete: (id: string) => void;
|
|
33
|
-
onBlockMove: (id: string, newIndex: number, containerId?: string) => void;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function EditorCanvas({
|
|
37
|
-
isPreviewMode,
|
|
38
|
-
heroBlock,
|
|
39
|
-
heroBlockDefinition,
|
|
40
|
-
contentBlocks,
|
|
41
|
-
title,
|
|
42
|
-
siteId,
|
|
43
|
-
locale,
|
|
44
|
-
darkMode,
|
|
45
|
-
backgroundColors,
|
|
46
|
-
featuredImage,
|
|
47
|
-
onTitleChange,
|
|
48
|
-
onHeroBlockUpdate,
|
|
49
|
-
onHeroBlockDelete,
|
|
50
|
-
onBlockAdd,
|
|
51
|
-
onBlockUpdate,
|
|
52
|
-
onBlockDelete,
|
|
53
|
-
onBlockMove,
|
|
54
|
-
}: EditorCanvasProps) {
|
|
55
|
-
const titleRef = useRef<HTMLTextAreaElement>(null);
|
|
56
|
-
|
|
57
|
-
// Handle Title Auto-resize
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
if (titleRef.current) {
|
|
60
|
-
titleRef.current.style.height = 'auto';
|
|
61
|
-
titleRef.current.style.height = `${titleRef.current.scrollHeight}px`;
|
|
62
|
-
}
|
|
63
|
-
}, [title]);
|
|
64
|
-
|
|
65
|
-
return (
|
|
66
|
-
<div
|
|
67
|
-
className="flex-1 overflow-y-auto overflow-x-hidden pb-40 px-6 custom-scrollbar selection:bg-primary/20 dark:selection:bg-primary/30 min-h-0"
|
|
68
|
-
style={{
|
|
69
|
-
backgroundColor: backgroundColors
|
|
70
|
-
? (darkMode && backgroundColors.dark
|
|
71
|
-
? backgroundColors.dark
|
|
72
|
-
: backgroundColors.light)
|
|
73
|
-
: undefined,
|
|
74
|
-
}}
|
|
75
|
-
>
|
|
76
|
-
<div className={`mx-auto transition-all duration-500 max-w-7xl w-full`}>
|
|
77
|
-
{/* Hero Block - Only show editable version when NOT in preview mode */}
|
|
78
|
-
{!isPreviewMode && heroBlockDefinition && heroBlock && (
|
|
79
|
-
<div className="mb-12">
|
|
80
|
-
<BlockWrapper
|
|
81
|
-
block={heroBlock}
|
|
82
|
-
onUpdate={onHeroBlockUpdate}
|
|
83
|
-
onDelete={onHeroBlockDelete}
|
|
84
|
-
onMoveUp={() => { }}
|
|
85
|
-
onMoveDown={() => { }}
|
|
86
|
-
allBlocks={[heroBlock]}
|
|
87
|
-
/>
|
|
88
|
-
</div>
|
|
89
|
-
)}
|
|
90
|
-
|
|
91
|
-
{isPreviewMode ? (
|
|
92
|
-
<div className="space-y-8">
|
|
93
|
-
{heroBlockDefinition && heroBlock && (
|
|
94
|
-
<BlockRenderer
|
|
95
|
-
block={heroBlock}
|
|
96
|
-
context={{
|
|
97
|
-
siteId,
|
|
98
|
-
locale,
|
|
99
|
-
// Pass featured image as fallback for hero block
|
|
100
|
-
// Only pass id and alt - plugin-images handles transforms
|
|
101
|
-
fallbackImage: featuredImage ? {
|
|
102
|
-
id: featuredImage.id,
|
|
103
|
-
alt: featuredImage.alt,
|
|
104
|
-
} : undefined,
|
|
105
|
-
}}
|
|
106
|
-
/>
|
|
107
|
-
)}
|
|
108
|
-
|
|
109
|
-
{!heroBlockDefinition && title && (
|
|
110
|
-
<h1 className="text-5xl font-serif font-medium text-neutral-950 dark:text-white leading-tight mb-12">
|
|
111
|
-
{title}
|
|
112
|
-
</h1>
|
|
113
|
-
)}
|
|
114
|
-
|
|
115
|
-
{contentBlocks.length > 0 ? (
|
|
116
|
-
<div className="space-y-8">
|
|
117
|
-
{contentBlocks.map((block) => (
|
|
118
|
-
<BlockRenderer
|
|
119
|
-
key={block.id}
|
|
120
|
-
block={block}
|
|
121
|
-
context={{ siteId, locale }}
|
|
122
|
-
/>
|
|
123
|
-
))}
|
|
124
|
-
</div>
|
|
125
|
-
) : (
|
|
126
|
-
<div className="text-center py-20 text-neutral-400 dark:text-neutral-500">
|
|
127
|
-
<p className="text-sm">No content blocks yet. Switch to Edit mode to add blocks.</p>
|
|
128
|
-
</div>
|
|
129
|
-
)}
|
|
130
|
-
</div>
|
|
131
|
-
) : (
|
|
132
|
-
<>
|
|
133
|
-
{!heroBlockDefinition && (
|
|
134
|
-
<div className="mb-12">
|
|
135
|
-
<textarea
|
|
136
|
-
ref={titleRef}
|
|
137
|
-
rows={1}
|
|
138
|
-
value={title}
|
|
139
|
-
onChange={(e) => onTitleChange(e.target.value)}
|
|
140
|
-
placeholder="The title of your story..."
|
|
141
|
-
className="w-full bg-transparent border-none outline-none text-5xl font-serif font-medium placeholder:text-neutral-500 dark:placeholder:text-neutral-500 resize-none leading-tight transition-colors duration-300 text-neutral-950 dark:text-white"
|
|
142
|
-
/>
|
|
143
|
-
</div>
|
|
144
|
-
)}
|
|
145
|
-
|
|
146
|
-
<EditorBody
|
|
147
|
-
blocks={contentBlocks}
|
|
148
|
-
darkMode={darkMode}
|
|
149
|
-
backgroundColors={backgroundColors}
|
|
150
|
-
onBlockAdd={onBlockAdd}
|
|
151
|
-
onBlockUpdate={onBlockUpdate}
|
|
152
|
-
onBlockDelete={onBlockDelete}
|
|
153
|
-
onBlockMove={onBlockMove}
|
|
154
|
-
/>
|
|
155
|
-
</>
|
|
156
|
-
)}
|
|
157
|
-
</div>
|
|
158
|
-
</div>
|
|
159
|
-
);
|
|
160
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { BlockTypeDefinition } from '../../../types/block';
|
|
2
|
-
export interface EditorLibraryProps {
|
|
3
|
-
registeredBlocks: BlockTypeDefinition[];
|
|
4
|
-
onAddBlock: (type: string) => void;
|
|
5
|
-
}
|
|
6
|
-
export declare function EditorLibrary({ registeredBlocks, onAddBlock }: EditorLibraryProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
//# sourceMappingURL=EditorLibrary.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EditorLibrary.d.ts","sourceRoot":"","sources":["EditorLibrary.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,MAAM,WAAW,kBAAkB;IAC/B,gBAAgB,EAAE,mBAAmB,EAAE,CAAC;IACxC,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC;AAED,wBAAgB,aAAa,CAAC,EAAE,gBAAgB,EAAE,UAAU,EAAE,EAAE,kBAAkB,2CA6GjF"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Library, Image as ImageIcon, LayoutTemplate, Type, Box } from 'lucide-react';
|
|
4
|
-
import { LibraryItem, CustomBlockItem } from './index';
|
|
5
|
-
export function EditorLibrary({ registeredBlocks, onAddBlock }) {
|
|
6
|
-
// Get all registered blocks from state (excluding Hero block from sidebar)
|
|
7
|
-
const allBlocks = registeredBlocks.filter(block => block.type !== 'hero');
|
|
8
|
-
const textBlocks = allBlocks.filter(block => block.category === 'text');
|
|
9
|
-
const customBlocks = allBlocks.filter(block => block.category === 'custom');
|
|
10
|
-
const mediaBlocks = allBlocks.filter(block => block.category === 'media');
|
|
11
|
-
const layoutBlocks = allBlocks.filter(block => block.category === 'layout');
|
|
12
|
-
return (_jsxs("div", { className: "p-6 w-72 min-w-0 max-w-full", children: [textBlocks.length > 0 && (_jsxs("div", { className: "mb-10", children: [_jsx("h3", { className: "text-[10px] uppercase tracking-[0.2em] text-neutral-500 dark:text-neutral-400 font-black mb-6", children: "Text" }), _jsx("div", { className: "grid grid-cols-2 gap-3", children: textBlocks.map((block) => {
|
|
13
|
-
const IconComponent = block.icon || block.components.Icon || Type;
|
|
14
|
-
return (_jsx(LibraryItem, { icon: _jsx(IconComponent, { size: 16 }), label: block.name, blockType: block.type, description: block.description, onAddBlock: onAddBlock }, block.type));
|
|
15
|
-
}) })] })), mediaBlocks.length > 0 && (_jsxs("div", { className: "mb-10", children: [_jsx("h3", { className: "text-[10px] uppercase tracking-[0.2em] text-neutral-500 dark:text-neutral-400 font-black mb-6", children: "Media" }), _jsx("div", { className: "grid grid-cols-2 gap-3", children: mediaBlocks.map((block) => {
|
|
16
|
-
const IconComponent = block.icon || block.components.Icon || ImageIcon;
|
|
17
|
-
return (_jsx(LibraryItem, { icon: _jsx(IconComponent, { size: 16 }), label: block.name, blockType: block.type, description: block.description, onAddBlock: onAddBlock }, block.type));
|
|
18
|
-
}) })] })), layoutBlocks.length > 0 && (_jsxs("div", { className: "mb-10", children: [_jsx("h3", { className: "text-[10px] uppercase tracking-[0.2em] text-neutral-500 dark:text-neutral-400 font-black mb-6", children: "Layout" }), _jsx("div", { className: "grid grid-cols-2 gap-3", children: layoutBlocks.map((block) => {
|
|
19
|
-
const IconComponent = block.icon || block.components.Icon || LayoutTemplate;
|
|
20
|
-
return (_jsx(LibraryItem, { icon: _jsx(IconComponent, { size: 16 }), label: block.name, blockType: block.type, description: block.description, onAddBlock: onAddBlock }, block.type));
|
|
21
|
-
}) })] })), customBlocks.length > 0 && (_jsxs("div", { children: [_jsx("h3", { className: "text-[10px] uppercase tracking-[0.2em] text-neutral-500 dark:text-neutral-400 font-black mb-6", children: "Custom Blocks" }), _jsx("div", { className: "space-y-3", children: customBlocks.map((block) => {
|
|
22
|
-
const IconComponent = block.icon || block.components.Icon || Box;
|
|
23
|
-
return (_jsx(CustomBlockItem, { blockType: block.type, name: block.name, description: block.description, icon: _jsx(IconComponent, { size: 14 }), onAddBlock: onAddBlock }, block.type));
|
|
24
|
-
}) })] })), allBlocks.length === 0 && (_jsxs("div", { className: "text-center py-12", children: [_jsx(Library, { size: 32, className: "mx-auto text-neutral-300 dark:text-neutral-700 mb-4" }), _jsx("p", { className: "text-xs text-neutral-500 dark:text-neutral-400", children: "No blocks registered yet." })] }))] }));
|
|
25
|
-
}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { Library, Image as ImageIcon, LayoutTemplate, Type, Box } from 'lucide-react';
|
|
5
|
-
import { LibraryItem, CustomBlockItem } from './index';
|
|
6
|
-
import type { BlockTypeDefinition } from '../../../types/block';
|
|
7
|
-
|
|
8
|
-
export interface EditorLibraryProps {
|
|
9
|
-
registeredBlocks: BlockTypeDefinition[];
|
|
10
|
-
onAddBlock: (type: string) => void;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function EditorLibrary({ registeredBlocks, onAddBlock }: EditorLibraryProps) {
|
|
14
|
-
// Get all registered blocks from state (excluding Hero block from sidebar)
|
|
15
|
-
const allBlocks = registeredBlocks.filter(block => block.type !== 'hero');
|
|
16
|
-
const textBlocks = allBlocks.filter(block => block.category === 'text');
|
|
17
|
-
const customBlocks = allBlocks.filter(block => block.category === 'custom');
|
|
18
|
-
const mediaBlocks = allBlocks.filter(block => block.category === 'media');
|
|
19
|
-
const layoutBlocks = allBlocks.filter(block => block.category === 'layout');
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<div className="p-6 w-72 min-w-0 max-w-full">
|
|
23
|
-
{/* Text Blocks */}
|
|
24
|
-
{textBlocks.length > 0 && (
|
|
25
|
-
<div className="mb-10">
|
|
26
|
-
<h3 className="text-[10px] uppercase tracking-[0.2em] text-neutral-500 dark:text-neutral-400 font-black mb-6">Text</h3>
|
|
27
|
-
<div className="grid grid-cols-2 gap-3">
|
|
28
|
-
{textBlocks.map((block) => {
|
|
29
|
-
const IconComponent = block.icon || block.components.Icon || Type;
|
|
30
|
-
return (
|
|
31
|
-
<LibraryItem
|
|
32
|
-
key={block.type}
|
|
33
|
-
icon={<IconComponent size={16} />}
|
|
34
|
-
label={block.name}
|
|
35
|
-
blockType={block.type}
|
|
36
|
-
description={block.description}
|
|
37
|
-
onAddBlock={onAddBlock}
|
|
38
|
-
/>
|
|
39
|
-
);
|
|
40
|
-
})}
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
)}
|
|
44
|
-
|
|
45
|
-
{/* Media Blocks */}
|
|
46
|
-
{mediaBlocks.length > 0 && (
|
|
47
|
-
<div className="mb-10">
|
|
48
|
-
<h3 className="text-[10px] uppercase tracking-[0.2em] text-neutral-500 dark:text-neutral-400 font-black mb-6">Media</h3>
|
|
49
|
-
<div className="grid grid-cols-2 gap-3">
|
|
50
|
-
{mediaBlocks.map((block) => {
|
|
51
|
-
const IconComponent = block.icon || block.components.Icon || ImageIcon;
|
|
52
|
-
return (
|
|
53
|
-
<LibraryItem
|
|
54
|
-
key={block.type}
|
|
55
|
-
icon={<IconComponent size={16} />}
|
|
56
|
-
label={block.name}
|
|
57
|
-
blockType={block.type}
|
|
58
|
-
description={block.description}
|
|
59
|
-
onAddBlock={onAddBlock}
|
|
60
|
-
/>
|
|
61
|
-
);
|
|
62
|
-
})}
|
|
63
|
-
</div>
|
|
64
|
-
</div>
|
|
65
|
-
)}
|
|
66
|
-
|
|
67
|
-
{/* Layout Blocks */}
|
|
68
|
-
{layoutBlocks.length > 0 && (
|
|
69
|
-
<div className="mb-10">
|
|
70
|
-
<h3 className="text-[10px] uppercase tracking-[0.2em] text-neutral-500 dark:text-neutral-400 font-black mb-6">Layout</h3>
|
|
71
|
-
<div className="grid grid-cols-2 gap-3">
|
|
72
|
-
{layoutBlocks.map((block) => {
|
|
73
|
-
const IconComponent = block.icon || block.components.Icon || LayoutTemplate;
|
|
74
|
-
return (
|
|
75
|
-
<LibraryItem
|
|
76
|
-
key={block.type}
|
|
77
|
-
icon={<IconComponent size={16} />}
|
|
78
|
-
label={block.name}
|
|
79
|
-
blockType={block.type}
|
|
80
|
-
description={block.description}
|
|
81
|
-
onAddBlock={onAddBlock}
|
|
82
|
-
/>
|
|
83
|
-
);
|
|
84
|
-
})}
|
|
85
|
-
</div>
|
|
86
|
-
</div>
|
|
87
|
-
)}
|
|
88
|
-
|
|
89
|
-
{/* Custom Blocks */}
|
|
90
|
-
{customBlocks.length > 0 && (
|
|
91
|
-
<div>
|
|
92
|
-
<h3 className="text-[10px] uppercase tracking-[0.2em] text-neutral-500 dark:text-neutral-400 font-black mb-6">Custom Blocks</h3>
|
|
93
|
-
<div className="space-y-3">
|
|
94
|
-
{customBlocks.map((block) => {
|
|
95
|
-
const IconComponent = block.icon || block.components.Icon || Box;
|
|
96
|
-
return (
|
|
97
|
-
<CustomBlockItem
|
|
98
|
-
key={block.type}
|
|
99
|
-
blockType={block.type}
|
|
100
|
-
name={block.name}
|
|
101
|
-
description={block.description}
|
|
102
|
-
icon={<IconComponent size={14} />}
|
|
103
|
-
onAddBlock={onAddBlock}
|
|
104
|
-
/>
|
|
105
|
-
);
|
|
106
|
-
})}
|
|
107
|
-
</div>
|
|
108
|
-
</div>
|
|
109
|
-
)}
|
|
110
|
-
|
|
111
|
-
{/* Empty State */}
|
|
112
|
-
{allBlocks.length === 0 && (
|
|
113
|
-
<div className="text-center py-12">
|
|
114
|
-
<Library size={32} className="mx-auto text-neutral-300 dark:text-neutral-700 mb-4" />
|
|
115
|
-
<p className="text-xs text-neutral-500 dark:text-neutral-400">
|
|
116
|
-
No blocks registered yet.
|
|
117
|
-
</p>
|
|
118
|
-
</div>
|
|
119
|
-
)}
|
|
120
|
-
</div>
|
|
121
|
-
);
|
|
122
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Block } from '../../../types/block';
|
|
2
|
-
import type { PostMetadata, SEOMetadata } from '../../../types/post';
|
|
3
|
-
export interface EditorSidebarProps {
|
|
4
|
-
slug: string;
|
|
5
|
-
seo: SEOMetadata;
|
|
6
|
-
metadata: PostMetadata;
|
|
7
|
-
heroBlock: Block | null;
|
|
8
|
-
status: string;
|
|
9
|
-
onSEOUpdate: (seo: Partial<SEOMetadata>) => void;
|
|
10
|
-
onMetadataUpdate: (metadata: Partial<PostMetadata>) => void;
|
|
11
|
-
}
|
|
12
|
-
export declare function EditorSidebar({ slug, seo, metadata, heroBlock, status, onSEOUpdate, onMetadataUpdate, }: EditorSidebarProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
//# sourceMappingURL=EditorSidebar.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EditorSidebar.d.ts","sourceRoot":"","sources":["EditorSidebar.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAErE,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,WAAW,CAAC;IACjB,QAAQ,EAAE,YAAY,CAAC;IACvB,SAAS,EAAE,KAAK,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,CAAC,GAAG,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACjD,gBAAgB,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;CAC/D;AAED,wBAAgB,aAAa,CAAC,EAC1B,IAAI,EACJ,GAAG,EACH,QAAQ,EACR,SAAS,EACT,MAAM,EACN,WAAW,EACX,gBAAgB,GACnB,EAAE,kBAAkB,2CA0JpB"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Globe, Search, Box } from 'lucide-react';
|
|
4
|
-
import { FeaturedMediaSection, PrivacySettingsSection } from './index';
|
|
5
|
-
export function EditorSidebar({ slug, seo, metadata, heroBlock, status, onSEOUpdate, onMetadataUpdate, }) {
|
|
6
|
-
var _a, _b, _c, _d, _e;
|
|
7
|
-
return (_jsxs("div", { className: "p-8 w-80 min-w-0 max-w-full space-y-12 overflow-y-auto max-h-full", children: [_jsxs("section", { children: [_jsxs("div", { className: "flex items-center gap-3 mb-6", children: [_jsx(Search, { size: 14, className: "text-neutral-500 dark:text-neutral-400" }), _jsx("label", { className: "text-[10px] uppercase tracking-[0.2em] text-neutral-500 dark:text-neutral-400 font-black", children: "SEO Settings" })] }), _jsxs("div", { className: "space-y-4", children: [_jsxs("div", { children: [_jsx("label", { className: "text-[10px] text-neutral-500 dark:text-neutral-400 uppercase font-bold block mb-2", children: "SEO Title" }), _jsx("input", { type: "text", value: seo.title || '', onChange: (e) => onSEOUpdate({ title: e.target.value }), placeholder: "SEO title (defaults to post title)", className: "w-full px-3 py-2 text-xs bg-dashboard-card border border-dashboard-border rounded-lg outline-none focus:border-primary transition-all text-dashboard-text" }), _jsxs("p", { className: "text-[9px] text-neutral-400 dark:text-neutral-500 mt-1", children: [((_a = seo.title) === null || _a === void 0 ? void 0 : _a.length) || 0, " / 60 characters"] })] }), _jsxs("div", { children: [_jsx("label", { className: "text-[10px] text-neutral-500 dark:text-neutral-400 uppercase font-bold block mb-2", children: "Meta Description" }), _jsx("textarea", { value: seo.description || '', onChange: (e) => onSEOUpdate({ description: e.target.value }), placeholder: "Brief description for search engines", rows: 3, className: "w-full px-3 py-2 text-xs bg-white dark:bg-neutral-900/50 border border-neutral-300 dark:border-neutral-700 rounded-lg outline-none focus:border-primary transition-all dark:text-neutral-100 resize-none" }), _jsxs("p", { className: "text-[9px] text-neutral-400 dark:text-neutral-500 mt-1", children: [((_b = seo.description) === null || _b === void 0 ? void 0 : _b.length) || 0, " / 160 characters"] })] }), _jsxs("div", { children: [_jsx("label", { className: "text-[10px] text-neutral-500 dark:text-neutral-400 uppercase font-bold block mb-2", children: "Keywords (comma-separated)" }), _jsx("input", { type: "text", value: ((_c = seo.keywords) === null || _c === void 0 ? void 0 : _c.join(', ')) || '', onChange: (e) => {
|
|
8
|
-
const keywords = e.target.value.split(',').map(k => k.trim()).filter(k => k);
|
|
9
|
-
onSEOUpdate({ keywords });
|
|
10
|
-
}, placeholder: "keyword1, keyword2, keyword3", className: "w-full px-3 py-2 text-xs bg-dashboard-card border border-dashboard-border rounded-lg outline-none focus:border-primary transition-all text-dashboard-text" })] }), _jsxs("div", { children: [_jsx("label", { className: "text-[10px] text-neutral-500 dark:text-neutral-400 uppercase font-bold block mb-2", children: "Open Graph Image URL" }), _jsx("input", { type: "url", value: seo.ogImage || '', onChange: (e) => onSEOUpdate({ ogImage: e.target.value }), placeholder: "https://example.com/image.jpg", className: "w-full px-3 py-2 text-xs bg-dashboard-card border border-dashboard-border rounded-lg outline-none focus:border-primary transition-all text-dashboard-text" })] })] })] }), _jsxs("section", { className: "pt-8 border-t border-neutral-200 dark:border-neutral-800", children: [_jsxs("div", { className: "flex items-center gap-3 mb-6", children: [_jsx(Globe, { size: 14, className: "text-neutral-500 dark:text-neutral-400" }), _jsx("label", { className: "text-[10px] uppercase tracking-[0.2em] text-neutral-500 dark:text-neutral-400 font-black", children: "Publishing" })] }), _jsxs("div", { className: "bg-dashboard-bg p-5 rounded-2xl border border-dashboard-border", children: [_jsx("span", { className: "text-[10px] text-neutral-500 dark:text-neutral-400 uppercase font-bold block mb-3", children: "Slug / Permalink" }), _jsxs("div", { className: "text-xs font-mono break-all text-neutral-600 dark:text-neutral-400 leading-relaxed", children: ["/blog/", _jsx("span", { className: "text-neutral-950 dark:text-white bg-amber-50 dark:bg-amber-900/20 px-1 rounded", children: slug || 'untitled-post' })] })] })] }), _jsxs("section", { className: "pt-8 border-t border-neutral-200 dark:border-neutral-800", children: [_jsxs("div", { className: "flex items-center gap-3 mb-6", children: [_jsx(Box, { size: 14, className: "text-neutral-500 dark:text-neutral-400" }), _jsx("label", { className: "text-[10px] uppercase tracking-[0.2em] text-neutral-500 dark:text-neutral-400 font-black", children: "Category" })] }), _jsx("div", { className: "space-y-4", children: _jsxs("div", { children: [_jsx("label", { className: "text-[10px] text-neutral-500 dark:text-neutral-400 uppercase font-bold block mb-2", children: "Category" }), _jsx("input", { type: "text", value: ((_d = metadata.categories) === null || _d === void 0 ? void 0 : _d[0]) || '', onChange: (e) => {
|
|
11
|
-
const category = e.target.value.trim();
|
|
12
|
-
onMetadataUpdate({
|
|
13
|
-
categories: category ? [category] : []
|
|
14
|
-
});
|
|
15
|
-
}, placeholder: "Enter category (required for publishing)", className: "w-full px-3 py-2 text-xs bg-dashboard-card border border-dashboard-border rounded-lg outline-none focus:border-primary transition-all text-dashboard-text" }), _jsx("p", { className: "text-[9px] text-neutral-400 dark:text-neutral-500 mt-1", children: ((_e = metadata.categories) === null || _e === void 0 ? void 0 : _e[0]) ? 'Category set' : 'No category set' })] }) })] }), _jsx(FeaturedMediaSection, { featuredImage: metadata.featuredImage, heroBlock: heroBlock, slug: slug, onUpdate: (image) => onMetadataUpdate({ featuredImage: image }) }), _jsx(PrivacySettingsSection, { privacy: metadata.privacy, onUpdate: (privacy) => onMetadataUpdate({ privacy }) }), _jsxs("section", { className: "pt-8 border-t border-neutral-200 dark:border-neutral-800", children: [_jsxs("div", { className: "flex items-center justify-between mb-4", children: [_jsx("label", { className: "text-[10px] uppercase tracking-[0.2em] text-neutral-500 dark:text-neutral-400 font-black", children: "Post Status" }), _jsx("span", { className: "text-[10px] font-black text-amber-700 dark:text-amber-400 bg-amber-50 dark:bg-amber-900/20 px-2.5 py-1 rounded-full uppercase tracking-tighter", children: status })] }), _jsx("p", { className: "text-[11px] text-neutral-500 dark:text-neutral-400 leading-relaxed italic", children: status === 'draft'
|
|
16
|
-
? 'This post is private. Only you can see it until you hit publish.'
|
|
17
|
-
: status === 'published'
|
|
18
|
-
? 'This post is live and visible to everyone.'
|
|
19
|
-
: 'This post is scheduled for publication.' })] })] }));
|
|
20
|
-
}
|