@trycourier/react-designer 0.0.0-canary-20251202152218 → 0.0.0-canary-20251204163023
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/cjs/index.js +54 -54
- package/dist/cjs/index.js.map +4 -4
- package/dist/cjs/styles.css +4 -0
- package/dist/components/extensions/Button/Button.types.d.ts +4 -4
- package/dist/components/extensions/Column/Column.types.d.ts +2 -2
- package/dist/components/extensions/ImageBlock/ImageBlock.types.d.ts +2 -6
- package/dist/components/extensions/TextBlock/TextBlock.types.d.ts +2 -10
- package/dist/components/ui/TextMenu/config.d.ts +16 -0
- package/dist/components/ui/TextMenu/hooks/useConditionalRules.d.ts +18 -0
- package/dist/components/ui/TextMenu/hooks/useTextmenuCommands.d.ts +15 -1
- package/dist/esm/index.js +55 -55
- package/dist/esm/index.js.map +4 -4
- package/dist/esm/styles.css +4 -0
- package/dist/lib/utils/image.d.ts +5 -0
- package/dist/styles.css +4 -0
- package/dist/types/elemental.types.d.ts +22 -2
- package/package.json +1 -1
package/dist/cjs/styles.css
CHANGED
|
@@ -2711,6 +2711,10 @@ body {
|
|
|
2711
2711
|
.courier-sms-editor .ProseMirror > .react-renderer .draggable-item > div {
|
|
2712
2712
|
padding-left: 0px;
|
|
2713
2713
|
}
|
|
2714
|
+
.courier-sms-editor .ProseMirror > .react-renderer.node-paragraph p {
|
|
2715
|
+
overflow-wrap: break-word;
|
|
2716
|
+
word-break: break-word;
|
|
2717
|
+
}
|
|
2714
2718
|
.courier-sms-editor .ProseMirror > .react-renderer.node-paragraph .selected-element .node-element::before {
|
|
2715
2719
|
display: none;
|
|
2716
2720
|
}
|
|
@@ -19,11 +19,11 @@ export declare const buttonSchema: z.ZodObject<{
|
|
|
19
19
|
label: string;
|
|
20
20
|
backgroundColor: string;
|
|
21
21
|
textColor: string;
|
|
22
|
+
borderWidth: number;
|
|
22
23
|
borderColor: string;
|
|
24
|
+
alignment: "left" | "center" | "right";
|
|
23
25
|
size: "full" | "default";
|
|
24
|
-
borderWidth: number;
|
|
25
26
|
borderRadius: number;
|
|
26
|
-
alignment: "left" | "center" | "right";
|
|
27
27
|
fontStyle: "italic" | "normal";
|
|
28
28
|
fontWeight: "bold" | "normal";
|
|
29
29
|
isUnderline: boolean;
|
|
@@ -34,11 +34,11 @@ export declare const buttonSchema: z.ZodObject<{
|
|
|
34
34
|
label: string;
|
|
35
35
|
backgroundColor: string;
|
|
36
36
|
textColor: string;
|
|
37
|
+
borderWidth: number;
|
|
37
38
|
borderColor: string;
|
|
39
|
+
alignment: "left" | "center" | "right";
|
|
38
40
|
size: "full" | "default";
|
|
39
|
-
borderWidth: number;
|
|
40
41
|
borderRadius: number;
|
|
41
|
-
alignment: "left" | "center" | "right";
|
|
42
42
|
fontStyle: "italic" | "normal";
|
|
43
43
|
fontWeight: "bold" | "normal";
|
|
44
44
|
isUnderline: boolean;
|
|
@@ -22,8 +22,8 @@ export declare const columnSchema: z.ZodObject<{
|
|
|
22
22
|
backgroundColor: string;
|
|
23
23
|
paddingVertical: number;
|
|
24
24
|
paddingHorizontal: number;
|
|
25
|
-
borderColor: string;
|
|
26
25
|
borderWidth: number;
|
|
26
|
+
borderColor: string;
|
|
27
27
|
borderRadius: number;
|
|
28
28
|
columnsCount: number;
|
|
29
29
|
cells?: {
|
|
@@ -33,8 +33,8 @@ export declare const columnSchema: z.ZodObject<{
|
|
|
33
33
|
backgroundColor?: string | undefined;
|
|
34
34
|
paddingVertical?: number | undefined;
|
|
35
35
|
paddingHorizontal?: number | undefined;
|
|
36
|
-
borderColor?: string | undefined;
|
|
37
36
|
borderWidth?: number | undefined;
|
|
37
|
+
borderColor?: string | undefined;
|
|
38
38
|
borderRadius?: number | undefined;
|
|
39
39
|
columnsCount?: number | undefined;
|
|
40
40
|
cells?: {
|
|
@@ -6,15 +6,13 @@ export declare const imageBlockSchema: z.ZodObject<{
|
|
|
6
6
|
alignment: z.ZodEnum<["left", "center", "right"]>;
|
|
7
7
|
width: z.ZodNumber;
|
|
8
8
|
borderWidth: z.ZodNumber;
|
|
9
|
-
borderRadius: z.ZodNumber;
|
|
10
9
|
borderColor: z.ZodString;
|
|
11
10
|
isUploading: z.ZodOptional<z.ZodBoolean>;
|
|
12
11
|
imageNaturalWidth: z.ZodNumber;
|
|
13
12
|
}, "strip", z.ZodTypeAny, {
|
|
14
13
|
width: number;
|
|
15
|
-
borderColor: string;
|
|
16
14
|
borderWidth: number;
|
|
17
|
-
|
|
15
|
+
borderColor: string;
|
|
18
16
|
alignment: "left" | "center" | "right";
|
|
19
17
|
sourcePath: string;
|
|
20
18
|
imageNaturalWidth: number;
|
|
@@ -23,9 +21,8 @@ export declare const imageBlockSchema: z.ZodObject<{
|
|
|
23
21
|
isUploading?: boolean | undefined;
|
|
24
22
|
}, {
|
|
25
23
|
width: number;
|
|
26
|
-
borderColor: string;
|
|
27
24
|
borderWidth: number;
|
|
28
|
-
|
|
25
|
+
borderColor: string;
|
|
29
26
|
alignment: "left" | "center" | "right";
|
|
30
27
|
sourcePath: string;
|
|
31
28
|
imageNaturalWidth: number;
|
|
@@ -40,7 +37,6 @@ export interface ImageBlockProps {
|
|
|
40
37
|
alignment: "left" | "center" | "right";
|
|
41
38
|
width: number;
|
|
42
39
|
borderWidth: number;
|
|
43
|
-
borderRadius: number;
|
|
44
40
|
borderColor: string;
|
|
45
41
|
isUploading?: boolean;
|
|
46
42
|
imageNaturalWidth: number;
|
|
@@ -4,31 +4,25 @@ export declare const textBlockSchema: z.ZodObject<{
|
|
|
4
4
|
paddingHorizontal: z.ZodNumber;
|
|
5
5
|
backgroundColor: z.ZodString;
|
|
6
6
|
borderWidth: z.ZodNumber;
|
|
7
|
-
borderRadius: z.ZodNumber;
|
|
8
7
|
borderColor: z.ZodString;
|
|
9
|
-
textColor: z.ZodString;
|
|
10
8
|
textAlign: z.ZodDefault<z.ZodEnum<["left", "center", "right", "justify"]>>;
|
|
11
9
|
selected: z.ZodDefault<z.ZodBoolean>;
|
|
12
10
|
id: z.ZodOptional<z.ZodString>;
|
|
13
11
|
}, "strip", z.ZodTypeAny, {
|
|
14
12
|
backgroundColor: string;
|
|
15
|
-
textColor: string;
|
|
16
13
|
paddingVertical: number;
|
|
17
14
|
paddingHorizontal: number;
|
|
18
|
-
borderColor: string;
|
|
19
15
|
borderWidth: number;
|
|
20
|
-
|
|
16
|
+
borderColor: string;
|
|
21
17
|
textAlign: "left" | "center" | "right" | "justify";
|
|
22
18
|
selected: boolean;
|
|
23
19
|
id?: string | undefined;
|
|
24
20
|
}, {
|
|
25
21
|
backgroundColor: string;
|
|
26
|
-
textColor: string;
|
|
27
22
|
paddingVertical: number;
|
|
28
23
|
paddingHorizontal: number;
|
|
29
|
-
borderColor: string;
|
|
30
24
|
borderWidth: number;
|
|
31
|
-
|
|
25
|
+
borderColor: string;
|
|
32
26
|
id?: string | undefined;
|
|
33
27
|
textAlign?: "left" | "center" | "right" | "justify" | undefined;
|
|
34
28
|
selected?: boolean | undefined;
|
|
@@ -38,9 +32,7 @@ export interface TextBlockProps {
|
|
|
38
32
|
paddingHorizontal: number;
|
|
39
33
|
backgroundColor: string;
|
|
40
34
|
borderWidth: number;
|
|
41
|
-
borderRadius: number;
|
|
42
35
|
borderColor: string;
|
|
43
|
-
textColor: string;
|
|
44
36
|
textAlign: "left" | "center" | "right" | "justify";
|
|
45
37
|
selected: boolean;
|
|
46
38
|
id?: string;
|
|
@@ -2,6 +2,21 @@ export type TextMenuItemState = "enabled" | "disabled" | "hidden";
|
|
|
2
2
|
export interface TextMenuItem {
|
|
3
3
|
state: TextMenuItemState;
|
|
4
4
|
}
|
|
5
|
+
export interface ConditionalRule {
|
|
6
|
+
id: string;
|
|
7
|
+
trigger: {
|
|
8
|
+
type: "node";
|
|
9
|
+
name: string;
|
|
10
|
+
active: boolean;
|
|
11
|
+
};
|
|
12
|
+
conditions: {
|
|
13
|
+
activeItems: Array<keyof TextMenuConfig>;
|
|
14
|
+
};
|
|
15
|
+
action: {
|
|
16
|
+
type: "toggle_off";
|
|
17
|
+
targets: Array<keyof TextMenuConfig>;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
5
20
|
export interface TextMenuConfig {
|
|
6
21
|
contentType?: TextMenuItem;
|
|
7
22
|
bold?: TextMenuItem;
|
|
@@ -15,6 +30,7 @@ export interface TextMenuConfig {
|
|
|
15
30
|
quote?: TextMenuItem;
|
|
16
31
|
link?: TextMenuItem;
|
|
17
32
|
variable?: TextMenuItem;
|
|
33
|
+
conditionalRules?: ConditionalRule[];
|
|
18
34
|
}
|
|
19
35
|
export declare const defaultTextMenuConfig: TextMenuConfig;
|
|
20
36
|
export declare const getTextMenuConfigForNode: (nodeName: string, hasTextSelection?: boolean) => TextMenuConfig;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Editor } from "@tiptap/react";
|
|
2
|
+
import type { TextMenuConfig } from "../config";
|
|
3
|
+
interface TextMenuStates {
|
|
4
|
+
isBold: boolean;
|
|
5
|
+
isItalic: boolean;
|
|
6
|
+
isUnderline: boolean;
|
|
7
|
+
isStrike: boolean;
|
|
8
|
+
isQuote: boolean;
|
|
9
|
+
isAlignLeft: boolean;
|
|
10
|
+
isAlignCenter: boolean;
|
|
11
|
+
isAlignRight: boolean;
|
|
12
|
+
isAlignJustify: boolean;
|
|
13
|
+
isLink: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const useConditionalRules: (config: TextMenuConfig | undefined, editor: Editor | null, states: TextMenuStates | undefined) => {
|
|
16
|
+
getRuleForItem: (itemKey: keyof TextMenuConfig) => import("../config").ConditionalRule | undefined;
|
|
17
|
+
} | null;
|
|
18
|
+
export {};
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import type { Editor } from "@tiptap/react";
|
|
2
|
-
|
|
2
|
+
import type { TextMenuConfig } from "../config";
|
|
3
|
+
interface TextMenuStates {
|
|
4
|
+
isBold: boolean;
|
|
5
|
+
isItalic: boolean;
|
|
6
|
+
isUnderline: boolean;
|
|
7
|
+
isStrike: boolean;
|
|
8
|
+
isQuote: boolean;
|
|
9
|
+
isAlignLeft: boolean;
|
|
10
|
+
isAlignCenter: boolean;
|
|
11
|
+
isAlignRight: boolean;
|
|
12
|
+
isAlignJustify: boolean;
|
|
13
|
+
isLink: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const useTextmenuCommands: (editor: Editor, config?: TextMenuConfig, states?: TextMenuStates) => {
|
|
3
16
|
onBold: () => boolean;
|
|
4
17
|
onItalic: () => boolean;
|
|
5
18
|
onStrike: () => boolean;
|
|
@@ -12,3 +25,4 @@ export declare const useTextmenuCommands: (editor: Editor) => {
|
|
|
12
25
|
onQuote: () => void;
|
|
13
26
|
resetButtonFormatting: () => boolean;
|
|
14
27
|
};
|
|
28
|
+
export {};
|