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