@commercetools-uikit/rich-text-utils 12.2.7 → 13.0.3
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/commercetools-uikit-rich-text-utils.cjs.d.ts +1 -0
- package/dist/commercetools-uikit-rich-text-utils.cjs.dev.js +261 -248
- package/dist/commercetools-uikit-rich-text-utils.cjs.prod.js +170 -147
- package/dist/commercetools-uikit-rich-text-utils.esm.js +258 -244
- package/dist/declarations/src/editor.types.d.ts +103 -0
- package/dist/declarations/src/has-block.d.ts +3 -0
- package/dist/declarations/src/html/html.d.ts +3 -0
- package/dist/declarations/src/html/index.d.ts +1 -0
- package/dist/declarations/src/index.d.ts +6 -0
- package/dist/declarations/src/is-empty/index.d.ts +1 -0
- package/dist/declarations/src/is-empty/is-empty.d.ts +2 -0
- package/dist/declarations/src/localized/index.d.ts +1 -0
- package/dist/declarations/src/localized/localized.d.ts +6 -0
- package/dist/declarations/src/plugins/index.d.ts +1 -0
- package/dist/declarations/src/plugins/list.d.ts +22 -0
- package/dist/declarations/src/plugins/mark.d.ts +29 -0
- package/dist/declarations/src/plugins/placeholder.d.ts +30 -0
- package/dist/declarations/src/plugins/plugins.d.ts +17 -0
- package/dist/declarations/src/plugins/redo.d.ts +12 -0
- package/dist/declarations/src/plugins/undo.d.ts +15 -0
- package/dist/declarations/src/rich-text-body/divider.d.ts +6 -0
- package/dist/declarations/src/rich-text-body/dropdown.d.ts +43 -0
- package/dist/declarations/src/rich-text-body/dropdown.styles.d.ts +19 -0
- package/dist/declarations/src/rich-text-body/hidden-input.d.ts +12 -0
- package/dist/declarations/src/rich-text-body/icons/generated/BoldReact.d.ts +14 -0
- package/dist/declarations/src/rich-text-body/icons/generated/ExpandFullReact.d.ts +14 -0
- package/dist/declarations/src/rich-text-body/icons/generated/ItalicReact.d.ts +14 -0
- package/dist/declarations/src/rich-text-body/icons/generated/MoreStylesReact.d.ts +14 -0
- package/dist/declarations/src/rich-text-body/icons/generated/OrderedListReact.d.ts +14 -0
- package/dist/declarations/src/rich-text-body/icons/generated/RedoReact.d.ts +14 -0
- package/dist/declarations/src/rich-text-body/icons/generated/StrikethroughReact.d.ts +14 -0
- package/dist/declarations/src/rich-text-body/icons/generated/SubscriptReact.d.ts +14 -0
- package/dist/declarations/src/rich-text-body/icons/generated/SuperscriptReact.d.ts +14 -0
- package/dist/declarations/src/rich-text-body/icons/generated/UnderlineReact.d.ts +14 -0
- package/dist/declarations/src/rich-text-body/icons/generated/UndoReact.d.ts +14 -0
- package/dist/declarations/src/rich-text-body/icons/generated/UnorderedListReact.d.ts +14 -0
- package/dist/declarations/src/rich-text-body/icons/generated/index.d.ts +12 -0
- package/dist/declarations/src/rich-text-body/icons/index.d.ts +1 -0
- package/dist/declarations/src/rich-text-body/index.d.ts +2 -0
- package/dist/declarations/src/rich-text-body/messages.d.ts +108 -0
- package/dist/declarations/src/rich-text-body/rich-text-body-button.d.ts +14 -0
- package/dist/declarations/src/rich-text-body/rich-text-body.d.ts +25 -0
- package/dist/declarations/src/rich-text-body/rich-text-body.styles.d.ts +24 -0
- package/dist/declarations/src/rich-text-plugins.d.ts +121 -0
- package/dist/declarations/src/tags.d.ts +22 -0
- package/dist/declarations/src/version.d.ts +2 -0
- package/package.json +12 -12
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
boldButtonLabel: {
|
|
3
|
+
id: string;
|
|
4
|
+
description: string;
|
|
5
|
+
defaultMessage: string;
|
|
6
|
+
};
|
|
7
|
+
expandButtonLabel: {
|
|
8
|
+
id: string;
|
|
9
|
+
description: string;
|
|
10
|
+
defaultMessage: string;
|
|
11
|
+
};
|
|
12
|
+
italicButtonLabel: {
|
|
13
|
+
id: string;
|
|
14
|
+
description: string;
|
|
15
|
+
defaultMessage: string;
|
|
16
|
+
};
|
|
17
|
+
moreStylesDropdownLabel: {
|
|
18
|
+
id: string;
|
|
19
|
+
description: string;
|
|
20
|
+
defaultMessage: string;
|
|
21
|
+
};
|
|
22
|
+
moreStylesDropdownOptionStrikethrough: {
|
|
23
|
+
id: string;
|
|
24
|
+
description: string;
|
|
25
|
+
defaultMessage: string;
|
|
26
|
+
};
|
|
27
|
+
moreStylesDropdownOptionSuperscript: {
|
|
28
|
+
id: string;
|
|
29
|
+
description: string;
|
|
30
|
+
defaultMessage: string;
|
|
31
|
+
};
|
|
32
|
+
moreStylesDropdownOptionSubscript: {
|
|
33
|
+
id: string;
|
|
34
|
+
description: string;
|
|
35
|
+
defaultMessage: string;
|
|
36
|
+
};
|
|
37
|
+
orderedListButtonLabel: {
|
|
38
|
+
id: string;
|
|
39
|
+
description: string;
|
|
40
|
+
defaultMessage: string;
|
|
41
|
+
};
|
|
42
|
+
redoButtonLabel: {
|
|
43
|
+
id: string;
|
|
44
|
+
description: string;
|
|
45
|
+
defaultMessage: string;
|
|
46
|
+
};
|
|
47
|
+
styleDropdownLabel: {
|
|
48
|
+
id: string;
|
|
49
|
+
description: string;
|
|
50
|
+
defaultMessage: string;
|
|
51
|
+
};
|
|
52
|
+
styleDropdownOptionParagraph: {
|
|
53
|
+
id: string;
|
|
54
|
+
description: string;
|
|
55
|
+
defaultMessage: string;
|
|
56
|
+
};
|
|
57
|
+
styleDropdownOptionH1: {
|
|
58
|
+
id: string;
|
|
59
|
+
description: string;
|
|
60
|
+
defaultMessage: string;
|
|
61
|
+
};
|
|
62
|
+
styleDropdownOptionH2: {
|
|
63
|
+
id: string;
|
|
64
|
+
description: string;
|
|
65
|
+
defaultMessage: string;
|
|
66
|
+
};
|
|
67
|
+
styleDropdownOptionH3: {
|
|
68
|
+
id: string;
|
|
69
|
+
description: string;
|
|
70
|
+
defaultMessage: string;
|
|
71
|
+
};
|
|
72
|
+
styleDropdownOptionH4: {
|
|
73
|
+
id: string;
|
|
74
|
+
description: string;
|
|
75
|
+
defaultMessage: string;
|
|
76
|
+
};
|
|
77
|
+
styleDropdownOptionH5: {
|
|
78
|
+
id: string;
|
|
79
|
+
description: string;
|
|
80
|
+
defaultMessage: string;
|
|
81
|
+
};
|
|
82
|
+
styleDropdownOptionQuote: {
|
|
83
|
+
id: string;
|
|
84
|
+
description: string;
|
|
85
|
+
defaultMessage: string;
|
|
86
|
+
};
|
|
87
|
+
styleDropdownOptionPreformatted: {
|
|
88
|
+
id: string;
|
|
89
|
+
description: string;
|
|
90
|
+
defaultMessage: string;
|
|
91
|
+
};
|
|
92
|
+
underlinedButtonLabel: {
|
|
93
|
+
id: string;
|
|
94
|
+
description: string;
|
|
95
|
+
defaultMessage: string;
|
|
96
|
+
};
|
|
97
|
+
undoButtonLabel: {
|
|
98
|
+
id: string;
|
|
99
|
+
description: string;
|
|
100
|
+
defaultMessage: string;
|
|
101
|
+
};
|
|
102
|
+
unorderedListButtonLabel: {
|
|
103
|
+
id: string;
|
|
104
|
+
description: string;
|
|
105
|
+
defaultMessage: string;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
declare type TRichTextBodyButtonProps = {
|
|
3
|
+
isDisabled?: boolean;
|
|
4
|
+
label: string;
|
|
5
|
+
isActive?: boolean;
|
|
6
|
+
isReadOnly?: boolean;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
onClick?: () => void;
|
|
9
|
+
};
|
|
10
|
+
declare const RichTextBodyButton: {
|
|
11
|
+
(props: TRichTextBodyButtonProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
12
|
+
displayName: string;
|
|
13
|
+
};
|
|
14
|
+
export default RichTextBodyButton;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ReactNode, type LegacyRef, type CSSProperties } from 'react';
|
|
2
|
+
import type { TEditor } from '../editor.types';
|
|
3
|
+
declare type TNodeRefObject = {
|
|
4
|
+
clientHeight: number;
|
|
5
|
+
} & LegacyRef<HTMLDivElement>;
|
|
6
|
+
declare type TRichtTextEditorBodyRef = {
|
|
7
|
+
registerContentNode: TNodeRefObject;
|
|
8
|
+
containerRef?: LegacyRef<HTMLDivElement>;
|
|
9
|
+
};
|
|
10
|
+
export declare type TRichTextEditorBody = {
|
|
11
|
+
editor: TEditor;
|
|
12
|
+
styles: {
|
|
13
|
+
container?: string;
|
|
14
|
+
};
|
|
15
|
+
hasError?: boolean;
|
|
16
|
+
isReadOnly: boolean;
|
|
17
|
+
hasWarning?: boolean;
|
|
18
|
+
isDisabled?: boolean;
|
|
19
|
+
showExpandIcon: boolean;
|
|
20
|
+
onClickExpand?: () => boolean;
|
|
21
|
+
containerStyles: CSSProperties;
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
};
|
|
24
|
+
declare const RichTextEditorBody: import("react").ForwardRefExoticComponent<TRichTextEditorBody & import("react").RefAttributes<TRichtTextEditorBodyRef>>;
|
|
25
|
+
export default RichTextEditorBody;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TRichTextEditorBody } from './rich-text-body';
|
|
3
|
+
declare type TRichTextBodyStylesProps = Pick<TRichTextEditorBody, 'hasError' | 'isReadOnly' | 'hasWarning' | 'isDisabled'>;
|
|
4
|
+
export declare const ToolbarMainControls: import("@emotion/styled").StyledComponent<{
|
|
5
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
6
|
+
as?: import("react").ElementType<any> | undefined;
|
|
7
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
8
|
+
export declare const ToolbarRightControls: import("@emotion/styled").StyledComponent<{
|
|
9
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
10
|
+
as?: import("react").ElementType<any> | undefined;
|
|
11
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
12
|
+
export declare const Toolbar: import("@emotion/styled").StyledComponent<{
|
|
13
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
14
|
+
as?: import("react").ElementType<any> | undefined;
|
|
15
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
16
|
+
export declare const EditorContainer: import("@emotion/styled").StyledComponent<{
|
|
17
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
18
|
+
as?: import("react").ElementType<any> | undefined;
|
|
19
|
+
} & TRichTextBodyStylesProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
20
|
+
export declare const Container: import("@emotion/styled").StyledComponent<{
|
|
21
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
22
|
+
as?: import("react").ElementType<any> | undefined;
|
|
23
|
+
} & TRichTextBodyStylesProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TEditor } from './editor.types';
|
|
3
|
+
declare const plugins: ({
|
|
4
|
+
decorateNode: (node: import("./editor.types").TNode, editor: TEditor, next: () => JSX.Element[]) => (JSX.Element | {
|
|
5
|
+
type: string;
|
|
6
|
+
data: {
|
|
7
|
+
key: number;
|
|
8
|
+
get?: ((name: string) => number) | undefined;
|
|
9
|
+
};
|
|
10
|
+
anchor: {
|
|
11
|
+
key: string;
|
|
12
|
+
offset: number;
|
|
13
|
+
path: string;
|
|
14
|
+
};
|
|
15
|
+
focus: {
|
|
16
|
+
key: string;
|
|
17
|
+
offset: number;
|
|
18
|
+
path: string;
|
|
19
|
+
};
|
|
20
|
+
})[];
|
|
21
|
+
renderDecoration: (props: {
|
|
22
|
+
children: import("react").ReactNode;
|
|
23
|
+
decoration: {
|
|
24
|
+
type: string;
|
|
25
|
+
data: {
|
|
26
|
+
key: number;
|
|
27
|
+
get?: ((name: string) => number) | undefined;
|
|
28
|
+
};
|
|
29
|
+
anchor: {
|
|
30
|
+
key: string;
|
|
31
|
+
offset: number;
|
|
32
|
+
path: string;
|
|
33
|
+
};
|
|
34
|
+
focus: {
|
|
35
|
+
key: string;
|
|
36
|
+
offset: number;
|
|
37
|
+
path: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
}, editor: Pick<TEditor, "props">, next: () => JSX.Element) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
41
|
+
} | {
|
|
42
|
+
onKeyDown(event: {
|
|
43
|
+
preventDefault: () => void;
|
|
44
|
+
}, editor: TEditor, next: () => void): void;
|
|
45
|
+
renderMark(props: {
|
|
46
|
+
children: import("react").ReactNode;
|
|
47
|
+
mark: import("./editor.types").TMark;
|
|
48
|
+
attributes: unknown;
|
|
49
|
+
}, _editor: TEditor, next: () => JSX.Element): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
50
|
+
commands: {
|
|
51
|
+
[x: string]: (editor: TEditor) => void | undefined;
|
|
52
|
+
};
|
|
53
|
+
queries: {
|
|
54
|
+
[x: string]: (editor: TEditor) => boolean | void;
|
|
55
|
+
};
|
|
56
|
+
}[] | {
|
|
57
|
+
renderMark(props: {
|
|
58
|
+
children: import("react").ReactNode;
|
|
59
|
+
mark: {
|
|
60
|
+
type: string;
|
|
61
|
+
};
|
|
62
|
+
attributes: unknown;
|
|
63
|
+
node: {
|
|
64
|
+
type: string;
|
|
65
|
+
};
|
|
66
|
+
}, next: () => import("react").ReactNode): import("react").ReactNode;
|
|
67
|
+
} | {
|
|
68
|
+
renderBlock(props: {
|
|
69
|
+
children: import("react").ReactNode;
|
|
70
|
+
mark: {
|
|
71
|
+
type: string;
|
|
72
|
+
};
|
|
73
|
+
attributes: unknown;
|
|
74
|
+
node: {
|
|
75
|
+
type: string;
|
|
76
|
+
};
|
|
77
|
+
}, next: () => import("react").ReactNode): import("react").ReactNode;
|
|
78
|
+
} | {
|
|
79
|
+
onKeyDown(event: import("react").KeyboardEvent<HTMLButtonElement | HTMLInputElement>, editor: TEditor & {
|
|
80
|
+
undo: () => void;
|
|
81
|
+
}, next: () => void): void;
|
|
82
|
+
queries: {
|
|
83
|
+
hasUndos: (editor: TEditor & {
|
|
84
|
+
undo: () => void;
|
|
85
|
+
}) => boolean;
|
|
86
|
+
};
|
|
87
|
+
commands: {
|
|
88
|
+
toggleUndo: (editor: TEditor & {
|
|
89
|
+
undo: () => void;
|
|
90
|
+
}) => void;
|
|
91
|
+
};
|
|
92
|
+
}[] | {
|
|
93
|
+
onKeyDown(event: import("react").KeyboardEvent<HTMLButtonElement | HTMLInputElement>, editor: TEditor, next: () => void): void;
|
|
94
|
+
queries: {
|
|
95
|
+
hasRedos: (editor: TEditor) => boolean;
|
|
96
|
+
};
|
|
97
|
+
commands: {
|
|
98
|
+
toggleRedo: (editor: TEditor) => void;
|
|
99
|
+
};
|
|
100
|
+
}[] | {
|
|
101
|
+
renderBlock(props: {
|
|
102
|
+
attributes: unknown;
|
|
103
|
+
children: import("react").ReactNode;
|
|
104
|
+
node: {
|
|
105
|
+
type: string;
|
|
106
|
+
};
|
|
107
|
+
}, _editor: TEditor, next: () => JSX.Element): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
108
|
+
commands: {
|
|
109
|
+
toggleBulletedListBlock: (editor: TEditor) => void;
|
|
110
|
+
toggleNumberedListBlock: (editor: TEditor) => void;
|
|
111
|
+
};
|
|
112
|
+
queries: {
|
|
113
|
+
hasBulletedListBlock: (editor: TEditor) => boolean | void;
|
|
114
|
+
hasNumberedListBlock: (editor: TEditor) => boolean | void;
|
|
115
|
+
};
|
|
116
|
+
}[] | {
|
|
117
|
+
queries: {
|
|
118
|
+
shouldUsePlaceholder: (editor: TEditor) => boolean;
|
|
119
|
+
};
|
|
120
|
+
})[];
|
|
121
|
+
export default plugins;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const BLOCK_TAGS: {
|
|
2
|
+
blockquote: string;
|
|
3
|
+
p: string;
|
|
4
|
+
h1: string;
|
|
5
|
+
h2: string;
|
|
6
|
+
h3: string;
|
|
7
|
+
h4: string;
|
|
8
|
+
h5: string;
|
|
9
|
+
pre: string;
|
|
10
|
+
li: string;
|
|
11
|
+
ol: string;
|
|
12
|
+
ul: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const MARK_TAGS: {
|
|
15
|
+
em: string;
|
|
16
|
+
strong: string;
|
|
17
|
+
u: string;
|
|
18
|
+
sup: string;
|
|
19
|
+
sub: string;
|
|
20
|
+
del: string;
|
|
21
|
+
span: string;
|
|
22
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-uikit/rich-text-utils",
|
|
3
3
|
"description": "Utilities for working with rich-text components.",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "13.0.3",
|
|
5
5
|
"bugs": "https://github.com/commercetools/ui-kit/issues",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -19,29 +19,29 @@
|
|
|
19
19
|
"module": "dist/commercetools-uikit-rich-text-utils.esm.js",
|
|
20
20
|
"files": ["dist"],
|
|
21
21
|
"scripts": {
|
|
22
|
-
"generate-icons": "svgr -d src/rich-text-body/icons/generated --typescript src/rich-text-body/icons/svg"
|
|
22
|
+
"generate-icons": "svgr -d src/rich-text-body/icons/generated --typescript -- src/rich-text-body/icons/svg"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@babel/runtime": "7.
|
|
26
|
-
"@babel/runtime-corejs3": "7.
|
|
27
|
-
"@commercetools-uikit/design-system": "
|
|
28
|
-
"@commercetools-uikit/icons": "
|
|
29
|
-
"@commercetools-uikit/input-utils": "
|
|
30
|
-
"@commercetools-uikit/spacings-inline": "
|
|
31
|
-
"@commercetools-uikit/tooltip": "
|
|
32
|
-
"@commercetools-uikit/utils": "
|
|
25
|
+
"@babel/runtime": "7.17.2",
|
|
26
|
+
"@babel/runtime-corejs3": "7.17.2",
|
|
27
|
+
"@commercetools-uikit/design-system": "13.0.0",
|
|
28
|
+
"@commercetools-uikit/icons": "13.0.2",
|
|
29
|
+
"@commercetools-uikit/input-utils": "13.0.2",
|
|
30
|
+
"@commercetools-uikit/spacings-inline": "13.0.2",
|
|
31
|
+
"@commercetools-uikit/tooltip": "13.0.2",
|
|
32
|
+
"@commercetools-uikit/utils": "13.0.2",
|
|
33
33
|
"@emotion/react": "^11.4.0",
|
|
34
34
|
"@emotion/styled": "^11.3.0",
|
|
35
35
|
"downshift": "6.1.7",
|
|
36
36
|
"is-hotkey": "0.2.0",
|
|
37
37
|
"lodash": "4.17.21",
|
|
38
|
-
"prop-types": "15.
|
|
38
|
+
"prop-types": "15.8.1",
|
|
39
39
|
"react-required-if": "1.0.3",
|
|
40
40
|
"slate-html-serializer": "0.8.13"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"react": "17.0.2",
|
|
44
|
-
"react-intl": "5.
|
|
44
|
+
"react-intl": "5.24.6"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"react": "17.x",
|