@react-email/editor 0.0.0-experimental.7 → 1.0.0-canary.51

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.
Files changed (92) hide show
  1. package/dist/columns-BItFgD76.mjs +273 -0
  2. package/dist/columns-BItFgD76.mjs.map +1 -0
  3. package/dist/columns-DqFvXgmK.cjs +394 -0
  4. package/dist/core/index.cjs +10 -0
  5. package/dist/core/index.d.cts +2 -0
  6. package/dist/core/index.d.mts +2 -0
  7. package/dist/core/index.mjs +4 -0
  8. package/dist/core-CbSTyrV4.mjs +151 -0
  9. package/dist/core-CbSTyrV4.mjs.map +1 -0
  10. package/dist/core-D7AzzMLI.cjs +167 -0
  11. package/dist/email-node-B-_g4X-S.mjs +254 -0
  12. package/dist/email-node-B-_g4X-S.mjs.map +1 -0
  13. package/dist/email-node-hLU5bGnX.cjs +288 -0
  14. package/dist/event-bus-CIJ___tH.cjs +65 -0
  15. package/dist/event-bus-CqrIUE24.mjs +55 -0
  16. package/dist/event-bus-CqrIUE24.mjs.map +1 -0
  17. package/dist/extension-BbjpP9mF.cjs +1625 -0
  18. package/dist/extension-C5qNDPZL.mjs +154 -0
  19. package/dist/extension-C5qNDPZL.mjs.map +1 -0
  20. package/dist/extension-Cs4Yq2gF.cjs +158 -0
  21. package/dist/extension-DlWknmE5.mjs +1495 -0
  22. package/dist/extension-DlWknmE5.mjs.map +1 -0
  23. package/dist/extensions/index.cjs +50 -0
  24. package/dist/extensions/index.d.cts +392 -0
  25. package/dist/extensions/index.d.cts.map +1 -0
  26. package/dist/extensions/index.d.mts +392 -0
  27. package/dist/extensions/index.d.mts.map +1 -0
  28. package/dist/extensions/index.mjs +4 -0
  29. package/dist/extensions-CHIQO3d-.mjs +1745 -0
  30. package/dist/extensions-CHIQO3d-.mjs.map +1 -0
  31. package/dist/extensions-DCrDvZ42.cjs +1981 -0
  32. package/dist/global-content-0-J-Te3N.mjs +77 -0
  33. package/dist/global-content-0-J-Te3N.mjs.map +1 -0
  34. package/dist/global-content-8M2KyrOL.cjs +87 -0
  35. package/dist/image-KwEYzhji.cjs +41 -0
  36. package/dist/image-Oc789YjV.mjs +37 -0
  37. package/dist/image-Oc789YjV.mjs.map +1 -0
  38. package/dist/index-CHAPu71g.d.cts +193 -0
  39. package/dist/index-CHAPu71g.d.cts.map +1 -0
  40. package/dist/index-D4UEWmJX.d.mts +193 -0
  41. package/dist/index-D4UEWmJX.d.mts.map +1 -0
  42. package/dist/index.cjs +216 -0
  43. package/dist/index.d.cts +38 -0
  44. package/dist/index.d.cts.map +1 -0
  45. package/dist/index.d.mts +33 -626
  46. package/dist/index.d.mts.map +1 -1
  47. package/dist/index.mjs +189 -2228
  48. package/dist/index.mjs.map +1 -1
  49. package/dist/plugins/index.cjs +56 -0
  50. package/dist/plugins/index.d.cts +114 -0
  51. package/dist/plugins/index.d.cts.map +1 -0
  52. package/dist/plugins/index.d.mts +114 -0
  53. package/dist/plugins/index.d.mts.map +1 -0
  54. package/dist/plugins/index.mjs +34 -0
  55. package/dist/plugins/index.mjs.map +1 -0
  56. package/dist/root-CT5d4CKj.cjs +2798 -0
  57. package/dist/root-uvdshbyT.mjs +2295 -0
  58. package/dist/root-uvdshbyT.mjs.map +1 -0
  59. package/dist/set-text-alignment-BCRnE5So.mjs +19 -0
  60. package/dist/set-text-alignment-BCRnE5So.mjs.map +1 -0
  61. package/dist/set-text-alignment-Twg1EG4-.cjs +22 -0
  62. package/dist/style.css +974 -0
  63. package/dist/types-BG5XsXt9.d.mts +37 -0
  64. package/dist/types-BG5XsXt9.d.mts.map +1 -0
  65. package/dist/types-DnOcnDoO.d.mts +56 -0
  66. package/dist/types-DnOcnDoO.d.mts.map +1 -0
  67. package/dist/types-DzPTbbDC.d.cts +56 -0
  68. package/dist/types-DzPTbbDC.d.cts.map +1 -0
  69. package/dist/types-hURXpEIO.d.cts +37 -0
  70. package/dist/types-hURXpEIO.d.cts.map +1 -0
  71. package/dist/ui/bubble-menu/bubble-menu.css +291 -0
  72. package/dist/ui/index.cjs +2895 -0
  73. package/dist/ui/index.d.cts +1155 -0
  74. package/dist/ui/index.d.cts.map +1 -0
  75. package/dist/ui/index.d.mts +1157 -0
  76. package/dist/ui/index.d.mts.map +1 -0
  77. package/dist/ui/index.mjs +2784 -0
  78. package/dist/ui/index.mjs.map +1 -0
  79. package/dist/ui/inspector/inspector.css +293 -0
  80. package/dist/ui/slash-command/slash-command.css +44 -0
  81. package/dist/ui/themes/default.css +1140 -0
  82. package/dist/utils/index.cjs +3 -0
  83. package/dist/utils/index.d.cts +7 -0
  84. package/dist/utils/index.d.cts.map +1 -0
  85. package/dist/utils/index.d.mts +7 -0
  86. package/dist/utils/index.d.mts.map +1 -0
  87. package/dist/utils/index.mjs +2 -0
  88. package/package.json +100 -16
  89. package/readme.md +69 -0
  90. package/dist/index.d.ts +0 -631
  91. package/dist/index.d.ts.map +0 -1
  92. package/dist/index.js +0 -2338
package/dist/index.mjs CHANGED
@@ -1,2255 +1,216 @@
1
- import { Extension, Mark, Node, findChildren, markInputRule, markPasteRule, mergeAttributes } from "@tiptap/core";
2
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import * as ReactEmailComponents from "@react-email/components";
4
- import { Button as Button$1, CodeBlock, Column, Row, Section as Section$1 } from "@react-email/components";
5
- import CodeBlock$1 from "@tiptap/extension-code-block";
6
- import { Plugin, PluginKey, TextSelection } from "@tiptap/pm/state";
7
- import { Decoration, DecorationSet } from "@tiptap/pm/view";
8
- import { fromHtml } from "hast-util-from-html";
9
- import Prism from "prismjs";
10
- import TipTapPlaceholder from "@tiptap/extension-placeholder";
11
- import { useCurrentEditor, useEditorState } from "@tiptap/react";
12
- import { AlignCenterIcon, AlignLeftIcon, AlignRightIcon, BoldIcon, CaseUpperIcon, Check, ChevronDown, Code, CodeIcon, Heading1, Heading2, Heading3, ItalicIcon, LinkIcon, List, ListOrdered, StrikethroughIcon, TextIcon, TextQuote, UnderlineIcon, UnlinkIcon } from "lucide-react";
13
- import * as React from "react";
14
- import * as Popover from "@radix-ui/react-popover";
15
- import { BubbleMenu as BubbleMenu$1 } from "@tiptap/react/menus";
16
-
17
- //#region src/core/email-node.ts
18
- var EmailNode = class EmailNode extends Node {
19
- constructor(config) {
20
- super(config);
21
- }
22
- /**
23
- * Create a new Node instance
24
- * @param config - Node configuration object or a function that returns a configuration object
25
- */
26
- static create(config) {
27
- return new EmailNode(typeof config === "function" ? config() : config);
28
- }
29
- static from(node, renderToReactEmail) {
30
- const customNode = EmailNode.create({});
31
- Object.assign(customNode, { ...node });
32
- customNode.config = {
33
- ...node.config,
34
- renderToReactEmail
35
- };
36
- return customNode;
37
- }
38
- configure(options) {
39
- return super.configure(options);
40
- }
41
- extend(extendedConfig) {
42
- const resolvedConfig = typeof extendedConfig === "function" ? extendedConfig() : extendedConfig;
43
- return super.extend(resolvedConfig);
44
- }
1
+ import { n as composeReactEmail } from "./core-CbSTyrV4.mjs";
2
+ import { t as StarterKit } from "./extensions-CHIQO3d-.mjs";
3
+ import { t as EmailTheming } from "./extension-DlWknmE5.mjs";
4
+ import { t as createImageExtension } from "./extension-C5qNDPZL.mjs";
5
+ import { t as SlashCommandRoot, x as BubbleMenu } from "./root-uvdshbyT.mjs";
6
+ import { EditorProvider, useCurrentEditor } from "@tiptap/react";
7
+ import { forwardRef, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef } from "react";
8
+ import { generateJSON } from "@tiptap/html";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ import { Placeholder } from "@tiptap/extension-placeholder";
11
+ //#region src/utils/paste-sanitizer.ts
12
+ /**
13
+ * Sanitizes pasted HTML.
14
+ * - From editor (has node-* classes): pass through as-is
15
+ * - From external: strip all styles/classes, keep only semantic HTML
16
+ */
17
+ /**
18
+ * Detects content from the Resend editor by checking for node-* class names.
19
+ */
20
+ const EDITOR_CLASS_PATTERN = /class="[^"]*node-/;
21
+ /**
22
+ * Attributes to preserve on specific elements for EXTERNAL content.
23
+ * Only functional attributes - NO style or class.
24
+ */
25
+ const PRESERVED_ATTRIBUTES = {
26
+ a: [
27
+ "href",
28
+ "target",
29
+ "rel"
30
+ ],
31
+ img: [
32
+ "src",
33
+ "alt",
34
+ "width",
35
+ "height"
36
+ ],
37
+ td: ["colspan", "rowspan"],
38
+ th: [
39
+ "colspan",
40
+ "rowspan",
41
+ "scope"
42
+ ],
43
+ table: [
44
+ "border",
45
+ "cellpadding",
46
+ "cellspacing"
47
+ ],
48
+ "*": ["id"]
45
49
  };
46
-
47
- //#endregion
48
- //#region src/core/event-bus.ts
49
- const EVENT_PREFIX = "@react-email/editor:";
50
- var EditorEventBus = class {
51
- prefixEventName(eventName) {
52
- return `${EVENT_PREFIX}${String(eventName)}`;
53
- }
54
- dispatch(eventName, payload, options) {
55
- const target = options?.target ?? window;
56
- const prefixedEventName = this.prefixEventName(eventName);
57
- const event = new CustomEvent(prefixedEventName, {
58
- detail: payload,
59
- bubbles: false,
60
- cancelable: false
61
- });
62
- target.dispatchEvent(event);
63
- }
64
- on(eventName, handler, options) {
65
- const target = options?.target ?? window;
66
- const prefixedEventName = this.prefixEventName(eventName);
67
- const abortController = new AbortController();
68
- const wrappedHandler = (event) => {
69
- const customEvent = event;
70
- const result = handler(customEvent.detail);
71
- if (result instanceof Promise) result.catch((error) => {
72
- console.error(`Error in async event handler for ${prefixedEventName}:`, {
73
- event: customEvent.detail,
74
- error
75
- });
76
- });
77
- };
78
- target.addEventListener(prefixedEventName, wrappedHandler, {
79
- ...options,
80
- signal: abortController.signal
81
- });
82
- return { unsubscribe: () => {
83
- abortController.abort();
84
- } };
85
- }
86
- };
87
- const editorEventBus = new EditorEventBus();
88
-
89
- //#endregion
90
- //#region src/extensions/alignment-attribute.tsx
91
- const AlignmentAttribute = Extension.create({
92
- name: "alignmentAttribute",
93
- addOptions() {
94
- return {
95
- types: [],
96
- alignments: [
97
- "left",
98
- "center",
99
- "right",
100
- "justify"
101
- ]
102
- };
103
- },
104
- addGlobalAttributes() {
105
- return [{
106
- types: this.options.types,
107
- attributes: { alignment: {
108
- parseHTML: (element) => {
109
- const explicitAlign = element.getAttribute("align") || element.getAttribute("alignment") || element.style.textAlign;
110
- if (explicitAlign && this.options.alignments.includes(explicitAlign)) return explicitAlign;
111
- return null;
112
- },
113
- renderHTML: (attributes) => {
114
- if (attributes.alignment === "left") return {};
115
- return { alignment: attributes.alignment };
116
- }
117
- } }
118
- }];
119
- },
120
- addCommands() {
121
- return { setAlignment: (alignment) => ({ commands }) => {
122
- if (!this.options.alignments.includes(alignment)) return false;
123
- return this.options.types.every((type) => commands.updateAttributes(type, { alignment }));
124
- } };
125
- },
126
- addKeyboardShortcuts() {
127
- return {
128
- Enter: () => {
129
- const { from } = this.editor.state.selection;
130
- const currentAlignment = this.editor.state.doc.nodeAt(from)?.attrs?.alignment;
131
- if (currentAlignment) requestAnimationFrame(() => {
132
- this.editor.commands.setAlignment(currentAlignment);
133
- });
134
- return false;
135
- },
136
- "Mod-Shift-l": () => this.editor.commands.setAlignment("left"),
137
- "Mod-Shift-e": () => this.editor.commands.setAlignment("center"),
138
- "Mod-Shift-r": () => this.editor.commands.setAlignment("right"),
139
- "Mod-Shift-j": () => this.editor.commands.setAlignment("justify")
140
- };
141
- }
142
- });
143
-
144
- //#endregion
145
- //#region src/utils/attribute-helpers.ts
146
- /**
147
- * Creates TipTap attribute definitions for a list of HTML attributes.
148
- * Each attribute will have the same pattern:
149
- * - default: null
150
- * - parseHTML: extracts the attribute from the element
151
- * - renderHTML: conditionally renders the attribute if it has a value
152
- *
153
- * @param attributeNames - Array of HTML attribute names to create definitions for
154
- * @returns Object with TipTap attribute definitions
155
- *
156
- * @example
157
- * const attrs = createStandardAttributes(['class', 'id', 'title']);
158
- * // Returns:
159
- * // {
160
- * // class: {
161
- * // default: null,
162
- * // parseHTML: (element) => element.getAttribute('class'),
163
- * // renderHTML: (attributes) => attributes.class ? { class: attributes.class } : {}
164
- * // },
165
- * // ...
166
- * // }
167
- */
168
- function createStandardAttributes(attributeNames) {
169
- return Object.fromEntries(attributeNames.map((attr) => [attr, {
170
- default: null,
171
- parseHTML: (element) => element.getAttribute(attr),
172
- renderHTML: (attributes) => {
173
- if (!attributes[attr]) return {};
174
- return { [attr]: attributes[attr] };
50
+ function isFromEditor(html) {
51
+ return EDITOR_CLASS_PATTERN.test(html);
52
+ }
53
+ function sanitizePastedHtml(html) {
54
+ if (isFromEditor(html)) return html;
55
+ const doc = new DOMParser().parseFromString(html, "text/html");
56
+ sanitizeNode(doc.body);
57
+ return doc.body.innerHTML;
58
+ }
59
+ function sanitizeNode(node) {
60
+ if (node.nodeType === Node.ELEMENT_NODE) sanitizeElement(node);
61
+ for (const child of Array.from(node.childNodes)) sanitizeNode(child);
62
+ }
63
+ function sanitizeElement(el) {
64
+ const allowedForTag = PRESERVED_ATTRIBUTES[el.tagName.toLowerCase()] || [];
65
+ const allowedGlobal = PRESERVED_ATTRIBUTES["*"] || [];
66
+ const allowed = new Set([...allowedForTag, ...allowedGlobal]);
67
+ const attributesToRemove = [];
68
+ for (const attr of Array.from(el.attributes)) {
69
+ if (attr.name.startsWith("data-")) {
70
+ attributesToRemove.push(attr.name);
71
+ continue;
175
72
  }
176
- }]));
73
+ if (!allowed.has(attr.name)) attributesToRemove.push(attr.name);
74
+ }
75
+ for (const attr of attributesToRemove) el.removeAttribute(attr);
177
76
  }
178
- /**
179
- * Common HTML attributes used across multiple extensions.
180
- * These preserve attributes during HTML import and editing for better
181
- * fidelity when importing existing email templates.
182
- */
183
- const COMMON_HTML_ATTRIBUTES = [
184
- "id",
185
- "class",
186
- "title",
187
- "lang",
188
- "dir",
189
- "data-id"
190
- ];
191
- /**
192
- * Layout-specific HTML attributes used for positioning and sizing.
193
- */
194
- const LAYOUT_ATTRIBUTES = [
195
- "align",
196
- "width",
197
- "height"
198
- ];
199
- /**
200
- * Table-specific HTML attributes used for table layout and styling.
201
- */
202
- const TABLE_ATTRIBUTES = [
203
- "border",
204
- "cellpadding",
205
- "cellspacing"
206
- ];
207
- /**
208
- * Table cell-specific HTML attributes.
209
- */
210
- const TABLE_CELL_ATTRIBUTES = [
211
- "valign",
212
- "bgcolor",
213
- "colspan",
214
- "rowspan"
215
- ];
216
- /**
217
- * Table header cell-specific HTML attributes.
218
- * These are additional attributes that only apply to <th> elements.
219
- */
220
- const TABLE_HEADER_ATTRIBUTES = [...TABLE_CELL_ATTRIBUTES, "scope"];
221
-
222
77
  //#endregion
223
- //#region src/utils/styles.ts
224
- const WHITE_SPACE_REGEX = /\s+/;
225
- const inlineCssToJs = (inlineStyle, options = {}) => {
226
- const styleObject = {};
227
- if (!inlineStyle || inlineStyle === "" || typeof inlineStyle === "object") return styleObject;
228
- inlineStyle.split(";").forEach((style) => {
229
- if (style.trim()) {
230
- const [key, value] = style.split(":");
231
- const valueTrimmed = value?.trim();
232
- if (!valueTrimmed) return;
233
- const formattedKey = key.trim().replace(/-\w/g, (match) => match[1].toUpperCase());
234
- styleObject[formattedKey] = options?.removeUnit ? valueTrimmed.replace(/px|%/g, "") : valueTrimmed;
78
+ //#region src/core/create-paste-handler.ts
79
+ function createPasteHandler({ onPaste, extensions }) {
80
+ return (view, event, slice) => {
81
+ const text = event.clipboardData?.getData("text/plain");
82
+ if (text && onPaste?.(text, view)) {
83
+ event.preventDefault();
84
+ return true;
235
85
  }
236
- });
237
- return styleObject;
238
- };
239
- /**
240
- * Expands CSS shorthand properties (margin, padding) into their longhand equivalents.
241
- * This prevents shorthand properties from overriding specific longhand properties in email clients.
242
- *
243
- * @param styles - Style object that may contain shorthand properties
244
- * @returns New style object with shorthand properties expanded to longhand
245
- *
246
- * @example
247
- * expandShorthandProperties({ margin: '0', paddingTop: '10px' })
248
- * // Returns: { marginTop: '0', marginRight: '0', marginBottom: '0', marginLeft: '0', paddingTop: '10px' }
249
- */
250
- function expandShorthandProperties(styles) {
251
- if (!styles || typeof styles !== "object") return {};
252
- const expanded = {};
253
- for (const key in styles) {
254
- const value = styles[key];
255
- if (value === void 0 || value === null || value === "") continue;
256
- switch (key) {
257
- case "margin": {
258
- const values = parseShorthandValue(value);
259
- expanded.marginTop = values.top;
260
- expanded.marginRight = values.right;
261
- expanded.marginBottom = values.bottom;
262
- expanded.marginLeft = values.left;
263
- break;
264
- }
265
- case "padding": {
266
- const values = parseShorthandValue(value);
267
- expanded.paddingTop = values.top;
268
- expanded.paddingRight = values.right;
269
- expanded.paddingBottom = values.bottom;
270
- expanded.paddingLeft = values.left;
271
- break;
86
+ if (event.clipboardData?.files?.[0]) {
87
+ const file = event.clipboardData.files[0];
88
+ if (onPaste?.(file, view)) {
89
+ event.preventDefault();
90
+ return true;
272
91
  }
273
- case "border": {
274
- const values = convertBorderValue(value);
275
- expanded.borderStyle = values.style;
276
- expanded.borderWidth = values.width;
277
- expanded.borderColor = values.color;
278
- break;
279
- }
280
- case "borderTopLeftRadius":
281
- case "borderTopRightRadius":
282
- case "borderBottomLeftRadius":
283
- case "borderBottomRightRadius":
284
- expanded[key] = value;
285
- if (styles.borderTopLeftRadius && styles.borderTopRightRadius && styles.borderBottomLeftRadius && styles.borderBottomRightRadius) {
286
- const values = [
287
- styles.borderTopLeftRadius,
288
- styles.borderTopRightRadius,
289
- styles.borderBottomLeftRadius,
290
- styles.borderBottomRightRadius
291
- ];
292
- if (new Set(values).size === 1) expanded.borderRadius = values[0];
293
- }
294
- break;
295
- default: expanded[key] = value;
296
92
  }
297
- }
298
- return expanded;
299
- }
300
- /**
301
- * Parses CSS shorthand value (1-4 values) into individual side values.
302
- * Follows CSS specification for shorthand property value parsing.
303
- *
304
- * @param value - Shorthand value string (e.g., '0', '10px 20px', '5px 10px 15px 20px')
305
- * @returns Object with top, right, bottom, left values
306
- */
307
- function parseShorthandValue(value) {
308
- const stringValue = String(value).trim();
309
- const parts = stringValue.split(WHITE_SPACE_REGEX);
310
- const len = parts.length;
311
- if (len === 1) return {
312
- top: parts[0],
313
- right: parts[0],
314
- bottom: parts[0],
315
- left: parts[0]
316
- };
317
- if (len === 2) return {
318
- top: parts[0],
319
- right: parts[1],
320
- bottom: parts[0],
321
- left: parts[1]
322
- };
323
- if (len === 3) return {
324
- top: parts[0],
325
- right: parts[1],
326
- bottom: parts[2],
327
- left: parts[1]
328
- };
329
- if (len === 4) return {
330
- top: parts[0],
331
- right: parts[1],
332
- bottom: parts[2],
333
- left: parts[3]
334
- };
335
- return {
336
- top: stringValue,
337
- right: stringValue,
338
- bottom: stringValue,
339
- left: stringValue
340
- };
341
- }
342
- function convertBorderValue(value) {
343
- const stringValue = String(value).trim();
344
- const parts = stringValue.split(WHITE_SPACE_REGEX);
345
- switch (parts.length) {
346
- case 1: return {
347
- style: "solid",
348
- width: parts[0],
349
- color: "black"
350
- };
351
- case 2: return {
352
- style: parts[1],
353
- width: parts[0],
354
- color: "black"
355
- };
356
- case 3: return {
357
- style: parts[1],
358
- width: parts[0],
359
- color: parts[2]
360
- };
361
- case 4: return {
362
- style: parts[1],
363
- width: parts[0],
364
- color: parts[2]
365
- };
366
- default: return {
367
- style: "solid",
368
- width: stringValue,
369
- color: "black"
370
- };
371
- }
372
- }
373
- /**
374
- * Resolves conflicts between reset styles and inline styles by expanding
375
- * shorthand properties (margin, padding) to longhand before merging.
376
- * This prevents shorthand properties from overriding specific longhand properties.
377
- *
378
- * @param resetStyles - Base reset styles that may contain shorthand properties
379
- * @param inlineStyles - Inline styles that should override reset styles
380
- * @returns Merged styles with inline styles taking precedence
381
- */
382
- function resolveConflictingStyles(resetStyles, inlineStyles) {
383
- const expandedResetStyles = expandShorthandProperties(resetStyles);
384
- const expandedInlineStyles = expandShorthandProperties(inlineStyles);
385
- return {
386
- ...expandedResetStyles,
387
- ...expandedInlineStyles
388
- };
389
- }
390
-
391
- //#endregion
392
- //#region src/extensions/body.tsx
393
- const Body = EmailNode.create({
394
- name: "body",
395
- group: "block",
396
- content: "block+",
397
- defining: true,
398
- isolating: true,
399
- addAttributes() {
400
- return { ...createStandardAttributes([...COMMON_HTML_ATTRIBUTES, ...LAYOUT_ATTRIBUTES]) };
401
- },
402
- parseHTML() {
403
- return [{
404
- tag: "body",
405
- getAttrs: (node) => {
406
- if (typeof node === "string") return false;
407
- const element = node;
408
- const attrs = {};
409
- Array.from(element.attributes).forEach((attr) => {
410
- attrs[attr.name] = attr.value;
411
- });
412
- return attrs;
413
- }
414
- }];
415
- },
416
- renderHTML({ HTMLAttributes }) {
417
- return [
418
- "div",
419
- mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
420
- 0
421
- ];
422
- },
423
- renderToReactEmail({ children, node, styles }) {
424
- const inlineStyles = inlineCssToJs(node.attrs?.style);
425
- return /* @__PURE__ */ jsx("div", {
426
- className: node.attrs?.class || void 0,
427
- style: {
428
- ...styles.reset,
429
- ...inlineStyles
430
- },
431
- children
432
- });
433
- }
434
- });
435
-
436
- //#endregion
437
- //#region src/extensions/bold.ts
438
- /**
439
- * Matches bold text via `**` as input.
440
- */
441
- const starInputRegex = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/;
442
- /**
443
- * Matches bold text via `**` while pasting.
444
- */
445
- const starPasteRegex = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g;
446
- /**
447
- * Matches bold text via `__` as input.
448
- */
449
- const underscoreInputRegex = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/;
450
- /**
451
- * Matches bold text via `__` while pasting.
452
- */
453
- const underscorePasteRegex = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g;
454
- /**
455
- * This extension allows you to mark text as bold.
456
- * @see https://tiptap.dev/api/marks/bold
457
- */
458
- const Bold = Mark.create({
459
- name: "bold",
460
- addOptions() {
461
- return { HTMLAttributes: {} };
462
- },
463
- parseHTML() {
464
- return [
465
- { tag: "strong" },
466
- {
467
- tag: "b",
468
- getAttrs: (node) => node.style.fontWeight !== "normal" && null
469
- },
470
- {
471
- style: "font-weight=400",
472
- clearMark: (mark) => mark.type.name === this.name
473
- }
474
- ];
475
- },
476
- renderHTML({ HTMLAttributes }) {
477
- return [
478
- "strong",
479
- mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
480
- 0
481
- ];
482
- },
483
- addCommands() {
484
- return {
485
- setBold: () => ({ commands }) => {
486
- return commands.setMark(this.name);
487
- },
488
- toggleBold: () => ({ commands }) => {
489
- return commands.toggleMark(this.name);
490
- },
491
- unsetBold: () => ({ commands }) => {
492
- return commands.unsetMark(this.name);
493
- }
494
- };
495
- },
496
- addKeyboardShortcuts() {
497
- return {
498
- "Mod-b": () => this.editor.commands.toggleBold(),
499
- "Mod-B": () => this.editor.commands.toggleBold()
500
- };
501
- },
502
- addInputRules() {
503
- return [markInputRule({
504
- find: starInputRegex,
505
- type: this.type
506
- }), markInputRule({
507
- find: underscoreInputRegex,
508
- type: this.type
509
- })];
510
- },
511
- addPasteRules() {
512
- return [markPasteRule({
513
- find: starPasteRegex,
514
- type: this.type
515
- }), markPasteRule({
516
- find: underscorePasteRegex,
517
- type: this.type
518
- })];
519
- }
520
- });
521
-
522
- //#endregion
523
- //#region src/extensions/button.tsx
524
- const Button = EmailNode.create({
525
- name: "button",
526
- group: "block",
527
- content: "inline*",
528
- defining: true,
529
- draggable: true,
530
- marks: "bold",
531
- addAttributes() {
532
- return {
533
- class: { default: "button" },
534
- href: { default: "#" },
535
- alignment: { default: "left" }
536
- };
537
- },
538
- parseHTML() {
539
- return [{
540
- tag: "a[data-id=\"react-email-button\"]",
541
- getAttrs: (node) => {
542
- if (typeof node === "string") return false;
543
- const element = node;
544
- const attrs = {};
545
- Array.from(element.attributes).forEach((attr) => {
546
- attrs[attr.name] = attr.value;
547
- });
548
- return attrs;
549
- }
550
- }];
551
- },
552
- renderHTML({ HTMLAttributes }) {
553
- return [
554
- "div",
555
- mergeAttributes({ class: `align-${HTMLAttributes?.alignment}` }),
556
- [
557
- "a",
558
- mergeAttributes({
559
- class: `node-button ${HTMLAttributes?.class}`,
560
- style: HTMLAttributes?.style,
561
- "data-id": "react-email-button",
562
- "data-href": HTMLAttributes?.href
563
- }),
564
- 0
565
- ]
566
- ];
567
- },
568
- addCommands() {
569
- return {
570
- updateButton: (attributes) => ({ commands }) => {
571
- return commands.updateAttributes("button", attributes);
572
- },
573
- setButton: () => ({ commands }) => {
574
- return commands.insertContent({
575
- type: "button",
576
- content: [{
577
- type: "text",
578
- text: "Button"
579
- }]
580
- });
581
- }
582
- };
583
- },
584
- renderToReactEmail({ children, node, styles }) {
585
- const inlineStyles = inlineCssToJs(node.attrs?.style);
586
- return /* @__PURE__ */ jsx(Row, { children: /* @__PURE__ */ jsx(Column, {
587
- align: node.attrs?.align || node.attrs?.alignment,
588
- children: /* @__PURE__ */ jsx(Button$1, {
589
- className: node.attrs?.class || void 0,
590
- href: node.attrs?.href,
591
- style: {
592
- ...styles.reset,
593
- ...styles.button,
594
- ...inlineStyles
595
- },
596
- children
597
- })
598
- }) });
599
- }
600
- });
601
-
602
- //#endregion
603
- //#region src/extensions/class-attribute.tsx
604
- const ClassAttribute = Extension.create({
605
- name: "classAttribute",
606
- addOptions() {
607
- return {
608
- types: [],
609
- class: []
610
- };
611
- },
612
- addGlobalAttributes() {
613
- return [{
614
- types: this.options.types,
615
- attributes: { class: {
616
- default: "",
617
- parseHTML: (element) => element.className || "",
618
- renderHTML: (attributes) => {
619
- return attributes.class ? { class: attributes.class } : {};
620
- }
621
- } }
622
- }];
623
- },
624
- addCommands() {
625
- return {
626
- unsetClass: () => ({ commands }) => {
627
- return this.options.types.every((type) => commands.resetAttributes(type, "class"));
628
- },
629
- setClass: (classList) => ({ commands }) => {
630
- return this.options.types.every((type) => commands.updateAttributes(type, { class: classList }));
631
- }
632
- };
633
- },
634
- addKeyboardShortcuts() {
635
- return { Enter: ({ editor }) => {
636
- requestAnimationFrame(() => {
637
- editor.commands.resetAttributes("paragraph", "class");
638
- });
639
- return false;
640
- } };
641
- }
642
- });
643
-
644
- //#endregion
645
- //#region src/utils/prism-utils.ts
646
- const publicURL = "/styles/prism";
647
- function loadPrismTheme(theme) {
648
- const link = document.createElement("link");
649
- link.rel = "stylesheet";
650
- link.href = `${publicURL}/prism-${theme}.css`;
651
- link.setAttribute("data-prism-theme", "");
652
- document.head.appendChild(link);
653
- }
654
- function removePrismTheme() {
655
- const existingTheme = document.querySelectorAll("link[rel=\"stylesheet\"][data-prism-theme]");
656
- if (existingTheme.length > 0) existingTheme.forEach((cssLinkTag) => {
657
- cssLinkTag.remove();
658
- });
659
- }
660
- function hasPrismThemeLoaded(theme) {
661
- return !!document.querySelector(`link[rel="stylesheet"][data-prism-theme][href="${publicURL}/prism-${theme}.css"]`);
662
- }
663
-
664
- //#endregion
665
- //#region src/extensions/prism-plugin.ts
666
- const PRISM_LANGUAGE_LOADED_META = "prismLanguageLoaded";
667
- function parseNodes(nodes, className = []) {
668
- return nodes.flatMap((node) => {
669
- const classes = [...className, ...node.properties ? node.properties.className : []];
670
- if (node.children) return parseNodes(node.children, classes);
671
- return {
672
- text: node.value ?? "",
673
- classes
674
- };
675
- });
676
- }
677
- function getHighlightNodes(html) {
678
- return fromHtml(html, { fragment: true }).children;
679
- }
680
- function registeredLang(aliasOrLanguage) {
681
- const allSupportLang = Object.keys(Prism.languages).filter((id) => typeof Prism.languages[id] === "object");
682
- return Boolean(allSupportLang.find((x) => x === aliasOrLanguage));
683
- }
684
- function getDecorations({ doc, name, defaultLanguage, defaultTheme, loadingLanguages, onLanguageLoaded }) {
685
- const decorations = [];
686
- findChildren(doc, (node) => node.type.name === name).forEach((block) => {
687
- let from = block.pos + 1;
688
- const language = block.node.attrs.language || defaultLanguage;
689
- const theme = block.node.attrs.theme || defaultTheme;
690
- let html = "";
691
- try {
692
- if (!registeredLang(language) && !loadingLanguages.has(language)) {
693
- loadingLanguages.add(language);
694
- import(`prismjs/components/prism-${language}`).then(() => {
695
- loadingLanguages.delete(language);
696
- onLanguageLoaded(language);
697
- }).catch(() => {
698
- loadingLanguages.delete(language);
699
- });
700
- }
701
- if (!hasPrismThemeLoaded(theme)) loadPrismTheme(theme);
702
- html = Prism.highlight(block.node.textContent, Prism.languages[language], language);
703
- } catch {
704
- html = Prism.highlight(block.node.textContent, Prism.languages.javascript, "js");
93
+ if (slice.content.childCount === 1) return false;
94
+ if (event.clipboardData?.getData?.("text/html")) {
95
+ event.preventDefault();
96
+ const jsonContent = generateJSON(sanitizePastedHtml(event.clipboardData.getData("text/html")), extensions);
97
+ const node = view.state.schema.nodeFromJSON(jsonContent);
98
+ const transaction = view.state.tr.replaceSelectionWith(node, false);
99
+ view.dispatch(transaction);
100
+ return true;
705
101
  }
706
- parseNodes(getHighlightNodes(html)).forEach((node) => {
707
- const to = from + node.text.length;
708
- if (node.classes.length) {
709
- const decoration = Decoration.inline(from, to, { class: node.classes.join(" ") });
710
- decorations.push(decoration);
711
- }
712
- from = to;
713
- });
714
- });
715
- return DecorationSet.create(doc, decorations);
716
- }
717
- function PrismPlugin({ name, defaultLanguage, defaultTheme }) {
718
- if (!defaultLanguage) throw Error("You must specify the defaultLanguage parameter");
719
- const loadingLanguages = /* @__PURE__ */ new Set();
720
- let pluginView = null;
721
- const onLanguageLoaded = (language) => {
722
- if (pluginView) pluginView.dispatch(pluginView.state.tr.setMeta(PRISM_LANGUAGE_LOADED_META, language));
102
+ return false;
723
103
  };
724
- const prismjsPlugin = new Plugin({
725
- key: new PluginKey("prism"),
726
- view(view) {
727
- pluginView = view;
728
- return { destroy() {
729
- pluginView = null;
730
- } };
731
- },
732
- state: {
733
- init: (_, { doc }) => {
734
- return getDecorations({
735
- doc,
736
- name,
737
- defaultLanguage,
738
- defaultTheme,
739
- loadingLanguages,
740
- onLanguageLoaded
741
- });
742
- },
743
- apply: (transaction, decorationSet, oldState, newState) => {
744
- const oldNodeName = oldState.selection.$head.parent.type.name;
745
- const newNodeName = newState.selection.$head.parent.type.name;
746
- const oldNodes = findChildren(oldState.doc, (node) => node.type.name === name);
747
- const newNodes = findChildren(newState.doc, (node) => node.type.name === name);
748
- if (transaction.getMeta(PRISM_LANGUAGE_LOADED_META) || transaction.docChanged && ([oldNodeName, newNodeName].includes(name) || newNodes.length !== oldNodes.length || transaction.steps.some((step) => {
749
- const rangeStep = step;
750
- return rangeStep.from !== void 0 && rangeStep.to !== void 0 && oldNodes.some((node) => {
751
- return node.pos >= rangeStep.from && node.pos + node.node.nodeSize <= rangeStep.to;
752
- });
753
- }))) return getDecorations({
754
- doc: transaction.doc,
755
- name,
756
- defaultLanguage,
757
- defaultTheme,
758
- loadingLanguages,
759
- onLanguageLoaded
760
- });
761
- return decorationSet.map(transaction.mapping, transaction.doc);
762
- }
763
- },
764
- props: { decorations(state) {
765
- return prismjsPlugin.getState(state);
766
- } },
767
- destroy() {
768
- pluginView = null;
769
- removePrismTheme();
770
- }
771
- });
772
- return prismjsPlugin;
773
104
  }
774
-
775
105
  //#endregion
776
- //#region src/extensions/code-block.tsx
777
- const CodeBlockPrism = EmailNode.from(CodeBlock$1.extend({
778
- addOptions() {
779
- return {
780
- languageClassPrefix: "language-",
781
- exitOnTripleEnter: false,
782
- exitOnArrowDown: false,
783
- enableTabIndentation: true,
784
- tabSize: 2,
785
- defaultLanguage: "javascript",
786
- defaultTheme: "default",
787
- HTMLAttributes: {}
788
- };
789
- },
790
- addAttributes() {
791
- return {
792
- ...this.parent?.(),
793
- language: {
794
- default: this.options.defaultLanguage,
795
- parseHTML: (element) => {
796
- if (!element) return null;
797
- const { languageClassPrefix } = this.options;
798
- if (!languageClassPrefix) return null;
799
- const language = [...element.firstElementChild?.classList || []].filter((className) => className.startsWith(languageClassPrefix || "")).map((className) => className.replace(languageClassPrefix, ""))[0];
800
- if (!language) return null;
801
- return language;
802
- },
803
- rendered: false
804
- },
805
- theme: {
806
- default: this.options.defaultTheme,
807
- rendered: false
808
- }
809
- };
810
- },
811
- renderHTML({ node, HTMLAttributes }) {
812
- return [
813
- "pre",
814
- mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, { class: node.attrs.language ? `${this.options.languageClassPrefix}${node.attrs.language}` : null }, { "data-theme": node.attrs.theme }),
815
- [
816
- "code",
817
- { class: node.attrs.language ? `${this.options.languageClassPrefix}${node.attrs.language} node-codeTag` : "node-codeTag" },
818
- 0
819
- ]
820
- ];
821
- },
822
- addKeyboardShortcuts() {
823
- return {
824
- ...this.parent?.(),
825
- "Mod-a": ({ editor }) => {
826
- const { state } = editor;
827
- const { selection } = state;
828
- const { $from } = selection;
829
- for (let depth = $from.depth; depth >= 1; depth--) if ($from.node(depth).type.name === this.name) {
830
- const blockStart = $from.start(depth);
831
- const blockEnd = $from.end(depth);
832
- if (selection.from === blockStart && selection.to === blockEnd) return false;
833
- const tr = state.tr.setSelection(TextSelection.create(state.doc, blockStart, blockEnd));
834
- editor.view.dispatch(tr);
835
- return true;
836
- }
837
- return false;
838
- }
839
- };
840
- },
841
- addProseMirrorPlugins() {
842
- return [...this.parent?.() || [], PrismPlugin({
843
- name: this.name,
844
- defaultLanguage: this.options.defaultLanguage,
845
- defaultTheme: this.options.defaultTheme
846
- })];
847
- }
848
- }), ({ node, styles }) => {
849
- const language = node.attrs?.language ? `${node.attrs.language}` : "javascript";
850
- const userTheme = ReactEmailComponents[node.attrs?.theme];
851
- const theme = userTheme ? {
852
- ...userTheme,
853
- base: {
854
- ...userTheme.base,
855
- borderRadius: "0.125rem",
856
- padding: "0.75rem 1rem"
857
- }
858
- } : { base: {
859
- color: "#1e293b",
860
- background: "#f1f5f9",
861
- lineHeight: "1.5",
862
- fontFamily: "\"Fira Code\", \"Fira Mono\", Menlo, Consolas, \"DejaVu Sans Mono\", monospace",
863
- padding: "0.75rem 1rem",
864
- borderRadius: "0.125rem"
865
- } };
866
- return /* @__PURE__ */ jsx(CodeBlock, {
867
- code: node.content?.[0]?.text ?? "",
868
- language,
869
- theme,
870
- style: {
871
- width: "auto",
872
- ...styles.codeBlock
873
- }
874
- });
875
- });
876
-
877
- //#endregion
878
- //#region src/extensions/columns.tsx
879
- const COLUMN_PARENT_TYPES = [
880
- "twoColumns",
881
- "threeColumns",
882
- "fourColumns"
883
- ];
884
- const COLUMN_PARENT_SET = new Set(COLUMN_PARENT_TYPES);
885
- const MAX_COLUMNS_DEPTH = 3;
886
- function getColumnsDepth(doc, from) {
887
- const $from = doc.resolve(from);
888
- let depth = 0;
889
- for (let d = $from.depth; d > 0; d--) if (COLUMN_PARENT_SET.has($from.node(d).type.name)) depth++;
890
- return depth;
891
- }
892
- const VARIANTS = [
893
- {
894
- name: "twoColumns",
895
- columnCount: 2,
896
- content: "columnsColumn columnsColumn",
897
- dataType: "two-columns"
898
- },
899
- {
900
- name: "threeColumns",
901
- columnCount: 3,
902
- content: "columnsColumn columnsColumn columnsColumn",
903
- dataType: "three-columns"
904
- },
905
- {
906
- name: "fourColumns",
907
- columnCount: 4,
908
- content: "columnsColumn{4}",
909
- dataType: "four-columns"
910
- }
911
- ];
912
- const NODE_TYPE_MAP = {
913
- 2: "twoColumns",
914
- 3: "threeColumns",
915
- 4: "fourColumns"
916
- };
917
- function createColumnsNode(config, includeCommands) {
918
- return EmailNode.create({
919
- name: config.name,
920
- group: "block",
921
- content: config.content,
922
- isolating: true,
923
- defining: true,
924
- addAttributes() {
925
- return createStandardAttributes([...LAYOUT_ATTRIBUTES, ...COMMON_HTML_ATTRIBUTES]);
106
+ //#region src/email-editor/email-editor.tsx
107
+ function buildRef(editor) {
108
+ return {
109
+ getEmail: async () => {
110
+ if (!editor) return {
111
+ html: "",
112
+ text: ""
113
+ };
114
+ return composeReactEmail({ editor });
926
115
  },
927
- parseHTML() {
928
- return [{ tag: `div[data-type="${config.dataType}"]` }];
116
+ getEmailHTML: async () => {
117
+ if (!editor) return "";
118
+ return (await composeReactEmail({ editor })).html;
929
119
  },
930
- renderHTML({ HTMLAttributes }) {
931
- return [
932
- "div",
933
- mergeAttributes({
934
- "data-type": config.dataType,
935
- class: "node-columns"
936
- }, HTMLAttributes),
937
- 0
938
- ];
120
+ getEmailText: async () => {
121
+ if (!editor) return "";
122
+ return (await composeReactEmail({ editor })).text;
939
123
  },
940
- ...includeCommands && { addCommands() {
941
- return { insertColumns: (count) => ({ commands, state }) => {
942
- if (getColumnsDepth(state.doc, state.selection.from) >= MAX_COLUMNS_DEPTH) return false;
943
- const nodeType = NODE_TYPE_MAP[count];
944
- const children = Array.from({ length: count }, () => ({
945
- type: "columnsColumn",
946
- content: [{
947
- type: "paragraph",
948
- content: []
949
- }]
950
- }));
951
- return commands.insertContent({
952
- type: nodeType,
953
- content: children
954
- });
955
- } };
956
- } },
957
- renderToReactEmail({ children, node, styles }) {
958
- const inlineStyles = inlineCssToJs(node.attrs?.style);
959
- return /* @__PURE__ */ jsx(Row, {
960
- className: node.attrs?.class || void 0,
961
- style: {
962
- ...styles.reset,
963
- ...inlineStyles
964
- },
965
- children
966
- });
967
- }
968
- });
969
- }
970
- const TwoColumns = createColumnsNode(VARIANTS[0], true);
971
- const ThreeColumns = createColumnsNode(VARIANTS[1], false);
972
- const FourColumns = createColumnsNode(VARIANTS[2], false);
973
- const ColumnsColumn = EmailNode.create({
974
- name: "columnsColumn",
975
- group: "columnsColumn",
976
- content: "block+",
977
- isolating: true,
978
- addAttributes() {
979
- return { ...createStandardAttributes([...LAYOUT_ATTRIBUTES, ...COMMON_HTML_ATTRIBUTES]) };
980
- },
981
- parseHTML() {
982
- return [{ tag: "div[data-type=\"column\"]" }];
983
- },
984
- renderHTML({ HTMLAttributes }) {
985
- return [
986
- "div",
987
- mergeAttributes({
988
- "data-type": "column",
989
- class: "node-column"
990
- }, HTMLAttributes),
991
- 0
992
- ];
993
- },
994
- addKeyboardShortcuts() {
995
- return {
996
- Backspace: ({ editor }) => {
997
- const { state } = editor;
998
- const { selection } = state;
999
- const { empty, $from } = selection;
1000
- if (!empty) return false;
1001
- for (let depth = $from.depth; depth >= 1; depth--) {
1002
- if ($from.pos !== $from.start(depth)) break;
1003
- const indexInParent = $from.index(depth - 1);
1004
- if (indexInParent === 0) continue;
1005
- const prevNode = $from.node(depth - 1).child(indexInParent - 1);
1006
- if (COLUMN_PARENT_SET.has(prevNode.type.name)) {
1007
- const deleteFrom = $from.before(depth) - prevNode.nodeSize;
1008
- const deleteTo = $from.before(depth);
1009
- editor.view.dispatch(state.tr.delete(deleteFrom, deleteTo));
1010
- return true;
1011
- }
1012
- break;
1013
- }
1014
- return false;
1015
- },
1016
- "Mod-a": ({ editor }) => {
1017
- const { state } = editor;
1018
- const { $from } = state.selection;
1019
- for (let d = $from.depth; d > 0; d--) {
1020
- if ($from.node(d).type.name !== "columnsColumn") continue;
1021
- const columnStart = $from.start(d);
1022
- const columnEnd = $from.end(d);
1023
- const { from, to } = state.selection;
1024
- if (from === columnStart && to === columnEnd) return false;
1025
- editor.view.dispatch(state.tr.setSelection(TextSelection.create(state.doc, columnStart, columnEnd)));
1026
- return true;
1027
- }
1028
- return false;
1029
- }
1030
- };
1031
- },
1032
- renderToReactEmail({ children, node, styles }) {
1033
- const inlineStyles = inlineCssToJs(node.attrs?.style);
1034
- const width = node.attrs?.width;
1035
- return /* @__PURE__ */ jsx(Column, {
1036
- className: node.attrs?.class || void 0,
1037
- style: {
1038
- ...styles.reset,
1039
- ...inlineStyles,
1040
- ...width ? { width } : {}
1041
- },
1042
- children
1043
- });
1044
- }
1045
- });
1046
-
1047
- //#endregion
1048
- //#region src/extensions/div.tsx
1049
- const Div = EmailNode.create({
1050
- name: "div",
1051
- group: "block",
1052
- content: "block+",
1053
- defining: true,
1054
- isolating: true,
1055
- parseHTML() {
1056
- return [{
1057
- tag: "div:not([data-type])",
1058
- getAttrs: (node) => {
1059
- if (typeof node === "string") return false;
1060
- const element = node;
1061
- const attrs = {};
1062
- Array.from(element.attributes).forEach((attr) => {
1063
- attrs[attr.name] = attr.value;
1064
- });
1065
- return attrs;
1066
- }
1067
- }];
1068
- },
1069
- renderHTML({ HTMLAttributes }) {
1070
- return [
1071
- "div",
1072
- mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
1073
- 0
1074
- ];
1075
- },
1076
- addAttributes() {
1077
- return { ...createStandardAttributes([...COMMON_HTML_ATTRIBUTES, ...LAYOUT_ATTRIBUTES]) };
1078
- },
1079
- renderToReactEmail({ children, node, styles }) {
1080
- const inlineStyles = inlineCssToJs(node.attrs?.style);
1081
- return /* @__PURE__ */ jsx("div", {
1082
- className: node.attrs?.class || void 0,
1083
- style: {
1084
- ...styles.reset,
1085
- ...inlineStyles
1086
- },
1087
- children
1088
- });
1089
- }
1090
- });
1091
-
1092
- //#endregion
1093
- //#region src/extensions/max-nesting.ts
1094
- const MaxNesting = Extension.create({
1095
- name: "maxNesting",
1096
- addOptions() {
1097
- return {
1098
- maxDepth: 3,
1099
- nodeTypes: void 0
1100
- };
1101
- },
1102
- addProseMirrorPlugins() {
1103
- const { maxDepth, nodeTypes } = this.options;
1104
- if (typeof maxDepth !== "number" || maxDepth < 1) throw new Error("maxDepth must be a positive number");
1105
- return [new Plugin({
1106
- key: new PluginKey("maxNesting"),
1107
- appendTransaction(transactions, _oldState, newState) {
1108
- if (!transactions.some((tr$1) => tr$1.docChanged)) return null;
1109
- const rangesToLift = [];
1110
- newState.doc.descendants((node, pos) => {
1111
- let depth = 0;
1112
- let currentPos = pos;
1113
- let currentNode = node;
1114
- while (currentNode && depth <= maxDepth) {
1115
- if (!nodeTypes || nodeTypes.includes(currentNode.type.name)) depth++;
1116
- const $pos = newState.doc.resolve(currentPos);
1117
- if ($pos.depth === 0) break;
1118
- currentPos = $pos.before($pos.depth);
1119
- currentNode = newState.doc.nodeAt(currentPos);
1120
- }
1121
- if (depth > maxDepth) {
1122
- const $pos = newState.doc.resolve(pos);
1123
- if ($pos.depth > 0) {
1124
- const range = $pos.blockRange();
1125
- if (range && "canReplace" in newState.schema.nodes.doc && typeof newState.schema.nodes.doc.canReplace === "function" && newState.schema.nodes.doc.canReplace(range.start - 1, range.end + 1, newState.doc.slice(range.start, range.end).content)) rangesToLift.push({
1126
- range,
1127
- target: range.start - 1
1128
- });
1129
- }
1130
- }
1131
- });
1132
- if (rangesToLift.length === 0) return null;
1133
- const tr = newState.tr;
1134
- for (let i = rangesToLift.length - 1; i >= 0; i--) {
1135
- const { range, target } = rangesToLift[i];
1136
- tr.lift(range, target);
1137
- }
1138
- return tr;
1139
- },
1140
- filterTransaction(tr) {
1141
- if (!tr.docChanged) return true;
1142
- let wouldCreateDeepNesting = false;
1143
- const newDoc = tr.doc;
1144
- newDoc.descendants((node, pos) => {
1145
- if (wouldCreateDeepNesting) return false;
1146
- let depth = 0;
1147
- let currentPos = pos;
1148
- let currentNode = node;
1149
- while (currentNode && depth <= maxDepth) {
1150
- if (!nodeTypes || nodeTypes.includes(currentNode.type.name)) depth++;
1151
- const $pos = newDoc.resolve(currentPos);
1152
- if ($pos.depth === 0) break;
1153
- currentPos = $pos.before($pos.depth);
1154
- currentNode = newDoc.nodeAt(currentPos);
1155
- }
1156
- if (depth > maxDepth) {
1157
- wouldCreateDeepNesting = true;
1158
- return false;
1159
- }
1160
- });
1161
- return !wouldCreateDeepNesting;
1162
- }
1163
- })];
1164
- }
1165
- });
1166
-
1167
- //#endregion
1168
- //#region src/extensions/placeholder.ts
1169
- const Placeholder = TipTapPlaceholder.configure({
1170
- placeholder: ({ node }) => {
1171
- if (node.type.name === "heading") return `Heading ${node.attrs.level}`;
1172
- return "Press '/' for commands";
1173
- },
1174
- includeChildren: true
1175
- });
1176
-
1177
- //#endregion
1178
- //#region src/extensions/preserved-style.ts
1179
- const PreservedStyle = Mark.create({
1180
- name: "preservedStyle",
1181
- addAttributes() {
1182
- return { style: {
1183
- default: null,
1184
- parseHTML: (element) => element.getAttribute("style"),
1185
- renderHTML: (attributes) => {
1186
- if (!attributes.style) return {};
1187
- return { style: attributes.style };
1188
- }
1189
- } };
1190
- },
1191
- parseHTML() {
1192
- return [{
1193
- tag: "span[style]",
1194
- getAttrs: (element) => {
1195
- if (typeof element === "string") return false;
1196
- const style = element.getAttribute("style");
1197
- if (style && hasPreservableStyles(style)) return { style };
1198
- return false;
1199
- }
1200
- }];
1201
- },
1202
- renderHTML({ HTMLAttributes }) {
1203
- return [
1204
- "span",
1205
- mergeAttributes(HTMLAttributes),
1206
- 0
1207
- ];
1208
- }
1209
- });
1210
- const LINK_INDICATOR_STYLES = [
1211
- "color",
1212
- "text-decoration",
1213
- "text-decoration-line",
1214
- "text-decoration-color",
1215
- "text-decoration-style"
1216
- ];
1217
- function parseStyleString(styleString) {
1218
- const temp = document.createElement("div");
1219
- temp.style.cssText = styleString;
1220
- return temp.style;
1221
- }
1222
- function hasBackground(style) {
1223
- const bgColor = style.backgroundColor;
1224
- const bg = style.background;
1225
- if (bgColor && bgColor !== "transparent" && bgColor !== "rgba(0, 0, 0, 0)") return true;
1226
- if (bg && bg !== "transparent" && bg !== "none" && bg !== "rgba(0, 0, 0, 0)") return true;
1227
- return false;
1228
- }
1229
- function hasPreservableStyles(styleString) {
1230
- return processStylesForUnlink(styleString) !== null;
1231
- }
1232
- /**
1233
- * Processes styles when unlinking:
1234
- * - Has background (button-like): preserve all styles
1235
- * - No background: strip link-indicator styles (color, text-decoration), keep the rest
1236
- */
1237
- function processStylesForUnlink(styleString) {
1238
- if (!styleString) return null;
1239
- const style = parseStyleString(styleString);
1240
- if (hasBackground(style)) return styleString;
1241
- const filtered = [];
1242
- for (let i = 0; i < style.length; i++) {
1243
- const prop = style[i];
1244
- if (LINK_INDICATOR_STYLES.includes(prop)) continue;
1245
- const value = style.getPropertyValue(prop);
1246
- if (value) filtered.push(`${prop}: ${value}`);
1247
- }
1248
- return filtered.length > 0 ? filtered.join("; ") : null;
1249
- }
1250
-
1251
- //#endregion
1252
- //#region src/extensions/preview-text.ts
1253
- const PreviewText = Node.create({
1254
- name: "previewText",
1255
- group: "block",
1256
- selectable: false,
1257
- draggable: false,
1258
- atom: true,
1259
- addOptions() {
1260
- return { HTMLAttributes: {} };
1261
- },
1262
- addStorage() {
1263
- return { previewText: null };
1264
- },
1265
- renderHTML() {
1266
- return ["div", { style: "display: none" }];
1267
- },
1268
- parseHTML() {
1269
- return [{
1270
- tag: "div[data-skip-in-text=\"true\"]",
1271
- getAttrs: (node) => {
1272
- if (typeof node === "string") return false;
1273
- const element = node;
1274
- let directText = "";
1275
- for (const child of element.childNodes) if (child.nodeType === 3) directText += child.textContent || "";
1276
- const cleanText = directText.trim();
1277
- if (cleanText) this.storage.previewText = cleanText;
1278
- return false;
1279
- }
1280
- }, {
1281
- tag: "span.preheader",
1282
- getAttrs: (node) => {
1283
- if (typeof node === "string") return false;
1284
- const preheaderText = node.textContent?.trim();
1285
- if (preheaderText) this.storage.previewText = preheaderText;
1286
- return false;
1287
- }
1288
- }];
1289
- }
1290
- });
1291
-
1292
- //#endregion
1293
- //#region src/utils/get-text-alignment.ts
1294
- function getTextAlignment(alignment) {
1295
- switch (alignment) {
1296
- case "left": return { textAlign: "left" };
1297
- case "center": return { textAlign: "center" };
1298
- case "right": return { textAlign: "right" };
1299
- default: return {};
1300
- }
1301
- }
1302
-
1303
- //#endregion
1304
- //#region src/extensions/section.tsx
1305
- const Section = EmailNode.create({
1306
- name: "section",
1307
- group: "block",
1308
- content: "block+",
1309
- isolating: true,
1310
- defining: true,
1311
- parseHTML() {
1312
- return [{ tag: "section[data-type=\"section\"]" }];
1313
- },
1314
- renderHTML({ HTMLAttributes }) {
1315
- return [
1316
- "section",
1317
- mergeAttributes({
1318
- "data-type": "section",
1319
- class: "node-section"
1320
- }, HTMLAttributes),
1321
- 0
1322
- ];
1323
- },
1324
- addCommands() {
1325
- return { insertSection: () => ({ commands }) => {
1326
- return commands.insertContent({
1327
- type: this.name,
1328
- content: [{
1329
- type: "paragraph",
1330
- content: []
1331
- }]
1332
- });
1333
- } };
1334
- },
1335
- renderToReactEmail({ children, node, styles }) {
1336
- const inlineStyles = inlineCssToJs(node.attrs?.style);
1337
- const textAlign = node.attrs?.align || node.attrs?.alignment;
1338
- return /* @__PURE__ */ jsx(Section$1, {
1339
- className: node.attrs?.class || void 0,
1340
- align: textAlign,
1341
- style: {
1342
- ...styles.section,
1343
- ...inlineStyles,
1344
- ...getTextAlignment(textAlign)
1345
- },
1346
- children
1347
- });
1348
- }
1349
- });
1350
-
1351
- //#endregion
1352
- //#region src/extensions/style-attribute.tsx
1353
- const StyleAttribute = Extension.create({
1354
- name: "styleAttribute",
1355
- priority: 101,
1356
- addOptions() {
1357
- return {
1358
- types: [],
1359
- style: []
1360
- };
1361
- },
1362
- addGlobalAttributes() {
1363
- return [{
1364
- types: this.options.types,
1365
- attributes: { style: {
1366
- default: "",
1367
- parseHTML: (element) => element.getAttribute("style") || "",
1368
- renderHTML: (attributes) => {
1369
- return { style: attributes.style ?? "" };
1370
- }
1371
- } }
1372
- }];
1373
- },
1374
- addCommands() {
1375
- return {
1376
- unsetStyle: () => ({ commands }) => {
1377
- return this.options.types.every((type) => commands.resetAttributes(type, "style"));
1378
- },
1379
- setStyle: (style) => ({ commands }) => {
1380
- return this.options.types.every((type) => commands.updateAttributes(type, { style }));
1381
- }
1382
- };
1383
- },
1384
- addKeyboardShortcuts() {
1385
- return { Enter: ({ editor }) => {
1386
- const { state } = editor.view;
1387
- const { selection } = state;
1388
- const { $from } = selection;
1389
- const textBefore = $from.nodeBefore?.text || "";
1390
- if (textBefore.includes("{{") || textBefore.includes("{{{")) return false;
1391
- requestAnimationFrame(() => {
1392
- editor.commands.resetAttributes("paragraph", "style");
1393
- });
1394
- return false;
1395
- } };
1396
- }
1397
- });
1398
-
1399
- //#endregion
1400
- //#region src/extensions/sup.ts
1401
- /**
1402
- * This extension allows you to mark text as superscript.
1403
- * @see https://tiptap.dev/api/marks/superscript
1404
- */
1405
- const Sup = Mark.create({
1406
- name: "sup",
1407
- addOptions() {
1408
- return { HTMLAttributes: {} };
1409
- },
1410
- parseHTML() {
1411
- return [{ tag: "sup" }];
1412
- },
1413
- renderHTML({ HTMLAttributes }) {
1414
- return [
1415
- "sup",
1416
- mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
1417
- 0
1418
- ];
1419
- },
1420
- addCommands() {
1421
- return {
1422
- setSup: () => ({ commands }) => {
1423
- return commands.setMark(this.name);
1424
- },
1425
- toggleSup: () => ({ commands }) => {
1426
- return commands.toggleMark(this.name);
1427
- },
1428
- unsetSup: () => ({ commands }) => {
1429
- return commands.unsetMark(this.name);
1430
- }
1431
- };
1432
- }
1433
- });
1434
-
1435
- //#endregion
1436
- //#region src/extensions/table.tsx
1437
- const Table = EmailNode.create({
1438
- name: "table",
1439
- group: "block",
1440
- content: "tableRow+",
1441
- isolating: true,
1442
- tableRole: "table",
1443
- addAttributes() {
1444
- return { ...createStandardAttributes([
1445
- ...TABLE_ATTRIBUTES,
1446
- ...LAYOUT_ATTRIBUTES,
1447
- ...COMMON_HTML_ATTRIBUTES
1448
- ]) };
1449
- },
1450
- parseHTML() {
1451
- return [{
1452
- tag: "table",
1453
- getAttrs: (node) => {
1454
- if (typeof node === "string") return false;
1455
- const element = node;
1456
- const attrs = {};
1457
- Array.from(element.attributes).forEach((attr) => {
1458
- attrs[attr.name] = attr.value;
1459
- });
1460
- return attrs;
1461
- }
1462
- }];
1463
- },
1464
- renderHTML({ HTMLAttributes }) {
1465
- return [
1466
- "table",
1467
- mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
1468
- [
1469
- "tbody",
1470
- {},
1471
- 0
1472
- ]
1473
- ];
1474
- },
1475
- renderToReactEmail({ children, node, styles }) {
1476
- const inlineStyles = inlineCssToJs(node.attrs?.style);
1477
- const alignment = node.attrs?.align || node.attrs?.alignment;
1478
- const width = node.attrs?.width;
1479
- const centeringStyles = alignment === "center" ? {
1480
- marginLeft: "auto",
1481
- marginRight: "auto"
1482
- } : {};
1483
- return /* @__PURE__ */ jsx(Section$1, {
1484
- className: node.attrs?.class || void 0,
1485
- align: alignment,
1486
- style: resolveConflictingStyles(styles.reset, {
1487
- ...inlineStyles,
1488
- ...centeringStyles
1489
- }),
1490
- ...width !== void 0 ? { width } : {},
1491
- children
1492
- });
1493
- }
1494
- });
1495
- const TableRow = EmailNode.create({
1496
- name: "tableRow",
1497
- group: "tableRow",
1498
- content: "(tableCell | tableHeader)+",
1499
- addAttributes() {
1500
- return { ...createStandardAttributes([
1501
- ...TABLE_CELL_ATTRIBUTES,
1502
- ...LAYOUT_ATTRIBUTES,
1503
- ...COMMON_HTML_ATTRIBUTES
1504
- ]) };
1505
- },
1506
- parseHTML() {
1507
- return [{
1508
- tag: "tr",
1509
- getAttrs: (node) => {
1510
- if (typeof node === "string") return false;
1511
- const element = node;
1512
- const attrs = {};
1513
- Array.from(element.attributes).forEach((attr) => {
1514
- attrs[attr.name] = attr.value;
1515
- });
1516
- return attrs;
1517
- }
1518
- }];
1519
- },
1520
- renderHTML({ HTMLAttributes }) {
1521
- return [
1522
- "tr",
1523
- HTMLAttributes,
1524
- 0
1525
- ];
1526
- },
1527
- renderToReactEmail({ children, node, styles }) {
1528
- const inlineStyles = inlineCssToJs(node.attrs?.style);
1529
- return /* @__PURE__ */ jsx("tr", {
1530
- className: node.attrs?.class || void 0,
1531
- style: {
1532
- ...styles.reset,
1533
- ...inlineStyles
1534
- },
1535
- children
1536
- });
1537
- }
1538
- });
1539
- const TableCell = EmailNode.create({
1540
- name: "tableCell",
1541
- group: "tableCell",
1542
- content: "block+",
1543
- isolating: true,
1544
- addAttributes() {
1545
- return { ...createStandardAttributes([
1546
- ...TABLE_CELL_ATTRIBUTES,
1547
- ...LAYOUT_ATTRIBUTES,
1548
- ...COMMON_HTML_ATTRIBUTES
1549
- ]) };
1550
- },
1551
- parseHTML() {
1552
- return [{
1553
- tag: "td",
1554
- getAttrs: (node) => {
1555
- if (typeof node === "string") return false;
1556
- const element = node;
1557
- const attrs = {};
1558
- Array.from(element.attributes).forEach((attr) => {
1559
- attrs[attr.name] = attr.value;
1560
- });
1561
- return attrs;
1562
- }
1563
- }];
1564
- },
1565
- renderHTML({ HTMLAttributes }) {
1566
- return [
1567
- "td",
1568
- HTMLAttributes,
1569
- 0
1570
- ];
1571
- },
1572
- renderToReactEmail({ children, node, styles }) {
1573
- const inlineStyles = inlineCssToJs(node.attrs?.style);
1574
- return /* @__PURE__ */ jsx(Column, {
1575
- className: node.attrs?.class || void 0,
1576
- align: node.attrs?.align || node.attrs?.alignment,
1577
- style: {
1578
- ...styles.reset,
1579
- ...inlineStyles
1580
- },
1581
- children
1582
- });
1583
- }
1584
- });
1585
- const TableHeader = Node.create({
1586
- name: "tableHeader",
1587
- group: "tableCell",
1588
- content: "block+",
1589
- isolating: true,
1590
- addAttributes() {
1591
- return { ...createStandardAttributes([
1592
- ...TABLE_HEADER_ATTRIBUTES,
1593
- ...TABLE_CELL_ATTRIBUTES,
1594
- ...LAYOUT_ATTRIBUTES,
1595
- ...COMMON_HTML_ATTRIBUTES
1596
- ]) };
1597
- },
1598
- parseHTML() {
1599
- return [{
1600
- tag: "th",
1601
- getAttrs: (node) => {
1602
- if (typeof node === "string") return false;
1603
- const element = node;
1604
- const attrs = {};
1605
- Array.from(element.attributes).forEach((attr) => {
1606
- attrs[attr.name] = attr.value;
1607
- });
1608
- return attrs;
1609
- }
1610
- }];
1611
- },
1612
- renderHTML({ HTMLAttributes }) {
1613
- return [
1614
- "th",
1615
- HTMLAttributes,
1616
- 0
1617
- ];
1618
- }
1619
- });
1620
-
1621
- //#endregion
1622
- //#region src/extensions/uppercase.ts
1623
- const Uppercase = Mark.create({
1624
- name: "uppercase",
1625
- addOptions() {
1626
- return { HTMLAttributes: {} };
1627
- },
1628
- parseHTML() {
1629
- return [{
1630
- tag: "span",
1631
- getAttrs: (node) => {
1632
- if (node.style.textTransform === "uppercase") return {};
1633
- return false;
1634
- }
1635
- }];
1636
- },
1637
- renderHTML({ HTMLAttributes }) {
1638
- return [
1639
- "span",
1640
- mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, { style: "text-transform: uppercase" }),
1641
- 0
1642
- ];
1643
- },
1644
- addCommands() {
1645
- return {
1646
- setUppercase: () => ({ commands }) => {
1647
- return commands.setMark(this.name);
1648
- },
1649
- toggleUppercase: () => ({ commands }) => {
1650
- return commands.toggleMark(this.name);
1651
- },
1652
- unsetUppercase: () => ({ commands }) => {
1653
- return commands.unsetMark(this.name);
1654
- }
1655
- };
1656
- }
1657
- });
1658
-
1659
- //#endregion
1660
- //#region src/utils/set-text-alignment.ts
1661
- function setTextAlignment(editor, alignment) {
1662
- const { from, to } = editor.state.selection;
1663
- const tr = editor.state.tr;
1664
- editor.state.doc.nodesBetween(from, to, (node, pos) => {
1665
- if (node.isTextblock) {
1666
- const prop = "align" in node.attrs ? "align" : "alignment";
1667
- tr.setNodeMarkup(pos, null, {
1668
- ...node.attrs,
1669
- [prop]: alignment
1670
- });
1671
- }
1672
- });
1673
- editor.view.dispatch(tr);
1674
- }
1675
-
1676
- //#endregion
1677
- //#region src/ui/bubble-menu/context.tsx
1678
- const BubbleMenuContext = React.createContext(null);
1679
- function useBubbleMenuContext() {
1680
- const context = React.useContext(BubbleMenuContext);
1681
- if (!context) throw new Error("BubbleMenu compound components must be used within <BubbleMenu.Root>");
1682
- return context;
1683
- }
1684
-
1685
- //#endregion
1686
- //#region src/ui/bubble-menu/item.tsx
1687
- function BubbleMenuItem({ name, isActive, onCommand, className, children,...rest }) {
1688
- return /* @__PURE__ */ jsx("button", {
1689
- type: "button",
1690
- "aria-label": name,
1691
- "aria-pressed": isActive,
1692
- className,
1693
- "data-re-bubble-menu-item": "",
1694
- "data-item": name,
1695
- ...isActive ? { "data-active": "" } : {},
1696
- onMouseDown: (e) => e.preventDefault(),
1697
- onClick: onCommand,
1698
- ...rest,
1699
- children
1700
- });
1701
- }
1702
-
1703
- //#endregion
1704
- //#region src/ui/bubble-menu/align-center.tsx
1705
- function BubbleMenuAlignCenter({ className, children }) {
1706
- const { editor } = useBubbleMenuContext();
1707
- return /* @__PURE__ */ jsx(BubbleMenuItem, {
1708
- name: "align-center",
1709
- isActive: useEditorState({
1710
- editor,
1711
- selector: ({ editor: editor$1 }) => editor$1?.isActive({ alignment: "center" }) ?? false
1712
- }),
1713
- onCommand: () => setTextAlignment(editor, "center"),
1714
- className,
1715
- children: children ?? /* @__PURE__ */ jsx(AlignCenterIcon, {})
1716
- });
1717
- }
1718
-
1719
- //#endregion
1720
- //#region src/ui/bubble-menu/align-left.tsx
1721
- function BubbleMenuAlignLeft({ className, children }) {
1722
- const { editor } = useBubbleMenuContext();
1723
- return /* @__PURE__ */ jsx(BubbleMenuItem, {
1724
- name: "align-left",
1725
- isActive: useEditorState({
1726
- editor,
1727
- selector: ({ editor: editor$1 }) => editor$1?.isActive({ alignment: "left" }) ?? false
1728
- }),
1729
- onCommand: () => setTextAlignment(editor, "left"),
1730
- className,
1731
- children: children ?? /* @__PURE__ */ jsx(AlignLeftIcon, {})
1732
- });
1733
- }
1734
-
1735
- //#endregion
1736
- //#region src/ui/bubble-menu/align-right.tsx
1737
- function BubbleMenuAlignRight({ className, children }) {
1738
- const { editor } = useBubbleMenuContext();
1739
- return /* @__PURE__ */ jsx(BubbleMenuItem, {
1740
- name: "align-right",
1741
- isActive: useEditorState({
1742
- editor,
1743
- selector: ({ editor: editor$1 }) => editor$1?.isActive({ alignment: "right" }) ?? false
1744
- }),
1745
- onCommand: () => setTextAlignment(editor, "right"),
1746
- className,
1747
- children: children ?? /* @__PURE__ */ jsx(AlignRightIcon, {})
1748
- });
1749
- }
1750
-
1751
- //#endregion
1752
- //#region src/ui/bubble-menu/create-mark-bubble-item.tsx
1753
- function createMarkBubbleItem(config) {
1754
- function MarkBubbleItem({ className, children }) {
1755
- const { editor } = useBubbleMenuContext();
1756
- const isActive = useEditorState({
1757
- editor,
1758
- selector: ({ editor: editor$1 }) => {
1759
- if (config.activeParams) return editor$1?.isActive(config.activeName, config.activeParams) ?? false;
1760
- return editor$1?.isActive(config.activeName) ?? false;
1761
- }
1762
- });
1763
- const handleCommand = () => {
1764
- const chain = editor.chain().focus();
1765
- const method = chain[config.command];
1766
- if (method) method.call(chain).run();
1767
- };
1768
- return /* @__PURE__ */ jsx(BubbleMenuItem, {
1769
- name: config.name,
1770
- isActive,
1771
- onCommand: handleCommand,
1772
- className,
1773
- children: children ?? config.icon
1774
- });
1775
- }
1776
- MarkBubbleItem.displayName = `BubbleMenu${config.name.charAt(0).toUpperCase() + config.name.slice(1)}`;
1777
- return MarkBubbleItem;
1778
- }
1779
-
1780
- //#endregion
1781
- //#region src/ui/bubble-menu/bold.tsx
1782
- const BubbleMenuBold = createMarkBubbleItem({
1783
- name: "bold",
1784
- activeName: "bold",
1785
- command: "toggleBold",
1786
- icon: /* @__PURE__ */ jsx(BoldIcon, {})
1787
- });
1788
-
1789
- //#endregion
1790
- //#region src/ui/bubble-menu/code.tsx
1791
- const BubbleMenuCode = createMarkBubbleItem({
1792
- name: "code",
1793
- activeName: "code",
1794
- command: "toggleCode",
1795
- icon: /* @__PURE__ */ jsx(CodeIcon, {})
1796
- });
1797
-
1798
- //#endregion
1799
- //#region src/ui/bubble-menu/group.tsx
1800
- function BubbleMenuItemGroup({ className, children }) {
1801
- return /* @__PURE__ */ jsx("fieldset", {
1802
- className,
1803
- "data-re-bubble-menu-group": "",
1804
- children
1805
- });
1806
- }
1807
-
1808
- //#endregion
1809
- //#region src/ui/bubble-menu/italic.tsx
1810
- const BubbleMenuItalic = createMarkBubbleItem({
1811
- name: "italic",
1812
- activeName: "italic",
1813
- command: "toggleItalic",
1814
- icon: /* @__PURE__ */ jsx(ItalicIcon, {})
1815
- });
1816
-
1817
- //#endregion
1818
- //#region src/ui/bubble-menu/utils.ts
1819
- const SAFE_PROTOCOLS = new Set([
1820
- "http:",
1821
- "https:",
1822
- "mailto:",
1823
- "tel:"
1824
- ]);
1825
- /**
1826
- * Basic URL validation and auto-prefixing.
1827
- * Rejects dangerous schemes (javascript:, data:, vbscript:, etc.).
1828
- * Returns the valid URL string or null.
1829
- */
1830
- function getUrlFromString(str) {
1831
- if (str === "#") return str;
1832
- try {
1833
- const url = new URL(str);
1834
- if (SAFE_PROTOCOLS.has(url.protocol)) return str;
1835
- return null;
1836
- } catch {}
1837
- try {
1838
- if (str.includes(".") && !str.includes(" ")) return new URL(`https://${str}`).toString();
1839
- } catch {}
1840
- return null;
1841
- }
1842
-
1843
- //#endregion
1844
- //#region src/ui/bubble-menu/link-selector.tsx
1845
- function BubbleMenuLinkSelector({ className, showToggle = true, validateUrl, onLinkApply, onLinkRemove, children }) {
1846
- const { editor } = useBubbleMenuContext();
1847
- const [isOpen, setIsOpen] = React.useState(false);
1848
- const editorState = useEditorState({
1849
- editor,
1850
- selector: ({ editor: editor$1 }) => ({
1851
- isLinkActive: editor$1?.isActive("link") ?? false,
1852
- hasLink: Boolean(editor$1?.getAttributes("link").href),
1853
- currentHref: editor$1?.getAttributes("link").href || ""
1854
- })
1855
- });
1856
- React.useEffect(() => {
1857
- const subscription = editorEventBus.on("bubble-menu:add-link", () => {
1858
- setIsOpen(true);
1859
- });
1860
- return () => {
1861
- setIsOpen(false);
1862
- subscription.unsubscribe();
1863
- };
1864
- }, []);
1865
- if (!editorState) return null;
1866
- const handleOpenLink = () => {
1867
- setIsOpen(!isOpen);
124
+ getJSON: () => editor?.getJSON() ?? {
125
+ type: "doc",
126
+ content: []
127
+ },
128
+ editor
1868
129
  };
1869
- return /* @__PURE__ */ jsxs("div", {
1870
- "data-re-link-selector": "",
1871
- ...isOpen ? { "data-open": "" } : {},
1872
- ...editorState.hasLink ? { "data-has-link": "" } : {},
1873
- className,
1874
- children: [showToggle && /* @__PURE__ */ jsx("button", {
1875
- type: "button",
1876
- "aria-expanded": isOpen,
1877
- "aria-haspopup": "true",
1878
- "aria-label": "Add link",
1879
- "aria-pressed": editorState.isLinkActive && editorState.hasLink,
1880
- "data-re-link-selector-trigger": "",
1881
- onClick: handleOpenLink,
1882
- children: /* @__PURE__ */ jsx(LinkIcon, {})
1883
- }), isOpen && /* @__PURE__ */ jsx(LinkForm, {
1884
- editor,
1885
- currentHref: editorState.currentHref,
1886
- validateUrl,
1887
- onLinkApply,
1888
- onLinkRemove,
1889
- setIsOpen,
1890
- children
1891
- })]
1892
- });
1893
130
  }
1894
- function LinkForm({ editor, currentHref, validateUrl, onLinkApply, onLinkRemove, setIsOpen, children }) {
1895
- const inputRef = React.useRef(null);
1896
- const formRef = React.useRef(null);
1897
- const displayHref = currentHref === "#" ? "" : currentHref;
1898
- const [inputValue, setInputValue] = React.useState(displayHref);
1899
- React.useEffect(() => {
1900
- const timeoutId = setTimeout(() => {
1901
- inputRef.current?.focus();
1902
- }, 0);
1903
- return () => clearTimeout(timeoutId);
1904
- }, []);
1905
- React.useEffect(() => {
1906
- const handleKeyDown = (event) => {
1907
- if (event.key === "Escape") {
1908
- if (editor.getAttributes("link").href === "#") editor.chain().unsetLink().run();
1909
- setIsOpen(false);
1910
- }
1911
- };
1912
- const handleClickOutside = (event) => {
1913
- if (formRef.current && !formRef.current.contains(event.target)) {
1914
- const form = formRef.current;
1915
- const submitEvent = new Event("submit", {
1916
- bubbles: true,
1917
- cancelable: true
1918
- });
1919
- form.dispatchEvent(submitEvent);
1920
- setIsOpen(false);
1921
- }
1922
- };
1923
- document.addEventListener("mousedown", handleClickOutside);
1924
- window.addEventListener("keydown", handleKeyDown);
131
+ function RefBridge({ editorRef, onUpdateRef }) {
132
+ const { editor } = useCurrentEditor();
133
+ const emailEditorRef = useMemo(() => buildRef(editor), [editor]);
134
+ useImperativeHandle(editorRef, () => emailEditorRef, [emailEditorRef]);
135
+ useEffect(() => {
136
+ if (!editor) return;
137
+ const handler = () => {
138
+ onUpdateRef.current?.(emailEditorRef);
139
+ };
140
+ editor.on("update", handler);
1925
141
  return () => {
1926
- window.removeEventListener("keydown", handleKeyDown);
1927
- document.removeEventListener("mousedown", handleClickOutside);
142
+ editor.off("update", handler);
1928
143
  };
1929
- }, [editor, setIsOpen]);
1930
- function handleSubmit(e) {
1931
- e.preventDefault();
1932
- const value = inputValue.trim();
1933
- if (value === "") {
1934
- setLinkHref(editor, "");
1935
- setIsOpen(false);
1936
- focusEditor(editor);
1937
- onLinkRemove?.();
1938
- return;
1939
- }
1940
- const finalValue = (validateUrl ?? getUrlFromString)(value);
1941
- if (!finalValue) {
1942
- setLinkHref(editor, "");
1943
- setIsOpen(false);
1944
- focusEditor(editor);
1945
- onLinkRemove?.();
1946
- return;
1947
- }
1948
- setLinkHref(editor, finalValue);
1949
- setIsOpen(false);
1950
- focusEditor(editor);
1951
- onLinkApply?.(finalValue);
1952
- }
1953
- function handleUnlink(e) {
1954
- e.stopPropagation();
1955
- setLinkHref(editor, "");
1956
- setIsOpen(false);
1957
- focusEditor(editor);
1958
- onLinkRemove?.();
1959
- }
1960
- return /* @__PURE__ */ jsxs("form", {
1961
- ref: formRef,
1962
- "data-re-link-selector-form": "",
1963
- onMouseDown: (e) => e.stopPropagation(),
1964
- onClick: (e) => e.stopPropagation(),
1965
- onKeyDown: (e) => e.stopPropagation(),
1966
- onSubmit: handleSubmit,
1967
- children: [
1968
- /* @__PURE__ */ jsx("input", {
1969
- ref: inputRef,
1970
- "data-re-link-selector-input": "",
1971
- value: inputValue,
1972
- onFocus: (e) => e.stopPropagation(),
1973
- onChange: (e) => setInputValue(e.target.value),
1974
- placeholder: "Paste a link",
1975
- type: "text"
1976
- }),
1977
- children,
1978
- displayHref ? /* @__PURE__ */ jsx("button", {
1979
- type: "button",
1980
- "aria-label": "Remove link",
1981
- "data-re-link-selector-unlink": "",
1982
- onClick: handleUnlink,
1983
- children: /* @__PURE__ */ jsx(UnlinkIcon, {})
1984
- }) : /* @__PURE__ */ jsx("button", {
1985
- type: "submit",
1986
- "aria-label": "Apply link",
1987
- "data-re-link-selector-apply": "",
1988
- onMouseDown: (e) => e.stopPropagation(),
1989
- children: /* @__PURE__ */ jsx(Check, {})
1990
- })
1991
- ]
1992
- });
1993
- }
1994
- function setLinkHref(editor, href) {
1995
- if (href.length === 0) {
1996
- editor.chain().unsetLink().run();
1997
- return;
1998
- }
1999
- const { from, to } = editor.state.selection;
2000
- if (from === to) {
2001
- editor.chain().extendMarkRange("link").setLink({ href }).setTextSelection({
2002
- from,
2003
- to
2004
- }).run();
2005
- return;
2006
- }
2007
- editor.chain().setLink({ href }).run();
2008
- }
2009
- function focusEditor(editor) {
2010
- setTimeout(() => {
2011
- editor.commands.focus();
2012
- }, 0);
2013
- }
2014
-
2015
- //#endregion
2016
- //#region src/ui/bubble-menu/node-selector.tsx
2017
- const NodeSelectorContext = React.createContext(null);
2018
- function useNodeSelectorContext() {
2019
- const context = React.useContext(NodeSelectorContext);
2020
- if (!context) throw new Error("NodeSelector compound components must be used within <NodeSelector.Root>");
2021
- return context;
2022
- }
2023
- function NodeSelectorRoot({ omit = [], open: controlledOpen, onOpenChange, className, children }) {
2024
- const { editor } = useBubbleMenuContext();
2025
- const [uncontrolledOpen, setUncontrolledOpen] = React.useState(false);
2026
- const isControlled = controlledOpen !== void 0;
2027
- const isOpen = isControlled ? controlledOpen : uncontrolledOpen;
2028
- const setIsOpen = React.useCallback((value) => {
2029
- if (!isControlled) setUncontrolledOpen(value);
2030
- onOpenChange?.(value);
2031
- }, [isControlled, onOpenChange]);
2032
- const editorState = useEditorState({
144
+ }, [
2033
145
  editor,
2034
- selector: ({ editor: editor$1 }) => ({
2035
- isParagraphActive: (editor$1?.isActive("paragraph") ?? false) && !editor$1?.isActive("bulletList") && !editor$1?.isActive("orderedList"),
2036
- isHeading1Active: editor$1?.isActive("heading", { level: 1 }) ?? false,
2037
- isHeading2Active: editor$1?.isActive("heading", { level: 2 }) ?? false,
2038
- isHeading3Active: editor$1?.isActive("heading", { level: 3 }) ?? false,
2039
- isBulletListActive: editor$1?.isActive("bulletList") ?? false,
2040
- isOrderedListActive: editor$1?.isActive("orderedList") ?? false,
2041
- isBlockquoteActive: editor$1?.isActive("blockquote") ?? false,
2042
- isCodeBlockActive: editor$1?.isActive("codeBlock") ?? false
2043
- })
2044
- });
2045
- const allItems = React.useMemo(() => [
2046
- {
2047
- name: "Text",
2048
- icon: TextIcon,
2049
- command: () => editor.chain().focus().clearNodes().toggleNode("paragraph", "paragraph").run(),
2050
- isActive: editorState?.isParagraphActive ?? false
2051
- },
2052
- {
2053
- name: "Title",
2054
- icon: Heading1,
2055
- command: () => editor.chain().focus().clearNodes().toggleHeading({ level: 1 }).run(),
2056
- isActive: editorState?.isHeading1Active ?? false
2057
- },
2058
- {
2059
- name: "Subtitle",
2060
- icon: Heading2,
2061
- command: () => editor.chain().focus().clearNodes().toggleHeading({ level: 2 }).run(),
2062
- isActive: editorState?.isHeading2Active ?? false
2063
- },
2064
- {
2065
- name: "Heading",
2066
- icon: Heading3,
2067
- command: () => editor.chain().focus().clearNodes().toggleHeading({ level: 3 }).run(),
2068
- isActive: editorState?.isHeading3Active ?? false
2069
- },
2070
- {
2071
- name: "Bullet List",
2072
- icon: List,
2073
- command: () => editor.chain().focus().clearNodes().toggleBulletList().run(),
2074
- isActive: editorState?.isBulletListActive ?? false
2075
- },
2076
- {
2077
- name: "Numbered List",
2078
- icon: ListOrdered,
2079
- command: () => editor.chain().focus().clearNodes().toggleOrderedList().run(),
2080
- isActive: editorState?.isOrderedListActive ?? false
2081
- },
2082
- {
2083
- name: "Quote",
2084
- icon: TextQuote,
2085
- command: () => editor.chain().focus().clearNodes().toggleNode("paragraph", "paragraph").toggleBlockquote().run(),
2086
- isActive: editorState?.isBlockquoteActive ?? false
2087
- },
2088
- {
2089
- name: "Code",
2090
- icon: Code,
2091
- command: () => editor.chain().focus().clearNodes().toggleCodeBlock().run(),
2092
- isActive: editorState?.isCodeBlockActive ?? false
2093
- }
2094
- ], [editor, editorState]);
2095
- const items = React.useMemo(() => allItems.filter((item) => !omit.includes(item.name)), [allItems, omit]);
2096
- const activeItem = React.useMemo(() => items.find((item) => item.isActive) ?? { name: "Multiple" }, [items]);
2097
- const contextValue = React.useMemo(() => ({
2098
- items,
2099
- activeItem,
2100
- isOpen,
2101
- setIsOpen
2102
- }), [
2103
- items,
2104
- activeItem,
2105
- isOpen,
2106
- setIsOpen
146
+ emailEditorRef,
147
+ onUpdateRef
2107
148
  ]);
2108
- if (!editorState || items.length === 0) return null;
2109
- return /* @__PURE__ */ jsx(NodeSelectorContext.Provider, {
2110
- value: contextValue,
2111
- children: /* @__PURE__ */ jsx(Popover.Root, {
2112
- open: isOpen,
2113
- onOpenChange: setIsOpen,
2114
- children: /* @__PURE__ */ jsx("div", {
2115
- "data-re-node-selector": "",
2116
- ...isOpen ? { "data-open": "" } : {},
2117
- className,
2118
- children
2119
- })
2120
- })
2121
- });
2122
- }
2123
- function NodeSelectorTrigger({ className, children }) {
2124
- const { activeItem, isOpen, setIsOpen } = useNodeSelectorContext();
2125
- return /* @__PURE__ */ jsx(Popover.Trigger, {
2126
- "data-re-node-selector-trigger": "",
2127
- className,
2128
- onClick: () => setIsOpen(!isOpen),
2129
- children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", { children: activeItem.name }), /* @__PURE__ */ jsx(ChevronDown, {})] })
2130
- });
2131
- }
2132
- function NodeSelectorContent({ className, align = "start", children }) {
2133
- const { items, setIsOpen } = useNodeSelectorContext();
2134
- return /* @__PURE__ */ jsx(Popover.Content, {
2135
- align,
2136
- "data-re-node-selector-content": "",
2137
- className,
2138
- children: children ? children(items, () => setIsOpen(false)) : items.map((item) => {
2139
- const Icon = item.icon;
2140
- return /* @__PURE__ */ jsxs("button", {
2141
- type: "button",
2142
- "data-re-node-selector-item": "",
2143
- ...item.isActive ? { "data-active": "" } : {},
2144
- onClick: () => {
2145
- item.command();
2146
- setIsOpen(false);
2147
- },
2148
- children: [
2149
- /* @__PURE__ */ jsx(Icon, {}),
2150
- /* @__PURE__ */ jsx("span", { children: item.name }),
2151
- item.isActive && /* @__PURE__ */ jsx(Check, {})
2152
- ]
2153
- }, item.name);
2154
- })
2155
- });
2156
- }
2157
- function BubbleMenuNodeSelector({ omit = [], className, triggerContent, open, onOpenChange }) {
2158
- return /* @__PURE__ */ jsxs(NodeSelectorRoot, {
2159
- omit,
2160
- open,
2161
- onOpenChange,
2162
- className,
2163
- children: [/* @__PURE__ */ jsx(NodeSelectorTrigger, { children: triggerContent }), /* @__PURE__ */ jsx(NodeSelectorContent, {})]
2164
- });
149
+ return null;
2165
150
  }
2166
-
2167
- //#endregion
2168
- //#region src/ui/bubble-menu/root.tsx
2169
- function BubbleMenuRoot({ excludeNodes = [], placement = "bottom", offset = 8, onHide, className, children }) {
151
+ function EmailEditorReadyBridge({ onReadyRef }) {
2170
152
  const { editor } = useCurrentEditor();
2171
- if (!editor) return null;
2172
- return /* @__PURE__ */ jsx(BubbleMenu$1, {
2173
- editor,
2174
- "data-re-bubble-menu": "",
2175
- shouldShow: ({ editor: editor$1, view }) => {
2176
- for (const node of excludeNodes) if (editor$1.isActive(node)) return false;
2177
- if (view.dom.classList.contains("dragging")) return false;
2178
- return editor$1.view.state.selection.content().size > 0;
2179
- },
2180
- options: {
2181
- placement,
2182
- offset,
2183
- onHide
2184
- },
2185
- className,
2186
- children: /* @__PURE__ */ jsx(BubbleMenuContext.Provider, {
2187
- value: { editor },
2188
- children
2189
- })
2190
- });
2191
- }
2192
-
2193
- //#endregion
2194
- //#region src/ui/bubble-menu/separator.tsx
2195
- function BubbleMenuSeparator({ className }) {
2196
- return /* @__PURE__ */ jsx("hr", {
2197
- className,
2198
- "data-re-bubble-menu-separator": ""
2199
- });
153
+ useLayoutEffect(() => {
154
+ if (!editor) return;
155
+ onReadyRef.current?.(buildRef(editor));
156
+ }, [editor, onReadyRef]);
157
+ return null;
2200
158
  }
2201
-
2202
- //#endregion
2203
- //#region src/ui/bubble-menu/strike.tsx
2204
- const BubbleMenuStrike = createMarkBubbleItem({
2205
- name: "strike",
2206
- activeName: "strike",
2207
- command: "toggleStrike",
2208
- icon: /* @__PURE__ */ jsx(StrikethroughIcon, {})
2209
- });
2210
-
2211
- //#endregion
2212
- //#region src/ui/bubble-menu/underline.tsx
2213
- const BubbleMenuUnderline = createMarkBubbleItem({
2214
- name: "underline",
2215
- activeName: "underline",
2216
- command: "toggleUnderline",
2217
- icon: /* @__PURE__ */ jsx(UnderlineIcon, {})
2218
- });
2219
-
2220
- //#endregion
2221
- //#region src/ui/bubble-menu/uppercase.tsx
2222
- const BubbleMenuUppercase = createMarkBubbleItem({
2223
- name: "uppercase",
2224
- activeName: "uppercase",
2225
- command: "toggleUppercase",
2226
- icon: /* @__PURE__ */ jsx(CaseUpperIcon, {})
159
+ const EmailEditor = forwardRef(({ content, onUpdate, onReady, theme = "basic", editable = true, placeholder, bubbleMenu, extensions: extensionsProp, onUploadImage, className, children }, ref) => {
160
+ const onUpdateRef = useRef(onUpdate);
161
+ onUpdateRef.current = onUpdate;
162
+ const onReadyRef = useRef(onReady);
163
+ onReadyRef.current = onReady;
164
+ const imageExtension = useMemo(() => {
165
+ if (!onUploadImage) return null;
166
+ return createImageExtension({ uploadImage: onUploadImage });
167
+ }, [onUploadImage]);
168
+ const extensions = useMemo(() => {
169
+ const base = extensionsProp ?? [
170
+ StarterKit.configure(),
171
+ Placeholder.configure({
172
+ placeholder: placeholder ?? (({ node }) => {
173
+ if (node.type.name === "heading") return `Heading ${node.attrs.level}`;
174
+ return "Press '/' for commands";
175
+ }),
176
+ includeChildren: true
177
+ }),
178
+ EmailTheming.configure({ theme })
179
+ ];
180
+ return imageExtension ? [...base, imageExtension] : base;
181
+ }, [
182
+ extensionsProp,
183
+ theme,
184
+ placeholder,
185
+ imageExtension
186
+ ]);
187
+ return /* @__PURE__ */ jsxs(EditorProvider, {
188
+ extensions,
189
+ content,
190
+ editable,
191
+ immediatelyRender: false,
192
+ editorProps: useMemo(() => ({ handlePaste: createPasteHandler({ extensions }) }), [extensions]),
193
+ editorContainerProps: { className },
194
+ children: [
195
+ /* @__PURE__ */ jsx(RefBridge, {
196
+ editorRef: ref,
197
+ onUpdateRef
198
+ }),
199
+ /* @__PURE__ */ jsx(EmailEditorReadyBridge, { onReadyRef }),
200
+ /* @__PURE__ */ jsx(BubbleMenu, {
201
+ hideWhenActiveNodes: bubbleMenu?.hideWhenActiveNodes ?? ["button"],
202
+ hideWhenActiveMarks: bubbleMenu?.hideWhenActiveMarks ?? ["link"]
203
+ }),
204
+ /* @__PURE__ */ jsx(BubbleMenu.LinkDefault, {}),
205
+ /* @__PURE__ */ jsx(BubbleMenu.ButtonDefault, {}),
206
+ /* @__PURE__ */ jsx(BubbleMenu.ImageDefault, {}),
207
+ /* @__PURE__ */ jsx(SlashCommandRoot, {}),
208
+ children
209
+ ]
210
+ }, typeof theme === "string" ? theme : JSON.stringify(theme));
2227
211
  });
2228
-
212
+ EmailEditor.displayName = "EmailEditor";
2229
213
  //#endregion
2230
- //#region src/ui/bubble-menu/index.ts
2231
- const BubbleMenu = {
2232
- Root: BubbleMenuRoot,
2233
- ItemGroup: BubbleMenuItemGroup,
2234
- Separator: BubbleMenuSeparator,
2235
- Item: BubbleMenuItem,
2236
- Bold: BubbleMenuBold,
2237
- Italic: BubbleMenuItalic,
2238
- Underline: BubbleMenuUnderline,
2239
- Strike: BubbleMenuStrike,
2240
- Code: BubbleMenuCode,
2241
- Uppercase: BubbleMenuUppercase,
2242
- AlignLeft: BubbleMenuAlignLeft,
2243
- AlignCenter: BubbleMenuAlignCenter,
2244
- AlignRight: BubbleMenuAlignRight,
2245
- NodeSelector: Object.assign(BubbleMenuNodeSelector, {
2246
- Root: NodeSelectorRoot,
2247
- Trigger: NodeSelectorTrigger,
2248
- Content: NodeSelectorContent
2249
- }),
2250
- LinkSelector: BubbleMenuLinkSelector
2251
- };
214
+ export { EmailEditor };
2252
215
 
2253
- //#endregion
2254
- export { AlignmentAttribute, Body, Bold, BubbleMenu, BubbleMenuAlignCenter, BubbleMenuAlignLeft, BubbleMenuAlignRight, BubbleMenuBold, BubbleMenuCode, BubbleMenuItalic, BubbleMenuItem, BubbleMenuItemGroup, BubbleMenuLinkSelector, BubbleMenuNodeSelector, BubbleMenuRoot, BubbleMenuSeparator, BubbleMenuStrike, BubbleMenuUnderline, BubbleMenuUppercase, Button, COLUMN_PARENT_TYPES, ClassAttribute, CodeBlockPrism, ColumnsColumn, Div, EmailNode, FourColumns, MAX_COLUMNS_DEPTH, MaxNesting, NodeSelectorContent, NodeSelectorRoot, NodeSelectorTrigger, Placeholder, PreservedStyle, PreviewText, Section, StyleAttribute, Sup, Table, TableCell, TableHeader, TableRow, ThreeColumns, TwoColumns, Uppercase, editorEventBus, getColumnsDepth, processStylesForUnlink, setTextAlignment };
2255
216
  //# sourceMappingURL=index.mjs.map