@react-email/editor 0.0.0-experimental.8 → 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 -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 +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 -628
  91. package/dist/index.d.ts.map +0 -1
  92. package/dist/index.js +0 -2461
@@ -0,0 +1,1981 @@
1
+ const require_columns = require("./columns-DqFvXgmK.cjs");
2
+ const require_email_node = require("./email-node-hLU5bGnX.cjs");
3
+ const require_core = require("./core-D7AzzMLI.cjs");
4
+ const require_event_bus = require("./event-bus-CIJ___tH.cjs");
5
+ const require_global_content = require("./global-content-8M2KyrOL.cjs");
6
+ let _tiptap_react = require("@tiptap/react");
7
+ let react_email = require("react-email");
8
+ react_email = require_columns.__toESM(react_email);
9
+ let react_jsx_runtime = require("react/jsx-runtime");
10
+ let _tiptap_core = require("@tiptap/core");
11
+ let _tiptap_extensions = require("@tiptap/extensions");
12
+ let _tiptap_starter_kit = require("@tiptap/starter-kit");
13
+ _tiptap_starter_kit = require_columns.__toESM(_tiptap_starter_kit);
14
+ let _tiptap_extension_blockquote = require("@tiptap/extension-blockquote");
15
+ _tiptap_extension_blockquote = require_columns.__toESM(_tiptap_extension_blockquote);
16
+ let _tiptap_extension_bold = require("@tiptap/extension-bold");
17
+ _tiptap_extension_bold = require_columns.__toESM(_tiptap_extension_bold);
18
+ let _tiptap_extension_bullet_list = require("@tiptap/extension-bullet-list");
19
+ _tiptap_extension_bullet_list = require_columns.__toESM(_tiptap_extension_bullet_list);
20
+ let _tiptap_extension_code = require("@tiptap/extension-code");
21
+ _tiptap_extension_code = require_columns.__toESM(_tiptap_extension_code);
22
+ let _tiptap_extension_code_block = require("@tiptap/extension-code-block");
23
+ _tiptap_extension_code_block = require_columns.__toESM(_tiptap_extension_code_block);
24
+ let _tiptap_pm_state = require("@tiptap/pm/state");
25
+ let _tiptap_pm_view = require("@tiptap/pm/view");
26
+ let hast_util_from_html = require("hast-util-from-html");
27
+ let prismjs = require("prismjs");
28
+ prismjs = require_columns.__toESM(prismjs);
29
+ let _tiptap_extension_horizontal_rule = require("@tiptap/extension-horizontal-rule");
30
+ _tiptap_extension_horizontal_rule = require_columns.__toESM(_tiptap_extension_horizontal_rule);
31
+ let _tiptap_extension_hard_break = require("@tiptap/extension-hard-break");
32
+ _tiptap_extension_hard_break = require_columns.__toESM(_tiptap_extension_hard_break);
33
+ let _tiptap_extension_heading = require("@tiptap/extension-heading");
34
+ let _tiptap_extension_italic = require("@tiptap/extension-italic");
35
+ _tiptap_extension_italic = require_columns.__toESM(_tiptap_extension_italic);
36
+ let _tiptap_extension_link = require("@tiptap/extension-link");
37
+ _tiptap_extension_link = require_columns.__toESM(_tiptap_extension_link);
38
+ let _tiptap_extension_list_item = require("@tiptap/extension-list-item");
39
+ _tiptap_extension_list_item = require_columns.__toESM(_tiptap_extension_list_item);
40
+ let _tiptap_extension_ordered_list = require("@tiptap/extension-ordered-list");
41
+ _tiptap_extension_ordered_list = require_columns.__toESM(_tiptap_extension_ordered_list);
42
+ let _tiptap_extension_paragraph = require("@tiptap/extension-paragraph");
43
+ _tiptap_extension_paragraph = require_columns.__toESM(_tiptap_extension_paragraph);
44
+ let _tiptap_extension_strike = require("@tiptap/extension-strike");
45
+ _tiptap_extension_strike = require_columns.__toESM(_tiptap_extension_strike);
46
+ let _tiptap_extension_superscript = require("@tiptap/extension-superscript");
47
+ _tiptap_extension_superscript = require_columns.__toESM(_tiptap_extension_superscript);
48
+ let _tiptap_extension_text = require("@tiptap/extension-text");
49
+ let _tiptap_extension_underline = require("@tiptap/extension-underline");
50
+ _tiptap_extension_underline = require_columns.__toESM(_tiptap_extension_underline);
51
+ //#region src/extensions/alignment-attribute.tsx
52
+ const AlignmentAttribute = _tiptap_core.Extension.create({
53
+ name: "alignmentAttribute",
54
+ addOptions() {
55
+ return {
56
+ types: [],
57
+ alignments: [
58
+ "left",
59
+ "center",
60
+ "right",
61
+ "justify"
62
+ ]
63
+ };
64
+ },
65
+ addGlobalAttributes() {
66
+ return [{
67
+ types: this.options.types,
68
+ attributes: { alignment: {
69
+ parseHTML: (element) => {
70
+ const explicitAlign = element.getAttribute("align") || element.getAttribute("alignment") || element.style.textAlign;
71
+ if (explicitAlign && this.options.alignments.includes(explicitAlign)) return explicitAlign;
72
+ return null;
73
+ },
74
+ renderHTML: (attributes) => {
75
+ if (attributes.alignment === "left") return {};
76
+ return { alignment: attributes.alignment };
77
+ }
78
+ } }
79
+ }];
80
+ },
81
+ addCommands() {
82
+ return { setAlignment: (alignment) => ({ commands }) => {
83
+ if (!this.options.alignments.includes(alignment)) return false;
84
+ return this.options.types.every((type) => commands.updateAttributes(type, { alignment }));
85
+ } };
86
+ },
87
+ addKeyboardShortcuts() {
88
+ return {
89
+ Enter: () => {
90
+ const { from } = this.editor.state.selection;
91
+ const currentAlignment = this.editor.state.doc.nodeAt(from)?.attrs?.alignment;
92
+ if (currentAlignment) requestAnimationFrame(() => {
93
+ this.editor.commands.setAlignment(currentAlignment);
94
+ });
95
+ return false;
96
+ },
97
+ "Mod-Shift-l": () => this.editor.commands.setAlignment("left"),
98
+ "Mod-Shift-e": () => this.editor.commands.setAlignment("center"),
99
+ "Mod-Shift-r": () => this.editor.commands.setAlignment("right"),
100
+ "Mod-Shift-j": () => this.editor.commands.setAlignment("justify")
101
+ };
102
+ }
103
+ });
104
+ //#endregion
105
+ //#region src/utils/get-text-alignment.ts
106
+ function getTextAlignment(alignment) {
107
+ switch (alignment) {
108
+ case "left": return { textAlign: "left" };
109
+ case "center": return { textAlign: "center" };
110
+ case "right": return { textAlign: "right" };
111
+ default: return {};
112
+ }
113
+ }
114
+ //#endregion
115
+ //#region src/extensions/blockquote.tsx
116
+ const Blockquote = require_email_node.EmailNode.from(_tiptap_extension_blockquote.default, ({ children, node, style }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("blockquote", {
117
+ className: node.attrs?.class || void 0,
118
+ style: {
119
+ ...style,
120
+ ...require_email_node.inlineCssToJs(node.attrs?.style),
121
+ ...getTextAlignment(node.attrs?.align || node.attrs?.alignment)
122
+ },
123
+ children
124
+ }));
125
+ //#endregion
126
+ //#region src/extensions/body.tsx
127
+ const Body = require_email_node.EmailNode.create({
128
+ name: "body",
129
+ group: "block",
130
+ content: "block+",
131
+ defining: true,
132
+ isolating: true,
133
+ addAttributes() {
134
+ return { ...require_columns.createStandardAttributes([...require_columns.COMMON_HTML_ATTRIBUTES, ...require_columns.LAYOUT_ATTRIBUTES]) };
135
+ },
136
+ parseHTML() {
137
+ return [{
138
+ tag: "body",
139
+ getAttrs: (node) => {
140
+ if (typeof node === "string") return false;
141
+ const element = node;
142
+ const attrs = {};
143
+ Array.from(element.attributes).forEach((attr) => {
144
+ attrs[attr.name] = attr.value;
145
+ });
146
+ return attrs;
147
+ }
148
+ }];
149
+ },
150
+ renderHTML({ HTMLAttributes }) {
151
+ return [
152
+ "div",
153
+ (0, _tiptap_core.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes),
154
+ 0
155
+ ];
156
+ },
157
+ renderToReactEmail({ children, node, style }) {
158
+ const inlineStyles = require_email_node.inlineCssToJs(node.attrs?.style);
159
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
160
+ className: node.attrs?.class || void 0,
161
+ style: {
162
+ ...style,
163
+ ...inlineStyles
164
+ },
165
+ children
166
+ });
167
+ }
168
+ });
169
+ //#endregion
170
+ //#region src/extensions/bold.tsx
171
+ const BoldWithoutFontWeightInference = _tiptap_extension_bold.default.extend({ parseHTML() {
172
+ return [
173
+ { tag: "strong" },
174
+ {
175
+ tag: "b",
176
+ getAttrs: (node) => node.style.fontWeight !== "normal" && null
177
+ },
178
+ {
179
+ style: "font-weight=400",
180
+ clearMark: (mark) => mark.type.name === this.name
181
+ }
182
+ ];
183
+ } });
184
+ const Bold = require_core.EmailMark.from(BoldWithoutFontWeightInference, ({ children, style }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", {
185
+ style,
186
+ children
187
+ }));
188
+ //#endregion
189
+ //#region src/extensions/bullet-list.tsx
190
+ const BulletList = require_email_node.EmailNode.from(_tiptap_extension_bullet_list.default, ({ children, node, style }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
191
+ className: node.attrs?.class || void 0,
192
+ style: {
193
+ ...style,
194
+ ...require_email_node.inlineCssToJs(node.attrs?.style)
195
+ },
196
+ children
197
+ }));
198
+ //#endregion
199
+ //#region src/extensions/button.tsx
200
+ const Button = require_email_node.EmailNode.create({
201
+ name: "button",
202
+ group: "block",
203
+ content: "inline*",
204
+ defining: true,
205
+ draggable: true,
206
+ marks: "bold",
207
+ addAttributes() {
208
+ return {
209
+ class: { default: "button" },
210
+ href: { default: "#" },
211
+ alignment: { default: "left" }
212
+ };
213
+ },
214
+ parseHTML() {
215
+ return [{
216
+ tag: "a[data-id=\"react-email-button\"]",
217
+ getAttrs: (node) => {
218
+ if (typeof node === "string") return false;
219
+ const element = node;
220
+ const attrs = {};
221
+ Array.from(element.attributes).forEach((attr) => {
222
+ attrs[attr.name] = attr.value;
223
+ });
224
+ return {
225
+ ...attrs,
226
+ href: attrs["data-href"] ?? attrs.href
227
+ };
228
+ }
229
+ }];
230
+ },
231
+ renderHTML({ HTMLAttributes }) {
232
+ return [
233
+ "div",
234
+ (0, _tiptap_core.mergeAttributes)({ class: `align-${HTMLAttributes?.alignment}` }),
235
+ [
236
+ "a",
237
+ (0, _tiptap_core.mergeAttributes)({
238
+ class: `node-button ${HTMLAttributes?.class}`,
239
+ style: HTMLAttributes?.style,
240
+ "data-id": "react-email-button",
241
+ href: HTMLAttributes?.href,
242
+ "data-href": HTMLAttributes?.href
243
+ }),
244
+ 0
245
+ ]
246
+ ];
247
+ },
248
+ addCommands() {
249
+ return {
250
+ updateButton: (attributes) => ({ commands }) => {
251
+ return commands.updateAttributes("button", attributes);
252
+ },
253
+ setButton: () => ({ commands }) => {
254
+ return commands.insertContent({
255
+ type: "button",
256
+ content: [{
257
+ type: "text",
258
+ text: "Button"
259
+ }]
260
+ });
261
+ }
262
+ };
263
+ },
264
+ renderToReactEmail({ children, node, style }) {
265
+ const inlineStyles = require_email_node.inlineCssToJs(node.attrs?.style);
266
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_email.Row, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_email.Column, {
267
+ align: node.attrs?.align || node.attrs?.alignment,
268
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_email.Button, {
269
+ className: node.attrs?.class || void 0,
270
+ href: node.attrs?.href,
271
+ style: {
272
+ ...style,
273
+ ...inlineStyles
274
+ },
275
+ children
276
+ })
277
+ }) });
278
+ }
279
+ });
280
+ //#endregion
281
+ //#region src/extensions/class-attribute.tsx
282
+ const ClassAttribute = _tiptap_core.Extension.create({
283
+ name: "classAttribute",
284
+ addOptions() {
285
+ return {
286
+ types: [],
287
+ class: []
288
+ };
289
+ },
290
+ addGlobalAttributes() {
291
+ return [{
292
+ types: this.options.types,
293
+ attributes: { class: {
294
+ default: "",
295
+ parseHTML: (element) => element.className || "",
296
+ renderHTML: (attributes) => {
297
+ return attributes.class ? { class: attributes.class } : {};
298
+ }
299
+ } }
300
+ }];
301
+ },
302
+ addCommands() {
303
+ return {
304
+ unsetClass: () => ({ commands }) => {
305
+ return this.options.types.every((type) => commands.resetAttributes(type, "class"));
306
+ },
307
+ setClass: (classList) => ({ commands }) => {
308
+ return this.options.types.every((type) => commands.updateAttributes(type, { class: classList }));
309
+ }
310
+ };
311
+ },
312
+ addKeyboardShortcuts() {
313
+ return { Enter: ({ editor }) => {
314
+ requestAnimationFrame(() => {
315
+ editor.commands.resetAttributes("paragraph", "class");
316
+ });
317
+ return false;
318
+ } };
319
+ }
320
+ });
321
+ //#endregion
322
+ //#region src/extensions/code.tsx
323
+ const Code = require_core.EmailMark.from(_tiptap_extension_code.default, ({ children, node, style }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
324
+ style: {
325
+ ...style,
326
+ ...require_email_node.inlineCssToJs(node.attrs?.style)
327
+ },
328
+ children
329
+ }));
330
+ //#endregion
331
+ //#region src/extensions/prism-plugin.ts
332
+ const PRISM_LANGUAGE_LOADED_META = "prismLanguageLoaded";
333
+ function parseNodes(nodes, className = []) {
334
+ return nodes.flatMap((node) => {
335
+ const classes = [...className, ...node.properties ? node.properties.className : []];
336
+ if (node.children) return parseNodes(node.children, classes);
337
+ return {
338
+ text: node.value ?? "",
339
+ classes
340
+ };
341
+ });
342
+ }
343
+ function getHighlightNodes(html) {
344
+ return (0, hast_util_from_html.fromHtml)(html, { fragment: true }).children;
345
+ }
346
+ function registeredLang(aliasOrLanguage) {
347
+ const allSupportLang = Object.keys(prismjs.default.languages).filter((id) => typeof prismjs.default.languages[id] === "object");
348
+ return Boolean(allSupportLang.find((x) => x === aliasOrLanguage));
349
+ }
350
+ function getDecorations({ doc, name, defaultLanguage, defaultTheme, loadingLanguages, onLanguageLoaded }) {
351
+ const decorations = [];
352
+ (0, _tiptap_core.findChildren)(doc, (node) => node.type.name === name).forEach((block) => {
353
+ let from = block.pos + 1;
354
+ const language = block.node.attrs.language || defaultLanguage;
355
+ const theme = block.node.attrs.theme || defaultTheme;
356
+ let html = "";
357
+ try {
358
+ if (!registeredLang(language) && !loadingLanguages.has(language)) {
359
+ loadingLanguages.add(language);
360
+ import(`prismjs/components/prism-${language}`).then(() => {
361
+ loadingLanguages.delete(language);
362
+ onLanguageLoaded(language);
363
+ }).catch(() => {
364
+ loadingLanguages.delete(language);
365
+ });
366
+ }
367
+ if (!require_columns.hasPrismThemeLoaded(theme)) require_columns.loadPrismTheme(theme);
368
+ html = prismjs.default.highlight(block.node.textContent, prismjs.default.languages[language], language);
369
+ } catch {
370
+ html = prismjs.default.highlight(block.node.textContent, prismjs.default.languages.javascript, "js");
371
+ }
372
+ parseNodes(getHighlightNodes(html)).forEach((node) => {
373
+ const to = from + node.text.length;
374
+ if (node.classes.length) {
375
+ const decoration = _tiptap_pm_view.Decoration.inline(from, to, { class: node.classes.join(" ") });
376
+ decorations.push(decoration);
377
+ }
378
+ from = to;
379
+ });
380
+ });
381
+ return _tiptap_pm_view.DecorationSet.create(doc, decorations);
382
+ }
383
+ function PrismPlugin({ name, defaultLanguage, defaultTheme }) {
384
+ if (!defaultLanguage) throw Error("You must specify the defaultLanguage parameter");
385
+ const loadingLanguages = /* @__PURE__ */ new Set();
386
+ let pluginView = null;
387
+ const onLanguageLoaded = (language) => {
388
+ if (pluginView) pluginView.dispatch(pluginView.state.tr.setMeta(PRISM_LANGUAGE_LOADED_META, language));
389
+ };
390
+ const prismjsPlugin = new _tiptap_pm_state.Plugin({
391
+ key: new _tiptap_pm_state.PluginKey("prism"),
392
+ view(view) {
393
+ pluginView = view;
394
+ return { destroy() {
395
+ pluginView = null;
396
+ } };
397
+ },
398
+ state: {
399
+ init: (_, { doc }) => {
400
+ return getDecorations({
401
+ doc,
402
+ name,
403
+ defaultLanguage,
404
+ defaultTheme,
405
+ loadingLanguages,
406
+ onLanguageLoaded
407
+ });
408
+ },
409
+ apply: (transaction, decorationSet, oldState, newState) => {
410
+ const oldNodeName = oldState.selection.$head.parent.type.name;
411
+ const newNodeName = newState.selection.$head.parent.type.name;
412
+ const oldNodes = (0, _tiptap_core.findChildren)(oldState.doc, (node) => node.type.name === name);
413
+ const newNodes = (0, _tiptap_core.findChildren)(newState.doc, (node) => node.type.name === name);
414
+ if (transaction.getMeta(PRISM_LANGUAGE_LOADED_META) || transaction.docChanged && ([oldNodeName, newNodeName].includes(name) || newNodes.length !== oldNodes.length || transaction.steps.some((step) => {
415
+ const rangeStep = step;
416
+ return rangeStep.from !== void 0 && rangeStep.to !== void 0 && oldNodes.some((node) => {
417
+ return node.pos >= rangeStep.from && node.pos + node.node.nodeSize <= rangeStep.to;
418
+ });
419
+ }))) return getDecorations({
420
+ doc: transaction.doc,
421
+ name,
422
+ defaultLanguage,
423
+ defaultTheme,
424
+ loadingLanguages,
425
+ onLanguageLoaded
426
+ });
427
+ return decorationSet.map(transaction.mapping, transaction.doc);
428
+ }
429
+ },
430
+ props: { decorations(state) {
431
+ return prismjsPlugin.getState(state);
432
+ } },
433
+ destroy() {
434
+ pluginView = null;
435
+ require_columns.removePrismTheme();
436
+ }
437
+ });
438
+ return prismjsPlugin;
439
+ }
440
+ //#endregion
441
+ //#region src/extensions/code-block.tsx
442
+ const CodeBlockPrism = require_email_node.EmailNode.from(_tiptap_extension_code_block.default.extend({
443
+ addOptions() {
444
+ return {
445
+ languageClassPrefix: "language-",
446
+ exitOnTripleEnter: false,
447
+ exitOnArrowDown: false,
448
+ enableTabIndentation: true,
449
+ tabSize: 2,
450
+ defaultLanguage: "javascript",
451
+ defaultTheme: "default",
452
+ HTMLAttributes: {}
453
+ };
454
+ },
455
+ addAttributes() {
456
+ return {
457
+ ...this.parent?.(),
458
+ language: {
459
+ default: this.options.defaultLanguage,
460
+ parseHTML: (element) => {
461
+ if (!element) return null;
462
+ const { languageClassPrefix } = this.options;
463
+ if (!languageClassPrefix) return null;
464
+ const language = [...element.firstElementChild?.classList || []].filter((className) => className.startsWith(languageClassPrefix || "")).map((className) => className.replace(languageClassPrefix, ""))[0];
465
+ if (!language) return null;
466
+ return language;
467
+ },
468
+ rendered: false
469
+ },
470
+ theme: {
471
+ default: this.options.defaultTheme,
472
+ rendered: false
473
+ }
474
+ };
475
+ },
476
+ renderHTML({ node, HTMLAttributes }) {
477
+ return [
478
+ "pre",
479
+ (0, _tiptap_core.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes, { class: node.attrs.language ? `${this.options.languageClassPrefix}${node.attrs.language}` : null }, { "data-theme": node.attrs.theme }),
480
+ [
481
+ "code",
482
+ { class: node.attrs.language ? `${this.options.languageClassPrefix}${node.attrs.language} node-codeTag` : "node-codeTag" },
483
+ 0
484
+ ]
485
+ ];
486
+ },
487
+ addKeyboardShortcuts() {
488
+ return {
489
+ ...this.parent?.(),
490
+ "Mod-a": ({ editor }) => {
491
+ const { state } = editor;
492
+ const { selection } = state;
493
+ const { $from } = selection;
494
+ for (let depth = $from.depth; depth >= 1; depth--) if ($from.node(depth).type.name === this.name) {
495
+ const blockStart = $from.start(depth);
496
+ const blockEnd = $from.end(depth);
497
+ if (selection.from === blockStart && selection.to === blockEnd) return false;
498
+ const tr = state.tr.setSelection(_tiptap_pm_state.TextSelection.create(state.doc, blockStart, blockEnd));
499
+ editor.view.dispatch(tr);
500
+ return true;
501
+ }
502
+ return false;
503
+ }
504
+ };
505
+ },
506
+ addProseMirrorPlugins() {
507
+ return [...this.parent?.() || [], PrismPlugin({
508
+ name: this.name,
509
+ defaultLanguage: this.options.defaultLanguage,
510
+ defaultTheme: this.options.defaultTheme
511
+ })];
512
+ }
513
+ }), ({ node, style }) => {
514
+ const language = node.attrs?.language ? `${node.attrs.language}` : "javascript";
515
+ const userTheme = react_email[node.attrs?.theme];
516
+ const theme = userTheme ? {
517
+ ...userTheme,
518
+ base: {
519
+ ...userTheme.base,
520
+ borderRadius: "0.125rem",
521
+ padding: "0.75rem 1rem"
522
+ }
523
+ } : { base: {
524
+ color: "#1e293b",
525
+ background: "#f1f5f9",
526
+ lineHeight: "1.5",
527
+ fontFamily: "\"Fira Code\", \"Fira Mono\", Menlo, Consolas, \"DejaVu Sans Mono\", monospace",
528
+ padding: "0.75rem 1rem",
529
+ borderRadius: "0.125rem"
530
+ } };
531
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_email.CodeBlock, {
532
+ code: node.content?.[0]?.text ?? "",
533
+ language,
534
+ theme,
535
+ style: {
536
+ width: "auto",
537
+ ...style
538
+ }
539
+ });
540
+ });
541
+ //#endregion
542
+ //#region src/utils/is-collaboration.ts
543
+ const COLLABORATION_EXTENSION_NAMES = new Set(["liveblocksExtension", "collaboration"]);
544
+ function hasCollaborationExtension(exts) {
545
+ return exts.some((ext) => COLLABORATION_EXTENSION_NAMES.has(ext.name));
546
+ }
547
+ //#endregion
548
+ //#region src/extensions/container.tsx
549
+ function hasContainerNode(doc) {
550
+ let found = false;
551
+ doc.forEach((node) => {
552
+ if (node.type.name === "container") found = true;
553
+ });
554
+ return found;
555
+ }
556
+ function wrapInContainer(state) {
557
+ const { doc } = state;
558
+ const containerType = state.schema.nodes.container;
559
+ const contentNodes = [];
560
+ const globalContentNodes = [];
561
+ doc.forEach((node) => {
562
+ if (node.type.name === "globalContent") globalContentNodes.push(node);
563
+ else contentNodes.push(node);
564
+ });
565
+ const containerContent = contentNodes.length > 0 ? contentNodes : [state.schema.nodes.paragraph.create()];
566
+ const containerNode = containerType.create(null, containerContent);
567
+ const newDocContent = [...globalContentNodes, containerNode];
568
+ const tr = state.tr;
569
+ tr.replaceWith(0, doc.content.size, newDocContent);
570
+ tr.setMeta("addToHistory", false);
571
+ return tr;
572
+ }
573
+ const Container = require_email_node.EmailNode.create({
574
+ name: "container",
575
+ group: "block",
576
+ content: "block+",
577
+ defining: true,
578
+ isolating: true,
579
+ selectable: false,
580
+ draggable: false,
581
+ addOptions() {
582
+ return { HTMLAttributes: {} };
583
+ },
584
+ parseHTML() {
585
+ return [{ tag: "div[data-type=\"container\"]" }, {
586
+ tag: "table[role=\"presentation\"]",
587
+ priority: 60,
588
+ getAttrs: (node) => {
589
+ if (typeof node === "string") return false;
590
+ const table = node;
591
+ if (!table.style.maxWidth) return false;
592
+ if (!table.querySelector(":scope > tbody > tr:only-child > td:only-child")) return false;
593
+ return null;
594
+ },
595
+ contentElement: (node) => node.querySelector(":scope > tbody > tr > td")
596
+ }];
597
+ },
598
+ renderHTML({ HTMLAttributes }) {
599
+ return [
600
+ "div",
601
+ (0, _tiptap_core.mergeAttributes)({
602
+ "data-type": "container",
603
+ class: "node-container"
604
+ }, this.options.HTMLAttributes, HTMLAttributes),
605
+ 0
606
+ ];
607
+ },
608
+ addProseMirrorPlugins() {
609
+ const isCollaborative = hasCollaborationExtension(this.editor.extensionManager.extensions);
610
+ return [new _tiptap_pm_state.Plugin({
611
+ key: new _tiptap_pm_state.PluginKey("containerEnforcer"),
612
+ view: isCollaborative ? void 0 : (editorView) => {
613
+ if (!hasContainerNode(editorView.state.doc)) {
614
+ const tr = wrapInContainer(editorView.state);
615
+ editorView.dispatch(tr);
616
+ }
617
+ return {};
618
+ },
619
+ appendTransaction(_transactions, oldState, newState) {
620
+ if (hasContainerNode(newState.doc)) return null;
621
+ if (newState.doc.eq(oldState.doc)) return null;
622
+ return wrapInContainer(newState);
623
+ }
624
+ })];
625
+ },
626
+ renderToReactEmail({ children, node, style }) {
627
+ const inlineStyles = require_email_node.inlineCssToJs(node.attrs?.style);
628
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_email.Container, {
629
+ className: node.attrs?.class || void 0,
630
+ align: style.align || "center",
631
+ style: {
632
+ ...style,
633
+ ...inlineStyles,
634
+ width: "100%",
635
+ maxWidth: style?.width ?? style?.maxWidth
636
+ },
637
+ children
638
+ });
639
+ }
640
+ });
641
+ //#endregion
642
+ //#region src/extensions/div.tsx
643
+ const Div = require_email_node.EmailNode.create({
644
+ name: "div",
645
+ group: "block",
646
+ content: "block+",
647
+ defining: true,
648
+ isolating: true,
649
+ parseHTML() {
650
+ return [{
651
+ tag: "div:not([data-type])",
652
+ getAttrs: (node) => {
653
+ if (typeof node === "string") return false;
654
+ const element = node;
655
+ const attrs = {};
656
+ Array.from(element.attributes).forEach((attr) => {
657
+ attrs[attr.name] = attr.value;
658
+ });
659
+ return attrs;
660
+ }
661
+ }];
662
+ },
663
+ renderHTML({ HTMLAttributes }) {
664
+ return [
665
+ "div",
666
+ (0, _tiptap_core.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes),
667
+ 0
668
+ ];
669
+ },
670
+ addAttributes() {
671
+ return { ...require_columns.createStandardAttributes([...require_columns.COMMON_HTML_ATTRIBUTES, ...require_columns.LAYOUT_ATTRIBUTES]) };
672
+ },
673
+ renderToReactEmail({ children, node, style }) {
674
+ const inlineStyles = require_email_node.inlineCssToJs(node.attrs?.style);
675
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
676
+ className: node.attrs?.class || void 0,
677
+ style: {
678
+ ...style,
679
+ ...inlineStyles
680
+ },
681
+ children
682
+ });
683
+ }
684
+ });
685
+ //#endregion
686
+ //#region src/extensions/divider.tsx
687
+ const Divider = require_email_node.EmailNode.from(_tiptap_extension_horizontal_rule.default.extend({
688
+ addAttributes() {
689
+ return { class: { default: "divider" } };
690
+ },
691
+ addInputRules() {
692
+ return [new _tiptap_core.InputRule({
693
+ find: /^(?:---|—-|___\s|\*\*\*\s)$/,
694
+ handler: ({ state, range }) => {
695
+ const attributes = {};
696
+ const { tr } = state;
697
+ const start = range.from;
698
+ const end = range.to;
699
+ tr.insert(start - 1, this.type.create(attributes)).delete(tr.mapping.map(start), tr.mapping.map(end));
700
+ }
701
+ })];
702
+ },
703
+ addNodeView() {
704
+ return (0, _tiptap_react.ReactNodeViewRenderer)((props) => {
705
+ const node = props.node;
706
+ const { class: className, ...rest } = node.attrs;
707
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_tiptap_react.NodeViewWrapper, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_email.Hr, {
708
+ ...rest,
709
+ className: "node-hr",
710
+ style: require_email_node.inlineCssToJs(node.attrs.style)
711
+ }) });
712
+ });
713
+ }
714
+ }), ({ node, style }) => {
715
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_email.Hr, {
716
+ className: node.attrs?.class || void 0,
717
+ style: {
718
+ ...style,
719
+ ...require_email_node.inlineCssToJs(node.attrs?.style)
720
+ }
721
+ });
722
+ });
723
+ //#endregion
724
+ //#region src/extensions/hard-break.tsx
725
+ const HardBreak = require_email_node.EmailNode.from(_tiptap_extension_hard_break.default, () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("br", {}));
726
+ //#endregion
727
+ //#region src/extensions/heading.tsx
728
+ const Heading = require_email_node.EmailNode.from(_tiptap_extension_heading.Heading.extend({ addNodeView() {
729
+ return (0, _tiptap_react.ReactNodeViewRenderer)(({ node }) => {
730
+ const level = node.attrs.level ?? 1;
731
+ const { class: className, ...rest } = node.attrs;
732
+ const attrs = {
733
+ ...rest,
734
+ className: `node-h${level} ${className}`,
735
+ style: require_email_node.inlineCssToJs(node.attrs.style)
736
+ };
737
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_tiptap_react.NodeViewWrapper, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_email.Heading, {
738
+ as: `h${level}`,
739
+ ...attrs,
740
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_tiptap_react.NodeViewContent, {})
741
+ }) });
742
+ });
743
+ } }), ({ children, node, style }) => {
744
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_email.Heading, {
745
+ as: `h${node.attrs?.level ?? 1}`,
746
+ className: node.attrs?.class || void 0,
747
+ style: {
748
+ ...style,
749
+ ...require_email_node.inlineCssToJs(node.attrs?.style),
750
+ ...getTextAlignment(node.attrs?.align ?? node.attrs?.alignment)
751
+ },
752
+ children
753
+ });
754
+ });
755
+ //#endregion
756
+ //#region src/extensions/italic.tsx
757
+ const Italic = require_core.EmailMark.from(_tiptap_extension_italic.default, ({ children, style }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("em", {
758
+ style,
759
+ children
760
+ }));
761
+ //#endregion
762
+ //#region src/extensions/preserved-style.tsx
763
+ const PreservedStyle = require_core.EmailMark.create({
764
+ name: "preservedStyle",
765
+ addAttributes() {
766
+ return { style: {
767
+ default: null,
768
+ parseHTML: (element) => element.getAttribute("style"),
769
+ renderHTML: (attributes) => {
770
+ if (!attributes.style) return {};
771
+ return { style: attributes.style };
772
+ }
773
+ } };
774
+ },
775
+ parseHTML() {
776
+ return [{
777
+ tag: "span[style]",
778
+ getAttrs: (element) => {
779
+ if (typeof element === "string") return false;
780
+ const style = element.getAttribute("style");
781
+ if (style && hasPreservableStyles(style)) return { style };
782
+ return false;
783
+ }
784
+ }];
785
+ },
786
+ renderHTML({ HTMLAttributes }) {
787
+ return [
788
+ "span",
789
+ (0, _tiptap_core.mergeAttributes)(HTMLAttributes),
790
+ 0
791
+ ];
792
+ },
793
+ renderToReactEmail({ children, mark }) {
794
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
795
+ style: mark.attrs?.style ? require_email_node.inlineCssToJs(mark.attrs.style) : void 0,
796
+ children
797
+ });
798
+ }
799
+ });
800
+ const LINK_INDICATOR_STYLES = [
801
+ "color",
802
+ "text-decoration",
803
+ "text-decoration-line",
804
+ "text-decoration-color",
805
+ "text-decoration-style"
806
+ ];
807
+ function parseStyleString(styleString) {
808
+ const temp = document.createElement("div");
809
+ temp.style.cssText = styleString;
810
+ return temp.style;
811
+ }
812
+ function hasBackground(style) {
813
+ const bgColor = style.backgroundColor;
814
+ const bg = style.background;
815
+ if (bgColor && bgColor !== "transparent" && bgColor !== "rgba(0, 0, 0, 0)") return true;
816
+ if (bg && bg !== "transparent" && bg !== "none" && bg !== "rgba(0, 0, 0, 0)") return true;
817
+ return false;
818
+ }
819
+ function hasPreservableStyles(styleString) {
820
+ return processStylesForUnlink(styleString) !== null;
821
+ }
822
+ /**
823
+ * Processes styles when unlinking:
824
+ * - Has background (button-like): preserve all styles
825
+ * - No background: strip link-indicator styles (color, text-decoration), keep the rest
826
+ */
827
+ function processStylesForUnlink(styleString) {
828
+ if (!styleString) return null;
829
+ const style = parseStyleString(styleString);
830
+ if (hasBackground(style)) return styleString;
831
+ const filtered = [];
832
+ for (let i = 0; i < style.length; i++) {
833
+ const prop = style[i];
834
+ if (LINK_INDICATOR_STYLES.includes(prop)) continue;
835
+ const value = style.getPropertyValue(prop);
836
+ if (value) filtered.push(`${prop}: ${value}`);
837
+ }
838
+ return filtered.length > 0 ? filtered.join("; ") : null;
839
+ }
840
+ //#endregion
841
+ //#region src/extensions/link.tsx
842
+ const Link = require_core.EmailMark.from(_tiptap_extension_link.default, ({ children, mark, style }) => {
843
+ const linkMarkStyle = mark.attrs?.style ? require_email_node.inlineCssToJs(mark.attrs.style) : {};
844
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_email.Link, {
845
+ href: mark.attrs?.href ?? void 0,
846
+ rel: mark.attrs?.rel ?? void 0,
847
+ style: {
848
+ ...style,
849
+ ...linkMarkStyle
850
+ },
851
+ target: mark.attrs?.target ?? void 0,
852
+ ...mark.attrs?.["ses:no-track"] ? { "ses:no-track": mark.attrs["ses:no-track"] } : {},
853
+ children
854
+ });
855
+ }).extend({
856
+ parseHTML() {
857
+ return [{
858
+ tag: "a[target]:not([data-id=\"react-email-button\"])",
859
+ getAttrs: (node) => {
860
+ if (typeof node === "string") return false;
861
+ const element = node;
862
+ const attrs = {};
863
+ Array.from(element.attributes).forEach((attr) => {
864
+ attrs[attr.name] = attr.value;
865
+ });
866
+ return attrs;
867
+ }
868
+ }, {
869
+ tag: "a[href]:not([data-id=\"react-email-button\"])",
870
+ getAttrs: (node) => {
871
+ if (typeof node === "string") return false;
872
+ const element = node;
873
+ const attrs = {};
874
+ Array.from(element.attributes).forEach((attr) => {
875
+ attrs[attr.name] = attr.value;
876
+ });
877
+ return attrs;
878
+ }
879
+ }];
880
+ },
881
+ addAttributes() {
882
+ return {
883
+ ...this.parent?.(),
884
+ "ses:no-track": {
885
+ default: null,
886
+ parseHTML: (element) => element.getAttribute("ses:no-track")
887
+ }
888
+ };
889
+ },
890
+ addCommands() {
891
+ return {
892
+ ...this.parent?.(),
893
+ unsetLink: () => ({ state, chain }) => {
894
+ const { from } = state.selection;
895
+ const linkStyle = state.doc.resolve(from).marks().find((m) => m.type.name === "link")?.attrs?.style ?? null;
896
+ const preservedStyle = processStylesForUnlink(linkStyle);
897
+ const shouldRemoveUnderline = preservedStyle !== linkStyle;
898
+ if (preservedStyle) {
899
+ const cmd = chain().extendMarkRange("link").unsetMark("link").setMark("preservedStyle", { style: preservedStyle });
900
+ return shouldRemoveUnderline ? cmd.unsetMark("underline").run() : cmd.run();
901
+ }
902
+ return chain().extendMarkRange("link").unsetMark("link").unsetMark("underline").run();
903
+ }
904
+ };
905
+ },
906
+ addKeyboardShortcuts() {
907
+ return { "Mod-k": () => {
908
+ require_event_bus.editorEventBus.dispatch("bubble-menu:add-link", void 0);
909
+ return this.editor.chain().focus().toggleLink({ href: "" }).run();
910
+ } };
911
+ }
912
+ });
913
+ //#endregion
914
+ //#region src/extensions/list-item.tsx
915
+ const ListItem = require_email_node.EmailNode.from(_tiptap_extension_list_item.default, ({ children, node, style }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
916
+ className: node.attrs?.class || void 0,
917
+ style: {
918
+ ...style,
919
+ ...require_email_node.inlineCssToJs(node.attrs?.style),
920
+ ...getTextAlignment(node.attrs?.align || node.attrs?.alignment)
921
+ },
922
+ children
923
+ }));
924
+ //#endregion
925
+ //#region src/extensions/max-nesting.ts
926
+ const MaxNesting = _tiptap_core.Extension.create({
927
+ name: "maxNesting",
928
+ addOptions() {
929
+ return {
930
+ maxDepth: 3,
931
+ nodeTypes: void 0
932
+ };
933
+ },
934
+ addProseMirrorPlugins() {
935
+ const { maxDepth, nodeTypes } = this.options;
936
+ if (typeof maxDepth !== "number" || maxDepth < 1) throw new Error("maxDepth must be a positive number");
937
+ return [new _tiptap_pm_state.Plugin({
938
+ key: new _tiptap_pm_state.PluginKey("maxNesting"),
939
+ appendTransaction(transactions, _oldState, newState) {
940
+ if (!transactions.some((tr) => tr.docChanged)) return null;
941
+ const rangesToLift = [];
942
+ newState.doc.descendants((node, pos) => {
943
+ let depth = 0;
944
+ let currentPos = pos;
945
+ let currentNode = node;
946
+ while (currentNode && depth <= maxDepth) {
947
+ if (!nodeTypes || nodeTypes.includes(currentNode.type.name)) depth++;
948
+ const $pos = newState.doc.resolve(currentPos);
949
+ if ($pos.depth === 0) break;
950
+ currentPos = $pos.before($pos.depth);
951
+ currentNode = newState.doc.nodeAt(currentPos);
952
+ }
953
+ if (depth > maxDepth) {
954
+ const $pos = newState.doc.resolve(pos);
955
+ if ($pos.depth > 0) {
956
+ const range = $pos.blockRange();
957
+ 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({
958
+ range,
959
+ target: range.start - 1
960
+ });
961
+ }
962
+ }
963
+ });
964
+ if (rangesToLift.length === 0) return null;
965
+ const tr = newState.tr;
966
+ for (let i = rangesToLift.length - 1; i >= 0; i--) {
967
+ const { range, target } = rangesToLift[i];
968
+ tr.lift(range, target);
969
+ }
970
+ return tr;
971
+ },
972
+ filterTransaction(tr) {
973
+ if (!tr.docChanged) return true;
974
+ let wouldCreateDeepNesting = false;
975
+ const newDoc = tr.doc;
976
+ newDoc.descendants((node, pos) => {
977
+ if (wouldCreateDeepNesting) return false;
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 = newDoc.resolve(currentPos);
984
+ if ($pos.depth === 0) break;
985
+ currentPos = $pos.before($pos.depth);
986
+ currentNode = newDoc.nodeAt(currentPos);
987
+ }
988
+ if (depth > maxDepth) {
989
+ wouldCreateDeepNesting = true;
990
+ return false;
991
+ }
992
+ });
993
+ return !wouldCreateDeepNesting;
994
+ }
995
+ })];
996
+ }
997
+ });
998
+ //#endregion
999
+ //#region src/extensions/ordered-list.tsx
1000
+ const OrderedList = require_email_node.EmailNode.from(_tiptap_extension_ordered_list.default, ({ children, node, style }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ol", {
1001
+ className: node.attrs?.class || void 0,
1002
+ start: node.attrs?.start,
1003
+ style: {
1004
+ ...style,
1005
+ ...require_email_node.inlineCssToJs(node.attrs?.style)
1006
+ },
1007
+ children
1008
+ }));
1009
+ //#endregion
1010
+ //#region src/extensions/paragraph.tsx
1011
+ const Paragraph = require_email_node.EmailNode.from(_tiptap_extension_paragraph.default, ({ children, node, style }) => {
1012
+ const isEmpty = !node.content || node.content.length === 0;
1013
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1014
+ className: node.attrs?.class || void 0,
1015
+ style: {
1016
+ ...style,
1017
+ ...require_email_node.inlineCssToJs(node.attrs?.style),
1018
+ ...getTextAlignment(node.attrs?.align || node.attrs?.alignment)
1019
+ },
1020
+ children: isEmpty ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("br", {}) : children
1021
+ });
1022
+ });
1023
+ //#endregion
1024
+ //#region src/extensions/preview-text.ts
1025
+ const PreviewText = _tiptap_core.Node.create({
1026
+ name: "previewText",
1027
+ group: "block",
1028
+ selectable: false,
1029
+ draggable: false,
1030
+ atom: true,
1031
+ addOptions() {
1032
+ return { HTMLAttributes: {} };
1033
+ },
1034
+ addStorage() {
1035
+ return { previewText: null };
1036
+ },
1037
+ renderHTML() {
1038
+ return ["div", { style: "display: none" }];
1039
+ },
1040
+ parseHTML() {
1041
+ return [{
1042
+ tag: "div[data-skip-in-text=\"true\"]",
1043
+ getAttrs: (node) => {
1044
+ if (typeof node === "string") return false;
1045
+ const element = node;
1046
+ let directText = "";
1047
+ for (const child of element.childNodes) if (child.nodeType === 3) directText += child.textContent || "";
1048
+ const cleanText = directText.trim();
1049
+ if (cleanText) this.storage.previewText = cleanText;
1050
+ return false;
1051
+ }
1052
+ }, {
1053
+ tag: "span.preheader",
1054
+ getAttrs: (node) => {
1055
+ if (typeof node === "string") return false;
1056
+ const preheaderText = node.textContent?.trim();
1057
+ if (preheaderText) this.storage.previewText = preheaderText;
1058
+ return false;
1059
+ }
1060
+ }];
1061
+ }
1062
+ });
1063
+ //#endregion
1064
+ //#region src/extensions/section.tsx
1065
+ function isSectionEmpty(node) {
1066
+ return node.textContent === "" && node.content.size <= node.childCount * 2;
1067
+ }
1068
+ const Section = require_email_node.EmailNode.create({
1069
+ name: "section",
1070
+ group: "block",
1071
+ content: "block+",
1072
+ isolating: true,
1073
+ defining: true,
1074
+ parseHTML() {
1075
+ return [{ tag: "section[data-type=\"section\"]" }];
1076
+ },
1077
+ renderHTML({ HTMLAttributes }) {
1078
+ return [
1079
+ "section",
1080
+ (0, _tiptap_core.mergeAttributes)({
1081
+ "data-type": "section",
1082
+ class: "node-section"
1083
+ }, HTMLAttributes),
1084
+ 0
1085
+ ];
1086
+ },
1087
+ addKeyboardShortcuts() {
1088
+ return { Backspace: ({ editor }) => {
1089
+ const { state } = editor;
1090
+ const { selection } = state;
1091
+ const { empty, $from } = selection;
1092
+ if (!empty) return false;
1093
+ for (let depth = $from.depth; depth >= 1; depth--) {
1094
+ if ($from.node(depth).type.name !== "section") continue;
1095
+ if ($from.parentOffset !== 0) return false;
1096
+ let atStart = true;
1097
+ for (let d = depth; d < $from.depth; d++) if ($from.index(d) !== 0) {
1098
+ atStart = false;
1099
+ break;
1100
+ }
1101
+ if (!atStart) return false;
1102
+ if (!isSectionEmpty($from.node(depth))) return false;
1103
+ const tr = state.tr;
1104
+ const from = $from.before(depth);
1105
+ const to = $from.after(depth);
1106
+ if ($from.node(depth - 1).childCount === 1) tr.replaceWith(from, to, state.schema.nodes.paragraph.create());
1107
+ else tr.delete(from, to);
1108
+ editor.view.dispatch(tr);
1109
+ return true;
1110
+ }
1111
+ for (let depth = $from.depth; depth >= 1; depth--) {
1112
+ if ($from.pos !== $from.start(depth)) break;
1113
+ const indexInParent = $from.index(depth - 1);
1114
+ if (indexInParent === 0) continue;
1115
+ const prevNode = $from.node(depth - 1).child(indexInParent - 1);
1116
+ if (prevNode.type.name === "section" && isSectionEmpty(prevNode)) {
1117
+ const deleteFrom = $from.before(depth) - prevNode.nodeSize;
1118
+ const deleteTo = $from.before(depth);
1119
+ editor.view.dispatch(state.tr.delete(deleteFrom, deleteTo));
1120
+ return true;
1121
+ }
1122
+ break;
1123
+ }
1124
+ return false;
1125
+ } };
1126
+ },
1127
+ addCommands() {
1128
+ return { insertSection: () => ({ commands }) => {
1129
+ return commands.insertContent({
1130
+ type: this.name,
1131
+ content: [{
1132
+ type: "paragraph",
1133
+ content: []
1134
+ }]
1135
+ });
1136
+ } };
1137
+ },
1138
+ renderToReactEmail({ children, node, style }) {
1139
+ const inlineStyles = require_email_node.inlineCssToJs(node.attrs?.style);
1140
+ const textAlign = node.attrs?.align || node.attrs?.alignment;
1141
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_email.Section, {
1142
+ className: node.attrs?.class || void 0,
1143
+ align: textAlign,
1144
+ style: {
1145
+ ...style,
1146
+ ...inlineStyles,
1147
+ ...getTextAlignment(textAlign)
1148
+ },
1149
+ children
1150
+ });
1151
+ }
1152
+ });
1153
+ //#endregion
1154
+ //#region src/extensions/strike.tsx
1155
+ const Strike = require_core.EmailMark.from(_tiptap_extension_strike.default, ({ children, style }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("s", {
1156
+ style,
1157
+ children
1158
+ }));
1159
+ //#endregion
1160
+ //#region src/extensions/style-attribute.tsx
1161
+ const StyleAttribute = _tiptap_core.Extension.create({
1162
+ name: "styleAttribute",
1163
+ priority: 101,
1164
+ addOptions() {
1165
+ return {
1166
+ types: [],
1167
+ style: []
1168
+ };
1169
+ },
1170
+ addGlobalAttributes() {
1171
+ return [{
1172
+ types: this.options.types,
1173
+ attributes: { style: {
1174
+ default: "",
1175
+ parseHTML: (element) => element.getAttribute("style") || "",
1176
+ renderHTML: (attributes) => {
1177
+ return { style: attributes.style ?? "" };
1178
+ }
1179
+ } }
1180
+ }];
1181
+ },
1182
+ addCommands() {
1183
+ return {
1184
+ unsetStyle: () => ({ commands }) => {
1185
+ return this.options.types.every((type) => commands.resetAttributes(type, "style"));
1186
+ },
1187
+ setStyle: (style) => ({ commands }) => {
1188
+ return this.options.types.every((type) => commands.updateAttributes(type, { style }));
1189
+ }
1190
+ };
1191
+ },
1192
+ addKeyboardShortcuts() {
1193
+ return { Enter: ({ editor }) => {
1194
+ const { state } = editor.view;
1195
+ const { selection } = state;
1196
+ const { $from } = selection;
1197
+ const textBefore = $from.nodeBefore?.text || "";
1198
+ if (textBefore.includes("{{") || textBefore.includes("{{{")) return false;
1199
+ requestAnimationFrame(() => {
1200
+ editor.commands.resetAttributes("paragraph", "style");
1201
+ });
1202
+ return false;
1203
+ } };
1204
+ }
1205
+ });
1206
+ //#endregion
1207
+ //#region src/extensions/sup.tsx
1208
+ const SupBase = _tiptap_extension_superscript.default.extend({
1209
+ name: "sup",
1210
+ addCommands() {
1211
+ return {
1212
+ ...this.parent?.(),
1213
+ setSup: () => ({ commands }) => {
1214
+ return commands.setMark(this.name);
1215
+ },
1216
+ toggleSup: () => ({ commands }) => {
1217
+ return commands.toggleMark(this.name);
1218
+ },
1219
+ unsetSup: () => ({ commands }) => {
1220
+ return commands.unsetMark(this.name);
1221
+ }
1222
+ };
1223
+ }
1224
+ });
1225
+ const Sup = require_core.EmailMark.from(SupBase, ({ children, style }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("sup", {
1226
+ style,
1227
+ children
1228
+ }));
1229
+ //#endregion
1230
+ //#region src/extensions/table.tsx
1231
+ const Table = require_email_node.EmailNode.create({
1232
+ name: "table",
1233
+ group: "block",
1234
+ content: "tableRow+",
1235
+ isolating: true,
1236
+ tableRole: "table",
1237
+ addAttributes() {
1238
+ return { ...require_columns.createStandardAttributes([
1239
+ ...require_columns.TABLE_ATTRIBUTES,
1240
+ ...require_columns.LAYOUT_ATTRIBUTES,
1241
+ ...require_columns.COMMON_HTML_ATTRIBUTES
1242
+ ]) };
1243
+ },
1244
+ parseHTML() {
1245
+ return [{
1246
+ tag: "table",
1247
+ getAttrs: (node) => {
1248
+ if (typeof node === "string") return false;
1249
+ const element = node;
1250
+ const attrs = {};
1251
+ Array.from(element.attributes).forEach((attr) => {
1252
+ attrs[attr.name] = attr.value;
1253
+ });
1254
+ return attrs;
1255
+ }
1256
+ }];
1257
+ },
1258
+ renderHTML({ HTMLAttributes }) {
1259
+ return [
1260
+ "table",
1261
+ (0, _tiptap_core.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes),
1262
+ [
1263
+ "tbody",
1264
+ {},
1265
+ 0
1266
+ ]
1267
+ ];
1268
+ },
1269
+ renderToReactEmail({ children, node, style }) {
1270
+ const inlineStyles = require_email_node.inlineCssToJs(node.attrs?.style);
1271
+ const alignment = node.attrs?.align || node.attrs?.alignment;
1272
+ const width = node.attrs?.width;
1273
+ const centeringStyles = alignment === "center" ? {
1274
+ marginLeft: "auto",
1275
+ marginRight: "auto"
1276
+ } : {};
1277
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("table", {
1278
+ align: alignment,
1279
+ width,
1280
+ border: 0,
1281
+ cellPadding: "0",
1282
+ cellSpacing: "0",
1283
+ role: "presentation",
1284
+ className: node.attrs?.class || void 0,
1285
+ style: require_email_node.resolveConflictingStyles(style, {
1286
+ ...inlineStyles,
1287
+ ...centeringStyles
1288
+ }),
1289
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", { children })
1290
+ });
1291
+ }
1292
+ });
1293
+ const TableRow = require_email_node.EmailNode.create({
1294
+ name: "tableRow",
1295
+ group: "tableRow",
1296
+ content: "(tableCell | tableHeader)+",
1297
+ addAttributes() {
1298
+ return { ...require_columns.createStandardAttributes([
1299
+ ...require_columns.TABLE_CELL_ATTRIBUTES,
1300
+ ...require_columns.LAYOUT_ATTRIBUTES,
1301
+ ...require_columns.COMMON_HTML_ATTRIBUTES
1302
+ ]) };
1303
+ },
1304
+ parseHTML() {
1305
+ return [{
1306
+ tag: "tr",
1307
+ getAttrs: (node) => {
1308
+ if (typeof node === "string") return false;
1309
+ const element = node;
1310
+ const attrs = {};
1311
+ Array.from(element.attributes).forEach((attr) => {
1312
+ attrs[attr.name] = attr.value;
1313
+ });
1314
+ return attrs;
1315
+ }
1316
+ }];
1317
+ },
1318
+ renderHTML({ HTMLAttributes }) {
1319
+ return [
1320
+ "tr",
1321
+ HTMLAttributes,
1322
+ 0
1323
+ ];
1324
+ },
1325
+ renderToReactEmail({ children, node, style }) {
1326
+ const inlineStyles = require_email_node.inlineCssToJs(node.attrs?.style);
1327
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tr", {
1328
+ className: node.attrs?.class || void 0,
1329
+ style: {
1330
+ ...style,
1331
+ ...inlineStyles
1332
+ },
1333
+ children
1334
+ });
1335
+ }
1336
+ });
1337
+ const TableCell = require_email_node.EmailNode.create({
1338
+ name: "tableCell",
1339
+ group: "tableCell",
1340
+ content: "block+",
1341
+ isolating: true,
1342
+ addAttributes() {
1343
+ return { ...require_columns.createStandardAttributes([
1344
+ ...require_columns.TABLE_CELL_ATTRIBUTES,
1345
+ ...require_columns.LAYOUT_ATTRIBUTES,
1346
+ ...require_columns.COMMON_HTML_ATTRIBUTES
1347
+ ]) };
1348
+ },
1349
+ parseHTML() {
1350
+ return [{
1351
+ tag: "td",
1352
+ getAttrs: (node) => {
1353
+ if (typeof node === "string") return false;
1354
+ const element = node;
1355
+ const attrs = {};
1356
+ Array.from(element.attributes).forEach((attr) => {
1357
+ attrs[attr.name] = attr.value;
1358
+ });
1359
+ return attrs;
1360
+ }
1361
+ }];
1362
+ },
1363
+ renderHTML({ HTMLAttributes }) {
1364
+ return [
1365
+ "td",
1366
+ HTMLAttributes,
1367
+ 0
1368
+ ];
1369
+ },
1370
+ renderToReactEmail({ children, node, style }) {
1371
+ const inlineStyles = require_email_node.inlineCssToJs(node.attrs?.style);
1372
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_email.Column, {
1373
+ className: node.attrs?.class || void 0,
1374
+ align: node.attrs?.align || node.attrs?.alignment,
1375
+ style: {
1376
+ ...style,
1377
+ ...inlineStyles
1378
+ },
1379
+ children
1380
+ });
1381
+ }
1382
+ });
1383
+ const TableHeader = _tiptap_core.Node.create({
1384
+ name: "tableHeader",
1385
+ group: "tableCell",
1386
+ content: "block+",
1387
+ isolating: true,
1388
+ addAttributes() {
1389
+ return { ...require_columns.createStandardAttributes([
1390
+ ...require_columns.TABLE_HEADER_ATTRIBUTES,
1391
+ ...require_columns.TABLE_CELL_ATTRIBUTES,
1392
+ ...require_columns.LAYOUT_ATTRIBUTES,
1393
+ ...require_columns.COMMON_HTML_ATTRIBUTES
1394
+ ]) };
1395
+ },
1396
+ parseHTML() {
1397
+ return [{
1398
+ tag: "th",
1399
+ getAttrs: (node) => {
1400
+ if (typeof node === "string") return false;
1401
+ const element = node;
1402
+ const attrs = {};
1403
+ Array.from(element.attributes).forEach((attr) => {
1404
+ attrs[attr.name] = attr.value;
1405
+ });
1406
+ return attrs;
1407
+ }
1408
+ }];
1409
+ },
1410
+ renderHTML({ HTMLAttributes }) {
1411
+ return [
1412
+ "th",
1413
+ HTMLAttributes,
1414
+ 0
1415
+ ];
1416
+ }
1417
+ });
1418
+ //#endregion
1419
+ //#region src/extensions/text.tsx
1420
+ const Text = require_email_node.EmailNode.from(_tiptap_extension_text.Text, ({ children }) => {
1421
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children });
1422
+ });
1423
+ //#endregion
1424
+ //#region src/extensions/trailing-node.tsx
1425
+ const skipTrailingNodeMeta = "skipTrailingNode";
1426
+ function nodeEqualsType({ types, node }) {
1427
+ return node && Array.isArray(types) && types.includes(node.type) || node?.type === types;
1428
+ }
1429
+ /**
1430
+ * This extension allows you to add an extra node at the end of a node.
1431
+ *
1432
+ * Differently from TipTap's native one, it allows you to pick which node to append the trailing node to.
1433
+ * @see https://www.tiptap.dev/api/extensions/trailing-node
1434
+ *
1435
+ * We could contribute this to TipTap's core extensions and I think we should at some once we get some time.
1436
+ */
1437
+ const TrailingNode = _tiptap_core.Extension.create({
1438
+ name: "trailingNode",
1439
+ addOptions() {
1440
+ return {
1441
+ node: void 0,
1442
+ appendTo: "doc",
1443
+ notAfter: []
1444
+ };
1445
+ },
1446
+ addProseMirrorPlugins() {
1447
+ const plugin = new _tiptap_pm_state.PluginKey(this.name);
1448
+ const defaultNode = this.options.node || this.editor.schema.topNodeType.contentMatch.defaultType?.name || "paragraph";
1449
+ const notAfter = Array.isArray(this.options.notAfter) ? this.options.notAfter : [this.options.notAfter].filter(Boolean);
1450
+ const disabledNodes = Object.entries(this.editor.schema.nodes).map(([, value]) => value).filter((node) => notAfter.concat(defaultNode).includes(node.name));
1451
+ const appendToTypes = (Array.isArray(this.options.appendTo) ? this.options.appendTo : [this.options.appendTo || "doc"]).map((name) => this.editor.schema.nodes[name]).filter(Boolean);
1452
+ const getInsertPositions = (doc) => {
1453
+ const positions = [];
1454
+ if (appendToTypes.includes(doc.type)) {
1455
+ if (!nodeEqualsType({
1456
+ node: doc.lastChild,
1457
+ types: disabledNodes
1458
+ })) positions.push(doc.content.size);
1459
+ }
1460
+ doc.descendants((node, pos) => {
1461
+ if (!appendToTypes.includes(node.type)) return;
1462
+ if (!nodeEqualsType({
1463
+ node: node.lastChild,
1464
+ types: disabledNodes
1465
+ })) positions.push(pos + node.nodeSize - 1);
1466
+ });
1467
+ return positions;
1468
+ };
1469
+ return [new _tiptap_pm_state.Plugin({
1470
+ key: plugin,
1471
+ appendTransaction: (transactions, __, state) => {
1472
+ const { doc, tr, schema } = state;
1473
+ const shouldInsert = plugin.getState(state);
1474
+ const type = schema.nodes[defaultNode];
1475
+ if (transactions.some((transaction) => transaction.getMeta("skipTrailingNode"))) return;
1476
+ if (!shouldInsert) return;
1477
+ const positions = getInsertPositions(doc);
1478
+ for (const pos of positions.sort((a, b) => b - a)) tr.insert(pos, type.create());
1479
+ return positions.length > 0 ? tr : void 0;
1480
+ },
1481
+ state: {
1482
+ init: (_, state) => {
1483
+ return getInsertPositions(state.doc).length > 0;
1484
+ },
1485
+ apply: (tr, value) => {
1486
+ if (!tr.docChanged) return value;
1487
+ if (tr.getMeta("__uniqueIDTransaction")) return value;
1488
+ return getInsertPositions(tr.doc).length > 0;
1489
+ }
1490
+ }
1491
+ })];
1492
+ }
1493
+ });
1494
+ //#endregion
1495
+ //#region src/extensions/underline.tsx
1496
+ const Underline = require_core.EmailMark.from(_tiptap_extension_underline.default, ({ children, style }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("u", {
1497
+ style,
1498
+ children
1499
+ }));
1500
+ //#endregion
1501
+ //#region src/extensions/uppercase.tsx
1502
+ const Uppercase = require_core.EmailMark.create({
1503
+ name: "uppercase",
1504
+ addOptions() {
1505
+ return { HTMLAttributes: {} };
1506
+ },
1507
+ parseHTML() {
1508
+ return [{
1509
+ tag: "span",
1510
+ getAttrs: (node) => {
1511
+ if (node.style.textTransform === "uppercase") return {};
1512
+ return false;
1513
+ }
1514
+ }];
1515
+ },
1516
+ renderHTML({ HTMLAttributes }) {
1517
+ return [
1518
+ "span",
1519
+ (0, _tiptap_core.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes, { style: "text-transform: uppercase" }),
1520
+ 0
1521
+ ];
1522
+ },
1523
+ renderToReactEmail({ children, style }) {
1524
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1525
+ style: {
1526
+ ...style,
1527
+ textTransform: "uppercase"
1528
+ },
1529
+ children
1530
+ });
1531
+ },
1532
+ addCommands() {
1533
+ return {
1534
+ setUppercase: () => ({ commands }) => {
1535
+ return commands.setMark(this.name);
1536
+ },
1537
+ toggleUppercase: () => ({ commands }) => {
1538
+ return commands.toggleMark(this.name);
1539
+ },
1540
+ unsetUppercase: () => ({ commands }) => {
1541
+ return commands.unsetMark(this.name);
1542
+ }
1543
+ };
1544
+ }
1545
+ });
1546
+ //#endregion
1547
+ //#region src/extensions/index.ts
1548
+ const starterKitExtensions = {
1549
+ CodeBlockPrism,
1550
+ Code,
1551
+ TwoColumns: require_columns.TwoColumns,
1552
+ ThreeColumns: require_columns.ThreeColumns,
1553
+ FourColumns: require_columns.FourColumns,
1554
+ Container,
1555
+ ColumnsColumn: require_columns.ColumnsColumn,
1556
+ Paragraph,
1557
+ BulletList,
1558
+ OrderedList,
1559
+ Blockquote,
1560
+ ListItem,
1561
+ HardBreak,
1562
+ Italic,
1563
+ PreviewText,
1564
+ TrailingNode,
1565
+ Bold,
1566
+ Strike,
1567
+ Heading,
1568
+ Divider,
1569
+ Link,
1570
+ Sup,
1571
+ Underline,
1572
+ Uppercase,
1573
+ PreservedStyle,
1574
+ Table,
1575
+ TableRow,
1576
+ TableCell,
1577
+ TableHeader,
1578
+ Body,
1579
+ Div,
1580
+ Button,
1581
+ Section,
1582
+ GlobalContent: require_global_content.GlobalContent,
1583
+ Text,
1584
+ AlignmentAttribute,
1585
+ StyleAttribute,
1586
+ ClassAttribute,
1587
+ MaxNesting,
1588
+ UndoRedo: _tiptap_extensions.UndoRedo
1589
+ };
1590
+ const StarterKit = _tiptap_core.Extension.create({
1591
+ name: "reactEmailStarterKit",
1592
+ addOptions() {
1593
+ return {
1594
+ TiptapStarterKit: {},
1595
+ CodeBlockPrism: {
1596
+ defaultLanguage: "javascript",
1597
+ HTMLAttributes: { class: "prism node-codeBlock" }
1598
+ },
1599
+ TrailingNode: {
1600
+ node: "paragraph",
1601
+ appendTo: [
1602
+ "container",
1603
+ "section",
1604
+ "columnsColumn"
1605
+ ]
1606
+ },
1607
+ Code: { HTMLAttributes: {
1608
+ class: "node-inlineCode",
1609
+ spellcheck: "false"
1610
+ } },
1611
+ TwoColumns: {},
1612
+ ThreeColumns: {},
1613
+ FourColumns: {},
1614
+ ColumnsColumn: {},
1615
+ Paragraph: { HTMLAttributes: { class: "node-paragraph" } },
1616
+ BulletList: { HTMLAttributes: { class: "node-bulletList" } },
1617
+ OrderedList: { HTMLAttributes: { class: "node-orderedList" } },
1618
+ Blockquote: { HTMLAttributes: { class: "node-blockquote" } },
1619
+ ListItem: {},
1620
+ HardBreak: {},
1621
+ Italic: {},
1622
+ PreviewText: {},
1623
+ Bold: {},
1624
+ Strike: {},
1625
+ Heading: {},
1626
+ Divider: {},
1627
+ Link: {
1628
+ openOnClick: false,
1629
+ HTMLAttributes: { class: "node-link" }
1630
+ },
1631
+ Sup: {},
1632
+ Underline: {},
1633
+ Uppercase: {},
1634
+ PreservedStyle: {},
1635
+ Table: {},
1636
+ TableRow: {},
1637
+ TableCell: {},
1638
+ TableHeader: {},
1639
+ Body: {},
1640
+ Container: {},
1641
+ Div: {},
1642
+ Button: {},
1643
+ Section: {},
1644
+ GlobalContent: {},
1645
+ AlignmentAttribute: { types: [
1646
+ "heading",
1647
+ "paragraph",
1648
+ "image",
1649
+ "blockquote",
1650
+ "codeBlock",
1651
+ "bulletList",
1652
+ "orderedList",
1653
+ "listItem",
1654
+ "button",
1655
+ "youtube",
1656
+ "twitter",
1657
+ "table",
1658
+ "tableRow",
1659
+ "tableCell",
1660
+ "tableHeader",
1661
+ "columnsColumn"
1662
+ ] },
1663
+ StyleAttribute: { types: [
1664
+ "heading",
1665
+ "paragraph",
1666
+ "image",
1667
+ "blockquote",
1668
+ "codeBlock",
1669
+ "bulletList",
1670
+ "orderedList",
1671
+ "listItem",
1672
+ "button",
1673
+ "youtube",
1674
+ "twitter",
1675
+ "horizontalRule",
1676
+ "footer",
1677
+ "section",
1678
+ "div",
1679
+ "body",
1680
+ "table",
1681
+ "tableRow",
1682
+ "tableCell",
1683
+ "tableHeader",
1684
+ "columnsColumn",
1685
+ "link"
1686
+ ] },
1687
+ Text: {},
1688
+ ClassAttribute: { types: [
1689
+ "heading",
1690
+ "paragraph",
1691
+ "image",
1692
+ "blockquote",
1693
+ "bulletList",
1694
+ "orderedList",
1695
+ "listItem",
1696
+ "button",
1697
+ "youtube",
1698
+ "twitter",
1699
+ "horizontalRule",
1700
+ "footer",
1701
+ "section",
1702
+ "div",
1703
+ "body",
1704
+ "table",
1705
+ "tableRow",
1706
+ "tableCell",
1707
+ "tableHeader",
1708
+ "columnsColumn",
1709
+ "link"
1710
+ ] },
1711
+ MaxNesting: {
1712
+ maxDepth: 50,
1713
+ nodeTypes: [
1714
+ "section",
1715
+ "bulletList",
1716
+ "orderedList"
1717
+ ]
1718
+ },
1719
+ UndoRedo: {}
1720
+ };
1721
+ },
1722
+ addExtensions() {
1723
+ const extensions = [];
1724
+ if (this.options.TiptapStarterKit !== false) extensions.push(_tiptap_starter_kit.default.configure({
1725
+ undoRedo: false,
1726
+ heading: false,
1727
+ link: false,
1728
+ underline: false,
1729
+ trailingNode: false,
1730
+ bold: false,
1731
+ italic: false,
1732
+ strike: false,
1733
+ code: false,
1734
+ paragraph: false,
1735
+ bulletList: false,
1736
+ orderedList: false,
1737
+ listItem: false,
1738
+ blockquote: false,
1739
+ hardBreak: false,
1740
+ gapcursor: false,
1741
+ codeBlock: false,
1742
+ text: false,
1743
+ horizontalRule: false,
1744
+ dropcursor: {
1745
+ color: "#61a8f8",
1746
+ class: "rounded-full animate-[fade-in_300ms_ease-in-out] !z-40",
1747
+ width: 4
1748
+ },
1749
+ ...this.options.TiptapStarterKit
1750
+ }));
1751
+ for (const [name, extension] of Object.entries(starterKitExtensions)) {
1752
+ const key = name;
1753
+ const extensionOptions = this.options[key];
1754
+ if (extensionOptions !== false) extensions.push(extension.configure(extensionOptions));
1755
+ }
1756
+ return extensions;
1757
+ }
1758
+ });
1759
+ //#endregion
1760
+ Object.defineProperty(exports, "AlignmentAttribute", {
1761
+ enumerable: true,
1762
+ get: function() {
1763
+ return AlignmentAttribute;
1764
+ }
1765
+ });
1766
+ Object.defineProperty(exports, "Blockquote", {
1767
+ enumerable: true,
1768
+ get: function() {
1769
+ return Blockquote;
1770
+ }
1771
+ });
1772
+ Object.defineProperty(exports, "Body", {
1773
+ enumerable: true,
1774
+ get: function() {
1775
+ return Body;
1776
+ }
1777
+ });
1778
+ Object.defineProperty(exports, "Bold", {
1779
+ enumerable: true,
1780
+ get: function() {
1781
+ return Bold;
1782
+ }
1783
+ });
1784
+ Object.defineProperty(exports, "BulletList", {
1785
+ enumerable: true,
1786
+ get: function() {
1787
+ return BulletList;
1788
+ }
1789
+ });
1790
+ Object.defineProperty(exports, "Button", {
1791
+ enumerable: true,
1792
+ get: function() {
1793
+ return Button;
1794
+ }
1795
+ });
1796
+ Object.defineProperty(exports, "ClassAttribute", {
1797
+ enumerable: true,
1798
+ get: function() {
1799
+ return ClassAttribute;
1800
+ }
1801
+ });
1802
+ Object.defineProperty(exports, "Code", {
1803
+ enumerable: true,
1804
+ get: function() {
1805
+ return Code;
1806
+ }
1807
+ });
1808
+ Object.defineProperty(exports, "CodeBlockPrism", {
1809
+ enumerable: true,
1810
+ get: function() {
1811
+ return CodeBlockPrism;
1812
+ }
1813
+ });
1814
+ Object.defineProperty(exports, "Container", {
1815
+ enumerable: true,
1816
+ get: function() {
1817
+ return Container;
1818
+ }
1819
+ });
1820
+ Object.defineProperty(exports, "Div", {
1821
+ enumerable: true,
1822
+ get: function() {
1823
+ return Div;
1824
+ }
1825
+ });
1826
+ Object.defineProperty(exports, "Divider", {
1827
+ enumerable: true,
1828
+ get: function() {
1829
+ return Divider;
1830
+ }
1831
+ });
1832
+ Object.defineProperty(exports, "HardBreak", {
1833
+ enumerable: true,
1834
+ get: function() {
1835
+ return HardBreak;
1836
+ }
1837
+ });
1838
+ Object.defineProperty(exports, "Heading", {
1839
+ enumerable: true,
1840
+ get: function() {
1841
+ return Heading;
1842
+ }
1843
+ });
1844
+ Object.defineProperty(exports, "Italic", {
1845
+ enumerable: true,
1846
+ get: function() {
1847
+ return Italic;
1848
+ }
1849
+ });
1850
+ Object.defineProperty(exports, "Link", {
1851
+ enumerable: true,
1852
+ get: function() {
1853
+ return Link;
1854
+ }
1855
+ });
1856
+ Object.defineProperty(exports, "ListItem", {
1857
+ enumerable: true,
1858
+ get: function() {
1859
+ return ListItem;
1860
+ }
1861
+ });
1862
+ Object.defineProperty(exports, "MaxNesting", {
1863
+ enumerable: true,
1864
+ get: function() {
1865
+ return MaxNesting;
1866
+ }
1867
+ });
1868
+ Object.defineProperty(exports, "OrderedList", {
1869
+ enumerable: true,
1870
+ get: function() {
1871
+ return OrderedList;
1872
+ }
1873
+ });
1874
+ Object.defineProperty(exports, "Paragraph", {
1875
+ enumerable: true,
1876
+ get: function() {
1877
+ return Paragraph;
1878
+ }
1879
+ });
1880
+ Object.defineProperty(exports, "PreservedStyle", {
1881
+ enumerable: true,
1882
+ get: function() {
1883
+ return PreservedStyle;
1884
+ }
1885
+ });
1886
+ Object.defineProperty(exports, "PreviewText", {
1887
+ enumerable: true,
1888
+ get: function() {
1889
+ return PreviewText;
1890
+ }
1891
+ });
1892
+ Object.defineProperty(exports, "Section", {
1893
+ enumerable: true,
1894
+ get: function() {
1895
+ return Section;
1896
+ }
1897
+ });
1898
+ Object.defineProperty(exports, "StarterKit", {
1899
+ enumerable: true,
1900
+ get: function() {
1901
+ return StarterKit;
1902
+ }
1903
+ });
1904
+ Object.defineProperty(exports, "Strike", {
1905
+ enumerable: true,
1906
+ get: function() {
1907
+ return Strike;
1908
+ }
1909
+ });
1910
+ Object.defineProperty(exports, "StyleAttribute", {
1911
+ enumerable: true,
1912
+ get: function() {
1913
+ return StyleAttribute;
1914
+ }
1915
+ });
1916
+ Object.defineProperty(exports, "Sup", {
1917
+ enumerable: true,
1918
+ get: function() {
1919
+ return Sup;
1920
+ }
1921
+ });
1922
+ Object.defineProperty(exports, "Table", {
1923
+ enumerable: true,
1924
+ get: function() {
1925
+ return Table;
1926
+ }
1927
+ });
1928
+ Object.defineProperty(exports, "TableCell", {
1929
+ enumerable: true,
1930
+ get: function() {
1931
+ return TableCell;
1932
+ }
1933
+ });
1934
+ Object.defineProperty(exports, "TableHeader", {
1935
+ enumerable: true,
1936
+ get: function() {
1937
+ return TableHeader;
1938
+ }
1939
+ });
1940
+ Object.defineProperty(exports, "TableRow", {
1941
+ enumerable: true,
1942
+ get: function() {
1943
+ return TableRow;
1944
+ }
1945
+ });
1946
+ Object.defineProperty(exports, "Text", {
1947
+ enumerable: true,
1948
+ get: function() {
1949
+ return Text;
1950
+ }
1951
+ });
1952
+ Object.defineProperty(exports, "TrailingNode", {
1953
+ enumerable: true,
1954
+ get: function() {
1955
+ return TrailingNode;
1956
+ }
1957
+ });
1958
+ Object.defineProperty(exports, "Underline", {
1959
+ enumerable: true,
1960
+ get: function() {
1961
+ return Underline;
1962
+ }
1963
+ });
1964
+ Object.defineProperty(exports, "Uppercase", {
1965
+ enumerable: true,
1966
+ get: function() {
1967
+ return Uppercase;
1968
+ }
1969
+ });
1970
+ Object.defineProperty(exports, "processStylesForUnlink", {
1971
+ enumerable: true,
1972
+ get: function() {
1973
+ return processStylesForUnlink;
1974
+ }
1975
+ });
1976
+ Object.defineProperty(exports, "skipTrailingNodeMeta", {
1977
+ enumerable: true,
1978
+ get: function() {
1979
+ return skipTrailingNodeMeta;
1980
+ }
1981
+ });