@react-email/editor 1.3.2 → 1.3.4

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.
@@ -114,12 +114,45 @@ function injectThemeCss(styles, options = {}) {
114
114
  const container = options.scopeSelector ?? ".tiptap-extended .tiptap.ProseMirror";
115
115
  const prefix = ".node-";
116
116
  const styleId = options.styleId ?? "tiptap-extended-theme-css";
117
+ const getNodeSelector = (classReference) => `${container} ${prefix}${classReference}`;
118
+ const getSelectors = (classReference) => {
119
+ switch (classReference) {
120
+ case "body": return [container];
121
+ case "reset": return [];
122
+ case "list": return [
123
+ getNodeSelector("list"),
124
+ getNodeSelector("bulletList"),
125
+ getNodeSelector("orderedList")
126
+ ];
127
+ case "bulletList": return [getNodeSelector("bulletList")];
128
+ case "orderedList": return [getNodeSelector("orderedList")];
129
+ case "nestedList": return [
130
+ getNodeSelector("nestedList"),
131
+ `${container} .node-list .node-list`,
132
+ `${container} .node-bulletList .node-bulletList`,
133
+ `${container} .node-bulletList .node-orderedList`,
134
+ `${container} .node-orderedList .node-bulletList`,
135
+ `${container} .node-orderedList .node-orderedList`
136
+ ];
137
+ case "listParagraph": return [`${container} .node-listItem > .node-paragraph`];
138
+ default: return [getNodeSelector(classReference)];
139
+ }
140
+ };
141
+ const resetStyles = styles.reset ?? {};
117
142
  const css = Object.entries(styles).reduce((acc, [key, value]) => {
118
- return `${acc}${key === "body" ? container : `${container} ${prefix}${key}`}{${Object.entries(value).reduce((acc, [prop, val]) => {
143
+ const classReference = key;
144
+ const selectors = getSelectors(classReference);
145
+ if (selectors.length === 0) return acc;
146
+ const resolvedStyles = RESET_NODE_TYPES.has(classReference) ? {
147
+ ...resetStyles,
148
+ ...value
149
+ } : value;
150
+ const cssString = Object.entries(resolvedStyles).reduce((acc, [prop, val]) => {
119
151
  const normalizeProp = prop.replace(/([A-Z])/g, "-$1").toLowerCase();
120
152
  if (val === void 0) return acc;
121
153
  return `${acc}${normalizeProp}:${val};`;
122
- }, "")}}`;
154
+ }, "");
155
+ return `${acc}${selectors.join(",")}{${cssString}}`;
123
156
  }, "");
124
157
  let styleTag = document.getElementById(styleId);
125
158
  if (!styleTag) {
@@ -162,6 +195,9 @@ const PANEL_SECTION_TITLES = {
162
195
  h2: "Subtitle",
163
196
  h3: "Heading",
164
197
  paragraph: "Paragraph",
198
+ list: "List",
199
+ "nested-list": "Nested List",
200
+ "list-item": "List Item",
165
201
  link: "Link",
166
202
  image: "Image",
167
203
  button: "Button",
@@ -367,6 +403,27 @@ const THEME_BASIC = [
367
403
  classReference: "paragraph",
368
404
  inputs: []
369
405
  },
406
+ {
407
+ id: "list",
408
+ title: "List",
409
+ category: "Text",
410
+ classReference: "list",
411
+ inputs: []
412
+ },
413
+ {
414
+ id: "nested-list",
415
+ title: "Nested List",
416
+ category: "Text",
417
+ classReference: "nestedList",
418
+ inputs: []
419
+ },
420
+ {
421
+ id: "list-item",
422
+ title: "List Item",
423
+ category: "Text",
424
+ classReference: "listItem",
425
+ inputs: []
426
+ },
370
427
  {
371
428
  id: "link",
372
429
  title: "Link",
@@ -716,6 +773,27 @@ const THEME_MINIMAL = [
716
773
  classReference: "paragraph",
717
774
  inputs: []
718
775
  },
776
+ {
777
+ id: "list",
778
+ title: "List",
779
+ category: "Text",
780
+ classReference: "list",
781
+ inputs: []
782
+ },
783
+ {
784
+ id: "nested-list",
785
+ title: "Nested List",
786
+ category: "Text",
787
+ classReference: "nestedList",
788
+ inputs: []
789
+ },
790
+ {
791
+ id: "list-item",
792
+ title: "List Item",
793
+ category: "Text",
794
+ classReference: "listItem",
795
+ inputs: []
796
+ },
719
797
  {
720
798
  id: "link",
721
799
  title: "Link",
@@ -786,14 +864,16 @@ const RESET_BASIC = {
786
864
  paddingLeft: "1.1em",
787
865
  paddingBottom: "1em"
788
866
  },
867
+ bulletList: { listStyleType: "disc" },
868
+ orderedList: { listStyleType: "decimal" },
789
869
  nestedList: {
790
870
  paddingLeft: "1.1em",
791
871
  paddingBottom: "0"
792
872
  },
793
873
  listItem: {
794
874
  marginLeft: "1em",
795
- marginBottom: "0.3em",
796
- marginTop: "0.3em"
875
+ paddingBottom: "0.3em",
876
+ paddingTop: "0.3em"
797
877
  },
798
878
  listParagraph: {
799
879
  padding: "0",
@@ -814,12 +894,24 @@ const RESET_BASIC = {
814
894
  footer: { fontSize: "0.8em" },
815
895
  hr: {
816
896
  paddingBottom: "1em",
897
+ borderStyle: "solid",
817
898
  borderWidth: "2px"
818
899
  },
819
900
  image: { maxWidth: "100%" },
820
901
  button: {
821
902
  lineHeight: "100%",
822
- display: "inline-block"
903
+ display: "inline-block",
904
+ paddingTop: "0.625em",
905
+ paddingRight: "1.25em",
906
+ paddingBottom: "0.625em",
907
+ paddingLeft: "1.25em",
908
+ backgroundColor: "#000000",
909
+ color: "#ffffff",
910
+ borderRadius: "0.375em",
911
+ fontWeight: 500,
912
+ fontSize: "0.875em",
913
+ textDecoration: "none",
914
+ textAlign: "center"
823
915
  },
824
916
  inlineCode: {
825
917
  paddingTop: "0.25em",
@@ -831,6 +923,13 @@ const RESET_BASIC = {
831
923
  borderRadius: "4px"
832
924
  },
833
925
  codeBlock: {
926
+ background: "#f1f5f9",
927
+ borderRadius: "4px",
928
+ paddingTop: "0.75rem",
929
+ paddingRight: "1rem",
930
+ paddingBottom: "0.75rem",
931
+ paddingLeft: "1rem",
932
+ overflowX: "auto",
834
933
  fontFamily: "monospace",
835
934
  fontWeight: "500",
836
935
  fontSize: ".92em"
@@ -853,9 +952,14 @@ const RESET_THEMES = {
853
952
  return acc;
854
953
  }, {}),
855
954
  reset: RESET_BASIC.reset,
856
- button: RESET_BASIC.button,
955
+ button: {
956
+ lineHeight: RESET_BASIC.button.lineHeight,
957
+ display: RESET_BASIC.button.display
958
+ },
857
959
  image: RESET_BASIC.image,
858
960
  list: RESET_BASIC.list,
961
+ bulletList: RESET_BASIC.bulletList,
962
+ orderedList: RESET_BASIC.orderedList,
859
963
  nestedList: RESET_BASIC.nestedList,
860
964
  listItem: RESET_BASIC.listItem,
861
965
  listParagraph: RESET_BASIC.listParagraph,
@@ -1180,6 +1284,9 @@ const PANEL_SECTION_IDS = new Set([
1180
1284
  "container",
1181
1285
  "typography",
1182
1286
  "paragraph",
1287
+ "list",
1288
+ "nested-list",
1289
+ "list-item",
1183
1290
  "link",
1184
1291
  "image",
1185
1292
  "button",
@@ -1193,6 +1300,9 @@ const PANEL_SECTION_IDS_BY_TITLE = {
1193
1300
  container: "container",
1194
1301
  typography: "typography",
1195
1302
  paragraph: "paragraph",
1303
+ list: "list",
1304
+ "nested list": "nested-list",
1305
+ "list item": "list-item",
1196
1306
  link: "link",
1197
1307
  image: "image",
1198
1308
  button: "button",
@@ -1202,6 +1312,9 @@ const PANEL_SECTION_IDS_BY_TITLE = {
1202
1312
  const PANEL_SECTION_IDS_BY_CLASS_REFERENCE = {
1203
1313
  container: "container",
1204
1314
  paragraph: "paragraph",
1315
+ list: "list",
1316
+ nestedList: "nested-list",
1317
+ listItem: "list-item",
1205
1318
  link: "link",
1206
1319
  image: "image",
1207
1320
  button: "button",
@@ -1279,6 +1392,9 @@ const CLASS_REFERENCE_TO_PANEL_ID = {
1279
1392
  link: "link",
1280
1393
  image: "image",
1281
1394
  button: "button",
1395
+ list: "list",
1396
+ nestedList: "nested-list",
1397
+ listItem: "list-item",
1282
1398
  codeBlock: "code-block",
1283
1399
  inlineCode: "inline-code"
1284
1400
  };
@@ -1382,13 +1498,21 @@ function getMergedCssJs(theme, panelStyles) {
1382
1498
  return mergeCssJs(RESET_THEMES[theme], parsed);
1383
1499
  }
1384
1500
  /**
1385
- * Returns resolved React.CSSProperties for a node when you already have merged CssJs
1386
- * (e.g. in the serializer where there is no editor). Centralizes which theme keys
1387
- * apply to which node type.
1501
+ * Node types and theme component keys that should receive the universal
1502
+ * `reset` CSS (e.g. `margin: 0; padding: 0`) layered underneath their own
1503
+ * theme styles. Shared between `getResolvedNodeStyles` (email serializer)
1504
+ * and `injectThemeCss` (editor preview) so both surfaces stay in sync.
1505
+ *
1506
+ * Includes both raw tiptap node names (e.g. `tableCell`) and theme
1507
+ * component keys (e.g. `list`) because the serializer matches against both.
1508
+ *
1509
+ * `bulletList` and `orderedList` are intentionally omitted: their elements
1510
+ * already carry the shared `node-list` class, so the `list` reset rule
1511
+ * covers them without forcing the dedicated `.node-bulletList` /
1512
+ * `.node-orderedList` rules to redundantly emit `margin: 0; padding: 0`.
1388
1513
  */
1389
1514
  const RESET_NODE_TYPES = new Set([
1390
1515
  "body",
1391
- "bulletList",
1392
1516
  "button",
1393
1517
  "columns",
1394
1518
  "div",
@@ -1399,7 +1523,6 @@ const RESET_NODE_TYPES = new Set([
1399
1523
  "listItem",
1400
1524
  "listParagraph",
1401
1525
  "nestedList",
1402
- "orderedList",
1403
1526
  "table",
1404
1527
  "paragraph",
1405
1528
  "tableCell",
@@ -1407,6 +1530,11 @@ const RESET_NODE_TYPES = new Set([
1407
1530
  "tableRow",
1408
1531
  "youtube"
1409
1532
  ]);
1533
+ /**
1534
+ * Returns resolved React.CSSProperties for a node when you already have merged CssJs
1535
+ * (e.g. in the serializer where there is no editor). Centralizes which theme keys
1536
+ * apply to which node type.
1537
+ */
1410
1538
  function getResolvedNodeStyles(node, depth, mergedCssJs) {
1411
1539
  const key = getThemeComponentKey(node.type ?? "", depth, node.attrs ?? {});
1412
1540
  if (!key) {
@@ -1619,6 +1747,12 @@ Object.defineProperty(exports, "INBOX_EMAIL_DEFAULTS", {
1619
1747
  return INBOX_EMAIL_DEFAULTS;
1620
1748
  }
1621
1749
  });
1750
+ Object.defineProperty(exports, "RESET_NODE_TYPES", {
1751
+ enumerable: true,
1752
+ get: function() {
1753
+ return RESET_NODE_TYPES;
1754
+ }
1755
+ });
1622
1756
  Object.defineProperty(exports, "RESET_THEMES", {
1623
1757
  enumerable: true,
1624
1758
  get: function() {
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_focus_scopes = require("../focus-scopes-l_Ki0562.cjs");
3
- const require_extensions = require("../extensions-CG4gZ1-f.cjs");
4
- const require_extension = require("../extension-W9raGSI9.cjs");
3
+ const require_extensions = require("../extensions-BYOlFEwI.cjs");
4
+ const require_extension = require("../extension-r1aNq37Z.cjs");
5
5
  exports.AlignmentAttribute = require_extensions.AlignmentAttribute;
6
6
  exports.Blockquote = require_extensions.Blockquote;
7
7
  exports.Body = require_extensions.Body;
@@ -1,4 +1,4 @@
1
- import { A as Code, C as Italic, D as Div, E as Divider, F as Body, I as Blockquote, L as AlignmentAttribute, M as Button, N as BulletList, O as Container, P as Bold, S as processStylesForUnlink, T as HardBreak, _ as OrderedList, a as skipTrailingNodeMeta, b as Link, c as TableCell, d as Sup, f as StyleAttribute, g as Paragraph, h as PreviewText, i as TrailingNode, j as ClassAttribute, k as CodeBlockPrism, l as TableHeader, m as Section, n as Uppercase, o as Text, p as Strike, r as Underline, s as Table, t as StarterKit, u as TableRow, v as MaxNesting, w as Heading, x as PreservedStyle, y as ListItem } from "../extensions-CQ3r7pnM.mjs";
1
+ import { A as Code, C as Italic, D as Div, E as Divider, F as Body, I as Blockquote, L as AlignmentAttribute, M as Button, N as BulletList, O as Container, P as Bold, S as processStylesForUnlink, T as HardBreak, _ as OrderedList, a as skipTrailingNodeMeta, b as Link, c as TableCell, d as Sup, f as StyleAttribute, g as Paragraph, h as PreviewText, i as TrailingNode, j as ClassAttribute, k as CodeBlockPrism, l as TableHeader, m as Section, n as Uppercase, o as Text, p as Strike, r as Underline, s as Table, t as StarterKit, u as TableRow, v as MaxNesting, w as Heading, x as PreservedStyle, y as ListItem } from "../extensions-BxF4VdQD.mjs";
2
2
  import { a as COLUMN_PARENT_TYPES, c as MAX_COLUMNS_DEPTH, d as getColumnsDepth, i as focusScopePluginKey, l as ThreeColumns, n as createFocusScopePlugin, o as ColumnsColumn, r as createFocusScopesStorage, s as FourColumns, t as FocusScopes, u as TwoColumns } from "../focus-scopes-B_0O7l7d.mjs";
3
- import { T as getGlobalContent, w as GlobalContent } from "../extension-TtsG0Puz.mjs";
3
+ import { E as getGlobalContent, T as GlobalContent } from "../extension-M9mAMex9.mjs";
4
4
  export { AlignmentAttribute, Blockquote, Body, Bold, BulletList, Button, COLUMN_PARENT_TYPES, ClassAttribute, Code, CodeBlockPrism, ColumnsColumn, Container, Div, Divider, FocusScopes, FourColumns, GlobalContent, HardBreak, Heading, Italic, Link, ListItem, MAX_COLUMNS_DEPTH, MaxNesting, OrderedList, Paragraph, PreservedStyle, PreviewText, Section, StarterKit, Strike, StyleAttribute, Sup, Table, TableCell, TableHeader, TableRow, Text, ThreeColumns, TrailingNode, TwoColumns, Underline, Uppercase, createFocusScopePlugin, createFocusScopesStorage, focusScopePluginKey, getColumnsDepth, getGlobalContent, processStylesForUnlink, skipTrailingNodeMeta };
@@ -2,7 +2,7 @@ const require_focus_scopes = require("./focus-scopes-l_Ki0562.cjs");
2
2
  const require_email_node = require("./email-node-DvyWFrOM.cjs");
3
3
  const require_core = require("./core-CLyAVVUW.cjs");
4
4
  const require_event_bus = require("./event-bus-C_wS2tD6.cjs");
5
- const require_extension = require("./extension-W9raGSI9.cjs");
5
+ const require_extension = require("./extension-r1aNq37Z.cjs");
6
6
  let _tiptap_react = require("@tiptap/react");
7
7
  let react_email = require("react-email");
8
8
  react_email = require_focus_scopes.__toESM(react_email);
@@ -1629,10 +1629,10 @@ const StarterKit = _tiptap_core.Extension.create({
1629
1629
  FourColumns: {},
1630
1630
  ColumnsColumn: {},
1631
1631
  Paragraph: { HTMLAttributes: { class: "node-paragraph" } },
1632
- BulletList: { HTMLAttributes: { class: "node-bulletList" } },
1633
- OrderedList: { HTMLAttributes: { class: "node-orderedList" } },
1632
+ BulletList: { HTMLAttributes: { class: "node-list node-bulletList" } },
1633
+ OrderedList: { HTMLAttributes: { class: "node-list node-orderedList" } },
1634
1634
  Blockquote: { HTMLAttributes: { class: "node-blockquote" } },
1635
- ListItem: {},
1635
+ ListItem: { HTMLAttributes: { class: "node-listItem" } },
1636
1636
  HardBreak: {},
1637
1637
  Italic: {},
1638
1638
  PreviewText: {},
@@ -2,7 +2,7 @@ import { a as jsToInlineCss, i as inlineCssToJs, o as resolveConflictingStyles,
2
2
  import { r as EmailMark } from "./core-CbSTyrV4.mjs";
3
3
  import { _ as TABLE_ATTRIBUTES, b as createStandardAttributes, f as hasPrismThemeLoaded, g as LAYOUT_ATTRIBUTES, h as COMMON_HTML_ATTRIBUTES, l as ThreeColumns, m as removePrismTheme, o as ColumnsColumn, p as loadPrismTheme, s as FourColumns, t as FocusScopes, u as TwoColumns, v as TABLE_CELL_ATTRIBUTES, y as TABLE_HEADER_ATTRIBUTES } from "./focus-scopes-B_0O7l7d.mjs";
4
4
  import { t as editorEventBus } from "./event-bus-CqrIUE24.mjs";
5
- import { i as getResolvedNodeStyles, n as getEmailTheming, r as getMergedCssJs, w as GlobalContent } from "./extension-TtsG0Puz.mjs";
5
+ import { T as GlobalContent, a as getResolvedNodeStyles, i as getMergedCssJs, r as getEmailTheming } from "./extension-M9mAMex9.mjs";
6
6
  import { NodeViewContent, NodeViewWrapper, ReactNodeViewRenderer } from "@tiptap/react";
7
7
  import * as ReactEmailComponents from "react-email";
8
8
  import { Button, CodeBlock, Column, Container, Heading, Hr, Link, Row, Section } from "react-email";
@@ -1612,10 +1612,10 @@ const StarterKit = Extension.create({
1612
1612
  FourColumns: {},
1613
1613
  ColumnsColumn: {},
1614
1614
  Paragraph: { HTMLAttributes: { class: "node-paragraph" } },
1615
- BulletList: { HTMLAttributes: { class: "node-bulletList" } },
1616
- OrderedList: { HTMLAttributes: { class: "node-orderedList" } },
1615
+ BulletList: { HTMLAttributes: { class: "node-list node-bulletList" } },
1616
+ OrderedList: { HTMLAttributes: { class: "node-list node-orderedList" } },
1617
1617
  Blockquote: { HTMLAttributes: { class: "node-blockquote" } },
1618
- ListItem: {},
1618
+ ListItem: { HTMLAttributes: { class: "node-listItem" } },
1619
1619
  HardBreak: {},
1620
1620
  Italic: {},
1621
1621
  PreviewText: {},
@@ -1759,4 +1759,4 @@ const StarterKit = Extension.create({
1759
1759
  //#endregion
1760
1760
  export { Code as A, Italic as C, Div as D, Divider as E, Body$1 as F, Blockquote as I, AlignmentAttribute as L, Button$1 as M, BulletList as N, Container$1 as O, Bold as P, processStylesForUnlink as S, HardBreak as T, OrderedList as _, skipTrailingNodeMeta as a, Link$1 as b, TableCell as c, Sup as d, StyleAttribute as f, Paragraph as g, PreviewText as h, TrailingNode as i, ClassAttribute as j, CodeBlockPrism 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, MaxNesting as v, Heading$2 as w, PreservedStyle as x, ListItem as y };
1761
1761
 
1762
- //# sourceMappingURL=extensions-CQ3r7pnM.mjs.map
1762
+ //# sourceMappingURL=extensions-BxF4VdQD.mjs.map