@dotcms/react 0.0.1-beta.26 → 0.0.1-beta.28

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/next.esm.js CHANGED
@@ -3,10 +3,10 @@ import { createContext, useContext, useState, useEffect, useLayoutEffect, useRef
3
3
  import { s as styleInject } from './web.url-search-params.size.esm.js';
4
4
  import { UVE_MODE, UVEEventType, DotCMSUVEAction } from '@dotcms/types';
5
5
  import { getUVEState, initUVE, createUVESubscription, sendMessageToUVE } from '@dotcms/uve';
6
- import { DEVELOPMENT_MODE, EMPTY_CONTAINER_STYLE_REACT, getDotContentletAttributes, CUSTOM_NO_COMPONENT, getContainersData, getContentletsInContainer, getDotContainerAttributes, getColumnPositionClasses, combineClasses, __DEFAULT_TINYMCE_CONFIG__, __BASE_TINYMCE_CONFIG_WITH_NO_DEFAULT__, __TINYMCE_PATH_ON_DOTCMS__ } from '@dotcms/uve/internal';
6
+ import { DEVELOPMENT_MODE, EMPTY_CONTAINER_STYLE_REACT, getDotContentletAttributes, CUSTOM_NO_COMPONENT, getContainersData, getContentletsInContainer, getDotContainerAttributes, getColumnPositionClasses, combineClasses, __DEFAULT_TINYMCE_CONFIG__, __BASE_TINYMCE_CONFIG_WITH_NO_DEFAULT__, __TINYMCE_PATH_ON_DOTCMS__, isValidBlocks } from '@dotcms/uve/internal';
7
7
  import { updateNavigation } from '@dotcms/client';
8
8
  import { Editor } from '@tinymce/tinymce-react';
9
- import { __DOTCMS_UVE_EVENT__ } from '@dotcms/types/internal';
9
+ import { __DOTCMS_UVE_EVENT__, BlockEditorDefaultBlocks } from '@dotcms/types/internal';
10
10
 
11
11
  /**
12
12
  * The `PageContext` is a React context that provides access to the DotCMS page context.
@@ -814,4 +814,543 @@ function DotCMSEditableText({
814
814
  });
815
815
  }
816
816
 
817
- export { DotCMSEditableText, DotCMSLayoutBody, DotCMSShow, useDotCMSShowWhen, useEditableDotCMSPage };
817
+ /**
818
+ * Renders a code block component.
819
+ *
820
+ * @param attrs - The attributes of the code block.
821
+ * @param children - The content of the code block.
822
+ * @returns The rendered code block component.
823
+ */
824
+ const CodeBlock = ({
825
+ node,
826
+ children
827
+ }) => {
828
+ var _node$attrs;
829
+ const language = (node == null || (_node$attrs = node.attrs) == null ? void 0 : _node$attrs.language) || '';
830
+ return jsx("pre", {
831
+ "data-language": language,
832
+ children: jsx("code", {
833
+ children: children
834
+ })
835
+ });
836
+ };
837
+ /**
838
+ * Renders a blockquote component.
839
+ *
840
+ * @param children - The content to be rendered inside the blockquote.
841
+ * @returns The rendered blockquote component.
842
+ */
843
+ const BlockQuote = ({
844
+ children
845
+ }) => {
846
+ return jsx("blockquote", {
847
+ children: children
848
+ });
849
+ };
850
+
851
+ /**
852
+ * Renders a DotContent component.
853
+ *
854
+ * @param {DotContentProps} props - The props for the DotContent component.
855
+ * @returns {JSX.Element} The rendered DotContent component.
856
+ */
857
+ const DotContent = ({
858
+ customRenderers,
859
+ node
860
+ }) => {
861
+ const isDevMode = useIsDevMode();
862
+ const attrs = (node == null ? void 0 : node.attrs) || {};
863
+ const data = attrs.data;
864
+ if (!data) {
865
+ console.error('DotContent: No data provided');
866
+ return null;
867
+ }
868
+ const contentType = data.contentType || 'Unknown Content Type';
869
+ const Component = customRenderers[contentType];
870
+ // In dev mode, show a helpful message for unknown content types
871
+ if (isDevMode && !Component) {
872
+ return jsxs("div", {
873
+ children: ["Unknown ContentType: ", contentType]
874
+ });
875
+ }
876
+ // In production, use default component if no matching component found
877
+ if (!Component) {
878
+ console.error('DotContent: No matching component found for content type', contentType);
879
+ return null;
880
+ }
881
+ return jsx(Component, Object.assign({}, node));
882
+ };
883
+
884
+ /**
885
+ * Renders an image component for dotCMS.
886
+ *
887
+ * @param node - The node for the DotCMSImage component.
888
+ * @returns The rendered image component.
889
+ */
890
+ const DotCMSImage = ({
891
+ node
892
+ }) => {
893
+ const {
894
+ src,
895
+ alt
896
+ } = node.attrs;
897
+ return jsx("img", {
898
+ alt: alt,
899
+ src: src
900
+ });
901
+ };
902
+
903
+ /**
904
+ * ListItem component represents a list item in a block editor.
905
+ *
906
+ * @param children - The content of the list item.
907
+ * @returns The rendered list item element.
908
+ */
909
+ const ListItem = ({
910
+ children
911
+ }) => {
912
+ return jsx("li", {
913
+ children: children
914
+ });
915
+ };
916
+ /**
917
+ * Renders an ordered list component.
918
+ *
919
+ * @param children - The content to be rendered inside the ordered list.
920
+ * @returns The ordered list component.
921
+ */
922
+ const OrderedList = ({
923
+ children
924
+ }) => {
925
+ return jsx("ol", {
926
+ children: children
927
+ });
928
+ };
929
+ /**
930
+ * Renders a bullet list component.
931
+ *
932
+ * @param children - The content of the bullet list.
933
+ * @returns The rendered bullet list component.
934
+ */
935
+ const BulletList = ({
936
+ children
937
+ }) => {
938
+ return jsx("ul", {
939
+ children: children
940
+ });
941
+ };
942
+
943
+ /**
944
+ * Renders a table component for the Block Editor.
945
+ *
946
+ * @param content - The content of the table.
947
+ * @param blockEditorItem - The Block Editor item component.
948
+ */
949
+ const TableRenderer = ({
950
+ content,
951
+ blockEditorItem
952
+ }) => {
953
+ const BlockEditorItemComponent = blockEditorItem;
954
+ const renderTableContent = node => {
955
+ var _node$content;
956
+ return jsx(BlockEditorItemComponent, {
957
+ content: (_node$content = node.content) != null ? _node$content : []
958
+ });
959
+ };
960
+ return jsxs("table", {
961
+ children: [jsx("thead", {
962
+ children: content.slice(0, 1).map((rowNode, rowIndex) => {
963
+ var _rowNode$content;
964
+ return jsx("tr", {
965
+ children: (_rowNode$content = rowNode.content) == null ? void 0 : _rowNode$content.map((cellNode, cellIndex) => {
966
+ var _cellNode$attrs, _cellNode$attrs2;
967
+ return jsx("th", {
968
+ colSpan: Number(((_cellNode$attrs = cellNode.attrs) == null ? void 0 : _cellNode$attrs.colspan) || 1),
969
+ rowSpan: Number(((_cellNode$attrs2 = cellNode.attrs) == null ? void 0 : _cellNode$attrs2.rowspan) || 1),
970
+ children: renderTableContent(cellNode)
971
+ }, `${cellNode.type}-${cellIndex}`);
972
+ })
973
+ }, `${rowNode.type}-${rowIndex}`);
974
+ })
975
+ }), jsx("tbody", {
976
+ children: content.slice(1).map((rowNode, rowIndex) => {
977
+ var _rowNode$content2;
978
+ return jsx("tr", {
979
+ children: (_rowNode$content2 = rowNode.content) == null ? void 0 : _rowNode$content2.map((cellNode, cellIndex) => {
980
+ var _cellNode$attrs3, _cellNode$attrs4;
981
+ return jsx("td", {
982
+ colSpan: Number(((_cellNode$attrs3 = cellNode.attrs) == null ? void 0 : _cellNode$attrs3.colspan) || 1),
983
+ rowSpan: Number(((_cellNode$attrs4 = cellNode.attrs) == null ? void 0 : _cellNode$attrs4.rowspan) || 1),
984
+ children: renderTableContent(cellNode)
985
+ }, `${cellNode.type}-${cellIndex}`);
986
+ })
987
+ }, `${rowNode.type}-${rowIndex}`);
988
+ })
989
+ })]
990
+ });
991
+ };
992
+
993
+ /**
994
+ * Renders the text in bold.
995
+ *
996
+ * @param children - The content to be rendered in bold.
997
+ */
998
+ const Bold = ({
999
+ children
1000
+ }) => jsx("strong", {
1001
+ children: children
1002
+ });
1003
+ /**
1004
+ * Renders the text in italic format.
1005
+ *
1006
+ * @param children - The content to be rendered in italic.
1007
+ */
1008
+ const Italic = ({
1009
+ children
1010
+ }) => jsx("em", {
1011
+ children: children
1012
+ });
1013
+ /**
1014
+ * Renders a strike-through text.
1015
+ *
1016
+ * @param children - The content to be rendered within the strike-through element.
1017
+ */
1018
+ const Strike = ({
1019
+ children
1020
+ }) => jsx("s", {
1021
+ children: children
1022
+ });
1023
+ /**
1024
+ * Renders an underline element for the given children.
1025
+ *
1026
+ * @param children - The content to be underlined.
1027
+ */
1028
+ const Underline = ({
1029
+ children
1030
+ }) => jsx("u", {
1031
+ children: children
1032
+ });
1033
+ /**
1034
+ * Renders a paragraph element.
1035
+ *
1036
+ * @param children - The content of the paragraph.
1037
+ * @param attrs - The style attributes for the paragraph.
1038
+ * @returns The rendered paragraph element.
1039
+ */
1040
+ const Paragraph = ({
1041
+ children,
1042
+ node
1043
+ }) => {
1044
+ const attrs = (node == null ? void 0 : node.attrs) || {};
1045
+ return jsx("p", {
1046
+ style: attrs,
1047
+ children: children
1048
+ });
1049
+ };
1050
+ /**
1051
+ * Renders a link component.
1052
+ *
1053
+ * @param children - The content of the link.
1054
+ * @param attrs - The attributes to be applied to the link.
1055
+ * @returns The rendered link component.
1056
+ */
1057
+ const Link = ({
1058
+ children,
1059
+ attrs
1060
+ }) => {
1061
+ return jsx("a", Object.assign({}, attrs, {
1062
+ children: children
1063
+ }));
1064
+ };
1065
+ /**
1066
+ * Renders a heading element with the specified level.
1067
+ *
1068
+ * @param children - The content of the heading.
1069
+ * @param attrs - The attributes for the heading.
1070
+ * @returns The rendered heading element.
1071
+ */
1072
+ const Heading = ({
1073
+ children,
1074
+ node
1075
+ }) => {
1076
+ const attrs = (node == null ? void 0 : node.attrs) || {};
1077
+ const level = attrs.level || 1;
1078
+ const Tag = `h${level}`;
1079
+ return jsx(Tag, {
1080
+ children: children
1081
+ });
1082
+ };
1083
+ /**
1084
+ * Renders the superscript text.
1085
+ *
1086
+ * @param children - The content to be rendered as superscript.
1087
+ */
1088
+ const Superscript = ({
1089
+ children
1090
+ }) => jsx("sup", {
1091
+ children: children
1092
+ });
1093
+ /**
1094
+ * Renders a subscript element.
1095
+ *
1096
+ * @param children - The content to be rendered as subscript.
1097
+ */
1098
+ const Subscript = ({
1099
+ children
1100
+ }) => jsx("sub", {
1101
+ children: children
1102
+ });
1103
+ const nodeMarks = {
1104
+ bold: Bold,
1105
+ link: Link,
1106
+ italic: Italic,
1107
+ strike: Strike,
1108
+ subscript: Subscript,
1109
+ underline: Underline,
1110
+ superscript: Superscript
1111
+ };
1112
+ const defaultMark = {
1113
+ type: '',
1114
+ attrs: {}
1115
+ };
1116
+ /**
1117
+ * Renders a text block with optional marks.
1118
+ *
1119
+ * @param props - The props for the TextBlock component.
1120
+ * @returns The rendered text block.
1121
+ */
1122
+ const TextBlock = (props = {}) => {
1123
+ const {
1124
+ marks = [],
1125
+ text
1126
+ } = props;
1127
+ const mark = marks[0] || defaultMark;
1128
+ const textProps = Object.assign({}, props, {
1129
+ marks: marks.slice(1)
1130
+ });
1131
+ const Component = nodeMarks[mark == null ? void 0 : mark.type];
1132
+ // In React, class is not a valid attribute name, so we need to rename it to className
1133
+ if (mark.attrs) {
1134
+ mark.attrs.className = mark.attrs.class;
1135
+ delete mark.attrs.class;
1136
+ }
1137
+ if (!Component) {
1138
+ return text;
1139
+ }
1140
+ return jsx(Component, {
1141
+ type: mark.type,
1142
+ attrs: mark.attrs,
1143
+ children: jsx(TextBlock, Object.assign({}, textProps))
1144
+ });
1145
+ };
1146
+
1147
+ /**
1148
+ * Renders a video component for displaying videos.
1149
+ *
1150
+ * @param props - The properties for the video component.
1151
+ * @returns The rendered video component.
1152
+ */
1153
+ const DotCMSVideo = ({
1154
+ node
1155
+ }) => {
1156
+ const {
1157
+ data,
1158
+ src,
1159
+ mimeType,
1160
+ width,
1161
+ height
1162
+ } = node.attrs;
1163
+ const poster = data == null ? void 0 : data.thumbnail;
1164
+ const posterAttribute = poster ? {
1165
+ poster
1166
+ } : {};
1167
+ return jsxs("video", Object.assign({
1168
+ controls: true,
1169
+ preload: "metadata",
1170
+ width: width,
1171
+ height: height
1172
+ }, posterAttribute, {
1173
+ children: [jsx("track", {
1174
+ default: true,
1175
+ kind: "captions",
1176
+ srcLang: "en"
1177
+ }), jsx("source", {
1178
+ src: src,
1179
+ type: mimeType
1180
+ }), "Your browser does not support the ", jsx("code", {
1181
+ children: "video"
1182
+ }), " element."]
1183
+ }));
1184
+ };
1185
+
1186
+ /**
1187
+ * Renders a block editor item based on the provided content and custom renderers.
1188
+ *
1189
+ * @param content - The content nodes to render.
1190
+ * @param customRenderers - Optional custom renderers for specific node types.
1191
+ * @returns The rendered block editor item.
1192
+ */
1193
+ const BlockEditorBlock = ({
1194
+ content,
1195
+ customRenderers
1196
+ }) => {
1197
+ if (!content) {
1198
+ return null;
1199
+ }
1200
+ return content == null ? void 0 : content.map((node, index) => {
1201
+ var _node$content;
1202
+ const CustomRendererComponent = customRenderers == null ? void 0 : customRenderers[node.type];
1203
+ if (CustomRendererComponent) {
1204
+ return jsx(CustomRendererComponent, {
1205
+ content: node.content,
1206
+ children: jsx(BlockEditorBlock, {
1207
+ content: node.content,
1208
+ customRenderers: customRenderers
1209
+ })
1210
+ }, `${node.type}-${index}`);
1211
+ }
1212
+ switch (node.type) {
1213
+ case BlockEditorDefaultBlocks.PARAGRAPH:
1214
+ return jsx(Paragraph, {
1215
+ node: node,
1216
+ children: jsx(BlockEditorBlock, {
1217
+ content: node.content,
1218
+ customRenderers: customRenderers
1219
+ })
1220
+ }, `${node.type}-${index}`);
1221
+ case BlockEditorDefaultBlocks.HEADING:
1222
+ return jsx(Heading, {
1223
+ node: node,
1224
+ children: jsx(BlockEditorBlock, {
1225
+ content: node.content,
1226
+ customRenderers: customRenderers
1227
+ })
1228
+ }, `${node.type}-${index}`);
1229
+ case BlockEditorDefaultBlocks.TEXT:
1230
+ return jsx(TextBlock, Object.assign({}, node), `${node.type}-${index}`);
1231
+ case BlockEditorDefaultBlocks.BULLET_LIST:
1232
+ return jsx(BulletList, {
1233
+ children: jsx(BlockEditorBlock, {
1234
+ content: node.content,
1235
+ customRenderers: customRenderers
1236
+ })
1237
+ }, `${node.type}-${index}`);
1238
+ case BlockEditorDefaultBlocks.ORDERED_LIST:
1239
+ return jsx(OrderedList, {
1240
+ children: jsx(BlockEditorBlock, {
1241
+ content: node.content,
1242
+ customRenderers: customRenderers
1243
+ })
1244
+ }, `${node.type}-${index}`);
1245
+ case BlockEditorDefaultBlocks.LIST_ITEM:
1246
+ return jsx(ListItem, {
1247
+ children: jsx(BlockEditorBlock, {
1248
+ content: node.content,
1249
+ customRenderers: customRenderers
1250
+ })
1251
+ }, `${node.type}-${index}`);
1252
+ case BlockEditorDefaultBlocks.BLOCK_QUOTE:
1253
+ return jsx(BlockQuote, {
1254
+ children: jsx(BlockEditorBlock, {
1255
+ content: node.content,
1256
+ customRenderers: customRenderers
1257
+ })
1258
+ }, `${node.type}-${index}`);
1259
+ case BlockEditorDefaultBlocks.CODE_BLOCK:
1260
+ return jsx(CodeBlock, {
1261
+ node: node,
1262
+ children: jsx(BlockEditorBlock, {
1263
+ content: node.content,
1264
+ customRenderers: customRenderers
1265
+ })
1266
+ }, `${node.type}-${index}`);
1267
+ case BlockEditorDefaultBlocks.HARDBREAK:
1268
+ return jsx("br", {}, `${node.type}-${index}`);
1269
+ case BlockEditorDefaultBlocks.HORIZONTAL_RULE:
1270
+ return jsx("hr", {}, `${node.type}-${index}`);
1271
+ case BlockEditorDefaultBlocks.DOT_IMAGE:
1272
+ return jsx(DotCMSImage, {
1273
+ node: node
1274
+ }, `${node.type}-${index}`);
1275
+ case BlockEditorDefaultBlocks.DOT_VIDEO:
1276
+ return jsx(DotCMSVideo, {
1277
+ node: node
1278
+ }, `${node.type}-${index}`);
1279
+ case BlockEditorDefaultBlocks.TABLE:
1280
+ return jsx(TableRenderer, {
1281
+ content: (_node$content = node.content) != null ? _node$content : [],
1282
+ blockEditorItem: BlockEditorBlock
1283
+ }, `${node.type}-${index}`);
1284
+ case BlockEditorDefaultBlocks.DOT_CONTENT:
1285
+ return jsx(DotContent, {
1286
+ customRenderers: customRenderers,
1287
+ node: node
1288
+ }, `${node.type}-${index}`);
1289
+ default:
1290
+ return jsxs("div", {
1291
+ children: ["Unknown Block Type ", node.type]
1292
+ }, `${node.type}-${index}`);
1293
+ }
1294
+ });
1295
+ };
1296
+
1297
+ /**
1298
+ * BlockEditorRenderer component for rendering block editor field.
1299
+ *
1300
+ * @component
1301
+ * @param {Object} props - The component props.
1302
+ * @param {BlockEditorContent} props.blocks - The blocks of content to render.
1303
+ * @param {CustomRenderer} [props.customRenderers] - Optional custom renderers for specific block types.
1304
+ * @param {string} [props.className] - Optional CSS class name for the container div.
1305
+ * @param {React.CSSProperties} [props.style] - Optional inline styles for the container div.
1306
+ * @returns {JSX.Element} A div containing the rendered blocks of content.
1307
+ */
1308
+ const DotCMSBlockEditorRenderer = ({
1309
+ blocks,
1310
+ style,
1311
+ className,
1312
+ customRenderers
1313
+ }) => {
1314
+ const [blockEditorState, setBlockEditorState] = useState({
1315
+ error: null
1316
+ });
1317
+ const isDevMode = useIsDevMode();
1318
+ /**
1319
+ * Validates the blocks structure and updates the block editor state.
1320
+ *
1321
+ * This effect:
1322
+ * 1. Validates that blocks have the correct structure (doc type, content array, etc)
1323
+ * 2. Updates the block editor state with validation result
1324
+ * 3. Logs any validation errors to console
1325
+ *
1326
+ * @dependency {Block} blocks - The content blocks to validate
1327
+ */
1328
+ useEffect(() => {
1329
+ const validationResult = isValidBlocks(blocks);
1330
+ setBlockEditorState(validationResult);
1331
+ if (validationResult.error) {
1332
+ console.error(validationResult.error);
1333
+ }
1334
+ }, [blocks]);
1335
+ if (blockEditorState.error) {
1336
+ console.error(blockEditorState.error);
1337
+ if (isDevMode) {
1338
+ return jsx("div", {
1339
+ "data-testid": "invalid-blocks-message",
1340
+ children: blockEditorState.error
1341
+ });
1342
+ }
1343
+ return null;
1344
+ }
1345
+ return jsx("div", {
1346
+ className: className,
1347
+ style: style,
1348
+ "data-testid": "dot-block-editor-container",
1349
+ children: jsx(BlockEditorBlock, {
1350
+ content: blocks == null ? void 0 : blocks.content,
1351
+ customRenderers: customRenderers
1352
+ })
1353
+ });
1354
+ };
1355
+
1356
+ export { DotCMSBlockEditorRenderer, DotCMSEditableText, DotCMSLayoutBody, DotCMSShow, useDotCMSShowWhen, useEditableDotCMSPage };
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@dotcms/react",
3
- "version": "0.0.1-beta.26",
3
+ "version": "0.0.1-beta.28",
4
4
  "peerDependencies": {
5
5
  "react": ">=18",
6
6
  "react-dom": ">=18",
7
- "@dotcms/client": "0.0.1-beta.26",
8
- "@dotcms/uve": "0.0.1-beta.26",
7
+ "@dotcms/client": "0.0.1-beta.28",
8
+ "@dotcms/uve": "0.0.1-beta.28",
9
9
  "@tinymce/tinymce-react": "^6.0.0"
10
10
  },
11
11
  "devDependencies": {
@@ -0,0 +1,27 @@
1
+ /// <reference types="react" />
2
+ import { BlockEditorContent } from '@dotcms/types';
3
+ /**
4
+ * Represents a Custom Renderer used by the Block Editor Component
5
+ *
6
+ * @export
7
+ * @interface CustomRenderer
8
+ */
9
+ export type CustomRenderer<T = any> = Record<string, React.FC<T>>;
10
+ export interface BlockEditorRendererProps {
11
+ blocks: BlockEditorContent;
12
+ style?: React.CSSProperties;
13
+ className?: string;
14
+ customRenderers?: CustomRenderer;
15
+ }
16
+ /**
17
+ * BlockEditorRenderer component for rendering block editor field.
18
+ *
19
+ * @component
20
+ * @param {Object} props - The component props.
21
+ * @param {BlockEditorContent} props.blocks - The blocks of content to render.
22
+ * @param {CustomRenderer} [props.customRenderers] - Optional custom renderers for specific block types.
23
+ * @param {string} [props.className] - Optional CSS class name for the container div.
24
+ * @param {React.CSSProperties} [props.style] - Optional inline styles for the container div.
25
+ * @returns {JSX.Element} A div containing the rendered blocks of content.
26
+ */
27
+ export declare const DotCMSBlockEditorRenderer: ({ blocks, style, className, customRenderers }: BlockEditorRendererProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,15 @@
1
+ import { BlockEditorNode } from '@dotcms/types';
2
+ import { CustomRenderer } from '../DotCMSBlockEditorRenderer';
3
+ interface BlockEditorBlockProps {
4
+ content: BlockEditorNode[] | undefined;
5
+ customRenderers?: CustomRenderer;
6
+ }
7
+ /**
8
+ * Renders a block editor item based on the provided content and custom renderers.
9
+ *
10
+ * @param content - The content nodes to render.
11
+ * @param customRenderers - Optional custom renderers for specific node types.
12
+ * @returns The rendered block editor item.
13
+ */
14
+ export declare const BlockEditorBlock: ({ content, customRenderers }: BlockEditorBlockProps) => import("react/jsx-runtime").JSX.Element[] | null;
15
+ export {};
@@ -0,0 +1,24 @@
1
+ /// <reference types="react" />
2
+ import { BlockEditorNode } from '@dotcms/types';
3
+ interface CodeBlockProps {
4
+ node: BlockEditorNode;
5
+ children: React.ReactNode;
6
+ }
7
+ /**
8
+ * Renders a code block component.
9
+ *
10
+ * @param attrs - The attributes of the code block.
11
+ * @param children - The content of the code block.
12
+ * @returns The rendered code block component.
13
+ */
14
+ export declare const CodeBlock: ({ node, children }: CodeBlockProps) => import("react/jsx-runtime").JSX.Element;
15
+ /**
16
+ * Renders a blockquote component.
17
+ *
18
+ * @param children - The content to be rendered inside the blockquote.
19
+ * @returns The rendered blockquote component.
20
+ */
21
+ export declare const BlockQuote: ({ children }: {
22
+ children: React.ReactNode;
23
+ }) => import("react/jsx-runtime").JSX.Element;
24
+ export {};
@@ -0,0 +1,14 @@
1
+ import { BlockEditorNode } from '@dotcms/types';
2
+ import { CustomRenderer } from '../../DotCMSBlockEditorRenderer';
3
+ interface DotContentProps {
4
+ customRenderers: CustomRenderer;
5
+ node: BlockEditorNode;
6
+ }
7
+ /**
8
+ * Renders a DotContent component.
9
+ *
10
+ * @param {DotContentProps} props - The props for the DotContent component.
11
+ * @returns {JSX.Element} The rendered DotContent component.
12
+ */
13
+ export declare const DotContent: ({ customRenderers, node }: DotContentProps) => import("react/jsx-runtime").JSX.Element | null;
14
+ export {};
@@ -0,0 +1,10 @@
1
+ import { BlockEditorNode } from '@dotcms/types';
2
+ /**
3
+ * Renders an image component for dotCMS.
4
+ *
5
+ * @param node - The node for the DotCMSImage component.
6
+ * @returns The rendered image component.
7
+ */
8
+ export declare const DotCMSImage: ({ node }: {
9
+ node: BlockEditorNode;
10
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,26 @@
1
+ /// <reference types="react" />
2
+ interface ListItemProps {
3
+ children: React.ReactNode;
4
+ }
5
+ /**
6
+ * ListItem component represents a list item in a block editor.
7
+ *
8
+ * @param children - The content of the list item.
9
+ * @returns The rendered list item element.
10
+ */
11
+ export declare const ListItem: ({ children }: ListItemProps) => import("react/jsx-runtime").JSX.Element;
12
+ /**
13
+ * Renders an ordered list component.
14
+ *
15
+ * @param children - The content to be rendered inside the ordered list.
16
+ * @returns The ordered list component.
17
+ */
18
+ export declare const OrderedList: ({ children }: ListItemProps) => import("react/jsx-runtime").JSX.Element;
19
+ /**
20
+ * Renders a bullet list component.
21
+ *
22
+ * @param children - The content of the bullet list.
23
+ * @returns The rendered bullet list component.
24
+ */
25
+ export declare const BulletList: ({ children }: ListItemProps) => import("react/jsx-runtime").JSX.Element;
26
+ export {};
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { BlockEditorNode } from '@dotcms/types';
3
+ interface TableRendererProps {
4
+ content: BlockEditorNode[];
5
+ blockEditorItem: React.FC<{
6
+ content: BlockEditorNode[];
7
+ }>;
8
+ }
9
+ /**
10
+ * Renders a table component for the Block Editor.
11
+ *
12
+ * @param content - The content of the table.
13
+ * @param blockEditorItem - The Block Editor item component.
14
+ */
15
+ export declare const TableRenderer: React.FC<TableRendererProps>;
16
+ export {};
@@ -0,0 +1,81 @@
1
+ /// <reference types="react" />
2
+ import { BlockEditorMark, BlockEditorNode } from '@dotcms/types';
3
+ interface MarkProps extends BlockEditorMark {
4
+ children: React.ReactNode;
5
+ }
6
+ interface TextComponentProp {
7
+ children: React.ReactNode;
8
+ node: BlockEditorNode;
9
+ }
10
+ interface TextNodeProps {
11
+ marks?: BlockEditorMark[];
12
+ text?: string;
13
+ }
14
+ /**
15
+ * Renders the text in bold.
16
+ *
17
+ * @param children - The content to be rendered in bold.
18
+ */
19
+ export declare const Bold: ({ children }: MarkProps) => import("react/jsx-runtime").JSX.Element;
20
+ /**
21
+ * Renders the text in italic format.
22
+ *
23
+ * @param children - The content to be rendered in italic.
24
+ */
25
+ export declare const Italic: ({ children }: MarkProps) => import("react/jsx-runtime").JSX.Element;
26
+ /**
27
+ * Renders a strike-through text.
28
+ *
29
+ * @param children - The content to be rendered within the strike-through element.
30
+ */
31
+ export declare const Strike: ({ children }: MarkProps) => import("react/jsx-runtime").JSX.Element;
32
+ /**
33
+ * Renders an underline element for the given children.
34
+ *
35
+ * @param children - The content to be underlined.
36
+ */
37
+ export declare const Underline: ({ children }: MarkProps) => import("react/jsx-runtime").JSX.Element;
38
+ /**
39
+ * Renders a paragraph element.
40
+ *
41
+ * @param children - The content of the paragraph.
42
+ * @param attrs - The style attributes for the paragraph.
43
+ * @returns The rendered paragraph element.
44
+ */
45
+ export declare const Paragraph: ({ children, node }: TextComponentProp) => import("react/jsx-runtime").JSX.Element;
46
+ /**
47
+ * Renders a link component.
48
+ *
49
+ * @param children - The content of the link.
50
+ * @param attrs - The attributes to be applied to the link.
51
+ * @returns The rendered link component.
52
+ */
53
+ export declare const Link: ({ children, attrs }: MarkProps) => import("react/jsx-runtime").JSX.Element;
54
+ /**
55
+ * Renders a heading element with the specified level.
56
+ *
57
+ * @param children - The content of the heading.
58
+ * @param attrs - The attributes for the heading.
59
+ * @returns The rendered heading element.
60
+ */
61
+ export declare const Heading: ({ children, node }: TextComponentProp) => import("react/jsx-runtime").JSX.Element;
62
+ /**
63
+ * Renders the superscript text.
64
+ *
65
+ * @param children - The content to be rendered as superscript.
66
+ */
67
+ export declare const Superscript: ({ children }: MarkProps) => import("react/jsx-runtime").JSX.Element;
68
+ /**
69
+ * Renders a subscript element.
70
+ *
71
+ * @param children - The content to be rendered as subscript.
72
+ */
73
+ export declare const Subscript: ({ children }: MarkProps) => import("react/jsx-runtime").JSX.Element;
74
+ /**
75
+ * Renders a text block with optional marks.
76
+ *
77
+ * @param props - The props for the TextBlock component.
78
+ * @returns The rendered text block.
79
+ */
80
+ export declare const TextBlock: (props?: TextNodeProps) => string | import("react/jsx-runtime").JSX.Element | undefined;
81
+ export {};
@@ -0,0 +1,10 @@
1
+ import { BlockEditorNode } from '@dotcms/types';
2
+ /**
3
+ * Renders a video component for displaying videos.
4
+ *
5
+ * @param props - The properties for the video component.
6
+ * @returns The rendered video component.
7
+ */
8
+ export declare const DotCMSVideo: ({ node }: {
9
+ node: BlockEditorNode;
10
+ }) => import("react/jsx-runtime").JSX.Element;
package/src/next.d.ts CHANGED
@@ -3,3 +3,4 @@ export { DotCMSShow } from './lib/next/components/DotCMSShow/DotCMSShow';
3
3
  export { useDotCMSShowWhen } from './lib/next/hooks/useDotCMSShowWhen';
4
4
  export { useEditableDotCMSPage } from './lib/next/hooks/useEditableDotCMSPage';
5
5
  export { DotCMSEditableText } from './lib/next/components/DotCMSEditableText/DotCMSEditableText';
6
+ export { DotCMSBlockEditorRenderer, BlockEditorRendererProps } from './lib/next/components/DotCMSBlockEditorRenderer/DotCMSBlockEditorRenderer';