@jhits/plugin-blog 0.0.16 → 0.0.17
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jhits/plugin-blog",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"description": "Professional blog management system for the JHITS ecosystem",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"lucide-react": "^0.564.0",
|
|
31
31
|
"mongodb": "^7.1.0",
|
|
32
32
|
"next-auth": "^4.24.13",
|
|
33
|
-
"@jhits/plugin-content": "0.0.
|
|
34
|
-
"@jhits/plugin-core": "0.0.
|
|
35
|
-
"@jhits/plugin-images": "0.0.
|
|
33
|
+
"@jhits/plugin-content": "0.0.15",
|
|
34
|
+
"@jhits/plugin-core": "0.0.10",
|
|
35
|
+
"@jhits/plugin-images": "0.0.13"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"next": ">=15.0.0",
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Columns Block
|
|
3
|
-
* Flex/grid container with configurable column layouts
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
'use client';
|
|
7
|
-
|
|
8
|
-
import React from 'react';
|
|
9
|
-
import { Plus, Trash2 } from 'lucide-react';
|
|
10
|
-
import { BlockEditProps, BlockPreviewProps } from '../../../types/block';
|
|
11
|
-
import { LayoutContainer } from '../../../views/CanvasEditor/LayoutContainer';
|
|
12
|
-
import { COLUMN_LAYOUTS, ColumnLayout } from '../index';
|
|
13
|
-
import { Block } from '../../../types/block';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Columns Block Edit Component
|
|
17
|
-
*/
|
|
18
|
-
export const ColumnsEdit: React.FC<BlockEditProps & {
|
|
19
|
-
childBlocks: Block[];
|
|
20
|
-
onChildBlockAdd: (type: string, index: number, containerId: string) => void;
|
|
21
|
-
onChildBlockDelete: (blockId: string) => void;
|
|
22
|
-
onChildBlockMove: (blockId: string, newIndex: number) => void;
|
|
23
|
-
}> = ({
|
|
24
|
-
block,
|
|
25
|
-
childBlocks,
|
|
26
|
-
onChildBlockAdd,
|
|
27
|
-
onChildBlockDelete,
|
|
28
|
-
onChildBlockMove,
|
|
29
|
-
}) => {
|
|
30
|
-
// Support both old layout-based system and new dynamic column count
|
|
31
|
-
const columnCount = block.data.columnCount as number | undefined;
|
|
32
|
-
const layout: ColumnLayout | undefined = block.data.layout as ColumnLayout | undefined;
|
|
33
|
-
|
|
34
|
-
// Determine number of columns: use columnCount if set, otherwise derive from layout
|
|
35
|
-
let numColumns: number;
|
|
36
|
-
let gridClass: string;
|
|
37
|
-
let columnWidths: number[];
|
|
38
|
-
|
|
39
|
-
// Grid class mapping for Tailwind (must be explicit for dynamic classes)
|
|
40
|
-
const gridClassMap: Record<number, string> = {
|
|
41
|
-
1: 'grid-cols-1',
|
|
42
|
-
2: 'grid-cols-2',
|
|
43
|
-
3: 'grid-cols-3',
|
|
44
|
-
4: 'grid-cols-4',
|
|
45
|
-
5: 'grid-cols-5',
|
|
46
|
-
6: 'grid-cols-6',
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
if (columnCount !== undefined && columnCount > 0) {
|
|
50
|
-
// Dynamic column system
|
|
51
|
-
numColumns = columnCount;
|
|
52
|
-
// Create equal-width columns
|
|
53
|
-
const widthPercent = Math.floor(100 / numColumns);
|
|
54
|
-
columnWidths = Array(numColumns).fill(widthPercent);
|
|
55
|
-
// Use explicit grid class from map, fallback to inline style if needed
|
|
56
|
-
gridClass = gridClassMap[numColumns] || \`grid-cols-\${numColumns}\`;
|
|
57
|
-
} else if (layout && COLUMN_LAYOUTS[layout]) {
|
|
58
|
-
// Legacy layout-based system
|
|
59
|
-
const layoutConfig = COLUMN_LAYOUTS[layout];
|
|
60
|
-
numColumns = layoutConfig.widths.length;
|
|
61
|
-
gridClass = layoutConfig.grid;
|
|
62
|
-
columnWidths = layoutConfig.widths;
|
|
63
|
-
} else {
|
|
64
|
-
// Default to 2 columns
|
|
65
|
-
numColumns = 2;
|
|
66
|
-
gridClass = 'grid-cols-2';
|
|
67
|
-
columnWidths = [50, 50];
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Split child blocks into columns based on columnIndex in meta, or round-robin
|
|
71
|
-
const columns: Block[][] = Array.from({ length: numColumns }, () => []);
|
|
72
|
-
childBlocks.forEach((childBlock) => {
|
|
73
|
-
const columnIndex = childBlock.meta?.columnIndex;
|
|
74
|
-
if (typeof columnIndex === 'number' && columnIndex >= 0 && columnIndex < numColumns) {
|
|
75
|
-
columns[columnIndex].push(childBlock);
|
|
76
|
-
} else {
|
|
77
|
-
// Fallback to round-robin if no columnIndex specified
|
|
78
|
-
const index = childBlocks.indexOf(childBlock);
|
|
79
|
-
columns[index % numColumns].push(childBlock);
|
|
80
|
-
}
|
|
81
|
-
});
|