@dotcms/uve 0.0.1-beta.15 → 0.0.1-beta.16
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/constants.cjs.js +767 -0
- package/constants.esm.js +740 -0
- package/index.cjs.js +8 -81
- package/index.esm.js +4 -76
- package/internal.cjs.js +107 -623
- package/internal.esm.js +78 -603
- package/package.json +1 -1
- package/src/internal.d.ts +2 -0
- package/src/lib/editor/internal.d.ts +16 -1
- package/src/lib/types/block-editor-renderer/internal.d.ts +46 -0
- package/src/lib/types/block-editor-renderer/public.d.ts +38 -0
- package/src/types.d.ts +1 -0
package/package.json
CHANGED
package/src/internal.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { DotCMSContainerBound } from '@dotcms/uve/internal';
|
|
1
|
+
import { BlockEditorState, DotCMSContainerBound } from '@dotcms/uve/internal';
|
|
2
|
+
import { Block } from '@dotcms/uve/types';
|
|
2
3
|
/**
|
|
3
4
|
* Sets the bounds of the containers in the editor.
|
|
4
5
|
* Retrieves the containers from the DOM and sends their position data to the editor.
|
|
@@ -6,3 +7,17 @@ import { DotCMSContainerBound } from '@dotcms/uve/internal';
|
|
|
6
7
|
* @memberof DotCMSPageEditor
|
|
7
8
|
*/
|
|
8
9
|
export declare function setBounds(bounds: DotCMSContainerBound[]): void;
|
|
10
|
+
/**
|
|
11
|
+
* Validates the structure of a Block Editor block.
|
|
12
|
+
*
|
|
13
|
+
* This function checks that:
|
|
14
|
+
* 1. The blocks parameter is a valid object
|
|
15
|
+
* 2. The block has a 'doc' type
|
|
16
|
+
* 3. The block has a valid content array that is not empty
|
|
17
|
+
*
|
|
18
|
+
* @param {Block} blocks - The blocks structure to validate
|
|
19
|
+
* @returns {BlockEditorState} Object containing validation state and any error message
|
|
20
|
+
* @property {boolean} BlockEditorState.isValid - Whether the blocks structure is valid
|
|
21
|
+
* @property {string | null} BlockEditorState.error - Error message if invalid, null if valid
|
|
22
|
+
*/
|
|
23
|
+
export declare const isValidBlocks: (blocks: Block) => BlockEditorState;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum representing the different types of blocks available in the Block Editor
|
|
3
|
+
*
|
|
4
|
+
* @export
|
|
5
|
+
* @enum {string}
|
|
6
|
+
*/
|
|
7
|
+
export declare enum Blocks {
|
|
8
|
+
/** Represents a paragraph block */
|
|
9
|
+
PARAGRAPH = "paragraph",
|
|
10
|
+
/** Represents a heading block */
|
|
11
|
+
HEADING = "heading",
|
|
12
|
+
/** Represents a text block */
|
|
13
|
+
TEXT = "text",
|
|
14
|
+
/** Represents a bullet/unordered list block */
|
|
15
|
+
BULLET_LIST = "bulletList",
|
|
16
|
+
/** Represents an ordered/numbered list block */
|
|
17
|
+
ORDERED_LIST = "orderedList",
|
|
18
|
+
/** Represents a list item within a list block */
|
|
19
|
+
LIST_ITEM = "listItem",
|
|
20
|
+
/** Represents a blockquote block */
|
|
21
|
+
BLOCK_QUOTE = "blockquote",
|
|
22
|
+
/** Represents a code block */
|
|
23
|
+
CODE_BLOCK = "codeBlock",
|
|
24
|
+
/** Represents a hard break (line break) */
|
|
25
|
+
HARDBREAK = "hardBreak",
|
|
26
|
+
/** Represents a horizontal rule/divider */
|
|
27
|
+
HORIZONTAL_RULE = "horizontalRule",
|
|
28
|
+
/** Represents a DotCMS image block */
|
|
29
|
+
DOT_IMAGE = "dotImage",
|
|
30
|
+
/** Represents a DotCMS video block */
|
|
31
|
+
DOT_VIDEO = "dotVideo",
|
|
32
|
+
/** Represents a table block */
|
|
33
|
+
TABLE = "table",
|
|
34
|
+
/** Represents a DotCMS content block */
|
|
35
|
+
DOT_CONTENT = "dotContent"
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Represents the validation state of a Block Editor instance
|
|
39
|
+
*
|
|
40
|
+
* @interface BlockEditorState
|
|
41
|
+
* @property {boolean} isValid - Whether the blocks structure is valid
|
|
42
|
+
* @property {string | null} error - Error message if blocks are invalid, null otherwise
|
|
43
|
+
*/
|
|
44
|
+
export interface BlockEditorState {
|
|
45
|
+
error: string | null;
|
|
46
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a Mark used by text content in the Block Editor
|
|
3
|
+
*
|
|
4
|
+
* @export
|
|
5
|
+
* @interface Mark
|
|
6
|
+
*/
|
|
7
|
+
export interface Mark {
|
|
8
|
+
type: string;
|
|
9
|
+
attrs: Record<string, string>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Represents a Content Node used by the Block Editor
|
|
13
|
+
*
|
|
14
|
+
* @export
|
|
15
|
+
* @interface ContentNode
|
|
16
|
+
*/
|
|
17
|
+
export interface ContentNode {
|
|
18
|
+
/** The type of content node */
|
|
19
|
+
type: string;
|
|
20
|
+
/** Child content nodes */
|
|
21
|
+
content?: ContentNode[];
|
|
22
|
+
/** Optional attributes for the node */
|
|
23
|
+
attrs?: Record<string, any>;
|
|
24
|
+
/** Optional marks applied to text content */
|
|
25
|
+
marks?: Mark[];
|
|
26
|
+
/** Optional text content */
|
|
27
|
+
text?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Represents a Block in the Block Editor
|
|
31
|
+
*
|
|
32
|
+
* @export
|
|
33
|
+
* @interface Block
|
|
34
|
+
*/
|
|
35
|
+
export interface Block {
|
|
36
|
+
content?: ContentNode[];
|
|
37
|
+
type: string;
|
|
38
|
+
}
|
package/src/types.d.ts
CHANGED