@trycourier/react-designer 0.5.1 → 0.7.0
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/README.md +75 -3
- package/dist/cjs/index.js +66 -58
- package/dist/cjs/index.js.map +4 -4
- package/dist/cjs/styles.css +579 -249
- package/dist/components/BrandEditor/Editor/BrandFooter/BrandFooter.d.ts +3 -1
- package/dist/components/Providers/TemplateProvider.d.ts +2 -0
- package/dist/components/TemplateEditor/Channels/Email/EmailEditor.d.ts +3 -1
- package/dist/components/TemplateEditor/Channels/Inbox/Inbox.d.ts +3 -0
- package/dist/components/TemplateEditor/Channels/Inbox/InboxEditor.d.ts +3 -1
- package/dist/components/TemplateEditor/Channels/MSTeams/MSTeams.d.ts +6 -1
- package/dist/components/TemplateEditor/Channels/MSTeams/MSTeamsEditor.d.ts +3 -1
- package/dist/components/TemplateEditor/Channels/MSTeams/SideBar/MSTeamsSideBarItemDetails.d.ts +8 -0
- package/dist/components/TemplateEditor/Channels/MSTeams/SideBar/index.d.ts +1 -0
- package/dist/components/TemplateEditor/Channels/MSTeams/index.d.ts +1 -1
- package/dist/components/TemplateEditor/Channels/Push/PushEditor.d.ts +3 -1
- package/dist/components/TemplateEditor/Channels/SMS/SMSEditor.d.ts +3 -1
- package/dist/components/TemplateEditor/Channels/Slack/Slack.d.ts +6 -1
- package/dist/components/TemplateEditor/Channels/Slack/SlackEditor.d.ts +3 -1
- package/dist/components/TemplateEditor/Layout/Layout.d.ts +1 -0
- package/dist/components/TemplateEditor/TemplateEditor.d.ts +2 -0
- package/dist/components/TemplateEditor/VariableViewModeSync.d.ts +27 -0
- package/dist/components/TemplateEditor/index.d.ts +2 -1
- package/dist/components/TemplateEditor/store.d.ts +19 -1
- package/dist/components/extensions/Blockquote/Blockquote.d.ts +4 -0
- package/dist/components/extensions/Button/Button.d.ts +0 -3
- package/dist/components/extensions/Button/Button.types.d.ts +8 -4
- package/dist/components/extensions/Button/ButtonComponent.d.ts +2 -3
- package/dist/components/extensions/Button/buttonUtils.d.ts +13 -0
- package/dist/components/extensions/HardBreak/HardBreak.d.ts +12 -0
- package/dist/components/extensions/HardBreak/index.d.ts +1 -0
- package/dist/components/extensions/ImageBlock/components/ImageBlockView.d.ts +1 -3
- package/dist/components/extensions/List/List.d.ts +0 -1
- package/dist/components/extensions/List/List.types.d.ts +0 -10
- package/dist/components/extensions/List/ListForm.d.ts +6 -1
- package/dist/components/extensions/MessagingChannelPaste/MessagingChannelPaste.d.ts +11 -0
- package/dist/components/extensions/MessagingChannelPaste/index.d.ts +2 -0
- package/dist/components/extensions/Variable/Variable.d.ts +5 -0
- package/dist/components/extensions/Variable/index.d.ts +2 -0
- package/dist/components/extensions/Variable/variable-storage.types.d.ts +26 -0
- package/dist/components/extensions/Variable/variable-storage.utils.d.ts +72 -0
- package/dist/components/extensions/extension-kit.d.ts +17 -0
- package/dist/components/extensions/index.d.ts +1 -1
- package/dist/components/ui/TextMenu/components/ContentTypePicker.d.ts +1 -1
- package/dist/components/ui/TextMenu/hooks/useTextmenuCommands.d.ts +0 -1
- package/dist/components/ui/TextMenu/hooks/useTextmenuStates.d.ts +1 -0
- package/dist/components/ui/VariableEditor/VariableChipBase.d.ts +8 -0
- package/dist/components/ui/VariableEditor/VariableInput.d.ts +18 -0
- package/dist/components/ui-kit/Button/Button.d.ts +1 -1
- package/dist/components/ui-kit/Toggle/Toggle.d.ts +2 -2
- package/dist/components/ui-kit/ToggleGroup/ToggleGroup.d.ts +2 -2
- package/dist/components/utils/shadowDomDndFix.d.ts +47 -0
- package/dist/esm/index.js +65 -57
- package/dist/esm/index.js.map +4 -4
- package/dist/esm/styles.css +579 -249
- package/dist/hooks/useAutoSave.d.ts +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/lib/constants/block-defaults.d.ts +43 -0
- package/dist/lib/constants/email-editor-tiptap-styles.d.ts +62 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/testHelpers.d.ts +21 -1
- package/dist/lib/utils/convertElementalToTiptap/convertElementalToTiptap.d.ts +6 -1
- package/dist/lib/utils/getTitle/index.d.ts +1 -1
- package/dist/lib/utils/getTitle/preserveStorageFormat.d.ts +7 -0
- package/dist/styles.css +579 -249
- package/dist/types/elemental.types.d.ts +3 -6
- package/package.json +6 -1
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { type VariableViewMode } from "@/components/TemplateEditor/store";
|
|
1
2
|
import type { Transaction } from "@tiptap/pm/state";
|
|
2
3
|
import type { Editor } from "@tiptap/react";
|
|
3
4
|
interface BrandFooterProps {
|
|
4
5
|
value?: string | null;
|
|
5
6
|
variables?: Record<string, unknown>;
|
|
6
7
|
readOnly?: boolean;
|
|
8
|
+
variableViewMode?: VariableViewMode;
|
|
7
9
|
facebookLink?: string;
|
|
8
10
|
linkedinLink?: string;
|
|
9
11
|
instagramLink?: string;
|
|
@@ -14,5 +16,5 @@ interface BrandFooterProps {
|
|
|
14
16
|
transaction: Transaction;
|
|
15
17
|
}) => void;
|
|
16
18
|
}
|
|
17
|
-
export declare const BrandFooter: import("react").MemoExoticComponent<({ facebookLink, linkedinLink, instagramLink, mediumLink, xLink, readOnly, value, onUpdate, }: BrandFooterProps) => import("react/jsx-runtime").JSX.Element>;
|
|
19
|
+
export declare const BrandFooter: import("react").MemoExoticComponent<({ facebookLink, linkedinLink, instagramLink, mediumLink, xLink, readOnly, value, variableViewMode, onUpdate, }: BrandFooterProps) => import("react/jsx-runtime").JSX.Element>;
|
|
18
20
|
export {};
|
|
@@ -14,6 +14,8 @@ export declare const useUploadImage: () => UploadImageFunction | null;
|
|
|
14
14
|
type TemplateProviderProps = BasicProviderProps & {
|
|
15
15
|
templateId: string;
|
|
16
16
|
uploadImage?: UploadImageFunction;
|
|
17
|
+
variables?: Record<string, unknown>;
|
|
18
|
+
disableVariablesAutocomplete?: boolean;
|
|
17
19
|
};
|
|
18
20
|
export declare const TemplateProvider: import("react").NamedExoticComponent<TemplateProviderProps>;
|
|
19
21
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type VariableViewMode } from "@/components/TemplateEditor/store";
|
|
1
2
|
import type { TiptapDoc } from "@/types";
|
|
2
3
|
import type { Editor } from "@tiptap/core";
|
|
3
4
|
export interface EmailEditorProps {
|
|
@@ -6,8 +7,9 @@ export interface EmailEditorProps {
|
|
|
6
7
|
subject?: string | null;
|
|
7
8
|
variables?: Record<string, unknown>;
|
|
8
9
|
disableVariablesAutocomplete?: boolean;
|
|
10
|
+
variableViewMode?: VariableViewMode;
|
|
9
11
|
onDestroy?: () => void;
|
|
10
12
|
onUpdate?: (editor: Editor) => void;
|
|
11
13
|
}
|
|
12
|
-
declare const EmailEditor: ({ value, readOnly, onDestroy, onUpdate, subject: propSubject, variables, disableVariablesAutocomplete, }: EmailEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare const EmailEditor: ({ value, readOnly, onDestroy, onUpdate, subject: propSubject, variables, disableVariablesAutocomplete, variableViewMode, }: EmailEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
15
|
export default EmailEditor;
|
|
@@ -7,6 +7,9 @@ import type { AnyExtension, Editor } from "@tiptap/react";
|
|
|
7
7
|
import type { HTMLAttributes } from "react";
|
|
8
8
|
import type { TemplateEditorProps } from "../../TemplateEditor";
|
|
9
9
|
export declare const defaultInboxContent: ElementalNode[];
|
|
10
|
+
export declare const getOrCreateInboxElement: (templateEditorContent: {
|
|
11
|
+
elements: ElementalNode[];
|
|
12
|
+
} | null | undefined) => ElementalNode;
|
|
10
13
|
export declare const InboxConfig: TextMenuConfig;
|
|
11
14
|
interface InboxEditorContentProps {
|
|
12
15
|
value?: TiptapDoc;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { InboxRenderProps } from "./Inbox";
|
|
2
|
+
import { type VariableViewMode } from "../../store";
|
|
2
3
|
export interface InboxEditorProps extends InboxRenderProps {
|
|
3
4
|
readOnly?: boolean;
|
|
5
|
+
variableViewMode?: VariableViewMode;
|
|
4
6
|
}
|
|
5
|
-
export declare const InboxEditor: ({ content, extensions, editable, autofocus, onUpdate, readOnly, }: InboxEditorProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export declare const InboxEditor: ({ content, extensions, editable, autofocus, onUpdate, readOnly, variableViewMode, }: InboxEditorProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -27,6 +27,7 @@ export interface MSTeamsRenderProps {
|
|
|
27
27
|
};
|
|
28
28
|
selectedNode: Node | null;
|
|
29
29
|
msteamsEditor: Editor | null;
|
|
30
|
+
textMenuConfig: TextMenuConfig;
|
|
30
31
|
}
|
|
31
32
|
export interface MSTeamsProps extends Pick<TemplateEditorProps, "hidePublish" | "theme" | "variables" | "disableVariablesAutocomplete" | "channels" | "routing" | "value" | "colorScheme">, Omit<HTMLAttributes<HTMLDivElement>, "value" | "onChange"> {
|
|
32
33
|
readOnly?: boolean;
|
|
@@ -37,6 +38,10 @@ export interface MSTeamsProps extends Pick<TemplateEditorProps, "hidePublish" |
|
|
|
37
38
|
}) => React.ReactNode;
|
|
38
39
|
render?: (props: MSTeamsRenderProps) => React.ReactNode;
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Get text menu configuration for an MS Teams node based on selection state
|
|
43
|
+
* This function applies MS Teams-specific constraints while respecting text selection
|
|
44
|
+
*/
|
|
45
|
+
export declare const getTextMenuConfigForMSTeamsNode: (nodeName: string, hasTextSelection?: boolean) => TextMenuConfig;
|
|
41
46
|
export declare const MSTeams: React.MemoExoticComponent<React.ForwardRefExoticComponent<MSTeamsProps & React.RefAttributes<HTMLDivElement>>>;
|
|
42
47
|
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { MSTeamsRenderProps } from "./MSTeams";
|
|
2
|
+
import { type VariableViewMode } from "../../store";
|
|
2
3
|
export interface MSTeamsEditorProps extends MSTeamsRenderProps {
|
|
3
4
|
readOnly?: boolean;
|
|
5
|
+
variableViewMode?: VariableViewMode;
|
|
4
6
|
}
|
|
5
|
-
export declare const MSTeamsEditor: ({ content, extensions, editable, autofocus, onUpdate, readOnly, }: MSTeamsEditorProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export declare const MSTeamsEditor: ({ content, extensions, editable, autofocus, onUpdate, readOnly, variableViewMode, textMenuConfig, }: MSTeamsEditorProps) => import("react/jsx-runtime").JSX.Element | null;
|
package/dist/components/TemplateEditor/Channels/MSTeams/SideBar/MSTeamsSideBarItemDetails.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Node as ProseMirrorNode } from "@tiptap/pm/model";
|
|
2
|
+
import type { Editor } from "@tiptap/react";
|
|
3
|
+
export interface MSTeamsSideBarItemDetailsProps {
|
|
4
|
+
element: ProseMirrorNode | null;
|
|
5
|
+
editor: Editor | null;
|
|
6
|
+
defaultElement: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const MSTeamsSideBarItemDetails: ({ element, editor, defaultElement, }: MSTeamsSideBarItemDetailsProps) => string | number | boolean | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { HTMLAttributes } from "react";
|
|
2
2
|
import { type PushRenderProps } from "./Push";
|
|
3
|
+
import { type VariableViewMode } from "../../store";
|
|
3
4
|
export interface PushEditorProps extends PushRenderProps, Omit<HTMLAttributes<HTMLDivElement>, "content"> {
|
|
4
5
|
readOnly?: boolean;
|
|
6
|
+
variableViewMode?: VariableViewMode;
|
|
5
7
|
}
|
|
6
|
-
export declare const PushEditor: ({ content, extensions, editable, autofocus, onUpdate, className, readOnly, }: PushEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const PushEditor: ({ content, extensions, editable, autofocus, onUpdate, className, readOnly, variableViewMode, }: PushEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { HTMLAttributes } from "react";
|
|
2
2
|
import type { SMSRenderProps } from "./SMS";
|
|
3
|
+
import { type VariableViewMode } from "../../store";
|
|
3
4
|
export interface SMSEditorProps extends SMSRenderProps, Omit<HTMLAttributes<HTMLDivElement>, "content"> {
|
|
4
5
|
readOnly?: boolean;
|
|
6
|
+
variableViewMode?: VariableViewMode;
|
|
5
7
|
}
|
|
6
|
-
export declare const SMSEditor: ({ content, extensions, editable, autofocus, onUpdate, className, readOnly, }: SMSEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const SMSEditor: ({ content, extensions, editable, autofocus, onUpdate, className, readOnly, variableViewMode, }: SMSEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -27,6 +27,7 @@ export interface SlackRenderProps {
|
|
|
27
27
|
};
|
|
28
28
|
selectedNode: Node | null;
|
|
29
29
|
slackEditor: Editor | null;
|
|
30
|
+
textMenuConfig: TextMenuConfig;
|
|
30
31
|
}
|
|
31
32
|
export interface SlackProps extends Pick<TemplateEditorProps, "hidePublish" | "theme" | "variables" | "disableVariablesAutocomplete" | "channels" | "routing" | "value" | "colorScheme">, Omit<HTMLAttributes<HTMLDivElement>, "value" | "onChange"> {
|
|
32
33
|
readOnly?: boolean;
|
|
@@ -37,6 +38,10 @@ export interface SlackProps extends Pick<TemplateEditorProps, "hidePublish" | "t
|
|
|
37
38
|
}) => React.ReactNode;
|
|
38
39
|
render?: (props: SlackRenderProps) => React.ReactNode;
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Get text menu configuration for a Slack node based on selection state
|
|
43
|
+
* This function applies Slack-specific constraints while respecting text selection
|
|
44
|
+
*/
|
|
45
|
+
export declare const getTextMenuConfigForSlackNode: (nodeName: string, hasTextSelection?: boolean) => TextMenuConfig;
|
|
41
46
|
export declare const Slack: React.MemoExoticComponent<React.ForwardRefExoticComponent<SlackProps & React.RefAttributes<HTMLDivElement>>>;
|
|
42
47
|
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { SlackRenderProps } from "./Slack";
|
|
2
|
+
import { type VariableViewMode } from "../../store";
|
|
2
3
|
export interface SlackEditorProps extends SlackRenderProps {
|
|
3
4
|
readOnly?: boolean;
|
|
5
|
+
variableViewMode?: VariableViewMode;
|
|
4
6
|
}
|
|
5
|
-
export declare const SlackEditor: ({ content, extensions, editable, autofocus, onUpdate, readOnly, }: SlackEditorProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export declare const SlackEditor: ({ content, extensions, editable, autofocus, onUpdate, readOnly, variableViewMode, textMenuConfig, }: SlackEditorProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -6,5 +6,6 @@ export declare const ChannelRootContainer: import("react").ForwardRefExoticCompo
|
|
|
6
6
|
export declare const EditorSidebar: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
7
7
|
previewMode?: "desktop" | "mobile" | undefined;
|
|
8
8
|
skipExpanded?: boolean;
|
|
9
|
+
collapsed?: boolean;
|
|
9
10
|
width?: string;
|
|
10
11
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -12,6 +12,8 @@ export interface TemplateEditorProps extends Omit<HTMLAttributes<HTMLDivElement>
|
|
|
12
12
|
/**
|
|
13
13
|
* Variables available for autocomplete suggestions.
|
|
14
14
|
* When provided, typing {{ will show a dropdown with matching variables.
|
|
15
|
+
* When not provided (undefined), all variable functionality is disabled:
|
|
16
|
+
* the variable toolbar button is hidden and typing {{ will not create variable chips.
|
|
15
17
|
*/
|
|
16
18
|
variables?: Record<string, unknown>;
|
|
17
19
|
/**
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type VariableViewMode } from "./store";
|
|
2
|
+
import { getVariableViewMode } from "../extensions/Variable/variable-storage.utils";
|
|
3
|
+
interface VariableViewModeSyncProps {
|
|
4
|
+
variableViewMode: VariableViewMode;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Syncs the variableViewMode prop to editor storage and dispatches a transaction
|
|
8
|
+
* to notify VariableView components to re-render.
|
|
9
|
+
*
|
|
10
|
+
* Also syncs the variablesEnabled state to the VariableInputRule extension storage,
|
|
11
|
+
* disabling the {{ input rule when the variables prop is not provided.
|
|
12
|
+
*
|
|
13
|
+
* This component should be placed inside an EditorProvider.
|
|
14
|
+
*/
|
|
15
|
+
export declare const VariableViewModeSync: ({ variableViewMode }: VariableViewModeSyncProps) => null;
|
|
16
|
+
/**
|
|
17
|
+
* Hook to get the current variable view mode from the editor.
|
|
18
|
+
* Useful for reading the variable view mode outside of VariableView components.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const { editor } = useCurrentEditor();
|
|
23
|
+
* const viewMode = useVariableViewMode(editor);
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function useVariableViewMode(editor: Parameters<typeof getVariableViewMode>[0]): VariableViewMode;
|
|
27
|
+
export {};
|
|
@@ -4,7 +4,7 @@ export { default as EmailEditor } from "./Channels/Email/EmailEditor";
|
|
|
4
4
|
export * from "./TemplateEditor";
|
|
5
5
|
export { SideBar as EmailSideBar, SideBarItemDetails as EmailSideBarItemDetails, } from "./Channels/Email/SideBar";
|
|
6
6
|
export { SideBar as InboxSideBar } from "./Channels/Inbox/SideBar";
|
|
7
|
-
export { MSTeamsSideBar } from "./Channels/MSTeams/SideBar";
|
|
7
|
+
export { MSTeamsSideBar, MSTeamsSideBarItemDetails } from "./Channels/MSTeams/SideBar";
|
|
8
8
|
export { SlackSideBar, SlackSideBarItemDetails } from "./Channels/Slack/SideBar";
|
|
9
9
|
export { EmailEditorContainer, EmailEditorMain, type EmailEditorProps, type InboxEditorProps, type MSTeamsEditorProps, type PushEditorProps, type SlackEditorProps, type SMSEditorProps, } from "./Channels";
|
|
10
10
|
export declare const EmailChannel: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<import("./Channels").EmailProps & import("react").RefAttributes<HTMLDivElement>>>;
|
|
@@ -14,5 +14,6 @@ export declare const InboxChannel: import("react").MemoExoticComponent<import("r
|
|
|
14
14
|
export declare const MSTeamsChannel: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<import("./Channels").MSTeamsProps & import("react").RefAttributes<HTMLDivElement>>>;
|
|
15
15
|
export declare const SlackChannel: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<import("./Channels").SlackProps & import("react").RefAttributes<HTMLDivElement>>>;
|
|
16
16
|
export { ChannelRootContainer, EditorSidebar } from "./Layout";
|
|
17
|
+
export { isSidebarExpandedAtom } from "./store";
|
|
17
18
|
export { InboxEditor, MSTeamsEditor, PushEditor, SlackEditor, SMSEditor } from "./Channels";
|
|
18
19
|
export { useDebouncedFlush } from "./hooks/useDebouncedFlush";
|
|
@@ -30,6 +30,9 @@ export declare const isSidebarExpandedAtom: import("jotai").PrimitiveAtom<boolea
|
|
|
30
30
|
export declare const variableValuesAtom: import("jotai").PrimitiveAtom<Record<string, string>> & {
|
|
31
31
|
init: Record<string, string>;
|
|
32
32
|
};
|
|
33
|
+
export declare const variablesEnabledAtom: import("jotai").PrimitiveAtom<boolean> & {
|
|
34
|
+
init: boolean;
|
|
35
|
+
};
|
|
33
36
|
export declare const availableVariablesAtom: import("jotai").PrimitiveAtom<Record<string, unknown>> & {
|
|
34
37
|
init: Record<string, unknown>;
|
|
35
38
|
};
|
|
@@ -39,9 +42,24 @@ export declare const disableVariablesAutocompleteAtom: import("jotai").Primitive
|
|
|
39
42
|
export declare const variableValidationAtom: import("jotai").PrimitiveAtom<VariableValidationConfig | undefined> & {
|
|
40
43
|
init: VariableValidationConfig | undefined;
|
|
41
44
|
};
|
|
45
|
+
export type VariableViewMode = "show-variables" | "wysiwyg";
|
|
42
46
|
export declare const isDraggingAtom: import("jotai").PrimitiveAtom<boolean> & {
|
|
43
47
|
init: boolean;
|
|
44
48
|
};
|
|
49
|
+
/**
|
|
50
|
+
* Increments or decrements the form updating counter.
|
|
51
|
+
* When true, increments the counter (starting an update).
|
|
52
|
+
* When false, decrements the counter (ending an update).
|
|
53
|
+
*/
|
|
54
|
+
export declare const setFormUpdating: (value: boolean) => void;
|
|
55
|
+
/**
|
|
56
|
+
* Returns true if any form update is in progress (counter > 0)
|
|
57
|
+
*/
|
|
58
|
+
export declare const getFormUpdating: () => boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Resets the form updating counter to 0 (for cleanup/testing)
|
|
61
|
+
*/
|
|
62
|
+
export declare const resetFormUpdating: () => void;
|
|
45
63
|
export declare const pendingAutoSaveAtom: import("jotai").PrimitiveAtom<ElementalContent | null> & {
|
|
46
64
|
init: ElementalContent | null;
|
|
47
65
|
};
|
|
@@ -58,7 +76,7 @@ export declare const flushAllPendingUpdates: (flushFunctions: Map<string, FlushF
|
|
|
58
76
|
/**
|
|
59
77
|
* Available block element types that can be used in the sidebar
|
|
60
78
|
*/
|
|
61
|
-
export type BlockElementType = "heading" | "text" | "image" | "spacer" | "divider" | "button" | "customCode" | "column" | "blockquote";
|
|
79
|
+
export type BlockElementType = "heading" | "text" | "image" | "spacer" | "divider" | "button" | "customCode" | "column" | "blockquote" | "list";
|
|
62
80
|
/**
|
|
63
81
|
* Attributes that can be set as defaults or in presets for blocks.
|
|
64
82
|
* Types match the actual TipTap node attribute types for each extension.
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import { PluginKey } from "@tiptap/pm/state";
|
|
1
2
|
import type { BlockquoteProps } from "./Blockquote.types";
|
|
3
|
+
import { QUOTE_TEXT_STYLE, QUOTE_TEXT_STYLE_VARIANTS } from "@/lib/constants/email-editor-tiptap-styles";
|
|
4
|
+
export { QUOTE_TEXT_STYLE, QUOTE_TEXT_STYLE_VARIANTS };
|
|
5
|
+
export declare const BlockquotePastePluginKey: PluginKey<any>;
|
|
2
6
|
export declare const defaultBlockquoteProps: BlockquoteProps;
|
|
3
7
|
export declare const Blockquote: import("@tiptap/core").Node<import("@tiptap/extension-blockquote").BlockquoteOptions, any>;
|
|
4
8
|
export default Blockquote;
|
|
@@ -5,7 +5,8 @@ export declare const buttonSchema: z.ZodObject<{
|
|
|
5
5
|
alignment: z.ZodEnum<["left", "center", "right"]>;
|
|
6
6
|
backgroundColor: z.ZodString;
|
|
7
7
|
borderRadius: z.ZodNumber;
|
|
8
|
-
|
|
8
|
+
paddingVertical: z.ZodNumber;
|
|
9
|
+
paddingHorizontal: z.ZodNumber;
|
|
9
10
|
fontWeight: z.ZodEnum<["normal", "bold"]>;
|
|
10
11
|
fontStyle: z.ZodEnum<["normal", "italic"]>;
|
|
11
12
|
isUnderline: z.ZodBoolean;
|
|
@@ -15,9 +16,10 @@ export declare const buttonSchema: z.ZodObject<{
|
|
|
15
16
|
}, "strip", z.ZodTypeAny, {
|
|
16
17
|
backgroundColor: string;
|
|
17
18
|
borderRadius: number;
|
|
19
|
+
paddingVertical: number;
|
|
20
|
+
paddingHorizontal: number;
|
|
18
21
|
label: string;
|
|
19
22
|
alignment: "left" | "center" | "right";
|
|
20
|
-
padding: number;
|
|
21
23
|
fontWeight: "normal" | "bold";
|
|
22
24
|
fontStyle: "normal" | "italic";
|
|
23
25
|
isUnderline: boolean;
|
|
@@ -28,9 +30,10 @@ export declare const buttonSchema: z.ZodObject<{
|
|
|
28
30
|
}, {
|
|
29
31
|
backgroundColor: string;
|
|
30
32
|
borderRadius: number;
|
|
33
|
+
paddingVertical: number;
|
|
34
|
+
paddingHorizontal: number;
|
|
31
35
|
label: string;
|
|
32
36
|
alignment: "left" | "center" | "right";
|
|
33
|
-
padding: number;
|
|
34
37
|
fontWeight: "normal" | "bold";
|
|
35
38
|
fontStyle: "normal" | "italic";
|
|
36
39
|
isUnderline: boolean;
|
|
@@ -45,7 +48,8 @@ export interface ButtonProps {
|
|
|
45
48
|
alignment: "left" | "center" | "right";
|
|
46
49
|
backgroundColor: string;
|
|
47
50
|
borderRadius: number;
|
|
48
|
-
|
|
51
|
+
paddingVertical: number;
|
|
52
|
+
paddingHorizontal: number;
|
|
49
53
|
fontWeight: "normal" | "bold";
|
|
50
54
|
fontStyle: "normal" | "italic";
|
|
51
55
|
isUnderline: boolean;
|
|
@@ -4,9 +4,8 @@ import type { ButtonProps } from "./Button.types";
|
|
|
4
4
|
export declare const ButtonComponent: React.FC<ButtonProps & {
|
|
5
5
|
nodeKey?: string;
|
|
6
6
|
selected?: boolean;
|
|
7
|
-
fontWeight?: string;
|
|
8
|
-
isUnderline?: boolean;
|
|
9
|
-
isStrike?: boolean;
|
|
10
7
|
children?: React.ReactNode;
|
|
8
|
+
isPreviewMode?: boolean;
|
|
9
|
+
link?: string;
|
|
11
10
|
}>;
|
|
12
11
|
export declare const ButtonComponentNode: (props: NodeViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Node as ProseMirrorNode } from "@tiptap/pm/model";
|
|
2
|
+
import type { EditorState, Transaction } from "@tiptap/pm/state";
|
|
3
|
+
export declare function findButtonNodeById(doc: ProseMirrorNode, id: string): {
|
|
4
|
+
pos: number;
|
|
5
|
+
node: ProseMirrorNode;
|
|
6
|
+
} | null;
|
|
7
|
+
export declare function findButtonNodeAtPosition(doc: ProseMirrorNode, position: number): {
|
|
8
|
+
pos: number;
|
|
9
|
+
node: ProseMirrorNode;
|
|
10
|
+
} | null;
|
|
11
|
+
export declare function extractButtonTextContent(node: ProseMirrorNode): string;
|
|
12
|
+
export declare function syncButtonContentToLabelAttr(state: EditorState): Transaction | null;
|
|
13
|
+
export declare function updateButtonLabelAndContent(tr: Transaction, buttonPos: number, newLabel: string): boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom HardBreak extension that extends the default TipTap HardBreak.
|
|
3
|
+
*
|
|
4
|
+
* This extension modifies the DOM rendering to include a zero-width space
|
|
5
|
+
* after the <br> element. This helps with cursor visibility when the cursor
|
|
6
|
+
* is positioned right after a hardBreak (e.g., before an inline node like a variable).
|
|
7
|
+
*
|
|
8
|
+
* Without this, the browser has no text node to anchor the cursor, making it invisible
|
|
9
|
+
* even though ProseMirror knows the correct cursor position.
|
|
10
|
+
*/
|
|
11
|
+
export declare const HardBreak: import("@tiptap/core").Node<import("@tiptap/extension-hard-break").HardBreakOptions, any>;
|
|
12
|
+
export default HardBreak;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { HardBreak } from "./HardBreak";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { NodeViewProps } from "@tiptap/react";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import type { ImageBlockProps } from "../ImageBlock.types";
|
|
4
4
|
export declare const ImageBlockComponent: React.FC<ImageBlockProps & {
|
|
@@ -7,7 +7,5 @@ export declare const ImageBlockComponent: React.FC<ImageBlockProps & {
|
|
|
7
7
|
draggable?: boolean;
|
|
8
8
|
onFileSelect?: (file: File) => void;
|
|
9
9
|
width: number;
|
|
10
|
-
imageNaturalWidth: number;
|
|
11
|
-
editor?: Editor;
|
|
12
10
|
}>;
|
|
13
11
|
export declare const ImageBlockView: (props: NodeViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,20 +2,14 @@ import { z } from "zod";
|
|
|
2
2
|
export declare const listSchema: z.ZodObject<{
|
|
3
3
|
id: z.ZodOptional<z.ZodString>;
|
|
4
4
|
listType: z.ZodEnum<["ordered", "unordered"]>;
|
|
5
|
-
borderColor: z.ZodString;
|
|
6
|
-
borderWidth: z.ZodNumber;
|
|
7
5
|
paddingVertical: z.ZodNumber;
|
|
8
6
|
paddingHorizontal: z.ZodNumber;
|
|
9
7
|
}, "strip", z.ZodTypeAny, {
|
|
10
|
-
borderColor: string;
|
|
11
|
-
borderWidth: number;
|
|
12
8
|
paddingVertical: number;
|
|
13
9
|
paddingHorizontal: number;
|
|
14
10
|
listType: "ordered" | "unordered";
|
|
15
11
|
id?: string | undefined;
|
|
16
12
|
}, {
|
|
17
|
-
borderColor: string;
|
|
18
|
-
borderWidth: number;
|
|
19
13
|
paddingVertical: number;
|
|
20
14
|
paddingHorizontal: number;
|
|
21
15
|
listType: "ordered" | "unordered";
|
|
@@ -26,10 +20,6 @@ export interface ListProps {
|
|
|
26
20
|
listType: "ordered" | "unordered";
|
|
27
21
|
/** Unique identifier for the list node */
|
|
28
22
|
id?: string;
|
|
29
|
-
/** Border color for list markers (bullets/numbers) */
|
|
30
|
-
borderColor?: string;
|
|
31
|
-
/** Border width in pixels */
|
|
32
|
-
borderWidth?: number;
|
|
33
23
|
/** Vertical padding in pixels */
|
|
34
24
|
paddingVertical?: number;
|
|
35
25
|
/** Horizontal padding in pixels */
|
|
@@ -4,6 +4,11 @@ interface ListFormProps {
|
|
|
4
4
|
element?: ProseMirrorNode;
|
|
5
5
|
editor: Editor | null;
|
|
6
6
|
hideCloseButton?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* When true, only shows the list type toggle (ordered/unordered).
|
|
9
|
+
* Used for channels like Slack and MS Teams that don't support styling options.
|
|
10
|
+
*/
|
|
11
|
+
minimalMode?: boolean;
|
|
7
12
|
}
|
|
8
|
-
export declare const ListForm: ({ element, editor, hideCloseButton }: ListFormProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
13
|
+
export declare const ListForm: ({ element, editor, hideCloseButton, minimalMode, }: ListFormProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
9
14
|
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Extension } from "@tiptap/core";
|
|
2
|
+
export interface MessagingChannelPasteOptions {
|
|
3
|
+
/** Convert all headings to this level, or "strip" to convert headings to paragraphs. */
|
|
4
|
+
headingBehavior: {
|
|
5
|
+
level: number;
|
|
6
|
+
} | "strip";
|
|
7
|
+
/** Node type names that should be silently dropped on paste (e.g. "button" for Teams). */
|
|
8
|
+
blockedNodeTypes?: string[];
|
|
9
|
+
}
|
|
10
|
+
export declare const MessagingChannelPaste: Extension<MessagingChannelPasteOptions, any>;
|
|
11
|
+
export default MessagingChannelPaste;
|
|
@@ -4,6 +4,11 @@ export declare const VariableNode: Node<VariableNodeOptions, any>;
|
|
|
4
4
|
/**
|
|
5
5
|
* Extension that inserts an empty variable chip when user types {{
|
|
6
6
|
* This is used when autocomplete is disabled (disableVariablesAutocomplete=true)
|
|
7
|
+
*
|
|
8
|
+
* Storage:
|
|
9
|
+
* - `disabled`: When true, typing {{ will not create variable chips.
|
|
10
|
+
* Set this from React via `editor.storage.variableInputRule.disabled = true`
|
|
11
|
+
* when the `variables` prop is not provided to TemplateEditor.
|
|
7
12
|
*/
|
|
8
13
|
export declare const VariableInputRule: Extension<any, any>;
|
|
9
14
|
/**
|
|
@@ -2,3 +2,5 @@ export * from "./Variable";
|
|
|
2
2
|
export * from "./Variable.types";
|
|
3
3
|
export * from "./VariablePaste";
|
|
4
4
|
export * from "./VariableSuggestions";
|
|
5
|
+
export type { VariableStorage } from "./variable-storage.types";
|
|
6
|
+
export { getVariableViewMode, setVariableViewMode, getVariableStorage, initializeVariableStorage, hasVariableStorage, } from "./variable-storage.utils";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { VariableViewMode } from "../../TemplateEditor/store";
|
|
2
|
+
/**
|
|
3
|
+
* Type definition for the Variable extension storage in TipTap editor.
|
|
4
|
+
* This storage is used to maintain variable-related state across the editor instance.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import type { VariableStorage, EditorWithVariableStorage } from './variable-storage.types';
|
|
9
|
+
* import { getVariableViewMode, setVariableViewMode } from './variable-storage.utils';
|
|
10
|
+
*
|
|
11
|
+
* // Access storage
|
|
12
|
+
* const editor: EditorWithVariableStorage = ...;
|
|
13
|
+
* const viewMode = getVariableViewMode(editor);
|
|
14
|
+
*
|
|
15
|
+
* // Update storage
|
|
16
|
+
* setVariableViewMode(editor, 'wysiwyg');
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export interface VariableStorage {
|
|
20
|
+
/**
|
|
21
|
+
* Controls how variables are displayed in the editor:
|
|
22
|
+
* - 'show-variables': Display as interactive chip components with icons
|
|
23
|
+
* - 'wysiwyg': Display as plain text values (preview mode)
|
|
24
|
+
*/
|
|
25
|
+
variableViewMode: VariableViewMode;
|
|
26
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { Editor } from "@tiptap/core";
|
|
2
|
+
import type { VariableViewMode } from "../../TemplateEditor/store";
|
|
3
|
+
import { type VariableStorage } from "./variable-storage.types";
|
|
4
|
+
/**
|
|
5
|
+
* Gets the variable view mode from the editor storage.
|
|
6
|
+
* Safely handles cases where storage or variable storage is not initialized.
|
|
7
|
+
*
|
|
8
|
+
* @param editor - The TipTap editor instance
|
|
9
|
+
* @param fallback - Fallback value if storage is not available (default: "show-variables")
|
|
10
|
+
* @returns The current variable view mode
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const editor = useCurrentEditor();
|
|
15
|
+
* const viewMode = getVariableViewMode(editor);
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function getVariableViewMode(editor: Editor | null | undefined, fallback?: VariableViewMode): VariableViewMode;
|
|
19
|
+
/**
|
|
20
|
+
* Sets the variable view mode in the editor storage.
|
|
21
|
+
* Safely handles cases where storage or variable storage is not initialized.
|
|
22
|
+
*
|
|
23
|
+
* @param editor - The TipTap editor instance
|
|
24
|
+
* @param mode - The new variable view mode to set
|
|
25
|
+
* @returns true if the mode was set successfully, false otherwise
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* const editor = useCurrentEditor();
|
|
30
|
+
* setVariableViewMode(editor, 'wysiwyg');
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function setVariableViewMode(editor: Editor | null | undefined, mode: VariableViewMode): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Gets the entire variable storage object from the editor.
|
|
36
|
+
* Safely handles cases where storage is not initialized.
|
|
37
|
+
*
|
|
38
|
+
* @param editor - The TipTap editor instance
|
|
39
|
+
* @returns The variable storage object, or undefined if not available
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* const editor = useCurrentEditor();
|
|
44
|
+
* const storage = getVariableStorage(editor);
|
|
45
|
+
* if (storage) {
|
|
46
|
+
* console.log('View mode:', storage.variableViewMode);
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare function getVariableStorage(editor: Editor | null | undefined): VariableStorage | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Initializes the variable storage on an editor instance.
|
|
53
|
+
* Should be called in the Variable extension's addStorage() method.
|
|
54
|
+
*
|
|
55
|
+
* @param defaultViewMode - The default variable view mode (default: "show-variables")
|
|
56
|
+
* @returns The initial storage object
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* // In Variable extension
|
|
61
|
+
* addStorage() {
|
|
62
|
+
* return initializeVariableStorage();
|
|
63
|
+
* }
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export declare function initializeVariableStorage(defaultViewMode?: VariableViewMode): VariableStorage;
|
|
67
|
+
/**
|
|
68
|
+
* Type guard to check if an object has variable storage
|
|
69
|
+
*/
|
|
70
|
+
export declare function hasVariableStorage(storage: unknown): storage is {
|
|
71
|
+
variable: VariableStorage;
|
|
72
|
+
};
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import type { Node } from "@tiptap/pm/model";
|
|
2
|
+
export interface RichTextMarksConfig {
|
|
3
|
+
/** Controls bold mark behavior: 'disabled' to disable, 'default' or undefined to enable */
|
|
4
|
+
bold?: "disabled" | "default";
|
|
5
|
+
/** Controls italic mark behavior: 'disabled' to disable, 'default' or undefined to enable */
|
|
6
|
+
italic?: "disabled" | "default";
|
|
7
|
+
/** Controls underline mark behavior: 'disabled' to disable, 'default' or undefined to enable */
|
|
8
|
+
underline?: "disabled" | "default";
|
|
9
|
+
/** Controls strike mark behavior: 'disabled' to disable, 'default' or undefined to enable */
|
|
10
|
+
strike?: "disabled" | "default";
|
|
11
|
+
}
|
|
2
12
|
export interface ExtensionKitOptions {
|
|
3
13
|
setSelectedNode?: (node: Node) => void;
|
|
4
14
|
shouldHandleClick?: () => boolean;
|
|
@@ -6,6 +16,13 @@ export interface ExtensionKitOptions {
|
|
|
6
16
|
variables?: Record<string, unknown>;
|
|
7
17
|
/** When true, disables variable autocomplete and allows typing any variable */
|
|
8
18
|
disableVariablesAutocomplete?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Controls rich text formatting marks (bold, italic, underline, strike).
|
|
21
|
+
* - `'plain-text'`: Disables all rich text marks (for SMS, Push, In-App)
|
|
22
|
+
* - Object with mark configurations: Enables granular control per mark
|
|
23
|
+
* - `undefined`: All marks enabled (default)
|
|
24
|
+
*/
|
|
25
|
+
textMarks?: "plain-text" | RichTextMarksConfig;
|
|
9
26
|
}
|
|
10
27
|
export declare const ExtensionKit: (options?: ExtensionKitOptions) => (import("@tiptap/core").Node<any, any> | import("@tiptap/core").Extension<any, any> | import("@tiptap/core").Mark<import("@tiptap/extension-underline").UnderlineOptions, any>)[];
|
|
11
28
|
export default ExtensionKit;
|