@payloadcms/richtext-lexical 4.0.0-canary.35 → 4.0.0-canary.37

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 (38) hide show
  1. package/dist/exports/client/bundled.css +1 -1
  2. package/dist/exports/client/index.js +17 -17
  3. package/dist/exports/client/index.js.map +3 -3
  4. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +12 -11
  5. package/dist/field/bundled.css +1 -1
  6. package/dist/lexical/ui/icons/H3/index.d.ts.map +1 -1
  7. package/dist/lexical/ui/icons/H3/index.js +13 -6
  8. package/dist/lexical/ui/icons/H3/index.js.map +1 -1
  9. package/dist/lexical/ui/icons/H4/index.d.ts.map +1 -1
  10. package/dist/lexical/ui/icons/H4/index.js +13 -6
  11. package/dist/lexical/ui/icons/H4/index.js.map +1 -1
  12. package/dist/lexical/ui/icons/H5/index.d.ts.map +1 -1
  13. package/dist/lexical/ui/icons/H5/index.js +13 -6
  14. package/dist/lexical/ui/icons/H5/index.js.map +1 -1
  15. package/dist/lexical/ui/icons/H6/index.d.ts.map +1 -1
  16. package/dist/lexical/ui/icons/H6/index.js +13 -6
  17. package/dist/lexical/ui/icons/H6/index.js.map +1 -1
  18. package/dist/utilities/upgradeLexicalData/index.js +6 -3
  19. package/dist/utilities/upgradeLexicalData/index.js.map +1 -1
  20. package/package.json +8 -8
  21. package/dist/dependencyChecker.spec.js +0 -16
  22. package/dist/dependencyChecker.spec.js.map +0 -1
  23. package/dist/features/converters/lexicalToHtml/sync/alignment.spec.js +0 -92
  24. package/dist/features/converters/lexicalToHtml/sync/alignment.spec.js.map +0 -1
  25. package/dist/features/converters/lexicalToJSX/Component/nodeTags.spec.js +0 -114
  26. package/dist/features/converters/lexicalToJSX/Component/nodeTags.spec.js.map +0 -1
  27. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js +0 -180
  28. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js.map +0 -1
  29. package/dist/features/link/markdownTransformer.spec.js +0 -195
  30. package/dist/features/link/markdownTransformer.spec.js.map +0 -1
  31. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.spec.js +0 -65
  32. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.spec.js.map +0 -1
  33. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js +0 -88
  34. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js.map +0 -1
  35. package/dist/lexical/utils/url.spec.js +0 -114
  36. package/dist/lexical/utils/url.spec.js.map +0 -1
  37. package/dist/utilities/jsx/jsx.spec.js +0 -178
  38. package/dist/utilities/jsx/jsx.spec.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lexical/ui/icons/H3/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC5B,CAaA,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lexical/ui/icons/H3/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC5B,CAoBA,CAAA"}
@@ -1,11 +1,12 @@
1
1
  'use client';
2
2
 
3
- import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
4
  import React from 'react';
5
- const path = 'M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z';
5
+ const headingPath = 'M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7z';
6
+ const numeralPath = 'M16.59 13.32 A1.5 1.25 0 1 1 18 15 A1.5 1.25 0 1 1 16.59 16.68';
6
7
  export const H3Icon = ({
7
8
  className
8
- }) => /*#__PURE__*/_jsx("svg", {
9
+ }) => /*#__PURE__*/_jsxs("svg", {
9
10
  "aria-hidden": "true",
10
11
  className: ['icon', className].filter(Boolean).join(' '),
11
12
  fill: "none",
@@ -14,9 +15,15 @@ export const H3Icon = ({
14
15
  viewBox: "0 0 24 24",
15
16
  width: 24,
16
17
  xmlns: "http://www.w3.org/2000/svg",
17
- children: /*#__PURE__*/_jsx("path", {
18
- d: path,
18
+ children: [/*#__PURE__*/_jsx("path", {
19
+ d: headingPath,
19
20
  fill: "currentColor"
20
- })
21
+ }), /*#__PURE__*/_jsx("path", {
22
+ d: numeralPath,
23
+ stroke: "currentColor",
24
+ strokeLinecap: "round",
25
+ strokeLinejoin: "round",
26
+ strokeWidth: 1
27
+ })]
21
28
  });
22
29
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","path","H3Icon","className","_jsx","filter","Boolean","join","fill","focusable","height","viewBox","width","xmlns","d"],"sources":["../../../../../src/lexical/ui/icons/H3/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nconst path =\n 'M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z'\n\nexport const H3Icon: React.FC<{\n readonly className?: string\n}> = ({ className }) => (\n <svg\n aria-hidden=\"true\"\n className={['icon', className].filter(Boolean).join(' ')}\n fill=\"none\"\n focusable=\"false\"\n height={24}\n viewBox=\"0 0 24 24\"\n width={24}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d={path} fill=\"currentColor\" />\n </svg>\n)\n"],"mappings":"AAAA;;;AACA,OAAOA,KAAA,MAAW;AAElB,MAAMC,IAAA,GACJ;AAEF,OAAO,MAAMC,MAAA,GAERA,CAAC;EAAEC;AAAS,CAAE,kBACjBC,IAAA,CAAC;EACC,eAAY;EACZD,SAAA,EAAW,CAAC,QAAQA,SAAA,CAAU,CAACE,MAAM,CAACC,OAAA,EAASC,IAAI,CAAC;EACpDC,IAAA,EAAK;EACLC,SAAA,EAAU;EACVC,MAAA,EAAQ;EACRC,OAAA,EAAQ;EACRC,KAAA,EAAO;EACPC,KAAA,EAAM;YAEN,aAAAT,IAAA,CAAC;IAAKU,CAAA,EAAGb,IAAA;IAAMO,IAAA,EAAK","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["React","headingPath","numeralPath","H3Icon","className","_jsxs","filter","Boolean","join","fill","focusable","height","viewBox","width","xmlns","_jsx","d","stroke","strokeLinecap","strokeLinejoin","strokeWidth"],"sources":["../../../../../src/lexical/ui/icons/H3/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nconst headingPath =\n 'M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7z'\nconst numeralPath = 'M16.59 13.32 A1.5 1.25 0 1 1 18 15 A1.5 1.25 0 1 1 16.59 16.68'\n\nexport const H3Icon: React.FC<{\n readonly className?: string\n}> = ({ className }) => (\n <svg\n aria-hidden=\"true\"\n className={['icon', className].filter(Boolean).join(' ')}\n fill=\"none\"\n focusable=\"false\"\n height={24}\n viewBox=\"0 0 24 24\"\n width={24}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d={headingPath} fill=\"currentColor\" />\n <path\n d={numeralPath}\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={1}\n />\n </svg>\n)\n"],"mappings":"AAAA;;;AACA,OAAOA,KAAA,MAAW;AAElB,MAAMC,WAAA,GACJ;AACF,MAAMC,WAAA,GAAc;AAEpB,OAAO,MAAMC,MAAA,GAERA,CAAC;EAAEC;AAAS,CAAE,kBACjBC,KAAA,CAAC;EACC,eAAY;EACZD,SAAA,EAAW,CAAC,QAAQA,SAAA,CAAU,CAACE,MAAM,CAACC,OAAA,EAASC,IAAI,CAAC;EACpDC,IAAA,EAAK;EACLC,SAAA,EAAU;EACVC,MAAA,EAAQ;EACRC,OAAA,EAAQ;EACRC,KAAA,EAAO;EACPC,KAAA,EAAM;0BAENC,IAAA,CAAC;IAAKC,CAAA,EAAGf,WAAA;IAAaQ,IAAA,EAAK;mBAC3BM,IAAA,CAAC;IACCC,CAAA,EAAGd,WAAA;IACHe,MAAA,EAAO;IACPC,aAAA,EAAc;IACdC,cAAA,EAAe;IACfC,WAAA,EAAa","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lexical/ui/icons/H4/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC5B,CAaA,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lexical/ui/icons/H4/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC5B,CAoBA,CAAA"}
@@ -1,11 +1,12 @@
1
1
  'use client';
2
2
 
3
- import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
4
  import React from 'react';
5
- const path = 'M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z';
5
+ const headingPath = 'M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7z';
6
+ const numeralPath = 'M18.85 17.5 V12.5 L16.5 15.85 H19.5';
6
7
  export const H4Icon = ({
7
8
  className
8
- }) => /*#__PURE__*/_jsx("svg", {
9
+ }) => /*#__PURE__*/_jsxs("svg", {
9
10
  "aria-hidden": "true",
10
11
  className: ['icon', className].filter(Boolean).join(' '),
11
12
  fill: "none",
@@ -14,9 +15,15 @@ export const H4Icon = ({
14
15
  viewBox: "0 0 24 24",
15
16
  width: 24,
16
17
  xmlns: "http://www.w3.org/2000/svg",
17
- children: /*#__PURE__*/_jsx("path", {
18
- d: path,
18
+ children: [/*#__PURE__*/_jsx("path", {
19
+ d: headingPath,
19
20
  fill: "currentColor"
20
- })
21
+ }), /*#__PURE__*/_jsx("path", {
22
+ d: numeralPath,
23
+ stroke: "currentColor",
24
+ strokeLinecap: "round",
25
+ strokeLinejoin: "round",
26
+ strokeWidth: 1
27
+ })]
21
28
  });
22
29
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","path","H4Icon","className","_jsx","filter","Boolean","join","fill","focusable","height","viewBox","width","xmlns","d"],"sources":["../../../../../src/lexical/ui/icons/H4/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nconst path =\n 'M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z'\n\nexport const H4Icon: React.FC<{\n readonly className?: string\n}> = ({ className }) => (\n <svg\n aria-hidden=\"true\"\n className={['icon', className].filter(Boolean).join(' ')}\n fill=\"none\"\n focusable=\"false\"\n height={24}\n viewBox=\"0 0 24 24\"\n width={24}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d={path} fill=\"currentColor\" />\n </svg>\n)\n"],"mappings":"AAAA;;;AACA,OAAOA,KAAA,MAAW;AAElB,MAAMC,IAAA,GACJ;AAEF,OAAO,MAAMC,MAAA,GAERA,CAAC;EAAEC;AAAS,CAAE,kBACjBC,IAAA,CAAC;EACC,eAAY;EACZD,SAAA,EAAW,CAAC,QAAQA,SAAA,CAAU,CAACE,MAAM,CAACC,OAAA,EAASC,IAAI,CAAC;EACpDC,IAAA,EAAK;EACLC,SAAA,EAAU;EACVC,MAAA,EAAQ;EACRC,OAAA,EAAQ;EACRC,KAAA,EAAO;EACPC,KAAA,EAAM;YAEN,aAAAT,IAAA,CAAC;IAAKU,CAAA,EAAGb,IAAA;IAAMO,IAAA,EAAK","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["React","headingPath","numeralPath","H4Icon","className","_jsxs","filter","Boolean","join","fill","focusable","height","viewBox","width","xmlns","_jsx","d","stroke","strokeLinecap","strokeLinejoin","strokeWidth"],"sources":["../../../../../src/lexical/ui/icons/H4/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nconst headingPath =\n 'M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7z'\nconst numeralPath = 'M18.85 17.5 V12.5 L16.5 15.85 H19.5'\n\nexport const H4Icon: React.FC<{\n readonly className?: string\n}> = ({ className }) => (\n <svg\n aria-hidden=\"true\"\n className={['icon', className].filter(Boolean).join(' ')}\n fill=\"none\"\n focusable=\"false\"\n height={24}\n viewBox=\"0 0 24 24\"\n width={24}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d={headingPath} fill=\"currentColor\" />\n <path\n d={numeralPath}\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={1}\n />\n </svg>\n)\n"],"mappings":"AAAA;;;AACA,OAAOA,KAAA,MAAW;AAElB,MAAMC,WAAA,GACJ;AACF,MAAMC,WAAA,GAAc;AAEpB,OAAO,MAAMC,MAAA,GAERA,CAAC;EAAEC;AAAS,CAAE,kBACjBC,KAAA,CAAC;EACC,eAAY;EACZD,SAAA,EAAW,CAAC,QAAQA,SAAA,CAAU,CAACE,MAAM,CAACC,OAAA,EAASC,IAAI,CAAC;EACpDC,IAAA,EAAK;EACLC,SAAA,EAAU;EACVC,MAAA,EAAQ;EACRC,OAAA,EAAQ;EACRC,KAAA,EAAO;EACPC,KAAA,EAAM;0BAENC,IAAA,CAAC;IAAKC,CAAA,EAAGf,WAAA;IAAaQ,IAAA,EAAK;mBAC3BM,IAAA,CAAC;IACCC,CAAA,EAAGd,WAAA;IACHe,MAAA,EAAO;IACPC,aAAA,EAAc;IACdC,cAAA,EAAe;IACfC,WAAA,EAAa","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lexical/ui/icons/H5/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC5B,CAaA,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lexical/ui/icons/H5/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC5B,CAoBA,CAAA"}
@@ -1,11 +1,12 @@
1
1
  'use client';
2
2
 
3
- import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
4
  import React from 'react';
5
- const path = 'M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.1576 10.269C12.6896 10.269 12.3746 10.494 12.2216 10.737H10.8176L11.1956 7.074H15.2546V8.28H12.3206L12.1856 9.549C12.4016 9.351 12.8516 9.126 13.4636 9.126C14.7866 9.126 15.6596 10.053 15.6596 11.358C15.6596 12.609 14.7326 13.608 13.1756 13.608C11.5826 13.608 10.6556 12.753 10.5566 11.511H12.1136C12.1586 12.06 12.5456 12.465 13.1576 12.465C13.8236 12.465 14.1746 11.97 14.1746 11.376C14.1746 10.764 13.8416 10.269 13.1576 10.269Z';
5
+ const headingPath = 'M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7z';
6
+ const numeralPath = 'M19.2 12.5 H16.8 V14.9 A1.5 1.5 0 1 1 16.7 16.9';
6
7
  export const H5Icon = ({
7
8
  className
8
- }) => /*#__PURE__*/_jsx("svg", {
9
+ }) => /*#__PURE__*/_jsxs("svg", {
9
10
  "aria-hidden": "true",
10
11
  className: ['icon', className].filter(Boolean).join(' '),
11
12
  fill: "none",
@@ -14,9 +15,15 @@ export const H5Icon = ({
14
15
  viewBox: "0 0 24 24",
15
16
  width: 24,
16
17
  xmlns: "http://www.w3.org/2000/svg",
17
- children: /*#__PURE__*/_jsx("path", {
18
- d: path,
18
+ children: [/*#__PURE__*/_jsx("path", {
19
+ d: headingPath,
19
20
  fill: "currentColor"
20
- })
21
+ }), /*#__PURE__*/_jsx("path", {
22
+ d: numeralPath,
23
+ stroke: "currentColor",
24
+ strokeLinecap: "round",
25
+ strokeLinejoin: "round",
26
+ strokeWidth: 1
27
+ })]
21
28
  });
22
29
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","path","H5Icon","className","_jsx","filter","Boolean","join","fill","focusable","height","viewBox","width","xmlns","d"],"sources":["../../../../../src/lexical/ui/icons/H5/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nconst path =\n 'M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.1576 10.269C12.6896 10.269 12.3746 10.494 12.2216 10.737H10.8176L11.1956 7.074H15.2546V8.28H12.3206L12.1856 9.549C12.4016 9.351 12.8516 9.126 13.4636 9.126C14.7866 9.126 15.6596 10.053 15.6596 11.358C15.6596 12.609 14.7326 13.608 13.1756 13.608C11.5826 13.608 10.6556 12.753 10.5566 11.511H12.1136C12.1586 12.06 12.5456 12.465 13.1576 12.465C13.8236 12.465 14.1746 11.97 14.1746 11.376C14.1746 10.764 13.8416 10.269 13.1576 10.269Z'\n\nexport const H5Icon: React.FC<{\n readonly className?: string\n}> = ({ className }) => (\n <svg\n aria-hidden=\"true\"\n className={['icon', className].filter(Boolean).join(' ')}\n fill=\"none\"\n focusable=\"false\"\n height={24}\n viewBox=\"0 0 24 24\"\n width={24}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d={path} fill=\"currentColor\" />\n </svg>\n)\n"],"mappings":"AAAA;;;AACA,OAAOA,KAAA,MAAW;AAElB,MAAMC,IAAA,GACJ;AAEF,OAAO,MAAMC,MAAA,GAERA,CAAC;EAAEC;AAAS,CAAE,kBACjBC,IAAA,CAAC;EACC,eAAY;EACZD,SAAA,EAAW,CAAC,QAAQA,SAAA,CAAU,CAACE,MAAM,CAACC,OAAA,EAASC,IAAI,CAAC;EACpDC,IAAA,EAAK;EACLC,SAAA,EAAU;EACVC,MAAA,EAAQ;EACRC,OAAA,EAAQ;EACRC,KAAA,EAAO;EACPC,KAAA,EAAM;YAEN,aAAAT,IAAA,CAAC;IAAKU,CAAA,EAAGb,IAAA;IAAMO,IAAA,EAAK","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["React","headingPath","numeralPath","H5Icon","className","_jsxs","filter","Boolean","join","fill","focusable","height","viewBox","width","xmlns","_jsx","d","stroke","strokeLinecap","strokeLinejoin","strokeWidth"],"sources":["../../../../../src/lexical/ui/icons/H5/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nconst headingPath =\n 'M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7z'\nconst numeralPath = 'M19.2 12.5 H16.8 V14.9 A1.5 1.5 0 1 1 16.7 16.9'\n\nexport const H5Icon: React.FC<{\n readonly className?: string\n}> = ({ className }) => (\n <svg\n aria-hidden=\"true\"\n className={['icon', className].filter(Boolean).join(' ')}\n fill=\"none\"\n focusable=\"false\"\n height={24}\n viewBox=\"0 0 24 24\"\n width={24}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d={headingPath} fill=\"currentColor\" />\n <path\n d={numeralPath}\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={1}\n />\n </svg>\n)\n"],"mappings":"AAAA;;;AACA,OAAOA,KAAA,MAAW;AAElB,MAAMC,WAAA,GACJ;AACF,MAAMC,WAAA,GAAc;AAEpB,OAAO,MAAMC,MAAA,GAERA,CAAC;EAAEC;AAAS,CAAE,kBACjBC,KAAA,CAAC;EACC,eAAY;EACZD,SAAA,EAAW,CAAC,QAAQA,SAAA,CAAU,CAACE,MAAM,CAACC,OAAA,EAASC,IAAI,CAAC;EACpDC,IAAA,EAAK;EACLC,SAAA,EAAU;EACVC,MAAA,EAAQ;EACRC,OAAA,EAAQ;EACRC,KAAA,EAAO;EACPC,KAAA,EAAM;0BAENC,IAAA,CAAC;IAAKC,CAAA,EAAGf,WAAA;IAAaQ,IAAA,EAAK;mBAC3BM,IAAA,CAAC;IACCC,CAAA,EAAGd,WAAA;IACHe,MAAA,EAAO;IACPC,aAAA,EAAc;IACdC,cAAA,EAAe;IACfC,WAAA,EAAa","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lexical/ui/icons/H6/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC5B,CAaA,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lexical/ui/icons/H6/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC5B,CAoBA,CAAA"}
@@ -1,11 +1,12 @@
1
1
  'use client';
2
2
 
3
- import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
4
  import React from 'react';
5
- const path = 'M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.3646 8.127C12.5456 8.127 12.0416 8.937 12.0416 9.999C12.3296 9.54 12.8246 9.207 13.5536 9.207C14.8586 9.207 15.8036 10.134 15.8036 11.376C15.8036 12.645 14.8226 13.608 13.3196 13.608C11.7266 13.608 10.6196 12.393 10.6196 10.395C10.6196 8.316 11.7716 6.966 13.4186 6.966C14.7056 6.966 15.5786 7.749 15.7316 8.829H14.3186C14.2016 8.415 13.9226 8.127 13.3646 8.127ZM13.3106 12.51C13.9586 12.51 14.3816 12.042 14.3816 11.385C14.3816 10.737 13.9586 10.278 13.3106 10.278C12.6536 10.278 12.2126 10.737 12.2126 11.385C12.2126 12.042 12.6536 12.51 13.3106 12.51Z';
5
+ const headingPath = 'M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7z';
6
+ const numeralPath = 'M18.85 12.55 C17.45 13.05 16.5 14.25 16.5 16 A1.5 1.5 0 1 1 19.5 16 A1.5 1.5 0 1 1 16.5 16';
6
7
  export const H6Icon = ({
7
8
  className
8
- }) => /*#__PURE__*/_jsx("svg", {
9
+ }) => /*#__PURE__*/_jsxs("svg", {
9
10
  "aria-hidden": "true",
10
11
  className: ['icon', className].filter(Boolean).join(' '),
11
12
  fill: "none",
@@ -14,9 +15,15 @@ export const H6Icon = ({
14
15
  viewBox: "0 0 24 24",
15
16
  width: 24,
16
17
  xmlns: "http://www.w3.org/2000/svg",
17
- children: /*#__PURE__*/_jsx("path", {
18
- d: path,
18
+ children: [/*#__PURE__*/_jsx("path", {
19
+ d: headingPath,
19
20
  fill: "currentColor"
20
- })
21
+ }), /*#__PURE__*/_jsx("path", {
22
+ d: numeralPath,
23
+ stroke: "currentColor",
24
+ strokeLinecap: "round",
25
+ strokeLinejoin: "round",
26
+ strokeWidth: 1
27
+ })]
21
28
  });
22
29
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","path","H6Icon","className","_jsx","filter","Boolean","join","fill","focusable","height","viewBox","width","xmlns","d"],"sources":["../../../../../src/lexical/ui/icons/H6/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nconst path =\n 'M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.3646 8.127C12.5456 8.127 12.0416 8.937 12.0416 9.999C12.3296 9.54 12.8246 9.207 13.5536 9.207C14.8586 9.207 15.8036 10.134 15.8036 11.376C15.8036 12.645 14.8226 13.608 13.3196 13.608C11.7266 13.608 10.6196 12.393 10.6196 10.395C10.6196 8.316 11.7716 6.966 13.4186 6.966C14.7056 6.966 15.5786 7.749 15.7316 8.829H14.3186C14.2016 8.415 13.9226 8.127 13.3646 8.127ZM13.3106 12.51C13.9586 12.51 14.3816 12.042 14.3816 11.385C14.3816 10.737 13.9586 10.278 13.3106 10.278C12.6536 10.278 12.2126 10.737 12.2126 11.385C12.2126 12.042 12.6536 12.51 13.3106 12.51Z'\n\nexport const H6Icon: React.FC<{\n readonly className?: string\n}> = ({ className }) => (\n <svg\n aria-hidden=\"true\"\n className={['icon', className].filter(Boolean).join(' ')}\n fill=\"none\"\n focusable=\"false\"\n height={24}\n viewBox=\"0 0 24 24\"\n width={24}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d={path} fill=\"currentColor\" />\n </svg>\n)\n"],"mappings":"AAAA;;;AACA,OAAOA,KAAA,MAAW;AAElB,MAAMC,IAAA,GACJ;AAEF,OAAO,MAAMC,MAAA,GAERA,CAAC;EAAEC;AAAS,CAAE,kBACjBC,IAAA,CAAC;EACC,eAAY;EACZD,SAAA,EAAW,CAAC,QAAQA,SAAA,CAAU,CAACE,MAAM,CAACC,OAAA,EAASC,IAAI,CAAC;EACpDC,IAAA,EAAK;EACLC,SAAA,EAAU;EACVC,MAAA,EAAQ;EACRC,OAAA,EAAQ;EACRC,KAAA,EAAO;EACPC,KAAA,EAAM;YAEN,aAAAT,IAAA,CAAC;IAAKU,CAAA,EAAGb,IAAA;IAAMO,IAAA,EAAK","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["React","headingPath","numeralPath","H6Icon","className","_jsxs","filter","Boolean","join","fill","focusable","height","viewBox","width","xmlns","_jsx","d","stroke","strokeLinecap","strokeLinejoin","strokeWidth"],"sources":["../../../../../src/lexical/ui/icons/H6/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nconst headingPath =\n 'M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7z'\nconst numeralPath =\n 'M18.85 12.55 C17.45 13.05 16.5 14.25 16.5 16 A1.5 1.5 0 1 1 19.5 16 A1.5 1.5 0 1 1 16.5 16'\n\nexport const H6Icon: React.FC<{\n readonly className?: string\n}> = ({ className }) => (\n <svg\n aria-hidden=\"true\"\n className={['icon', className].filter(Boolean).join(' ')}\n fill=\"none\"\n focusable=\"false\"\n height={24}\n viewBox=\"0 0 24 24\"\n width={24}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d={headingPath} fill=\"currentColor\" />\n <path\n d={numeralPath}\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={1}\n />\n </svg>\n)\n"],"mappings":"AAAA;;;AACA,OAAOA,KAAA,MAAW;AAElB,MAAMC,WAAA,GACJ;AACF,MAAMC,WAAA,GACJ;AAEF,OAAO,MAAMC,MAAA,GAERA,CAAC;EAAEC;AAAS,CAAE,kBACjBC,KAAA,CAAC;EACC,eAAY;EACZD,SAAA,EAAW,CAAC,QAAQA,SAAA,CAAU,CAACE,MAAM,CAACC,OAAA,EAASC,IAAI,CAAC;EACpDC,IAAA,EAAK;EACLC,SAAA,EAAU;EACVC,MAAA,EAAQ;EACRC,OAAA,EAAQ;EACRC,KAAA,EAAO;EACPC,KAAA,EAAM;0BAENC,IAAA,CAAC;IAAKC,CAAA,EAAGf,WAAA;IAAaQ,IAAA,EAAK;mBAC3BM,IAAA,CAAC;IACCC,CAAA,EAAGd,WAAA;IACHe,MAAA,EAAO;IACPC,aAAA,EAAc;IACdC,cAAA,EAAe;IACfC,WAAA,EAAa","ignoreList":[]}
@@ -54,7 +54,8 @@ async function upgradeGlobal({
54
54
  slug: global.slug,
55
55
  data: document,
56
56
  depth: 0,
57
- locale: locale || undefined
57
+ locale: locale || undefined,
58
+ overrideAccess: true
58
59
  });
59
60
  }
60
61
  }
@@ -68,7 +69,8 @@ async function upgradeCollection({
68
69
  console.log(`Lexical Upgrade: ${locale}: Upgrading collection:`, collection.slug, '(' + cur + '/' + max + ')');
69
70
  const documentCount = (await payload.count({
70
71
  collection: collection.slug,
71
- locale: locale || undefined
72
+ locale: locale || undefined,
73
+ overrideAccess: true
72
74
  })).totalDocs;
73
75
  let page = 1;
74
76
  let upgraded = 0;
@@ -95,7 +97,8 @@ async function upgradeCollection({
95
97
  collection: collection.slug,
96
98
  data: document,
97
99
  depth: 0,
98
- locale: locale || undefined
100
+ locale: locale || undefined,
101
+ overrideAccess: true
99
102
  });
100
103
  }
101
104
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["upgradeDocumentFieldsRecursively","upgradeLexicalData","payload","collections","config","allLocales","localization","localeCodes","totalCollections","length","locale","curCollection","collection","upgradeCollection","cur","max","global","globals","upgradeGlobal","console","log","slug","document","findGlobal","depth","undefined","overrideAccess","found","upgradeDocument","fields","updateGlobal","data","documentCount","count","totalDocs","page","upgraded","documents","find","pagination","docs","id","update"],"sources":["../../../src/utilities/upgradeLexicalData/index.ts"],"sourcesContent":["import type { CollectionConfig, Field, GlobalConfig, Payload } from 'payload'\n\nimport { upgradeDocumentFieldsRecursively } from './upgradeDocumentFieldsRecursively.js'\n\n/**\n * This goes through every single document in your payload app and re-saves it, if it has a lexical editor.\n * This way, the data is automatically converted to the new format, and that automatic conversion gets applied to every single document in your app.\n *\n * @param payload\n */\nexport async function upgradeLexicalData({ payload }: { payload: Payload }) {\n const collections = payload.config.collections\n\n const allLocales = payload.config.localization ? payload.config.localization.localeCodes : [null]\n\n const totalCollections = collections.length\n for (const locale of allLocales) {\n let curCollection = 0\n for (const collection of collections) {\n curCollection++\n await upgradeCollection({\n collection,\n cur: curCollection,\n locale,\n max: totalCollections,\n payload,\n })\n }\n for (const global of payload.config.globals) {\n await upgradeGlobal({\n global,\n locale,\n payload,\n })\n }\n }\n}\n\nasync function upgradeGlobal({\n global,\n locale,\n payload,\n}: {\n global: GlobalConfig\n locale: null | string\n payload: Payload\n}) {\n console.log(`Lexical Upgrader: ${locale}: Upgrading global:`, global.slug)\n\n const document = await payload.findGlobal({\n slug: global.slug,\n depth: 0,\n locale: locale || undefined,\n overrideAccess: true,\n })\n\n const found = upgradeDocument({\n document,\n fields: global.fields,\n payload,\n })\n\n if (found) {\n await payload.updateGlobal({\n slug: global.slug,\n data: document,\n depth: 0,\n locale: locale || undefined,\n })\n }\n}\n\nasync function upgradeCollection({\n collection,\n cur,\n locale,\n max,\n payload,\n}: {\n collection: CollectionConfig\n cur: number\n locale: null | string\n max: number\n payload: Payload\n}) {\n console.log(\n `Lexical Upgrade: ${locale}: Upgrading collection:`,\n collection.slug,\n '(' + cur + '/' + max + ')',\n )\n\n const documentCount = (\n await payload.count({\n collection: collection.slug,\n locale: locale || undefined,\n })\n ).totalDocs\n\n let page = 1\n let upgraded = 0\n\n while (upgraded < documentCount) {\n const documents = await payload.find({\n collection: collection.slug,\n depth: 0,\n locale: locale || undefined,\n overrideAccess: true,\n page,\n pagination: true,\n })\n\n for (const document of documents.docs) {\n upgraded++\n console.log(\n `Lexical Upgrade: ${locale}: Upgrading collection:`,\n collection.slug,\n '(' +\n cur +\n '/' +\n max +\n ') - Upgrading Document: ' +\n document.id +\n ' (' +\n upgraded +\n '/' +\n documentCount +\n ')',\n )\n const found = upgradeDocument({\n document,\n fields: collection.fields,\n payload,\n })\n\n if (found) {\n await payload.update({\n id: document.id,\n collection: collection.slug,\n data: document,\n depth: 0,\n locale: locale || undefined,\n })\n }\n }\n page++\n }\n}\n\nfunction upgradeDocument({\n document,\n fields,\n payload,\n}: {\n document: Record<string, unknown>\n fields: Field[]\n payload: Payload\n}): boolean {\n return !!upgradeDocumentFieldsRecursively({\n data: document,\n fields,\n found: 0,\n payload,\n })\n}\n"],"mappings":"AAEA,SAASA,gCAAgC,QAAQ;AAEjD;;;;;;AAMA,OAAO,eAAeC,mBAAmB;EAAEC;AAAO,CAAwB;EACxE,MAAMC,WAAA,GAAcD,OAAA,CAAQE,MAAM,CAACD,WAAW;EAE9C,MAAME,UAAA,GAAaH,OAAA,CAAQE,MAAM,CAACE,YAAY,GAAGJ,OAAA,CAAQE,MAAM,CAACE,YAAY,CAACC,WAAW,GAAG,CAAC,KAAK;EAEjG,MAAMC,gBAAA,GAAmBL,WAAA,CAAYM,MAAM;EAC3C,KAAK,MAAMC,MAAA,IAAUL,UAAA,EAAY;IAC/B,IAAIM,aAAA,GAAgB;IACpB,KAAK,MAAMC,UAAA,IAAcT,WAAA,EAAa;MACpCQ,aAAA;MACA,MAAME,iBAAA,CAAkB;QACtBD,UAAA;QACAE,GAAA,EAAKH,aAAA;QACLD,MAAA;QACAK,GAAA,EAAKP,gBAAA;QACLN;MACF;IACF;IACA,KAAK,MAAMc,MAAA,IAAUd,OAAA,CAAQE,MAAM,CAACa,OAAO,EAAE;MAC3C,MAAMC,aAAA,CAAc;QAClBF,MAAA;QACAN,MAAA;QACAR;MACF;I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3BG,KAAA,EAAO;MACPd,MAAA,EAAQA,MAAA,IAAUe,SAAA;MAClBC,cAAA,EAAgB;MAChBS,IAAA;MACAI,UAAA,EAAY;IACd;IAEA,KAAK,MAAMjB,QAAA,IAAYe,SAAA,CAAUG,IAAI,EAAE;MACrCJ,QAAA;MACAjB,OAAA,CAAQC,GAAG,CACT,oBAAoBV,MAAA,yBAA+B,EACnDE,UAAA,CAAWS,IAAI,EACf,MACEP,GAAA,GACA,MACAC,GAAA,GACA,6BACAO,QAAA,CAASmB,EAAE,GACX,OACAL,QAAA,GACA,MACAJ,aAAA,GACA;MAEJ,MAAML,KAAA,GAAQC,eAAA,CAAgB;QAC5BN,QAAA;QACAO,MAAA,EAAQjB,UAAA,CAAWiB,MAAM;QACzB3B;MACF;MAEA,IAAIyB,KAAA,EAAO;QACT,MAAMzB,OAAA,CAAQwC,MAAM,CAAC;UACnBD,EAAA,EAAInB,QAAA,CAASmB,EAAE;UACf7B,UAAA,EAAYA,UAAA,CAAWS,IAAI;UAC3BU,IAAA,EAAMT,QAAA;UACNE,KAAA,EAAO;UACPd,MAAA,EAAQA,MAAA,IAAUe;QACpB;MACF;IACF;IACAU,IAAA;EACF;AACF;AAEA,SAASP,gBAAgB;EACvBN,QAAQ;EACRO,MAAM;EACN3B;AAAO,CAKR;EACC,OAAO,CAAC,CAACF,gCAAA,CAAiC;IACxC+B,IAAA,EAAMT,QAAA;IACNO,MAAA;IACAF,KAAA,EAAO;IACPzB;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["upgradeDocumentFieldsRecursively","upgradeLexicalData","payload","collections","config","allLocales","localization","localeCodes","totalCollections","length","locale","curCollection","collection","upgradeCollection","cur","max","global","globals","upgradeGlobal","console","log","slug","document","findGlobal","depth","undefined","overrideAccess","found","upgradeDocument","fields","updateGlobal","data","documentCount","count","totalDocs","page","upgraded","documents","find","pagination","docs","id","update"],"sources":["../../../src/utilities/upgradeLexicalData/index.ts"],"sourcesContent":["import type { CollectionConfig, Field, GlobalConfig, Payload } from 'payload'\n\nimport { upgradeDocumentFieldsRecursively } from './upgradeDocumentFieldsRecursively.js'\n\n/**\n * This goes through every single document in your payload app and re-saves it, if it has a lexical editor.\n * This way, the data is automatically converted to the new format, and that automatic conversion gets applied to every single document in your app.\n *\n * @param payload\n */\nexport async function upgradeLexicalData({ payload }: { payload: Payload }) {\n const collections = payload.config.collections\n\n const allLocales = payload.config.localization ? payload.config.localization.localeCodes : [null]\n\n const totalCollections = collections.length\n for (const locale of allLocales) {\n let curCollection = 0\n for (const collection of collections) {\n curCollection++\n await upgradeCollection({\n collection,\n cur: curCollection,\n locale,\n max: totalCollections,\n payload,\n })\n }\n for (const global of payload.config.globals) {\n await upgradeGlobal({\n global,\n locale,\n payload,\n })\n }\n }\n}\n\nasync function upgradeGlobal({\n global,\n locale,\n payload,\n}: {\n global: GlobalConfig\n locale: null | string\n payload: Payload\n}) {\n console.log(`Lexical Upgrader: ${locale}: Upgrading global:`, global.slug)\n\n const document = await payload.findGlobal({\n slug: global.slug,\n depth: 0,\n locale: locale || undefined,\n overrideAccess: true,\n })\n\n const found = upgradeDocument({\n document,\n fields: global.fields,\n payload,\n })\n\n if (found) {\n await payload.updateGlobal({\n slug: global.slug,\n data: document,\n depth: 0,\n locale: locale || undefined,\n overrideAccess: true,\n })\n }\n}\n\nasync function upgradeCollection({\n collection,\n cur,\n locale,\n max,\n payload,\n}: {\n collection: CollectionConfig\n cur: number\n locale: null | string\n max: number\n payload: Payload\n}) {\n console.log(\n `Lexical Upgrade: ${locale}: Upgrading collection:`,\n collection.slug,\n '(' + cur + '/' + max + ')',\n )\n\n const documentCount = (\n await payload.count({\n collection: collection.slug,\n locale: locale || undefined,\n overrideAccess: true,\n })\n ).totalDocs\n\n let page = 1\n let upgraded = 0\n\n while (upgraded < documentCount) {\n const documents = await payload.find({\n collection: collection.slug,\n depth: 0,\n locale: locale || undefined,\n overrideAccess: true,\n page,\n pagination: true,\n })\n\n for (const document of documents.docs) {\n upgraded++\n console.log(\n `Lexical Upgrade: ${locale}: Upgrading collection:`,\n collection.slug,\n '(' +\n cur +\n '/' +\n max +\n ') - Upgrading Document: ' +\n document.id +\n ' (' +\n upgraded +\n '/' +\n documentCount +\n ')',\n )\n const found = upgradeDocument({\n document,\n fields: collection.fields,\n payload,\n })\n\n if (found) {\n await payload.update({\n id: document.id,\n collection: collection.slug,\n data: document,\n depth: 0,\n locale: locale || undefined,\n overrideAccess: true,\n })\n }\n }\n page++\n }\n}\n\nfunction upgradeDocument({\n document,\n fields,\n payload,\n}: {\n document: Record<string, unknown>\n fields: Field[]\n payload: Payload\n}): boolean {\n return !!upgradeDocumentFieldsRecursively({\n data: document,\n fields,\n found: 0,\n payload,\n })\n}\n"],"mappings":"AAEA,SAASA,gCAAgC,QAAQ;AAEjD;;;;;;AAMA,OAAO,eAAeC,mBAAmB;EAAEC;AAAO,CAAwB;EACxE,MAAMC,WAAA,GAAcD,OAAA,CAAQE,MAAM,CAACD,WAAW;EAE9C,MAAME,UAAA,GAAaH,OAAA,CAAQE,MAAM,CAACE,YAAY,GAAGJ,OAAA,CAAQE,MAAM,CAACE,YAAY,CAACC,WAAW,GAAG,CAAC,KAAK;EAEjG,MAAMC,gBAAA,GAAmBL,WAAA,CAAYM,MAAM;EAC3C,KAAK,MAAMC,MAAA,IAAUL,UAAA,EAAY;IAC/B,IAAIM,aAAA,GAAgB;IACpB,KAAK,MAAMC,UAAA,IAAcT,WAAA,EAAa;MACpCQ,aAAA;MACA,MAAME,iBAAA,CAAkB;QACtBD,UAAA;QACAE,GAAA,EAAKH,aAAA;QACLD,MAAA;QACAK,GAAA,EAAKP,gBAAA;QACLN;MACF;IACF;IACA,KAAK,MAAMc,MAAA,IAAUd,OAAA,CAAQE,MAAM,CAACa,OAAO,EAAE;MAC3C,MAAMC,aAAA,CAAc;QAClBF,MAAA;QACAN,MAAA;QACAR;MACF;IACF;EACF;AACF;AAEA,eAAegB,cAAc;EAC3BF,MAAM;EACNN,MAAM;E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AA,EAAO;MACPd,MAAA,EAAQA,MAAA,IAAUe,SAAA;MAClBC,cAAA,EAAgB;MAChBS,IAAA;MACAI,UAAA,EAAY;IACd;IAEA,KAAK,MAAMjB,QAAA,IAAYe,SAAA,CAAUG,IAAI,EAAE;MACrCJ,QAAA;MACAjB,OAAA,CAAQC,GAAG,CACT,oBAAoBV,MAAA,yBAA+B,EACnDE,UAAA,CAAWS,IAAI,EACf,MACEP,GAAA,GACA,MACAC,GAAA,GACA,6BACAO,QAAA,CAASmB,EAAE,GACX,OACAL,QAAA,GACA,MACAJ,aAAA,GACA;MAEJ,MAAML,KAAA,GAAQC,eAAA,CAAgB;QAC5BN,QAAA;QACAO,MAAA,EAAQjB,UAAA,CAAWiB,MAAM;QACzB3B;MACF;MAEA,IAAIyB,KAAA,EAAO;QACT,MAAMzB,OAAA,CAAQwC,MAAM,CAAC;UACnBD,EAAA,EAAInB,QAAA,CAASmB,EAAE;UACf7B,UAAA,EAAYA,UAAA,CAAWS,IAAI;UAC3BU,IAAA,EAAMT,QAAA;UACNE,KAAA,EAAO;UACPd,MAAA,EAAQA,MAAA,IAAUe,SAAA;UAClBC,cAAA,EAAgB;QAClB;MACF;IACF;IACAS,IAAA;EACF;AACF;AAEA,SAASP,gBAAgB;EACvBN,QAAQ;EACRO,MAAM;EACN3B;AAAO,CAKR;EACC,OAAO,CAAC,CAACF,gCAAA,CAAiC;IACxC+B,IAAA,EAAMT,QAAA;IACNO,MAAA;IACAF,KAAA,EAAO;IACPzB;EACF;AACF","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/richtext-lexical",
3
- "version": "4.0.0-canary.35",
3
+ "version": "4.0.0-canary.37",
4
4
  "description": "The officially supported Lexical richtext adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -443,8 +443,8 @@
443
443
  "react-error-boundary": "6.1.1",
444
444
  "ts-essentials": "10.0.3",
445
445
  "uuid": "14.0.0",
446
- "@payloadcms/translations": "4.0.0-canary.35",
447
- "@payloadcms/ui": "4.0.0-canary.35"
446
+ "@payloadcms/translations": "4.0.0-canary.37",
447
+ "@payloadcms/ui": "4.0.0-canary.37"
448
448
  },
449
449
  "devDependencies": {
450
450
  "@babel/cli": "7.27.2",
@@ -463,15 +463,15 @@
463
463
  "esbuild": "0.27.1",
464
464
  "esbuild-sass-plugin": "3.3.1",
465
465
  "swc-plugin-transform-remove-imports": "8.3.0",
466
- "@payloadcms/eslint-config": "3.28.0",
467
- "payload": "4.0.0-canary.35"
466
+ "payload": "4.0.0-canary.37",
467
+ "@payloadcms/eslint-config": "3.28.0"
468
468
  },
469
469
  "peerDependencies": {
470
470
  "@faceless-ui/modal": "3.0.1",
471
471
  "@faceless-ui/scroll-info": "2.0.0",
472
472
  "react": "^19.0.1 || ^19.1.2 || ^19.2.1",
473
473
  "react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1",
474
- "payload": "4.0.0-canary.35"
474
+ "payload": "4.0.0-canary.37"
475
475
  },
476
476
  "engines": {
477
477
  "node": ">=24.15.0"
@@ -493,8 +493,8 @@
493
493
  "build:types": "tsc --emitDeclarationOnly --outDir dist",
494
494
  "build:without_reactcompiler": "rm -rf dist && rm -rf tsconfig.tsbuildinfo && pnpm copyfiles && pnpm build:types && pnpm build:swc && pnpm build:esbuild && pnpm build:esbuild:postproces && rm -rf dist/exports/client && mv dist/exports/client_unoptimized dist/exports/client",
495
495
  "clean": "rimraf -g {dist,*.tsbuildinfo,esbuild}",
496
- "copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
497
- "copyfiles:debug": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
496
+ "copyfiles": "copyfiles -u 1 -e \"**/*.spec.*\" \"src/**/*.{html,css,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
497
+ "copyfiles:debug": "copyfiles -u 1 -e \"**/*.spec.*\" \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
498
498
  "lint": "eslint .",
499
499
  "lint:fix": "eslint . --fix"
500
500
  }
@@ -1,16 +0,0 @@
1
- import { lexicalTargetVersion } from './index';
2
- import { fileURLToPath } from 'url';
3
- import path from 'path';
4
- import fs from 'fs/promises';
5
- import { describe, it, expect } from 'vitest';
6
- const filename = fileURLToPath(import.meta.url);
7
- const dirname = path.dirname(filename);
8
- describe('Lexical dependency checker', () => {
9
- it('ensure lexical version installed in package.json matches dependency checker version', async () => {
10
- const packageJsonString = await fs.readFile(path.resolve(dirname, '../package.json'), 'utf-8');
11
- const packageJson = JSON.parse(packageJsonString);
12
- const packageJsonLexicalVersion = packageJson.dependencies['lexical'];
13
- expect(packageJsonLexicalVersion).toBe(lexicalTargetVersion);
14
- });
15
- });
16
- //# sourceMappingURL=dependencyChecker.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dependencyChecker.spec.js","names":["lexicalTargetVersion","fileURLToPath","path","fs","describe","it","expect","filename","import","meta","url","dirname","packageJsonString","readFile","resolve","packageJson","JSON","parse","packageJsonLexicalVersion","dependencies","toBe"],"sources":["../src/dependencyChecker.spec.ts"],"sourcesContent":["import { lexicalTargetVersion } from './index'\nimport { fileURLToPath } from 'url'\nimport path from 'path'\nimport fs from 'fs/promises'\nimport { describe, it, expect } from 'vitest'\n\nconst filename = fileURLToPath(import.meta.url)\nconst dirname = path.dirname(filename)\n\ndescribe('Lexical dependency checker', () => {\n it('ensure lexical version installed in package.json matches dependency checker version', async () => {\n const packageJsonString = await fs.readFile(path.resolve(dirname, '../package.json'), 'utf-8')\n const packageJson = JSON.parse(packageJsonString)\n const packageJsonLexicalVersion = packageJson.dependencies['lexical']\n\n expect(packageJsonLexicalVersion).toBe(lexicalTargetVersion)\n })\n})\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ;AACrC,SAASC,aAAa,QAAQ;AAC9B,OAAOC,IAAA,MAAU;AACjB,OAAOC,EAAA,MAAQ;AACf,SAASC,QAAQ,EAAEC,EAAE,EAAEC,MAAM,QAAQ;AAErC,MAAMC,QAAA,GAAWN,aAAA,CAAcO,MAAA,CAAAC,IAAA,CAAYC,GAAG;AAC9C,MAAMC,OAAA,GAAUT,IAAA,CAAKS,OAAO,CAACJ,QAAA;AAE7BH,QAAA,CAAS,8BAA8B;EACrCC,EAAA,CAAG,uFAAuF;IACxF,MAAMO,iBAAA,GAAoB,MAAMT,EAAA,CAAGU,QAAQ,CAACX,IAAA,CAAKY,OAAO,CAACH,OAAA,EAAS,oBAAoB;IACtF,MAAMI,WAAA,GAAcC,IAAA,CAAKC,KAAK,CAACL,iBAAA;IAC/B,MAAMM,yBAAA,GAA4BH,WAAA,CAAYI,YAAY,CAAC,UAAU;IAErEb,MAAA,CAAOY,yBAAA,EAA2BE,IAAI,CAACpB,oBAAA;EACzC;AACF","ignoreList":[]}
@@ -1,92 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { convertLexicalToHTML } from './index.js';
3
- function textNode(text) {
4
- return {
5
- type: 'text',
6
- detail: 0,
7
- format: 0,
8
- mode: 'normal',
9
- style: '',
10
- text,
11
- version: 1
12
- };
13
- }
14
- function paragraphNode({
15
- direction = null,
16
- format
17
- }) {
18
- return {
19
- type: 'paragraph',
20
- children: [textNode('مرحبا')],
21
- direction,
22
- format,
23
- indent: 0,
24
- textFormat: 0,
25
- version: 1
26
- };
27
- }
28
- function rootNode(paragraph) {
29
- return {
30
- root: {
31
- type: 'root',
32
- children: [paragraph],
33
- direction: null,
34
- format: '',
35
- indent: 0,
36
- version: 1
37
- }
38
- };
39
- }
40
- describe('convertLexicalToHTML - paragraph alignment', () => {
41
- it('preserves logical alignment for format: start', () => {
42
- const html = convertLexicalToHTML({
43
- data: rootNode(paragraphNode({
44
- format: 'start'
45
- })),
46
- disableContainer: true
47
- });
48
- expect(html).toBe('<p style="text-align: start;">مرحبا</p>');
49
- });
50
- it('preserves logical alignment for format: end', () => {
51
- const html = convertLexicalToHTML({
52
- data: rootNode(paragraphNode({
53
- format: 'end'
54
- })),
55
- disableContainer: true
56
- });
57
- expect(html).toBe('<p style="text-align: end;">مرحبا</p>');
58
- });
59
- it('emits text-align for explicit format: left', () => {
60
- const html = convertLexicalToHTML({
61
- data: rootNode(paragraphNode({
62
- format: 'left'
63
- })),
64
- disableContainer: true
65
- });
66
- expect(html).toBe('<p style="text-align: left;">مرحبا</p>');
67
- });
68
- it('emits text-align for explicit format: right', () => {
69
- const html = convertLexicalToHTML({
70
- data: rootNode(paragraphNode({
71
- format: 'right'
72
- })),
73
- disableContainer: true
74
- });
75
- expect(html).toBe('<p style="text-align: right;">مرحبا</p>');
76
- });
77
- it('preserves logical alignment start for RTL-directed paragraphs', () => {
78
- const html = convertLexicalToHTML({
79
- data: rootNode(paragraphNode({
80
- direction: 'rtl',
81
- format: 'start'
82
- })),
83
- disableContainer: true
84
- });
85
- // For RTL content, `start` must NOT be resolved to `left` - it must stay logical
86
- // (or resolve to `right`, its physical RTL equivalent), otherwise the paragraph
87
- // renders visually misaligned against the text's own reading direction.
88
- expect(html).not.toBe('<p style="text-align: left;">مرحبا</p>');
89
- expect(html).toBe('<p style="text-align: start;">مرحبا</p>');
90
- });
91
- });
92
- //# sourceMappingURL=alignment.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"alignment.spec.js","names":["describe","expect","it","convertLexicalToHTML","textNode","text","type","detail","format","mode","style","version","paragraphNode","direction","children","indent","textFormat","rootNode","paragraph","root","html","data","disableContainer","toBe","not"],"sources":["../../../../../src/features/converters/lexicalToHtml/sync/alignment.spec.ts"],"sourcesContent":["import { describe, expect, it } from 'vitest'\nimport type {\n DefaultTypedEditorState,\n LexicalElementDirection,\n LexicalElementFormat,\n SerializedParagraphNode,\n SerializedTextNode,\n} from '../../../../types/nodeTypes.js'\n\nimport { convertLexicalToHTML } from './index.js'\n\nfunction textNode(text: string): SerializedTextNode {\n return {\n type: 'text',\n detail: 0,\n format: 0,\n mode: 'normal',\n style: '',\n text,\n version: 1,\n }\n}\n\nfunction paragraphNode({\n direction = null,\n format,\n}: {\n direction?: LexicalElementDirection\n format: LexicalElementFormat\n}): SerializedParagraphNode {\n return {\n type: 'paragraph',\n children: [textNode('مرحبا')],\n direction,\n format,\n indent: 0,\n textFormat: 0,\n version: 1,\n }\n}\n\nfunction rootNode(paragraph: SerializedParagraphNode): DefaultTypedEditorState {\n return {\n root: {\n type: 'root',\n children: [paragraph],\n direction: null,\n format: '',\n indent: 0,\n version: 1,\n },\n }\n}\n\ndescribe('convertLexicalToHTML - paragraph alignment', () => {\n it('preserves logical alignment for format: start', () => {\n const html = convertLexicalToHTML({\n data: rootNode(paragraphNode({ format: 'start' })),\n disableContainer: true,\n })\n\n expect(html).toBe('<p style=\"text-align: start;\">مرحبا</p>')\n })\n\n it('preserves logical alignment for format: end', () => {\n const html = convertLexicalToHTML({\n data: rootNode(paragraphNode({ format: 'end' })),\n disableContainer: true,\n })\n\n expect(html).toBe('<p style=\"text-align: end;\">مرحبا</p>')\n })\n\n it('emits text-align for explicit format: left', () => {\n const html = convertLexicalToHTML({\n data: rootNode(paragraphNode({ format: 'left' })),\n disableContainer: true,\n })\n\n expect(html).toBe('<p style=\"text-align: left;\">مرحبا</p>')\n })\n\n it('emits text-align for explicit format: right', () => {\n const html = convertLexicalToHTML({\n data: rootNode(paragraphNode({ format: 'right' })),\n disableContainer: true,\n })\n\n expect(html).toBe('<p style=\"text-align: right;\">مرحبا</p>')\n })\n\n it('preserves logical alignment start for RTL-directed paragraphs', () => {\n const html = convertLexicalToHTML({\n data: rootNode(paragraphNode({ direction: 'rtl', format: 'start' })),\n disableContainer: true,\n })\n\n // For RTL content, `start` must NOT be resolved to `left` - it must stay logical\n // (or resolve to `right`, its physical RTL equivalent), otherwise the paragraph\n // renders visually misaligned against the text's own reading direction.\n expect(html).not.toBe('<p style=\"text-align: left;\">مرحبا</p>')\n expect(html).toBe('<p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A8C;IAC/C,MAAMkB,IAAA,GAAOjB,oBAAA,CAAqB;MAChCkB,IAAA,EAAMJ,QAAA,CAASL,aAAA,CAAc;QAAEJ,MAAA,EAAQ;MAAO;MAC9Cc,gBAAA,EAAkB;IACpB;IAEArB,MAAA,CAAOmB,IAAA,EAAMG,IAAI,CAAC;EACpB;EAEArB,EAAA,CAAG,+CAA+C;IAChD,MAAMkB,IAAA,GAAOjB,oBAAA,CAAqB;MAChCkB,IAAA,EAAMJ,QAAA,CAASL,aAAA,CAAc;QAAEJ,MAAA,EAAQ;MAAQ;MAC/Cc,gBAAA,EAAkB;IACpB;IAEArB,MAAA,CAAOmB,IAAA,EAAMG,IAAI,CAAC;EACpB;EAEArB,EAAA,CAAG,iEAAiE;IAClE,MAAMkB,IAAA,GAAOjB,oBAAA,CAAqB;MAChCkB,IAAA,EAAMJ,QAAA,CAASL,aAAA,CAAc;QAAEC,SAAA,EAAW;QAAOL,MAAA,EAAQ;MAAQ;MACjEc,gBAAA,EAAkB;IACpB;IAEA;IACA;IACA;IACArB,MAAA,CAAOmB,IAAA,EAAMI,GAAG,CAACD,IAAI,CAAC;IACtBtB,MAAA,CAAOmB,IAAA,EAAMG,IAAI,CAAC;EACpB;AACF","ignoreList":[]}
@@ -1,114 +0,0 @@
1
- import { createElement } from 'react';
2
- import { renderToStaticMarkup } from 'react-dom/server';
3
- import { describe, expect, it } from 'vitest';
4
- import { RichText } from './index.js';
5
- const text = 'body { display: none; }';
6
- const textNode = {
7
- type: 'text',
8
- detail: 0,
9
- format: 0,
10
- mode: 'normal',
11
- style: '',
12
- text,
13
- version: 1
14
- };
15
- describe('RichText node tags', () => {
16
- it.each(['h1', 'h2', 'h3', 'h4', 'h5', 'h6'])('should preserve the allowed heading tag %s', tag => {
17
- const html = renderToStaticMarkup(createElement(RichText, {
18
- data: createEditorState({
19
- tag,
20
- type: 'heading'
21
- }),
22
- disableContainer: true
23
- }));
24
- expect(html).toBe(`<${tag}>${text}</${tag}>`);
25
- });
26
- it.each([{
27
- listType: 'bullet',
28
- tag: 'ul'
29
- }, {
30
- listType: 'number',
31
- tag: 'ol'
32
- }, {
33
- listType: 'check',
34
- tag: 'ul'
35
- }])('should preserve the allowed $listType list tag $tag', ({
36
- listType,
37
- tag
38
- }) => {
39
- const html = renderToStaticMarkup(createElement(RichText, {
40
- data: createEditorState({
41
- listType,
42
- tag,
43
- type: 'list'
44
- }),
45
- disableContainer: true
46
- }));
47
- expect(html).toBe(`<${tag} class="list-${listType}">${text}</${tag}>`);
48
- });
49
- describe.each(['heading', 'list'])('%s', type => {
50
- it.each(['style', 'script', 'plaintext', 'iframe', 'div', 'h7', '', null, undefined, 1, {}, ['h1']].map(tag => ({
51
- tag
52
- })))('should replace an invalid tag $tag with a safe fallback', ({
53
- tag
54
- }) => {
55
- const html = renderToStaticMarkup(createElement(RichText, {
56
- data: createEditorState({
57
- tag,
58
- type
59
- }),
60
- disableContainer: true
61
- }));
62
- expect(html).toBe(type === 'heading' ? `<h1>${text}</h1>` : `<ul class="list-bullet">${text}</ul>`);
63
- });
64
- it('should replace invalid tags in nested nodes', () => {
65
- const data = createEditorState({
66
- tag: 'style',
67
- type
68
- });
69
- data.root.children = [{
70
- type: 'quote',
71
- children: data.root.children,
72
- direction: null,
73
- format: '',
74
- indent: 0,
75
- version: 1
76
- }];
77
- const html = renderToStaticMarkup(createElement(RichText, {
78
- data,
79
- disableContainer: true
80
- }));
81
- expect(html).toBe(`<blockquote>${type === 'heading' ? `<h1>${text}</h1>` : `<ul class="list-bullet">${text}</ul>`}</blockquote>`);
82
- });
83
- });
84
- });
85
- function createEditorState({
86
- listType = 'bullet',
87
- tag,
88
- type
89
- }) {
90
- // Stored JSON can contain values outside the serialized node's TypeScript types.
91
- return {
92
- root: {
93
- type: 'root',
94
- children: [{
95
- type,
96
- children: [textNode],
97
- direction: null,
98
- format: '',
99
- indent: 0,
100
- ...(type === 'list' ? {
101
- listType,
102
- start: 1
103
- } : {}),
104
- tag,
105
- version: 1
106
- }],
107
- direction: null,
108
- format: '',
109
- indent: 0,
110
- version: 1
111
- }
112
- };
113
- }
114
- //# sourceMappingURL=nodeTags.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nodeTags.spec.js","names":["createElement","renderToStaticMarkup","describe","expect","it","RichText","text","textNode","type","detail","format","mode","style","version","each","tag","html","data","createEditorState","disableContainer","toBe","listType","undefined","map","root","children","direction","indent","start"],"sources":["../../../../../src/features/converters/lexicalToJSX/Component/nodeTags.spec.ts"],"sourcesContent":["import { createElement } from 'react'\nimport { renderToStaticMarkup } from 'react-dom/server'\nimport { describe, expect, it } from 'vitest'\n\nimport type { DefaultTypedEditorState, SerializedTextNode } from '../../../../types/nodeTypes.js'\n\nimport { RichText } from './index.js'\n\nconst text = 'body { display: none; }'\nconst textNode: SerializedTextNode = {\n type: 'text',\n detail: 0,\n format: 0,\n mode: 'normal',\n style: '',\n text,\n version: 1,\n}\n\ndescribe('RichText node tags', () => {\n it.each(['h1', 'h2', 'h3', 'h4', 'h5', 'h6'])(\n 'should preserve the allowed heading tag %s',\n (tag) => {\n const html = renderToStaticMarkup(\n createElement(RichText, {\n data: createEditorState({ tag, type: 'heading' }),\n disableContainer: true,\n }),\n )\n\n expect(html).toBe(`<${tag}>${text}</${tag}>`)\n },\n )\n\n it.each([\n { listType: 'bullet', tag: 'ul' },\n { listType: 'number', tag: 'ol' },\n { listType: 'check', tag: 'ul' },\n ])('should preserve the allowed $listType list tag $tag', ({ listType, tag }) => {\n const html = renderToStaticMarkup(\n createElement(RichText, {\n data: createEditorState({ listType, tag, type: 'list' }),\n disableContainer: true,\n }),\n )\n\n expect(html).toBe(`<${tag} class=\"list-${listType}\">${text}</${tag}>`)\n })\n\n describe.each(['heading', 'list'] as const)('%s', (type) => {\n it.each(\n [\n 'style',\n 'script',\n 'plaintext',\n 'iframe',\n 'div',\n 'h7',\n '',\n null,\n undefined,\n 1,\n {},\n ['h1'],\n ].map((tag) => ({ tag })),\n )('should replace an invalid tag $tag with a safe fallback', ({ tag }) => {\n const html = renderToStaticMarkup(\n createElement(RichText, { data: createEditorState({ tag, type }), disableContainer: true }),\n )\n\n expect(html).toBe(\n type === 'heading' ? `<h1>${text}</h1>` : `<ul class=\"list-bullet\">${text}</ul>`,\n )\n })\n\n it('should replace invalid tags in nested nodes', () => {\n const data = createEditorState({ tag: 'style', type })\n\n data.root.children = [\n {\n type: 'quote',\n children: data.root.children,\n direction: null,\n format: '',\n indent: 0,\n version: 1,\n },\n ]\n\n const html = renderToStaticMarkup(createElement(RichText, { data, disableContainer: true }))\n\n expect(html).toBe(\n `<blockquote>${type === 'heading' ? `<h1>${text}</h1>` : `<ul class=\"list-bullet\">${text}</ul>`}</blockquote>`,\n )\n })\n })\n})\n\nfunction createEditorState({\n listType = 'bullet',\n tag,\n type,\n}: {\n listType?: string\n tag: unknown\n type: 'heading' | 'list'\n}): DefaultTypedEditorState {\n // Stored JSON can contain values outside the serialized node's TypeScript types.\n return {\n root: {\n type: 'root',\n children: [\n {\n type,\n children: [textNode],\n direction: null,\n format: '',\n indent: 0,\n ...(type === 'list' ? { listType, start: 1 } : {}),\n tag,\n version: 1,\n },\n ],\n direction: null,\n format: '',\n indent: 0,\n version: 1,\n },\n } as DefaultTypedEditorState\n}\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ;AAC9B,SAASC,oBAAoB,QAAQ;AACrC,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ;AAIrC,SAASC,QAAQ,QAAQ;AAEzB,MAAMC,IAAA,GAAO;AACb,MAAMC,QAAA,GAA+B;EACnCC,IAAA,EAAM;EACNC,MAAA,EAAQ;EACRC,MAAA,EAAQ;EACRC,IAAA,EAAM;EACNC,KAAA,EAAO;EACPN,IAAA;EACAO,OAAA,EAAS;AACX;AAEAX,QAAA,CAAS,sBAAsB;EAC7BE,EAAA,CAAGU,IAAI,CAAC,CAAC,MAAM,MAAM,MAAM,MAAM,MAAM,KAAK,EAC1C,8CACCC,GAAA;IACC,M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