@react-email/editor 0.0.0-experimental.26 → 0.0.0-experimental.28
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/{columns-ZSaLdkg9.cjs → columns-BXN-NNd4.cjs} +3 -183
- package/dist/{columns-CUxUEHje.mjs → columns-Cos2lqfu.mjs} +3 -171
- package/dist/columns-Cos2lqfu.mjs.map +1 -0
- package/dist/core/index.cjs +2 -2
- package/dist/core/index.d.cts +1 -1
- package/dist/core/index.d.mts +1 -1
- package/dist/core/index.mjs +2 -2
- package/dist/{core-DpfUR_iP.cjs → core-BHyps3LA.cjs} +40 -124
- package/dist/{core-C0EkaM-K.mjs → core-BjxjzlNZ.mjs} +20 -92
- package/dist/core-BjxjzlNZ.mjs.map +1 -0
- package/dist/extensions/index.cjs +5 -4
- package/dist/extensions/index.d.cts +1 -1
- package/dist/extensions/index.d.mts +1 -1
- package/dist/extensions/index.mjs +3 -2
- package/dist/global-content-BRvA4PRG.cjs +89 -0
- package/dist/global-content-kdUzYcsA.mjs +78 -0
- package/dist/global-content-kdUzYcsA.mjs.map +1 -0
- package/dist/{index-BPjgJSQh.d.cts → index-jGyVEd5q.d.cts} +1 -1
- package/dist/{index-BPjgJSQh.d.cts.map → index-jGyVEd5q.d.cts.map} +1 -1
- package/dist/{index-4EvOA-Ll.d.mts → index-ozCcANmD.d.mts} +1 -1
- package/dist/{index-4EvOA-Ll.d.mts.map → index-ozCcANmD.d.mts.map} +1 -1
- package/dist/plugins/index.cjs +747 -0
- package/dist/plugins/index.d.cts +79 -0
- package/dist/plugins/index.d.cts.map +1 -0
- package/dist/plugins/index.d.mts +79 -0
- package/dist/plugins/index.d.mts.map +1 -0
- package/dist/plugins/index.mjs +742 -0
- package/dist/plugins/index.mjs.map +1 -0
- package/dist/{set-text-alignment-DZvgnbvz.mjs → set-text-alignment-BO24ieeE.mjs} +1 -1
- package/dist/{set-text-alignment-DZvgnbvz.mjs.map → set-text-alignment-BO24ieeE.mjs.map} +1 -1
- package/dist/styles-C-cCyJCn.cjs +211 -0
- package/dist/styles-DLviD0JK.mjs +194 -0
- package/dist/styles-DLviD0JK.mjs.map +1 -0
- package/dist/ui/index.cjs +2 -2
- package/dist/ui/index.d.cts +1 -1
- package/dist/ui/index.d.mts +42 -42
- package/dist/ui/index.mjs +2 -2
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.mjs +1 -1
- package/package.json +13 -3
- package/dist/columns-CUxUEHje.mjs.map +0 -1
- package/dist/core-C0EkaM-K.mjs.map +0 -1
- /package/dist/{set-text-alignment-Bx3bPteH.cjs → set-text-alignment-CbECklB4.cjs} +0 -0
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const require_columns = require('./columns-
|
|
1
|
+
const require_columns = require('./columns-BXN-NNd4.cjs');
|
|
2
|
+
const require_styles = require('./styles-C-cCyJCn.cjs');
|
|
3
|
+
const require_global_content = require('./global-content-BRvA4PRG.cjs');
|
|
2
4
|
let _react_email_components = require("@react-email/components");
|
|
3
5
|
_react_email_components = require_columns.__toESM(_react_email_components);
|
|
4
6
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -143,18 +145,29 @@ const composeReactEmail = async ({ editor, preview }) => {
|
|
|
143
145
|
if (!content) return;
|
|
144
146
|
return content.map((node, index) => {
|
|
145
147
|
const style = serializerPlugin?.getNodeStyles(node, depth, editor) ?? {};
|
|
146
|
-
const inlineStyles =
|
|
148
|
+
const inlineStyles = require_styles.inlineCssToJs(node.attrs?.style);
|
|
147
149
|
if (!node.type) return null;
|
|
148
150
|
const emailNode = typeToExtensionMap[node.type];
|
|
149
151
|
if (!emailNode || !(emailNode instanceof require_columns.EmailNode)) return null;
|
|
150
152
|
const NodeComponent = emailNode.config.renderToReactEmail;
|
|
151
153
|
const childDepth = NODES_WITH_INCREMENTED_CHILD_DEPTH.has(node.type) ? depth + 1 : depth;
|
|
152
|
-
let
|
|
154
|
+
let renderedNode = node.text ? node.text : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NodeComponent, {
|
|
155
|
+
node: node.type === "table" && inlineStyles.width && !node.attrs?.width ? {
|
|
156
|
+
...node,
|
|
157
|
+
attrs: {
|
|
158
|
+
...node.attrs,
|
|
159
|
+
width: inlineStyles.width
|
|
160
|
+
}
|
|
161
|
+
} : node,
|
|
162
|
+
style,
|
|
163
|
+
extension: emailNode,
|
|
164
|
+
children: parseContent(node.content, childDepth)
|
|
165
|
+
}, index);
|
|
153
166
|
if (node.marks) for (const mark of node.marks) {
|
|
154
167
|
const emailMark = typeToExtensionMap[mark.type];
|
|
155
168
|
if (emailMark instanceof EmailMark) {
|
|
156
169
|
const MarkComponent = emailMark.config.renderToReactEmail;
|
|
157
|
-
|
|
170
|
+
renderedNode = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkComponent, {
|
|
158
171
|
mark,
|
|
159
172
|
node,
|
|
160
173
|
style: serializerPlugin?.getNodeStyles({
|
|
@@ -162,22 +175,11 @@ const composeReactEmail = async ({ editor, preview }) => {
|
|
|
162
175
|
attrs: mark.attrs ?? {}
|
|
163
176
|
}, depth, editor) ?? {},
|
|
164
177
|
extension: emailMark,
|
|
165
|
-
children
|
|
178
|
+
children: renderedNode
|
|
166
179
|
});
|
|
167
180
|
}
|
|
168
181
|
}
|
|
169
|
-
return
|
|
170
|
-
node: node.type === "table" && inlineStyles.width && !node.attrs?.width ? {
|
|
171
|
-
...node,
|
|
172
|
-
attrs: {
|
|
173
|
-
...node.attrs,
|
|
174
|
-
width: inlineStyles.width
|
|
175
|
-
}
|
|
176
|
-
} : node,
|
|
177
|
-
style,
|
|
178
|
-
extension: emailNode,
|
|
179
|
-
children
|
|
180
|
-
}, index);
|
|
182
|
+
return renderedNode;
|
|
181
183
|
});
|
|
182
184
|
}
|
|
183
185
|
const unformattedHtml = await (0, _react_email_components.render)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(serializerPlugin?.BaseTemplate ?? DefaultBaseTemplate, {
|
|
@@ -264,7 +266,7 @@ const Blockquote = require_columns.EmailNode.from(_tiptap_extension_blockquote.d
|
|
|
264
266
|
className: node.attrs?.class || void 0,
|
|
265
267
|
style: {
|
|
266
268
|
...style,
|
|
267
|
-
...
|
|
269
|
+
...require_styles.inlineCssToJs(node.attrs?.style),
|
|
268
270
|
...getTextAlignment(node.attrs?.align || node.attrs?.alignment)
|
|
269
271
|
},
|
|
270
272
|
children
|
|
@@ -303,7 +305,7 @@ const Body = require_columns.EmailNode.create({
|
|
|
303
305
|
];
|
|
304
306
|
},
|
|
305
307
|
renderToReactEmail({ children, node, style }) {
|
|
306
|
-
const inlineStyles =
|
|
308
|
+
const inlineStyles = require_styles.inlineCssToJs(node.attrs?.style);
|
|
307
309
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
308
310
|
className: node.attrs?.class || void 0,
|
|
309
311
|
style: {
|
|
@@ -341,7 +343,7 @@ const BulletList = require_columns.EmailNode.from(_tiptap_extension_bullet_list.
|
|
|
341
343
|
className: node.attrs?.class || void 0,
|
|
342
344
|
style: {
|
|
343
345
|
...style,
|
|
344
|
-
...
|
|
346
|
+
...require_styles.inlineCssToJs(node.attrs?.style)
|
|
345
347
|
},
|
|
346
348
|
children
|
|
347
349
|
}));
|
|
@@ -409,7 +411,7 @@ const Button = require_columns.EmailNode.create({
|
|
|
409
411
|
};
|
|
410
412
|
},
|
|
411
413
|
renderToReactEmail({ children, node, style }) {
|
|
412
|
-
const inlineStyles =
|
|
414
|
+
const inlineStyles = require_styles.inlineCssToJs(node.attrs?.style);
|
|
413
415
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_react_email_components.Row, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_react_email_components.Column, {
|
|
414
416
|
align: node.attrs?.align || node.attrs?.alignment,
|
|
415
417
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_react_email_components.Button, {
|
|
@@ -472,7 +474,7 @@ const ClassAttribute = _tiptap_core.Extension.create({
|
|
|
472
474
|
const Code = EmailMark.from(_tiptap_extension_code.default, ({ children, node, style }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
|
|
473
475
|
style: {
|
|
474
476
|
...style,
|
|
475
|
-
...
|
|
477
|
+
...require_styles.inlineCssToJs(node.attrs?.style)
|
|
476
478
|
},
|
|
477
479
|
children
|
|
478
480
|
}));
|
|
@@ -743,7 +745,7 @@ const Div = require_columns.EmailNode.create({
|
|
|
743
745
|
return { ...require_columns.createStandardAttributes([...require_columns.COMMON_HTML_ATTRIBUTES, ...require_columns.LAYOUT_ATTRIBUTES]) };
|
|
744
746
|
},
|
|
745
747
|
renderToReactEmail({ children, node, style }) {
|
|
746
|
-
const inlineStyles =
|
|
748
|
+
const inlineStyles = require_styles.inlineCssToJs(node.attrs?.style);
|
|
747
749
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
748
750
|
className: node.attrs?.class || void 0,
|
|
749
751
|
style: {
|
|
@@ -780,7 +782,7 @@ const Divider = require_columns.EmailNode.from(_tiptap_extension_horizontal_rule
|
|
|
780
782
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_tiptap_react.NodeViewWrapper, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_react_email_components.Hr, {
|
|
781
783
|
...rest,
|
|
782
784
|
className: "node-hr",
|
|
783
|
-
style:
|
|
785
|
+
style: require_styles.inlineCssToJs(node.attrs.style)
|
|
784
786
|
}) });
|
|
785
787
|
});
|
|
786
788
|
}
|
|
@@ -789,85 +791,11 @@ const Divider = require_columns.EmailNode.from(_tiptap_extension_horizontal_rule
|
|
|
789
791
|
className: node.attrs?.class || void 0,
|
|
790
792
|
style: {
|
|
791
793
|
...style,
|
|
792
|
-
...
|
|
794
|
+
...require_styles.inlineCssToJs(node.attrs?.style)
|
|
793
795
|
}
|
|
794
796
|
});
|
|
795
797
|
});
|
|
796
798
|
|
|
797
|
-
//#endregion
|
|
798
|
-
//#region src/extensions/global-content.ts
|
|
799
|
-
const GLOBAL_CONTENT_NODE_TYPE = "globalContent";
|
|
800
|
-
let cachedGlobalPosition = null;
|
|
801
|
-
function findGlobalContentPositions(doc) {
|
|
802
|
-
const positions = [];
|
|
803
|
-
doc.descendants((node, position) => {
|
|
804
|
-
if (node.type.name === GLOBAL_CONTENT_NODE_TYPE) positions.push(position);
|
|
805
|
-
});
|
|
806
|
-
return positions;
|
|
807
|
-
}
|
|
808
|
-
function getCachedGlobalContentPosition(doc) {
|
|
809
|
-
if (cachedGlobalPosition != null) try {
|
|
810
|
-
if (doc.nodeAt(cachedGlobalPosition)?.type.name === GLOBAL_CONTENT_NODE_TYPE) return cachedGlobalPosition;
|
|
811
|
-
} catch {
|
|
812
|
-
cachedGlobalPosition = null;
|
|
813
|
-
}
|
|
814
|
-
cachedGlobalPosition = findGlobalContentPositions(doc)[0] ?? null;
|
|
815
|
-
return cachedGlobalPosition;
|
|
816
|
-
}
|
|
817
|
-
function getGlobalContent(key, editor) {
|
|
818
|
-
const position = getCachedGlobalContentPosition(editor.state.doc);
|
|
819
|
-
if (cachedGlobalPosition == null) return null;
|
|
820
|
-
return editor.state.doc.nodeAt(position)?.attrs.data[key] ?? null;
|
|
821
|
-
}
|
|
822
|
-
const GlobalContent = _tiptap_core.Node.create({
|
|
823
|
-
name: GLOBAL_CONTENT_NODE_TYPE,
|
|
824
|
-
addOptions() {
|
|
825
|
-
return {
|
|
826
|
-
key: GLOBAL_CONTENT_NODE_TYPE,
|
|
827
|
-
data: {}
|
|
828
|
-
};
|
|
829
|
-
},
|
|
830
|
-
group: "block",
|
|
831
|
-
selectable: false,
|
|
832
|
-
draggable: false,
|
|
833
|
-
atom: true,
|
|
834
|
-
addAttributes() {
|
|
835
|
-
return { data: { default: this.options.data } };
|
|
836
|
-
},
|
|
837
|
-
parseHTML() {
|
|
838
|
-
return [{ tag: `div[data-type="${this.name}"]` }];
|
|
839
|
-
},
|
|
840
|
-
renderHTML({ HTMLAttributes }) {
|
|
841
|
-
return ["div", (0, _tiptap_core.mergeAttributes)(HTMLAttributes, {
|
|
842
|
-
"data-type": this.name,
|
|
843
|
-
style: "width: 100%; height: 1px; visibility: hidden;"
|
|
844
|
-
})];
|
|
845
|
-
},
|
|
846
|
-
addCommands() {
|
|
847
|
-
return { setGlobalContent: (key, value) => ({ tr, dispatch }) => {
|
|
848
|
-
const ensureGlobalPosition = () => {
|
|
849
|
-
const positions = findGlobalContentPositions(tr.doc);
|
|
850
|
-
for (let i = positions.length - 1; i > 0; i--) tr.delete(positions[i], positions[i] + 1);
|
|
851
|
-
const pos = positions[0] ?? -1;
|
|
852
|
-
if (pos >= 0) cachedGlobalPosition = pos;
|
|
853
|
-
else {
|
|
854
|
-
cachedGlobalPosition = 0;
|
|
855
|
-
tr.insert(0, this.type.create());
|
|
856
|
-
}
|
|
857
|
-
};
|
|
858
|
-
if (dispatch) {
|
|
859
|
-
ensureGlobalPosition();
|
|
860
|
-
if (cachedGlobalPosition == null) return false;
|
|
861
|
-
tr.setNodeAttribute(cachedGlobalPosition, "data", {
|
|
862
|
-
...tr.doc.nodeAt(cachedGlobalPosition)?.attrs.data,
|
|
863
|
-
[key]: value
|
|
864
|
-
});
|
|
865
|
-
}
|
|
866
|
-
return true;
|
|
867
|
-
} };
|
|
868
|
-
}
|
|
869
|
-
});
|
|
870
|
-
|
|
871
799
|
//#endregion
|
|
872
800
|
//#region src/extensions/hard-break.tsx
|
|
873
801
|
const HardBreak = require_columns.EmailNode.from(_tiptap_extension_hard_break.default, () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("br", {}));
|
|
@@ -881,7 +809,7 @@ const Heading = require_columns.EmailNode.from(_tiptap_extension_heading.Heading
|
|
|
881
809
|
const attrs = {
|
|
882
810
|
...rest,
|
|
883
811
|
className: `node-h${level} ${className}`,
|
|
884
|
-
style:
|
|
812
|
+
style: require_styles.inlineCssToJs(node.attrs.style)
|
|
885
813
|
};
|
|
886
814
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_tiptap_react.NodeViewWrapper, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_react_email_components.Heading, {
|
|
887
815
|
as: `h${level}`,
|
|
@@ -895,7 +823,7 @@ const Heading = require_columns.EmailNode.from(_tiptap_extension_heading.Heading
|
|
|
895
823
|
className: node.attrs?.class || void 0,
|
|
896
824
|
style: {
|
|
897
825
|
...style,
|
|
898
|
-
...
|
|
826
|
+
...require_styles.inlineCssToJs(node.attrs?.style),
|
|
899
827
|
...getTextAlignment(node.attrs?.align ?? node.attrs?.alignment)
|
|
900
828
|
},
|
|
901
829
|
children
|
|
@@ -943,7 +871,7 @@ const PreservedStyle = EmailMark.create({
|
|
|
943
871
|
},
|
|
944
872
|
renderToReactEmail({ children, mark }) {
|
|
945
873
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
946
|
-
style: mark.attrs?.style ?
|
|
874
|
+
style: mark.attrs?.style ? require_styles.inlineCssToJs(mark.attrs.style) : void 0,
|
|
947
875
|
children
|
|
948
876
|
});
|
|
949
877
|
}
|
|
@@ -992,7 +920,7 @@ function processStylesForUnlink(styleString) {
|
|
|
992
920
|
//#endregion
|
|
993
921
|
//#region src/extensions/link.tsx
|
|
994
922
|
const Link = EmailMark.from(_tiptap_extension_link.default, ({ children, mark, style }) => {
|
|
995
|
-
const linkMarkStyle = mark.attrs?.style ?
|
|
923
|
+
const linkMarkStyle = mark.attrs?.style ? require_styles.inlineCssToJs(mark.attrs.style) : {};
|
|
996
924
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_react_email_components.Link, {
|
|
997
925
|
href: mark.attrs?.href ?? void 0,
|
|
998
926
|
rel: mark.attrs?.rel ?? void 0,
|
|
@@ -1069,7 +997,7 @@ const ListItem = require_columns.EmailNode.from(_tiptap_extension_list_item.defa
|
|
|
1069
997
|
className: node.attrs?.class || void 0,
|
|
1070
998
|
style: {
|
|
1071
999
|
...style,
|
|
1072
|
-
...
|
|
1000
|
+
...require_styles.inlineCssToJs(node.attrs?.style),
|
|
1073
1001
|
...getTextAlignment(node.attrs?.align || node.attrs?.alignment)
|
|
1074
1002
|
},
|
|
1075
1003
|
children
|
|
@@ -1157,7 +1085,7 @@ const OrderedList = require_columns.EmailNode.from(_tiptap_extension_ordered_lis
|
|
|
1157
1085
|
start: node.attrs?.start,
|
|
1158
1086
|
style: {
|
|
1159
1087
|
...style,
|
|
1160
|
-
...
|
|
1088
|
+
...require_styles.inlineCssToJs(node.attrs?.style)
|
|
1161
1089
|
},
|
|
1162
1090
|
children
|
|
1163
1091
|
}));
|
|
@@ -1170,7 +1098,7 @@ const Paragraph = require_columns.EmailNode.from(_tiptap_extension_paragraph.def
|
|
|
1170
1098
|
className: node.attrs?.class || void 0,
|
|
1171
1099
|
style: {
|
|
1172
1100
|
...style,
|
|
1173
|
-
...
|
|
1101
|
+
...require_styles.inlineCssToJs(node.attrs?.style),
|
|
1174
1102
|
...getTextAlignment(node.attrs?.align || node.attrs?.alignment)
|
|
1175
1103
|
},
|
|
1176
1104
|
children: isEmpty ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("br", {}) : children
|
|
@@ -1261,7 +1189,7 @@ const Section$1 = require_columns.EmailNode.create({
|
|
|
1261
1189
|
} };
|
|
1262
1190
|
},
|
|
1263
1191
|
renderToReactEmail({ children, node, style }) {
|
|
1264
|
-
const inlineStyles =
|
|
1192
|
+
const inlineStyles = require_styles.inlineCssToJs(node.attrs?.style);
|
|
1265
1193
|
const textAlign = node.attrs?.align || node.attrs?.alignment;
|
|
1266
1194
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_react_email_components.Section, {
|
|
1267
1195
|
className: node.attrs?.class || void 0,
|
|
@@ -1396,7 +1324,7 @@ const Table = require_columns.EmailNode.create({
|
|
|
1396
1324
|
];
|
|
1397
1325
|
},
|
|
1398
1326
|
renderToReactEmail({ children, node, style }) {
|
|
1399
|
-
const inlineStyles =
|
|
1327
|
+
const inlineStyles = require_styles.inlineCssToJs(node.attrs?.style);
|
|
1400
1328
|
const alignment = node.attrs?.align || node.attrs?.alignment;
|
|
1401
1329
|
const width = node.attrs?.width;
|
|
1402
1330
|
const centeringStyles = alignment === "center" ? {
|
|
@@ -1406,7 +1334,7 @@ const Table = require_columns.EmailNode.create({
|
|
|
1406
1334
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_react_email_components.Section, {
|
|
1407
1335
|
className: node.attrs?.class || void 0,
|
|
1408
1336
|
align: alignment,
|
|
1409
|
-
style:
|
|
1337
|
+
style: require_styles.resolveConflictingStyles(style, {
|
|
1410
1338
|
...inlineStyles,
|
|
1411
1339
|
...centeringStyles
|
|
1412
1340
|
}),
|
|
@@ -1448,7 +1376,7 @@ const TableRow = require_columns.EmailNode.create({
|
|
|
1448
1376
|
];
|
|
1449
1377
|
},
|
|
1450
1378
|
renderToReactEmail({ children, node, style }) {
|
|
1451
|
-
const inlineStyles =
|
|
1379
|
+
const inlineStyles = require_styles.inlineCssToJs(node.attrs?.style);
|
|
1452
1380
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tr", {
|
|
1453
1381
|
className: node.attrs?.class || void 0,
|
|
1454
1382
|
style: {
|
|
@@ -1493,7 +1421,7 @@ const TableCell = require_columns.EmailNode.create({
|
|
|
1493
1421
|
];
|
|
1494
1422
|
},
|
|
1495
1423
|
renderToReactEmail({ children, node, style }) {
|
|
1496
|
-
const inlineStyles =
|
|
1424
|
+
const inlineStyles = require_styles.inlineCssToJs(node.attrs?.style);
|
|
1497
1425
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_react_email_components.Column, {
|
|
1498
1426
|
className: node.attrs?.class || void 0,
|
|
1499
1427
|
align: node.attrs?.align || node.attrs?.alignment,
|
|
@@ -1636,7 +1564,7 @@ const starterKitExtensions = {
|
|
|
1636
1564
|
Div,
|
|
1637
1565
|
Button,
|
|
1638
1566
|
Section: Section$1,
|
|
1639
|
-
GlobalContent,
|
|
1567
|
+
GlobalContent: require_global_content.GlobalContent,
|
|
1640
1568
|
Text,
|
|
1641
1569
|
AlignmentAttribute,
|
|
1642
1570
|
StyleAttribute,
|
|
@@ -2064,12 +1992,6 @@ Object.defineProperty(exports, 'Divider', {
|
|
|
2064
1992
|
return Divider;
|
|
2065
1993
|
}
|
|
2066
1994
|
});
|
|
2067
|
-
Object.defineProperty(exports, 'GlobalContent', {
|
|
2068
|
-
enumerable: true,
|
|
2069
|
-
get: function () {
|
|
2070
|
-
return GlobalContent;
|
|
2071
|
-
}
|
|
2072
|
-
});
|
|
2073
1995
|
Object.defineProperty(exports, 'HardBreak', {
|
|
2074
1996
|
enumerable: true,
|
|
2075
1997
|
get: function () {
|
|
@@ -2214,12 +2136,6 @@ Object.defineProperty(exports, 'composeReactEmail', {
|
|
|
2214
2136
|
return composeReactEmail;
|
|
2215
2137
|
}
|
|
2216
2138
|
});
|
|
2217
|
-
Object.defineProperty(exports, 'getGlobalContent', {
|
|
2218
|
-
enumerable: true,
|
|
2219
|
-
get: function () {
|
|
2220
|
-
return getGlobalContent;
|
|
2221
|
-
}
|
|
2222
|
-
});
|
|
2223
2139
|
Object.defineProperty(exports, 'isDocumentVisuallyEmpty', {
|
|
2224
2140
|
enumerable: true,
|
|
2225
2141
|
get: function () {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as ThreeColumns, c as COMMON_HTML_ATTRIBUTES, d as TABLE_CELL_ATTRIBUTES, f as TABLE_HEADER_ATTRIBUTES, h as editorEventBus, l as LAYOUT_ATTRIBUTES, m as EmailNode, n as ColumnsColumn, o as TwoColumns, p as createStandardAttributes, r as FourColumns, u as TABLE_ATTRIBUTES } from "./columns-Cos2lqfu.mjs";
|
|
2
|
+
import { n as inlineCssToJs, r as resolveConflictingStyles } from "./styles-DLviD0JK.mjs";
|
|
3
|
+
import { t as GlobalContent } from "./global-content-kdUzYcsA.mjs";
|
|
2
4
|
import * as ReactEmailComponents from "@react-email/components";
|
|
3
5
|
import { Body, Button, CodeBlock, Column, Head, Heading, Hr, Html, Link, Preview, Row, Section, pretty, render, toPlainText } from "@react-email/components";
|
|
4
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -130,12 +132,23 @@ const composeReactEmail = async ({ editor, preview }) => {
|
|
|
130
132
|
if (!emailNode || !(emailNode instanceof EmailNode)) return null;
|
|
131
133
|
const NodeComponent = emailNode.config.renderToReactEmail;
|
|
132
134
|
const childDepth = NODES_WITH_INCREMENTED_CHILD_DEPTH.has(node.type) ? depth + 1 : depth;
|
|
133
|
-
let
|
|
135
|
+
let renderedNode = node.text ? node.text : /* @__PURE__ */ jsx(NodeComponent, {
|
|
136
|
+
node: node.type === "table" && inlineStyles.width && !node.attrs?.width ? {
|
|
137
|
+
...node,
|
|
138
|
+
attrs: {
|
|
139
|
+
...node.attrs,
|
|
140
|
+
width: inlineStyles.width
|
|
141
|
+
}
|
|
142
|
+
} : node,
|
|
143
|
+
style,
|
|
144
|
+
extension: emailNode,
|
|
145
|
+
children: parseContent(node.content, childDepth)
|
|
146
|
+
}, index);
|
|
134
147
|
if (node.marks) for (const mark of node.marks) {
|
|
135
148
|
const emailMark = typeToExtensionMap[mark.type];
|
|
136
149
|
if (emailMark instanceof EmailMark) {
|
|
137
150
|
const MarkComponent = emailMark.config.renderToReactEmail;
|
|
138
|
-
|
|
151
|
+
renderedNode = /* @__PURE__ */ jsx(MarkComponent, {
|
|
139
152
|
mark,
|
|
140
153
|
node,
|
|
141
154
|
style: serializerPlugin?.getNodeStyles({
|
|
@@ -143,22 +156,11 @@ const composeReactEmail = async ({ editor, preview }) => {
|
|
|
143
156
|
attrs: mark.attrs ?? {}
|
|
144
157
|
}, depth, editor) ?? {},
|
|
145
158
|
extension: emailMark,
|
|
146
|
-
children
|
|
159
|
+
children: renderedNode
|
|
147
160
|
});
|
|
148
161
|
}
|
|
149
162
|
}
|
|
150
|
-
return
|
|
151
|
-
node: node.type === "table" && inlineStyles.width && !node.attrs?.width ? {
|
|
152
|
-
...node,
|
|
153
|
-
attrs: {
|
|
154
|
-
...node.attrs,
|
|
155
|
-
width: inlineStyles.width
|
|
156
|
-
}
|
|
157
|
-
} : node,
|
|
158
|
-
style,
|
|
159
|
-
extension: emailNode,
|
|
160
|
-
children
|
|
161
|
-
}, index);
|
|
163
|
+
return renderedNode;
|
|
162
164
|
});
|
|
163
165
|
}
|
|
164
166
|
const unformattedHtml = await render(/* @__PURE__ */ jsx(serializerPlugin?.BaseTemplate ?? DefaultBaseTemplate, {
|
|
@@ -775,80 +777,6 @@ const Divider = EmailNode.from(HorizontalRule.extend({
|
|
|
775
777
|
});
|
|
776
778
|
});
|
|
777
779
|
|
|
778
|
-
//#endregion
|
|
779
|
-
//#region src/extensions/global-content.ts
|
|
780
|
-
const GLOBAL_CONTENT_NODE_TYPE = "globalContent";
|
|
781
|
-
let cachedGlobalPosition = null;
|
|
782
|
-
function findGlobalContentPositions(doc) {
|
|
783
|
-
const positions = [];
|
|
784
|
-
doc.descendants((node, position) => {
|
|
785
|
-
if (node.type.name === GLOBAL_CONTENT_NODE_TYPE) positions.push(position);
|
|
786
|
-
});
|
|
787
|
-
return positions;
|
|
788
|
-
}
|
|
789
|
-
function getCachedGlobalContentPosition(doc) {
|
|
790
|
-
if (cachedGlobalPosition != null) try {
|
|
791
|
-
if (doc.nodeAt(cachedGlobalPosition)?.type.name === GLOBAL_CONTENT_NODE_TYPE) return cachedGlobalPosition;
|
|
792
|
-
} catch {
|
|
793
|
-
cachedGlobalPosition = null;
|
|
794
|
-
}
|
|
795
|
-
cachedGlobalPosition = findGlobalContentPositions(doc)[0] ?? null;
|
|
796
|
-
return cachedGlobalPosition;
|
|
797
|
-
}
|
|
798
|
-
function getGlobalContent(key, editor) {
|
|
799
|
-
const position = getCachedGlobalContentPosition(editor.state.doc);
|
|
800
|
-
if (cachedGlobalPosition == null) return null;
|
|
801
|
-
return editor.state.doc.nodeAt(position)?.attrs.data[key] ?? null;
|
|
802
|
-
}
|
|
803
|
-
const GlobalContent = Node$1.create({
|
|
804
|
-
name: GLOBAL_CONTENT_NODE_TYPE,
|
|
805
|
-
addOptions() {
|
|
806
|
-
return {
|
|
807
|
-
key: GLOBAL_CONTENT_NODE_TYPE,
|
|
808
|
-
data: {}
|
|
809
|
-
};
|
|
810
|
-
},
|
|
811
|
-
group: "block",
|
|
812
|
-
selectable: false,
|
|
813
|
-
draggable: false,
|
|
814
|
-
atom: true,
|
|
815
|
-
addAttributes() {
|
|
816
|
-
return { data: { default: this.options.data } };
|
|
817
|
-
},
|
|
818
|
-
parseHTML() {
|
|
819
|
-
return [{ tag: `div[data-type="${this.name}"]` }];
|
|
820
|
-
},
|
|
821
|
-
renderHTML({ HTMLAttributes }) {
|
|
822
|
-
return ["div", mergeAttributes(HTMLAttributes, {
|
|
823
|
-
"data-type": this.name,
|
|
824
|
-
style: "width: 100%; height: 1px; visibility: hidden;"
|
|
825
|
-
})];
|
|
826
|
-
},
|
|
827
|
-
addCommands() {
|
|
828
|
-
return { setGlobalContent: (key, value) => ({ tr, dispatch }) => {
|
|
829
|
-
const ensureGlobalPosition = () => {
|
|
830
|
-
const positions = findGlobalContentPositions(tr.doc);
|
|
831
|
-
for (let i = positions.length - 1; i > 0; i--) tr.delete(positions[i], positions[i] + 1);
|
|
832
|
-
const pos = positions[0] ?? -1;
|
|
833
|
-
if (pos >= 0) cachedGlobalPosition = pos;
|
|
834
|
-
else {
|
|
835
|
-
cachedGlobalPosition = 0;
|
|
836
|
-
tr.insert(0, this.type.create());
|
|
837
|
-
}
|
|
838
|
-
};
|
|
839
|
-
if (dispatch) {
|
|
840
|
-
ensureGlobalPosition();
|
|
841
|
-
if (cachedGlobalPosition == null) return false;
|
|
842
|
-
tr.setNodeAttribute(cachedGlobalPosition, "data", {
|
|
843
|
-
...tr.doc.nodeAt(cachedGlobalPosition)?.attrs.data,
|
|
844
|
-
[key]: value
|
|
845
|
-
});
|
|
846
|
-
}
|
|
847
|
-
return true;
|
|
848
|
-
} };
|
|
849
|
-
}
|
|
850
|
-
});
|
|
851
|
-
|
|
852
780
|
//#endregion
|
|
853
781
|
//#region src/extensions/hard-break.tsx
|
|
854
782
|
const HardBreak = EmailNode.from(HardBreakBase, () => /* @__PURE__ */ jsx("br", {}));
|
|
@@ -1979,5 +1907,5 @@ function useEditor$1({ content, extensions = [], onUpdate, onPaste, onUploadImag
|
|
|
1979
1907
|
}
|
|
1980
1908
|
|
|
1981
1909
|
//#endregion
|
|
1982
|
-
export {
|
|
1983
|
-
//# sourceMappingURL=core-
|
|
1910
|
+
export { ClassAttribute as A, Italic as C, Div as D, Divider as E, Blockquote as F, AlignmentAttribute as I, composeReactEmail as L, BulletList as M, Bold as N, CodeBlockPrism as O, Body$1 as P, isDocumentVisuallyEmpty as R, processStylesForUnlink as S, HardBreak as T, OrderedList as _, Text$1 as a, Link$1 as b, TableHeader as c, StyleAttribute as d, Strike as f, Paragraph as g, Placeholder as h, Underline as i, Button$1 as j, Code as k, TableRow as l, PreviewText as m, StarterKit as n, Table as o, Section$1 as p, Uppercase as r, TableCell as s, useEditor$1 as t, Sup as u, MaxNesting as v, Heading$2 as w, PreservedStyle as x, ListItem as y };
|
|
1911
|
+
//# sourceMappingURL=core-BjxjzlNZ.mjs.map
|