@react-email/editor 0.0.0-experimental.45 → 0.0.0-experimental.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{event-bus-BFzKTuhV.mjs → columns-DC8gJU2D.mjs} +5 -88
- package/dist/columns-DC8gJU2D.mjs.map +1 -0
- package/dist/{event-bus-D-uahiao.cjs → columns-DFnIRlLe.cjs} +6 -107
- package/dist/core/index.cjs +5 -6
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.mts +2 -3
- package/dist/core/index.mjs +3 -3
- package/dist/core-BxIUuTKo.mjs +156 -0
- package/dist/core-BxIUuTKo.mjs.map +1 -0
- package/dist/core-i3eza_VQ.cjs +173 -0
- package/dist/event-bus-BxVEXi1L.mjs +88 -0
- package/dist/event-bus-BxVEXi1L.mjs.map +1 -0
- package/dist/event-bus-GmFPYJu2.cjs +105 -0
- package/dist/{extension-DHsEsAaO.cjs → extension-CoGXXzHr.cjs} +4 -3
- package/dist/{extension-B_ImOuII.mjs → extension-DgSX6dcu.mjs} +3 -2
- package/dist/{extension-B_ImOuII.mjs.map → extension-DgSX6dcu.mjs.map} +1 -1
- package/dist/extensions/index.cjs +10 -10
- package/dist/extensions/index.d.cts +1 -1
- package/dist/extensions/index.d.mts +1 -2
- package/dist/extensions/index.d.mts.map +1 -1
- package/dist/extensions/index.mjs +3 -3
- package/dist/{extensions-BT49qi4I.mjs → extensions-CGtkbFUL.mjs} +13 -352
- package/dist/extensions-CGtkbFUL.mjs.map +1 -0
- package/dist/{extensions-5sSJryUX.cjs → extensions-DE0L4Pim.cjs} +79 -455
- package/dist/global-content-CaNsyaPw.mjs +78 -0
- package/dist/global-content-CaNsyaPw.mjs.map +1 -0
- package/dist/global-content-Dcc6RTLp.cjs +89 -0
- package/dist/{index-BL2rehV8.d.mts → index-BMsf5s28.d.mts} +3 -34
- package/dist/index-BMsf5s28.d.mts.map +1 -0
- package/dist/{index-DJgMqa5C.d.cts → index-DNriNUPU.d.cts} +3 -34
- package/dist/index-DNriNUPU.d.cts.map +1 -0
- package/dist/index.cjs +136 -7
- package/dist/index.d.cts +11 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +9 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +132 -3
- package/dist/index.mjs.map +1 -1
- package/dist/plugins/index.cjs +1 -1
- package/dist/plugins/index.d.cts +1 -1
- package/dist/plugins/index.d.mts +1 -1
- package/dist/plugins/index.mjs +1 -1
- package/dist/{root-CEAehvsX.cjs → root-BYXulnav.cjs} +7 -6
- package/dist/{root-CJuwiIRn.mjs → root-SovCbqdr.mjs} +4 -3
- package/dist/{root-CJuwiIRn.mjs.map → root-SovCbqdr.mjs.map} +1 -1
- package/dist/{set-text-alignment-GMXOPMlJ.mjs → set-text-alignment-BTFzq8uT.mjs} +1 -1
- package/dist/{set-text-alignment-GMXOPMlJ.mjs.map → set-text-alignment-BTFzq8uT.mjs.map} +1 -1
- package/dist/{global-content-D3TNgSN6.cjs → styles-CYEzPPfZ.cjs} +0 -88
- package/dist/{global-content-6jVh6L0b.mjs → styles-DZ9S92ix.mjs} +2 -78
- package/dist/styles-DZ9S92ix.mjs.map +1 -0
- package/dist/{types-BNEbRz-a.d.cts → types-B-hiUAR9.d.cts} +1 -1
- package/dist/{types-BNEbRz-a.d.cts.map → types-B-hiUAR9.d.cts.map} +1 -1
- package/dist/{types-C8k-blF7.d.mts → types-J7sLqbPy.d.mts} +1 -1
- package/dist/{types-C8k-blF7.d.mts.map → types-J7sLqbPy.d.mts.map} +1 -1
- package/dist/ui/index.cjs +17 -17
- package/dist/ui/index.d.cts +108 -108
- package/dist/ui/index.d.cts.map +1 -1
- package/dist/ui/index.d.mts +107 -107
- package/dist/ui/index.d.mts.map +1 -1
- package/dist/ui/index.mjs +4 -4
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.mjs +1 -1
- package/package.json +1 -1
- package/readme.md +1 -1
- package/dist/create-paste-handler-B8BtjBk3.d.cts +0 -14
- package/dist/create-paste-handler-B8BtjBk3.d.cts.map +0 -1
- package/dist/create-paste-handler-DsJYKisA.d.mts +0 -14
- package/dist/create-paste-handler-DsJYKisA.d.mts.map +0 -1
- package/dist/event-bus-BFzKTuhV.mjs.map +0 -1
- package/dist/extensions-BT49qi4I.mjs.map +0 -1
- package/dist/global-content-6jVh6L0b.mjs.map +0 -1
- package/dist/index-BL2rehV8.d.mts.map +0 -1
- package/dist/index-DJgMqa5C.d.cts.map +0 -1
- /package/dist/{set-text-alignment-aNb7Ml9N.cjs → set-text-alignment-DWSnscb6.cjs} +0 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
1
|
+
import { a as resolveConflictingStyles, r as inlineCssToJs } from "./styles-DZ9S92ix.mjs";
|
|
2
|
+
import { r as EmailMark } from "./core-BxIUuTKo.mjs";
|
|
3
|
+
import { r as EmailNode, t as editorEventBus } from "./event-bus-BxVEXi1L.mjs";
|
|
4
|
+
import { a as ThreeColumns, c as hasPrismThemeLoaded, d as COMMON_HTML_ATTRIBUTES, f as LAYOUT_ATTRIBUTES, g as createStandardAttributes, h as TABLE_HEADER_ATTRIBUTES, l as loadPrismTheme, m as TABLE_CELL_ATTRIBUTES, n as ColumnsColumn, o as TwoColumns, p as TABLE_ATTRIBUTES, r as FourColumns, u as removePrismTheme } from "./columns-DC8gJU2D.mjs";
|
|
5
|
+
import { t as GlobalContent } from "./global-content-CaNsyaPw.mjs";
|
|
6
|
+
import { NodeViewContent, NodeViewWrapper, ReactNodeViewRenderer } from "@tiptap/react";
|
|
6
7
|
import * as ReactEmailComponents from "@react-email/components";
|
|
7
|
-
import {
|
|
8
|
-
import { Fragment, jsx
|
|
9
|
-
import { Extension, InputRule,
|
|
8
|
+
import { Button, CodeBlock, Column, Container, Heading, Hr, Link, Row, Section } from "@react-email/components";
|
|
9
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
10
|
+
import { Extension, InputRule, Node, findChildren, mergeAttributes } from "@tiptap/core";
|
|
10
11
|
import { UndoRedo } from "@tiptap/extensions";
|
|
11
12
|
import TipTapStarterKit from "@tiptap/starter-kit";
|
|
12
13
|
import BlockquoteBase from "@tiptap/extension-blockquote";
|
|
@@ -32,256 +33,6 @@ import SuperscriptBase from "@tiptap/extension-superscript";
|
|
|
32
33
|
import { Text } from "@tiptap/extension-text";
|
|
33
34
|
import UnderlineBase from "@tiptap/extension-underline";
|
|
34
35
|
|
|
35
|
-
//#region src/core/create-drop-handler.ts
|
|
36
|
-
function createDropHandler({ onPaste, onUploadImage }) {
|
|
37
|
-
return (view, event, _slice, moved) => {
|
|
38
|
-
if (!moved && event.dataTransfer && event.dataTransfer.files && event.dataTransfer.files[0]) {
|
|
39
|
-
event.preventDefault();
|
|
40
|
-
const file = event.dataTransfer.files[0];
|
|
41
|
-
if (onPaste?.(file, view)) return true;
|
|
42
|
-
if (file.type.includes("image/") && onUploadImage) {
|
|
43
|
-
onUploadImage(file, view, (view.posAtCoords({
|
|
44
|
-
left: event.clientX,
|
|
45
|
-
top: event.clientY
|
|
46
|
-
})?.pos || 0) - 1);
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return false;
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
//#endregion
|
|
55
|
-
//#region src/utils/paste-sanitizer.ts
|
|
56
|
-
/**
|
|
57
|
-
* Sanitizes pasted HTML.
|
|
58
|
-
* - From editor (has node-* classes): pass through as-is
|
|
59
|
-
* - From external: strip all styles/classes, keep only semantic HTML
|
|
60
|
-
*/
|
|
61
|
-
/**
|
|
62
|
-
* Detects content from the Resend editor by checking for node-* class names.
|
|
63
|
-
*/
|
|
64
|
-
const EDITOR_CLASS_PATTERN = /class="[^"]*node-/;
|
|
65
|
-
/**
|
|
66
|
-
* Attributes to preserve on specific elements for EXTERNAL content.
|
|
67
|
-
* Only functional attributes - NO style or class.
|
|
68
|
-
*/
|
|
69
|
-
const PRESERVED_ATTRIBUTES = {
|
|
70
|
-
a: [
|
|
71
|
-
"href",
|
|
72
|
-
"target",
|
|
73
|
-
"rel"
|
|
74
|
-
],
|
|
75
|
-
img: [
|
|
76
|
-
"src",
|
|
77
|
-
"alt",
|
|
78
|
-
"width",
|
|
79
|
-
"height"
|
|
80
|
-
],
|
|
81
|
-
td: ["colspan", "rowspan"],
|
|
82
|
-
th: [
|
|
83
|
-
"colspan",
|
|
84
|
-
"rowspan",
|
|
85
|
-
"scope"
|
|
86
|
-
],
|
|
87
|
-
table: [
|
|
88
|
-
"border",
|
|
89
|
-
"cellpadding",
|
|
90
|
-
"cellspacing"
|
|
91
|
-
],
|
|
92
|
-
"*": ["id"]
|
|
93
|
-
};
|
|
94
|
-
function isFromEditor(html) {
|
|
95
|
-
return EDITOR_CLASS_PATTERN.test(html);
|
|
96
|
-
}
|
|
97
|
-
function sanitizePastedHtml(html) {
|
|
98
|
-
if (isFromEditor(html)) return html;
|
|
99
|
-
const doc = new DOMParser().parseFromString(html, "text/html");
|
|
100
|
-
sanitizeNode(doc.body);
|
|
101
|
-
return doc.body.innerHTML;
|
|
102
|
-
}
|
|
103
|
-
function sanitizeNode(node) {
|
|
104
|
-
if (node.nodeType === Node.ELEMENT_NODE) sanitizeElement(node);
|
|
105
|
-
for (const child of Array.from(node.childNodes)) sanitizeNode(child);
|
|
106
|
-
}
|
|
107
|
-
function sanitizeElement(el) {
|
|
108
|
-
const allowedForTag = PRESERVED_ATTRIBUTES[el.tagName.toLowerCase()] || [];
|
|
109
|
-
const allowedGlobal = PRESERVED_ATTRIBUTES["*"] || [];
|
|
110
|
-
const allowed = new Set([...allowedForTag, ...allowedGlobal]);
|
|
111
|
-
const attributesToRemove = [];
|
|
112
|
-
for (const attr of Array.from(el.attributes)) {
|
|
113
|
-
if (attr.name.startsWith("data-")) {
|
|
114
|
-
attributesToRemove.push(attr.name);
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
if (!allowed.has(attr.name)) attributesToRemove.push(attr.name);
|
|
118
|
-
}
|
|
119
|
-
for (const attr of attributesToRemove) el.removeAttribute(attr);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
//#endregion
|
|
123
|
-
//#region src/core/create-paste-handler.ts
|
|
124
|
-
function createPasteHandler({ onPaste, onUploadImage, extensions: extensions$1 }) {
|
|
125
|
-
return (view, event, slice) => {
|
|
126
|
-
const text = event.clipboardData?.getData("text/plain");
|
|
127
|
-
if (text && onPaste?.(text, view)) {
|
|
128
|
-
event.preventDefault();
|
|
129
|
-
return true;
|
|
130
|
-
}
|
|
131
|
-
if (event.clipboardData?.files?.[0]) {
|
|
132
|
-
const file = event.clipboardData.files[0];
|
|
133
|
-
if (onPaste?.(file, view)) {
|
|
134
|
-
event.preventDefault();
|
|
135
|
-
return true;
|
|
136
|
-
}
|
|
137
|
-
if (file.type.includes("image/") && onUploadImage) {
|
|
138
|
-
const pos = view.state.selection.from;
|
|
139
|
-
onUploadImage(file, view, pos);
|
|
140
|
-
return true;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* If the coming content has a single child, we can assume
|
|
145
|
-
* it's a plain text and doesn't need to be parsed and
|
|
146
|
-
* be introduced in a new line
|
|
147
|
-
*/
|
|
148
|
-
if (slice.content.childCount === 1) return false;
|
|
149
|
-
if (event.clipboardData?.getData?.("text/html")) {
|
|
150
|
-
event.preventDefault();
|
|
151
|
-
const jsonContent = generateJSON(sanitizePastedHtml(event.clipboardData.getData("text/html")), extensions$1);
|
|
152
|
-
const node = view.state.schema.nodeFromJSON(jsonContent);
|
|
153
|
-
const transaction = view.state.tr.replaceSelectionWith(node, false);
|
|
154
|
-
view.dispatch(transaction);
|
|
155
|
-
return true;
|
|
156
|
-
}
|
|
157
|
-
return false;
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
//#endregion
|
|
162
|
-
//#region src/core/serializer/default-base-template.tsx
|
|
163
|
-
function DefaultBaseTemplate({ children, previewText }) {
|
|
164
|
-
return /* @__PURE__ */ jsxs(Html, { children: [
|
|
165
|
-
/* @__PURE__ */ jsxs(Head, { children: [
|
|
166
|
-
/* @__PURE__ */ jsx("meta", {
|
|
167
|
-
content: "width=device-width",
|
|
168
|
-
name: "viewport"
|
|
169
|
-
}),
|
|
170
|
-
/* @__PURE__ */ jsx("meta", {
|
|
171
|
-
content: "IE=edge",
|
|
172
|
-
httpEquiv: "X-UA-Compatible"
|
|
173
|
-
}),
|
|
174
|
-
/* @__PURE__ */ jsx("meta", { name: "x-apple-disable-message-reformatting" }),
|
|
175
|
-
/* @__PURE__ */ jsx("meta", {
|
|
176
|
-
content: "telephone=no,address=no,email=no,date=no,url=no",
|
|
177
|
-
name: "format-detection"
|
|
178
|
-
})
|
|
179
|
-
] }),
|
|
180
|
-
previewText && previewText !== "" && /* @__PURE__ */ jsx(Preview, { children: previewText }),
|
|
181
|
-
/* @__PURE__ */ jsx(Body, { children })
|
|
182
|
-
] });
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
//#endregion
|
|
186
|
-
//#region src/core/serializer/email-mark.ts
|
|
187
|
-
var EmailMark = class EmailMark extends Mark {
|
|
188
|
-
constructor(config) {
|
|
189
|
-
super(config);
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Create a new Mark instance
|
|
193
|
-
* @param config - Mark configuration object or a function that returns a configuration object
|
|
194
|
-
*/
|
|
195
|
-
static create(config) {
|
|
196
|
-
return new EmailMark(typeof config === "function" ? config() : config);
|
|
197
|
-
}
|
|
198
|
-
static from(mark, renderToReactEmail) {
|
|
199
|
-
const customMark = EmailMark.create({});
|
|
200
|
-
Object.assign(customMark, { ...mark });
|
|
201
|
-
customMark.config = {
|
|
202
|
-
...mark.config,
|
|
203
|
-
renderToReactEmail
|
|
204
|
-
};
|
|
205
|
-
return customMark;
|
|
206
|
-
}
|
|
207
|
-
configure(options) {
|
|
208
|
-
return super.configure(options);
|
|
209
|
-
}
|
|
210
|
-
extend(extendedConfig) {
|
|
211
|
-
const resolvedConfig = typeof extendedConfig === "function" ? extendedConfig() : extendedConfig;
|
|
212
|
-
return super.extend(resolvedConfig);
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
//#endregion
|
|
217
|
-
//#region src/core/serializer/compose-react-email.tsx
|
|
218
|
-
const NODES_WITH_INCREMENTED_CHILD_DEPTH = new Set(["bulletList", "orderedList"]);
|
|
219
|
-
function getMarkRank(schema, markName) {
|
|
220
|
-
return schema.marks[markName]?.rank ?? Number.MAX_SAFE_INTEGER;
|
|
221
|
-
}
|
|
222
|
-
/** Sort marks by schema rank (Tiptap extension priority → ProseMirror order). */
|
|
223
|
-
function sortMarksBySchema(marks, schema) {
|
|
224
|
-
return [...marks].sort((a, b) => getMarkRank(schema, b.type) - getMarkRank(schema, a.type));
|
|
225
|
-
}
|
|
226
|
-
const composeReactEmail = async ({ editor, preview }) => {
|
|
227
|
-
const data = editor.getJSON();
|
|
228
|
-
const extensions$1 = editor.extensionManager.extensions;
|
|
229
|
-
const serializerPlugin = extensions$1.map((ext) => ext.options?.serializerPlugin).filter((p) => Boolean(p)).at(-1);
|
|
230
|
-
const typeToExtensionMap = Object.fromEntries(extensions$1.map((extension) => [extension.name, extension]));
|
|
231
|
-
function parseContent(content, depth = 0) {
|
|
232
|
-
if (!content) return;
|
|
233
|
-
return content.map((node, index) => {
|
|
234
|
-
const style = serializerPlugin?.getNodeStyles(node, depth, editor) ?? {};
|
|
235
|
-
const inlineStyles = inlineCssToJs(node.attrs?.style);
|
|
236
|
-
if (!node.type) return null;
|
|
237
|
-
const emailNode = typeToExtensionMap[node.type];
|
|
238
|
-
if (!emailNode || !(emailNode instanceof EmailNode)) return null;
|
|
239
|
-
const NodeComponent = emailNode.config.renderToReactEmail;
|
|
240
|
-
const childDepth = NODES_WITH_INCREMENTED_CHILD_DEPTH.has(node.type) ? depth + 1 : depth;
|
|
241
|
-
let renderedNode = node.text ? node.text : /* @__PURE__ */ jsx(NodeComponent, {
|
|
242
|
-
node: node.type === "table" && inlineStyles.width && !node.attrs?.width ? {
|
|
243
|
-
...node,
|
|
244
|
-
attrs: {
|
|
245
|
-
...node.attrs,
|
|
246
|
-
width: inlineStyles.width
|
|
247
|
-
}
|
|
248
|
-
} : node,
|
|
249
|
-
style,
|
|
250
|
-
extension: emailNode,
|
|
251
|
-
children: parseContent(node.content, childDepth)
|
|
252
|
-
}, index);
|
|
253
|
-
if (node.marks) for (const mark of sortMarksBySchema(node.marks, editor.schema)) {
|
|
254
|
-
const emailMark = typeToExtensionMap[mark.type];
|
|
255
|
-
if (emailMark instanceof EmailMark) {
|
|
256
|
-
const MarkComponent = emailMark.config.renderToReactEmail;
|
|
257
|
-
renderedNode = /* @__PURE__ */ jsx(MarkComponent, {
|
|
258
|
-
mark,
|
|
259
|
-
node,
|
|
260
|
-
style: serializerPlugin?.getNodeStyles({
|
|
261
|
-
type: mark.type,
|
|
262
|
-
attrs: mark.attrs ?? {}
|
|
263
|
-
}, depth, editor) ?? {},
|
|
264
|
-
extension: emailMark,
|
|
265
|
-
children: renderedNode
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
return renderedNode;
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
const unformattedHtml = await render(/* @__PURE__ */ jsx(serializerPlugin?.BaseTemplate ?? DefaultBaseTemplate, {
|
|
273
|
-
previewText: preview,
|
|
274
|
-
editor,
|
|
275
|
-
children: parseContent(data.content)
|
|
276
|
-
}));
|
|
277
|
-
const [prettyHtml, text] = await Promise.all([pretty(unformattedHtml), toPlainText(unformattedHtml)]);
|
|
278
|
-
return {
|
|
279
|
-
html: prettyHtml,
|
|
280
|
-
text
|
|
281
|
-
};
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
//#endregion
|
|
285
36
|
//#region src/extensions/alignment-attribute.tsx
|
|
286
37
|
const AlignmentAttribute = Extension.create({
|
|
287
38
|
name: "alignmentAttribute",
|
|
@@ -926,96 +677,6 @@ const Div = EmailNode.create({
|
|
|
926
677
|
}
|
|
927
678
|
});
|
|
928
679
|
|
|
929
|
-
//#endregion
|
|
930
|
-
//#region src/core/is-document-visually-empty.ts
|
|
931
|
-
function isDocumentVisuallyEmpty(doc) {
|
|
932
|
-
let nonGlobalNodeCount = 0;
|
|
933
|
-
let firstNonGlobalNode = null;
|
|
934
|
-
for (let index = 0; index < doc.childCount; index += 1) {
|
|
935
|
-
const node = doc.child(index);
|
|
936
|
-
if (node.type.name === "globalContent") continue;
|
|
937
|
-
nonGlobalNodeCount += 1;
|
|
938
|
-
if (firstNonGlobalNode === null) firstNonGlobalNode = node;
|
|
939
|
-
}
|
|
940
|
-
if (nonGlobalNodeCount === 0) return true;
|
|
941
|
-
if (nonGlobalNodeCount !== 1) return false;
|
|
942
|
-
if (firstNonGlobalNode.type.name === "container") return hasOnlyEmptyParagraph(firstNonGlobalNode);
|
|
943
|
-
return isEmptyParagraph(firstNonGlobalNode);
|
|
944
|
-
}
|
|
945
|
-
function hasOnlyEmptyParagraph(node) {
|
|
946
|
-
if (node.childCount === 0) return true;
|
|
947
|
-
if (node.childCount !== 1) return false;
|
|
948
|
-
return isEmptyParagraph(node.child(0));
|
|
949
|
-
}
|
|
950
|
-
function isEmptyParagraph(node) {
|
|
951
|
-
return node.type.name === "paragraph" && node.content.size === 0;
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
//#endregion
|
|
955
|
-
//#region src/core/use-editor.ts
|
|
956
|
-
function useEditor$1({ content, extensions: extensions$1 = [], onUpdate, onPaste, onUploadImage, onReady, editable = true, ...rest }) {
|
|
957
|
-
const [contentError, setContentError] = React$1.useState(null);
|
|
958
|
-
const isCollaborative = hasCollaborationExtension(extensions$1);
|
|
959
|
-
const effectiveExtensions = React$1.useMemo(() => [
|
|
960
|
-
StarterKit.configure({ UndoRedo: false }),
|
|
961
|
-
...isCollaborative ? [] : [UndoRedo],
|
|
962
|
-
...extensions$1
|
|
963
|
-
], [extensions$1, isCollaborative]);
|
|
964
|
-
const editor = useEditor({
|
|
965
|
-
content: isCollaborative ? void 0 : content,
|
|
966
|
-
extensions: effectiveExtensions,
|
|
967
|
-
editable,
|
|
968
|
-
immediatelyRender: false,
|
|
969
|
-
enableContentCheck: true,
|
|
970
|
-
onContentError({ editor: editor$1, error, disableCollaboration }) {
|
|
971
|
-
disableCollaboration();
|
|
972
|
-
setContentError(error);
|
|
973
|
-
console.error(error);
|
|
974
|
-
editor$1.setEditable(false);
|
|
975
|
-
},
|
|
976
|
-
onCreate({ editor: editor$1 }) {
|
|
977
|
-
onReady?.(editor$1);
|
|
978
|
-
},
|
|
979
|
-
onUpdate({ editor: editor$1, transaction }) {
|
|
980
|
-
onUpdate?.(editor$1, transaction);
|
|
981
|
-
},
|
|
982
|
-
editorProps: {
|
|
983
|
-
handleDOMEvents: { click: (view, event) => {
|
|
984
|
-
if (!view.editable) {
|
|
985
|
-
if (event.target.closest("a")) {
|
|
986
|
-
event.preventDefault();
|
|
987
|
-
return true;
|
|
988
|
-
}
|
|
989
|
-
}
|
|
990
|
-
return false;
|
|
991
|
-
} },
|
|
992
|
-
handlePaste: createPasteHandler({
|
|
993
|
-
onPaste,
|
|
994
|
-
onUploadImage,
|
|
995
|
-
extensions: effectiveExtensions
|
|
996
|
-
}),
|
|
997
|
-
handleDrop: createDropHandler({
|
|
998
|
-
onPaste,
|
|
999
|
-
onUploadImage
|
|
1000
|
-
})
|
|
1001
|
-
},
|
|
1002
|
-
...rest
|
|
1003
|
-
});
|
|
1004
|
-
return {
|
|
1005
|
-
editor,
|
|
1006
|
-
isEditorEmpty: useEditorState({
|
|
1007
|
-
editor,
|
|
1008
|
-
selector: (context) => {
|
|
1009
|
-
if (!context.editor) return true;
|
|
1010
|
-
return isDocumentVisuallyEmpty(context.editor.state.doc);
|
|
1011
|
-
}
|
|
1012
|
-
}) ?? true,
|
|
1013
|
-
extensions: effectiveExtensions,
|
|
1014
|
-
contentError,
|
|
1015
|
-
isCollaborative
|
|
1016
|
-
};
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
680
|
//#endregion
|
|
1020
681
|
//#region src/extensions/divider.tsx
|
|
1021
682
|
const Divider = EmailNode.from(HorizontalRule.extend({
|
|
@@ -1376,7 +1037,7 @@ const Placeholder = TipTapPlaceholder.configure({
|
|
|
1376
1037
|
|
|
1377
1038
|
//#endregion
|
|
1378
1039
|
//#region src/extensions/preview-text.ts
|
|
1379
|
-
const PreviewText = Node
|
|
1040
|
+
const PreviewText = Node.create({
|
|
1380
1041
|
name: "previewText",
|
|
1381
1042
|
group: "block",
|
|
1382
1043
|
selectable: false,
|
|
@@ -1735,7 +1396,7 @@ const TableCell = EmailNode.create({
|
|
|
1735
1396
|
});
|
|
1736
1397
|
}
|
|
1737
1398
|
});
|
|
1738
|
-
const TableHeader = Node
|
|
1399
|
+
const TableHeader = Node.create({
|
|
1739
1400
|
name: "tableHeader",
|
|
1740
1401
|
group: "tableCell",
|
|
1741
1402
|
content: "block+",
|
|
@@ -2116,5 +1777,5 @@ const StarterKit = Extension.create({
|
|
|
2116
1777
|
});
|
|
2117
1778
|
|
|
2118
1779
|
//#endregion
|
|
2119
|
-
export {
|
|
2120
|
-
//# sourceMappingURL=extensions-
|
|
1780
|
+
export { CodeBlockPrism as A, processStylesForUnlink as C, Divider as D, HardBreak as E, Bold as F, Body$1 as I, Blockquote as L, ClassAttribute as M, Button$1 as N, Div as O, BulletList as P, AlignmentAttribute as R, PreservedStyle as S, Heading$2 as T, Paragraph as _, skipTrailingNodeMeta as a, ListItem as b, TableCell as c, Sup as d, StyleAttribute as f, Placeholder as g, PreviewText as h, TrailingNode as i, Code as j, Container$1 as k, TableHeader as l, Section$1 as m, Uppercase as n, Text$1 as o, Strike as p, Underline as r, Table as s, StarterKit as t, TableRow as u, OrderedList as v, Italic as w, Link$1 as x, MaxNesting as y };
|
|
1781
|
+
//# sourceMappingURL=extensions-CGtkbFUL.mjs.map
|