@payloadcms/richtext-lexical 3.59.0-internal.d8b427e → 3.59.0-internal.ee5f42c

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 (120) hide show
  1. package/dist/exports/client/{Field-2MCIQXRP.js → Field-EHRBYNHO.js} +2 -2
  2. package/dist/exports/client/bundled.css +1 -1
  3. package/dist/exports/client/{chunk-TLQLXR6Q.js → chunk-2Y72RT72.js} +2 -2
  4. package/dist/exports/client/chunk-3BY5IZJD.js +2 -0
  5. package/dist/exports/client/chunk-3BY5IZJD.js.map +7 -0
  6. package/dist/exports/client/componentInline-7TPI7ZBC.js +2 -0
  7. package/dist/exports/client/index.d.ts +0 -3
  8. package/dist/exports/client/index.d.ts.map +1 -1
  9. package/dist/exports/client/index.js +10 -35
  10. package/dist/exports/client/index.js.map +4 -4
  11. package/dist/features/blocks/client/component/BlockContent.d.ts +27 -52
  12. package/dist/features/blocks/client/component/BlockContent.d.ts.map +1 -1
  13. package/dist/features/blocks/client/component/BlockContent.js +51 -45
  14. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  15. package/dist/features/blocks/client/component/components/BlockCollapsible.d.ts +9 -2
  16. package/dist/features/blocks/client/component/components/BlockCollapsible.d.ts.map +1 -1
  17. package/dist/features/blocks/client/component/components/BlockCollapsible.js +25 -7
  18. package/dist/features/blocks/client/component/components/BlockCollapsible.js.map +1 -1
  19. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  20. package/dist/features/blocks/client/component/index.js +50 -62
  21. package/dist/features/blocks/client/component/index.js.map +1 -1
  22. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  23. package/dist/features/blocks/client/componentInline/index.js +1 -0
  24. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  25. package/dist/features/blocks/client/index.d.ts.map +1 -1
  26. package/dist/features/blocks/client/index.js +0 -5
  27. package/dist/features/blocks/client/index.js.map +1 -1
  28. package/dist/features/blocks/client/markdownTransformer.d.ts +17 -0
  29. package/dist/features/blocks/client/markdownTransformer.d.ts.map +1 -0
  30. package/dist/features/blocks/client/markdownTransformer.js +144 -0
  31. package/dist/features/blocks/client/markdownTransformer.js.map +1 -0
  32. package/dist/features/blocks/server/i18n.js +38 -38
  33. package/dist/features/blocks/server/i18n.js.map +1 -1
  34. package/dist/features/blocks/server/index.js +1 -1
  35. package/dist/features/blocks/server/index.js.map +1 -1
  36. package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.d.ts.map +1 -0
  37. package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.js.map +1 -0
  38. package/dist/features/blocks/server/markdownTransformer.d.ts +22 -0
  39. package/dist/features/blocks/server/markdownTransformer.d.ts.map +1 -0
  40. package/dist/features/blocks/server/{markdown/markdownTransformer.js → markdownTransformer.js} +48 -6
  41. package/dist/features/blocks/server/markdownTransformer.js.map +1 -0
  42. package/dist/field/RenderLexical/index.d.ts.map +1 -1
  43. package/dist/field/RenderLexical/index.js +1 -0
  44. package/dist/field/RenderLexical/index.js.map +1 -1
  45. package/dist/field/bundled.css +1 -1
  46. package/dist/index.d.ts +0 -1
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +0 -1
  49. package/dist/index.js.map +1 -1
  50. package/dist/lexical/ui/icons/CodeBlock/index.d.ts.map +1 -1
  51. package/dist/lexical/ui/icons/CodeBlock/index.js +15 -10
  52. package/dist/lexical/ui/icons/CodeBlock/index.js.map +1 -1
  53. package/dist/utilities/jsx/collectTopLevelJSXInLines.js +2 -2
  54. package/dist/utilities/jsx/collectTopLevelJSXInLines.js.map +1 -1
  55. package/package.json +6 -6
  56. package/dist/exports/client/chunk-K47TNP5J.js +0 -2
  57. package/dist/exports/client/chunk-K47TNP5J.js.map +0 -7
  58. package/dist/exports/client/componentInline-AGFSKAY4.js +0 -2
  59. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts +0 -6
  60. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts.map +0 -1
  61. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js +0 -24
  62. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js.map +0 -1
  63. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts +0 -6
  64. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts.map +0 -1
  65. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js +0 -20
  66. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js.map +0 -1
  67. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts +0 -12
  68. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts.map +0 -1
  69. package/dist/features/blocks/client/markdown/markdownTransformer.js +0 -348
  70. package/dist/features/blocks/client/markdown/markdownTransformer.js.map +0 -1
  71. package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts +0 -5
  72. package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts.map +0 -1
  73. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +0 -151
  74. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +0 -1
  75. package/dist/features/blocks/premade/CodeBlock/Component/Code.d.ts +0 -61
  76. package/dist/features/blocks/premade/CodeBlock/Component/Code.d.ts.map +0 -1
  77. package/dist/features/blocks/premade/CodeBlock/Component/Code.js +0 -89
  78. package/dist/features/blocks/premade/CodeBlock/Component/Code.js.map +0 -1
  79. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.d.ts +0 -4
  80. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.d.ts.map +0 -1
  81. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js +0 -17
  82. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js.map +0 -1
  83. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.d.ts +0 -4
  84. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.d.ts.map +0 -1
  85. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js +0 -26
  86. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js.map +0 -1
  87. package/dist/features/blocks/premade/CodeBlock/converter.d.ts +0 -7
  88. package/dist/features/blocks/premade/CodeBlock/converter.d.ts.map +0 -1
  89. package/dist/features/blocks/premade/CodeBlock/converter.js +0 -46
  90. package/dist/features/blocks/premade/CodeBlock/converter.js.map +0 -1
  91. package/dist/features/blocks/premade/CodeBlock/converterClient.d.ts +0 -2
  92. package/dist/features/blocks/premade/CodeBlock/converterClient.d.ts.map +0 -1
  93. package/dist/features/blocks/premade/CodeBlock/converterClient.js +0 -4
  94. package/dist/features/blocks/premade/CodeBlock/converterClient.js.map +0 -1
  95. package/dist/features/blocks/premade/CodeBlock/index.d.ts +0 -7
  96. package/dist/features/blocks/premade/CodeBlock/index.d.ts.map +0 -1
  97. package/dist/features/blocks/premade/CodeBlock/index.js +0 -52
  98. package/dist/features/blocks/premade/CodeBlock/index.js.map +0 -1
  99. package/dist/features/blocks/server/markdown/getLexicalToMarkdown.d.ts +0 -6
  100. package/dist/features/blocks/server/markdown/getLexicalToMarkdown.d.ts.map +0 -1
  101. package/dist/features/blocks/server/markdown/getLexicalToMarkdown.js +0 -27
  102. package/dist/features/blocks/server/markdown/getLexicalToMarkdown.js.map +0 -1
  103. package/dist/features/blocks/server/markdown/getMarkdownToLexical.d.ts +0 -7
  104. package/dist/features/blocks/server/markdown/getMarkdownToLexical.d.ts.map +0 -1
  105. package/dist/features/blocks/server/markdown/getMarkdownToLexical.js +0 -22
  106. package/dist/features/blocks/server/markdown/getMarkdownToLexical.js.map +0 -1
  107. package/dist/features/blocks/server/markdown/linesFromMatchToContentAndPropsString.d.ts.map +0 -1
  108. package/dist/features/blocks/server/markdown/linesFromMatchToContentAndPropsString.js.map +0 -1
  109. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts +0 -15
  110. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts.map +0 -1
  111. package/dist/features/blocks/server/markdown/markdownTransformer.js.map +0 -1
  112. package/dist/lexical/ui/icons/Collapse/index.d.ts +0 -3
  113. package/dist/lexical/ui/icons/Collapse/index.d.ts.map +0 -1
  114. package/dist/lexical/ui/icons/Collapse/index.js +0 -18
  115. package/dist/lexical/ui/icons/Collapse/index.js.map +0 -1
  116. /package/dist/exports/client/{Field-2MCIQXRP.js.map → Field-EHRBYNHO.js.map} +0 -0
  117. /package/dist/exports/client/{chunk-TLQLXR6Q.js.map → chunk-2Y72RT72.js.map} +0 -0
  118. /package/dist/exports/client/{componentInline-AGFSKAY4.js.map → componentInline-7TPI7ZBC.js.map} +0 -0
  119. /package/dist/features/blocks/server/{markdown/linesFromMatchToContentAndPropsString.d.ts → linesFromMatchToContentAndPropsString.d.ts} +0 -0
  120. /package/dist/features/blocks/server/{markdown/linesFromMatchToContentAndPropsString.js → linesFromMatchToContentAndPropsString.js} +0 -0
@@ -1,151 +0,0 @@
1
- 'use client';
2
-
3
- import { c as _c } from "react/compiler-runtime";
4
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
5
- import { ChevronIcon, CopyToClipboard, Popup, PopupList, RenderFields, useForm, useFormFields } from '@payloadcms/ui';
6
- import React from 'react';
7
- import { CodeBlockIcon } from '../../../../../lexical/ui/icons/CodeBlock/index.js';
8
- import { useBlockComponentContext } from '../../../client/component/BlockContent.js';
9
- import { Collapse } from './Collapse/index.js';
10
- import { FloatingCollapse } from './FloatingCollapse/index.js';
11
- const baseClass = 'payload-richtext-code-block';
12
- export const CodeBlockBlockComponent = args => {
13
- const $ = _c(14);
14
- const {
15
- languages
16
- } = args;
17
- const {
18
- BlockCollapsible,
19
- formSchema,
20
- RemoveButton
21
- } = useBlockComponentContext();
22
- const {
23
- setModified
24
- } = useForm();
25
- const {
26
- codeField
27
- } = useFormFields(_temp);
28
- let t0;
29
- if ($[0] !== setModified) {
30
- t0 = t1 => {
31
- const [fields_0, dispatch] = t1;
32
- return {
33
- selectedLanguageField: fields_0?.language,
34
- setSelectedLanguage: language => {
35
- dispatch({
36
- type: "UPDATE",
37
- path: "language",
38
- value: language
39
- });
40
- setModified(true);
41
- }
42
- };
43
- };
44
- $[0] = setModified;
45
- $[1] = t0;
46
- } else {
47
- t0 = $[1];
48
- }
49
- const {
50
- selectedLanguageField,
51
- setSelectedLanguage
52
- } = useFormFields(t0);
53
- const selectedLanguageLabel = languages[selectedLanguageField?.value];
54
- const t1 = selectedLanguageField?.value;
55
- let t2;
56
- if ($[2] !== BlockCollapsible || $[3] !== RemoveButton || $[4] !== codeField?.value || $[5] !== formSchema || $[6] !== languages || $[7] !== selectedLanguageLabel || $[8] !== setSelectedLanguage || $[9] !== t1) {
57
- let t3;
58
- if ($[11] !== languages || $[12] !== setSelectedLanguage) {
59
- t3 = t4 => {
60
- const {
61
- close
62
- } = t4;
63
- return _jsx(PopupList.ButtonGroup, {
64
- children: Object.entries(languages).map(t5 => {
65
- const [languageCode, languageLabel] = t5;
66
- return _jsx(PopupList.Button, {
67
- active: false,
68
- disabled: false,
69
- onClick: () => {
70
- setSelectedLanguage(languageCode);
71
- close();
72
- },
73
- children: _jsx("span", {
74
- className: `${baseClass}__language-code`,
75
- "data-language": languageCode,
76
- children: languageLabel
77
- })
78
- }, languageCode);
79
- })
80
- });
81
- };
82
- $[11] = languages;
83
- $[12] = setSelectedLanguage;
84
- $[13] = t3;
85
- } else {
86
- t3 = $[13];
87
- }
88
- t2 = _jsx(BlockCollapsible, {
89
- Actions: _jsxs("div", {
90
- className: `${baseClass}__actions`,
91
- children: [_jsx(Popup, {
92
- button: _jsxs("div", {
93
- className: `${baseClass}__language-selector-button`,
94
- "data-selected-language": t1,
95
- children: [_jsx("span", {
96
- children: selectedLanguageLabel
97
- }), _jsx(ChevronIcon, {
98
- className: `${baseClass}__chevron`
99
- })]
100
- }),
101
- className: `${baseClass}__language-selector`,
102
- horizontalAlign: "right",
103
- render: t3,
104
- showScrollbar: true,
105
- size: "large"
106
- }), _jsx(CopyToClipboard, {
107
- value: codeField?.value ?? ""
108
- }), _jsx(Collapse, {}), _jsx(RemoveButton, {})]
109
- }),
110
- className: baseClass,
111
- collapsibleProps: {
112
- AfterCollapsible: _jsx(FloatingCollapse, {}),
113
- disableHeaderToggle: true,
114
- disableToggleIndicator: true
115
- },
116
- Pill: _jsx("div", {
117
- className: `${baseClass}__pill`,
118
- children: _jsx(CodeBlockIcon, {})
119
- }),
120
- children: _jsx(_Fragment, {
121
- children: _jsx(RenderFields, {
122
- fields: formSchema,
123
- forceRender: true,
124
- parentIndexPath: "",
125
- parentPath: "",
126
- parentSchemaPath: "",
127
- permissions: true
128
- })
129
- })
130
- });
131
- $[2] = BlockCollapsible;
132
- $[3] = RemoveButton;
133
- $[4] = codeField?.value;
134
- $[5] = formSchema;
135
- $[6] = languages;
136
- $[7] = selectedLanguageLabel;
137
- $[8] = setSelectedLanguage;
138
- $[9] = t1;
139
- $[10] = t2;
140
- } else {
141
- t2 = $[10];
142
- }
143
- return t2;
144
- };
145
- function _temp(t0) {
146
- const [fields] = t0;
147
- return {
148
- codeField: fields?.code
149
- };
150
- }
151
- //# sourceMappingURL=Block.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Block.js","names":["c","_c","ChevronIcon","CopyToClipboard","Popup","PopupList","RenderFields","useForm","useFormFields","React","CodeBlockIcon","useBlockComponentContext","Collapse","FloatingCollapse","baseClass","CodeBlockBlockComponent","args","$","languages","BlockCollapsible","formSchema","RemoveButton","setModified","codeField","_temp","t0","t1","fields_0","dispatch","selectedLanguageField","fields","language","setSelectedLanguage","type","path","value","selectedLanguageLabel","t2","t3","t4","close","_jsx","ButtonGroup","children","Object","entries","map","t5","languageCode","languageLabel","Button","active","disabled","onClick","className","Actions","_jsxs","button","horizontalAlign","render","disableHeaderToggle","disableToggleIndicator","Pill","_Fragment","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","code"],"sources":["../../../../../../src/features/blocks/premade/CodeBlock/Component/Block.tsx"],"sourcesContent":["'use client'\nimport type {} from 'payload'\n\nimport {\n ChevronIcon,\n CopyToClipboard,\n Popup,\n PopupList,\n RenderFields,\n useForm,\n useFormFields,\n} from '@payloadcms/ui'\nimport React from 'react'\n\nimport './index.scss'\n\nimport type { AdditionalCodeComponentProps } from './Code.js'\n\nimport { CodeBlockIcon } from '../../../../../lexical/ui/icons/CodeBlock/index.js'\nimport { useBlockComponentContext } from '../../../client/component/BlockContent.js'\nimport { Collapse } from './Collapse/index.js'\nimport { FloatingCollapse } from './FloatingCollapse/index.js'\n\nconst baseClass = 'payload-richtext-code-block'\nexport const CodeBlockBlockComponent: React.FC<\n Required<Pick<AdditionalCodeComponentProps, 'languages'>>\n> = (args) => {\n const { languages } = args\n const { BlockCollapsible, formSchema, RemoveButton } = useBlockComponentContext()\n const { setModified } = useForm()\n\n const { codeField } = useFormFields(([fields]) => ({\n codeField: fields?.code,\n }))\n\n const { selectedLanguageField, setSelectedLanguage } = useFormFields(([fields, dispatch]) => ({\n selectedLanguageField: fields?.language,\n setSelectedLanguage: (language: string) => {\n dispatch({\n type: 'UPDATE',\n path: 'language',\n value: language,\n })\n setModified(true)\n },\n }))\n\n const selectedLanguageLabel = languages[selectedLanguageField?.value as keyof typeof languages]\n\n return (\n <BlockCollapsible\n Actions={\n <div className={`${baseClass}__actions`}>\n <Popup\n button={\n <div\n className={`${baseClass}__language-selector-button`}\n data-selected-language={selectedLanguageField?.value}\n >\n <span>{selectedLanguageLabel}</span>\n <ChevronIcon className={`${baseClass}__chevron`} />\n </div>\n }\n className={`${baseClass}__language-selector`}\n horizontalAlign=\"right\"\n render={({ close }) => (\n <PopupList.ButtonGroup>\n {Object.entries(languages).map(([languageCode, languageLabel]) => {\n return (\n <PopupList.Button\n active={false}\n disabled={false}\n key={languageCode}\n onClick={() => {\n setSelectedLanguage(languageCode)\n close()\n }}\n >\n <span className={`${baseClass}__language-code`} data-language={languageCode}>\n {languageLabel}\n </span>\n </PopupList.Button>\n )\n })}\n </PopupList.ButtonGroup>\n )}\n showScrollbar\n size=\"large\"\n />\n <CopyToClipboard value={(codeField?.value as string) ?? ''} />\n\n <Collapse />\n\n <RemoveButton />\n </div>\n }\n className={baseClass}\n collapsibleProps={{\n AfterCollapsible: <FloatingCollapse />,\n disableHeaderToggle: true,\n disableToggleIndicator: true,\n }}\n Pill={\n <div className={`${baseClass}__pill`}>\n <CodeBlockIcon />\n </div>\n }\n >\n <>\n <RenderFields\n fields={formSchema}\n forceRender={true}\n parentIndexPath=\"\"\n parentPath={''}\n parentSchemaPath=\"\"\n permissions={true}\n />\n </>\n </BlockCollapsible>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SACEC,WAAW,EACXC,eAAe,EACfC,KAAK,EACLC,SAAS,EACTC,YAAY,EACZC,OAAO,EACPC,aAAa,QACR;AACP,OAAOC,KAAA,MAAW;AAMlB,SAASC,aAAa,QAAQ;AAC9B,SAASC,wBAAwB,QAAQ;AACzC,SAASC,QAAQ,QAAQ;AACzB,SAASC,gBAAgB,QAAQ;AAEjC,MAAMC,SAAA,GAAY;AAClB,OAAO,MAAMC,uBAAA,GAETC,IAAA;EAAA,MAAAC,CAAA,GAAAhB,EAAA;EACF;IAAAiB;EAAA,IAAsBF,IAAA;EACtB;IAAAG,gBAAA;IAAAC,UAAA;IAAAC;EAAA,IAAuDV,wBAAA;EACvD;IAAAW;EAAA,IAAwBf,OAAA;EAExB;IAAAgB;EAAA,IAAsBf,aAAA,CAAAgB,KAEtB;EAAA,IAAAC,EAAA;EAAA,IAAAR,CAAA,QAAAK,WAAA;IAEqEG,EAAA,GAAAC,EAAA;MAAC,OAAAC,QAAA,EAAAC,QAAA,IAAAF,EAAkB;MAAA;QAAAG,qBAAA,EAC/DC,QAAA,EAAAC,QAAA;QAAAC,mBAAA,EAAAD,QAAA;UAErBH,QAAA;YAAAK,IAAA,EACQ;YAAAC,IAAA,EACA;YAAAC,KAAA,EACCJ;UAAA,CACT;UACAT,WAAA,KAAY;QAAA;MAAA;IAA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4
- /**
5
- * @default first key of the `languages` prop
6
- */
7
- defaultLanguage?: string;
8
- /**
9
- * @default
10
- * {
11
- * js: 'JavaScript',
12
- * plaintext: 'Plain Text',
13
- * ts: 'TypeScript',
14
- * }
15
- */
16
- languages?: Record<string, string>;
17
- /**
18
- * Override the name of the block.
19
- *
20
- * @default 'Code'
21
- */
22
- slug?: string;
23
- /**
24
- * Configure typescript settings for the editor
25
- */
26
- typescript?: {
27
- /**
28
- * By default, the editor will not perform semantic validation. This means that
29
- * while syntax errors will be highlighted, other issues like missing imports or incorrect
30
- * types will not be.
31
- *
32
- * @default false
33
- */
34
- enableSemanticValidation?: boolean;
35
- /**
36
- * Additional types to fetch and include in the editor for autocompletion.
37
- *
38
- * For example, to include types for payload, you would set this to
39
- *
40
- * [{ url: 'https://unpkg.com/payload@latest/dist/index.d.ts', filePath: 'file:///node_modules/payload/index.d.ts' }]
41
- */
42
- fetchTypes?: Array<{
43
- filePath: string;
44
- url: string;
45
- }>;
46
- /**
47
- * @default undefined
48
- */
49
- paths?: Record<string, string[]>;
50
- /**
51
- * @default "ESNext"
52
- */
53
- target?: string;
54
- /**
55
- * @default ['node_modules/@types']
56
- */
57
- typeRoots?: string[];
58
- };
59
- };
60
- export declare const CodeComponent: React.FC<AdditionalCodeComponentProps & CodeFieldClientProps>;
61
- //# sourceMappingURL=Code.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Code.d.ts","sourceRoot":"","sources":["../../../../../../src/features/blocks/premade/CodeBlock/Component/Code.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAmB,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAGpE,OAAO,KAAkB,MAAM,OAAO,CAAA;AAEtC,MAAM,MAAM,4BAA4B,GAAG;IACzC;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAClC;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,UAAU,CAAC,EAAE;QACX;;;;;;WAMG;QACH,wBAAwB,CAAC,EAAE,OAAO,CAAA;QAClC;;;;;;WAMG;QACH,UAAU,CAAC,EAAE,KAAK,CAAC;YACjB,QAAQ,EAAE,MAAM,CAAA;YAChB,GAAG,EAAE,MAAM,CAAA;SACZ,CAAC,CAAA;QACF;;WAEG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;QAChC;;WAEG;QACH,MAAM,CAAC,EAAE,MAAM,CAAA;QACf;;WAEG;QACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;KACrB,CAAA;CACF,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,4BAA4B,GAAG,oBAAoB,CA8GvF,CAAA"}
@@ -1,89 +0,0 @@
1
- 'use client';
2
-
3
- import { jsx as _jsx } from "react/jsx-runtime";
4
- import { CodeField, useFormFields } from '@payloadcms/ui';
5
- import React, { useMemo } from 'react';
6
- export const CodeComponent = ({
7
- autoComplete,
8
- field,
9
- forceRender,
10
- languages = {
11
- js: 'JavaScript',
12
- plaintext: 'Plain Text',
13
- ts: 'TypeScript'
14
- },
15
- path,
16
- permissions,
17
- readOnly,
18
- renderedBlocks,
19
- schemaPath,
20
- typescript,
21
- validate
22
- }) => {
23
- const languageField = useFormFields(([fields]) => fields['language']);
24
- const language = languageField?.value || languageField?.initialValue || 'typescript';
25
- const label = languages[language];
26
- const props = useMemo(() => ({
27
- ...field,
28
- type: 'code',
29
- admin: {
30
- ...field.admin,
31
- editorOptions: {},
32
- language
33
- }
34
- }), [field, language]);
35
- const key = `${field.name}-${language}-${label}`;
36
- return props && /*#__PURE__*/_jsx(CodeField, {
37
- autoComplete: autoComplete,
38
- field: props,
39
- forceRender: forceRender,
40
- onMount: (_editor, monaco) => {
41
- monaco.editor.defineTheme('vs-dark', {
42
- base: 'vs-dark',
43
- colors: {
44
- 'editor.background': '#222222'
45
- },
46
- inherit: true,
47
- rules: []
48
- });
49
- monaco.editor.defineTheme('vs', {
50
- base: 'vs',
51
- colors: {
52
- 'editor.background': '#f5f5f5'
53
- },
54
- inherit: true,
55
- rules: []
56
- });
57
- monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
58
- allowNonTsExtensions: true,
59
- // Set module resolution to NodeJs to enable autocompletion
60
- jsx: 4,
61
- moduleResolution: monaco.languages.typescript.ModuleResolutionKind.NodeJs,
62
- paths: typescript?.paths,
63
- target: monaco.languages.typescript.ScriptTarget[typescript?.target ?? 'ESNext'],
64
- typeRoots: typescript?.typeRoots ?? ['node_modules/@types']
65
- });
66
- monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
67
- noSemanticValidation: typescript?.enableSemanticValidation ? false : true,
68
- noSyntaxValidation: false
69
- });
70
- const run = async () => {
71
- if (typescript?.fetchTypes && Array.isArray(typescript.fetchTypes) && typescript.fetchTypes.length > 0) {
72
- await Promise.all(typescript.fetchTypes.map(async type => {
73
- const types = await fetch(type.url);
74
- const typesText = await types.text();
75
- monaco.languages.typescript.typescriptDefaults.addExtraLib(typesText, type.filePath);
76
- }));
77
- }
78
- };
79
- void run();
80
- },
81
- path: path,
82
- permissions: permissions,
83
- readOnly: readOnly,
84
- renderedBlocks: renderedBlocks,
85
- schemaPath: schemaPath,
86
- validate: validate
87
- }, key);
88
- };
89
- //# sourceMappingURL=Code.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Code.js","names":["CodeField","useFormFields","React","useMemo","CodeComponent","autoComplete","field","forceRender","languages","js","plaintext","ts","path","permissions","readOnly","renderedBlocks","schemaPath","typescript","validate","languageField","fields","language","value","initialValue","label","props","type","admin","editorOptions","key","name","_jsx","onMount","_editor","monaco","editor","defineTheme","base","colors","inherit","rules","typescriptDefaults","setCompilerOptions","allowNonTsExtensions","jsx","moduleResolution","ModuleResolutionKind","NodeJs","paths","target","ScriptTarget","typeRoots","javascriptDefaults","setDiagnosticsOptions","noSemanticValidation","enableSemanticValidation","noSyntaxValidation","run","fetchTypes","Array","isArray","length","Promise","all","map","types","fetch","url","typesText","text","addExtraLib","filePath"],"sources":["../../../../../../src/features/blocks/premade/CodeBlock/Component/Code.tsx"],"sourcesContent":["'use client'\n\nimport type { CodeFieldClient, CodeFieldClientProps } from 'payload'\n\nimport { CodeField, useFormFields } from '@payloadcms/ui'\nimport React, { useMemo } from 'react'\n\nexport type AdditionalCodeComponentProps = {\n /**\n * @default first key of the `languages` prop\n */\n defaultLanguage?: string\n /**\n * @default\n * {\n * js: 'JavaScript',\n * plaintext: 'Plain Text',\n * ts: 'TypeScript',\n * }\n */\n languages?: Record<string, string>\n /**\n * Override the name of the block.\n *\n * @default 'Code'\n */\n slug?: string\n /**\n * Configure typescript settings for the editor\n */\n typescript?: {\n /**\n * By default, the editor will not perform semantic validation. This means that\n * while syntax errors will be highlighted, other issues like missing imports or incorrect\n * types will not be.\n *\n * @default false\n */\n enableSemanticValidation?: boolean\n /**\n * Additional types to fetch and include in the editor for autocompletion.\n *\n * For example, to include types for payload, you would set this to\n *\n * [{ url: 'https://unpkg.com/payload@latest/dist/index.d.ts', filePath: 'file:///node_modules/payload/index.d.ts' }]\n */\n fetchTypes?: Array<{\n filePath: string\n url: string\n }>\n /**\n * @default undefined\n */\n paths?: Record<string, string[]>\n /**\n * @default \"ESNext\"\n */\n target?: string\n /**\n * @default ['node_modules/@types']\n */\n typeRoots?: string[]\n }\n}\n\nexport const CodeComponent: React.FC<AdditionalCodeComponentProps & CodeFieldClientProps> = ({\n autoComplete,\n field,\n forceRender,\n languages = {\n js: 'JavaScript',\n plaintext: 'Plain Text',\n ts: 'TypeScript',\n },\n path,\n permissions,\n readOnly,\n renderedBlocks,\n schemaPath,\n typescript,\n validate,\n}) => {\n const languageField = useFormFields(([fields]) => fields['language'])\n\n const language: string =\n (languageField?.value as string) || (languageField?.initialValue as string) || 'typescript'\n\n const label = languages[language]\n\n const props: CodeFieldClient = useMemo<CodeFieldClient>(\n () => ({\n ...field,\n type: 'code',\n admin: {\n ...field.admin,\n editorOptions: {},\n language,\n },\n }),\n [field, language],\n )\n\n const key = `${field.name}-${language}-${label}`\n\n return (\n props && (\n <CodeField\n autoComplete={autoComplete}\n field={props}\n forceRender={forceRender}\n key={key}\n onMount={(_editor, monaco) => {\n monaco.editor.defineTheme('vs-dark', {\n base: 'vs-dark',\n colors: {\n 'editor.background': '#222222',\n },\n inherit: true,\n rules: [],\n })\n\n monaco.editor.defineTheme('vs', {\n base: 'vs',\n colors: {\n 'editor.background': '#f5f5f5',\n },\n inherit: true,\n rules: [],\n })\n monaco.languages.typescript.typescriptDefaults.setCompilerOptions({\n allowNonTsExtensions: true,\n // Set module resolution to NodeJs to enable autocompletion\n jsx: 4, // React JSX\n moduleResolution: monaco.languages.typescript.ModuleResolutionKind.NodeJs,\n paths: typescript?.paths,\n target: monaco.languages.typescript.ScriptTarget[\n typescript?.target ?? ('ESNext' as any)\n ] as any,\n typeRoots: typescript?.typeRoots ?? ['node_modules/@types'],\n })\n\n monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({\n noSemanticValidation: typescript?.enableSemanticValidation ? false : true,\n noSyntaxValidation: false,\n })\n\n const run = async () => {\n if (\n typescript?.fetchTypes &&\n Array.isArray(typescript.fetchTypes) &&\n typescript.fetchTypes.length > 0\n ) {\n await Promise.all(\n typescript.fetchTypes.map(async (type) => {\n const types = await fetch(type.url)\n const typesText = await types.text()\n monaco.languages.typescript.typescriptDefaults.addExtraLib(\n typesText,\n type.filePath,\n )\n }),\n )\n }\n }\n void run()\n }}\n path={path}\n permissions={permissions}\n readOnly={readOnly}\n renderedBlocks={renderedBlocks}\n schemaPath={schemaPath}\n validate={validate}\n />\n )\n )\n}\n"],"mappings":"AAAA;;;AAIA,SAASA,SAAS,EAAEC,aAAa,QAAQ;AACzC,OAAOC,KAAA,IAASC,OAAO,QAAQ;AA4D/B,OAAO,MAAMC,aAAA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AA,EAAYA,UAAA;IACZE,QAAA,EAAUA;KA7DLW,GAAA;AAiEb","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import './index.scss';
3
- export declare const Collapse: React.FC;
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/blocks/premade/CodeBlock/Component/Collapse/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,cAAc,CAAA;AAOrB,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAO5B,CAAA"}
@@ -1,17 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import React from 'react';
3
- const baseClass = 'code-block-collapse-button';
4
- import { useCollapsible } from '@payloadcms/ui';
5
- import { CollapseIcon } from '../../../../../../lexical/ui/icons/Collapse/index.js';
6
- export const Collapse = () => {
7
- const {
8
- toggle
9
- } = useCollapsible();
10
- return /*#__PURE__*/_jsx("button", {
11
- className: baseClass,
12
- onClick: toggle,
13
- type: "button",
14
- children: /*#__PURE__*/_jsx(CollapseIcon, {})
15
- });
16
- };
17
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["React","baseClass","useCollapsible","CollapseIcon","Collapse","toggle","_jsx","className","onClick","type"],"sources":["../../../../../../../src/features/blocks/premade/CodeBlock/Component/Collapse/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport './index.scss'\n\nconst baseClass = 'code-block-collapse-button'\nimport { useCollapsible } from '@payloadcms/ui'\n\nimport { CollapseIcon } from '../../../../../../lexical/ui/icons/Collapse/index.js'\n\nexport const Collapse: React.FC = () => {\n const { toggle } = useCollapsible()\n return (\n <button className={baseClass} onClick={toggle} type=\"button\">\n <CollapseIcon />\n </button>\n )\n}\n"],"mappings":";AAAA,OAAOA,KAAA,MAAW;AAIlB,MAAMC,SAAA,GAAY;AAClB,SAASC,cAAc,QAAQ;AAE/B,SAASC,YAAY,QAAQ;AAE7B,OAAO,MAAMC,QAAA,GAAqBA,CAAA;EAChC,MAAM;IAAEC;EAAM,CAAE,GAAGH,cAAA;EACnB,oBACEI,IAAA,CAAC;IAAOC,SAAA,EAAWN,SAAA;IAAWO,OAAA,EAASH,MAAA;IAAQI,IAAA,EAAK;cAClD,aAAAH,IAAA,CAACH,YAAA;;AAGP","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import './index.scss';
3
- export declare const FloatingCollapse: React.FC;
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,cAAc,CAAA;AAOrB,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAcpC,CAAA"}
@@ -1,26 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React from 'react';
3
- const baseClass = 'code-block-floating-collapse-button';
4
- import { useCollapsible, useTranslation } from '@payloadcms/ui';
5
- import { CollapseIcon } from '../../../../../../lexical/ui/icons/Collapse/index.js';
6
- export const FloatingCollapse = () => {
7
- const {
8
- isCollapsed,
9
- toggle
10
- } = useCollapsible();
11
- const {
12
- t
13
- } = useTranslation();
14
- if (!isCollapsed) {
15
- return null;
16
- }
17
- return /*#__PURE__*/_jsxs("button", {
18
- className: baseClass,
19
- onClick: toggle,
20
- type: "button",
21
- children: [/*#__PURE__*/_jsx("span", {
22
- children: t('general:collapse')
23
- }), /*#__PURE__*/_jsx(CollapseIcon, {})]
24
- });
25
- };
26
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["React","baseClass","useCollapsible","useTranslation","CollapseIcon","FloatingCollapse","isCollapsed","toggle","t","_jsxs","className","onClick","type","_jsx"],"sources":["../../../../../../../src/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport './index.scss'\n\nconst baseClass = 'code-block-floating-collapse-button'\nimport { useCollapsible, useTranslation } from '@payloadcms/ui'\n\nimport { CollapseIcon } from '../../../../../../lexical/ui/icons/Collapse/index.js'\n\nexport const FloatingCollapse: React.FC = () => {\n const { isCollapsed, toggle } = useCollapsible()\n const { t } = useTranslation()\n\n if (!isCollapsed) {\n return null\n }\n\n return (\n <button className={baseClass} onClick={toggle} type=\"button\">\n <span>{t('general:collapse')}</span>\n <CollapseIcon />\n </button>\n )\n}\n"],"mappings":";AAAA,OAAOA,KAAA,MAAW;AAIlB,MAAMC,SAAA,GAAY;AAClB,SAASC,cAAc,EAAEC,cAAc,QAAQ;AAE/C,SAASC,YAAY,QAAQ;AAE7B,OAAO,MAAMC,gBAAA,GAA6BA,CAAA;EACxC,MAAM;IAAEC,WAAW;IAAEC;EAAM,CAAE,GAAGL,cAAA;EAChC,MAAM;IAAEM;EAAC,CAAE,GAAGL,cAAA;EAEd,IAAI,CAACG,WAAA,EAAa;IAChB,OAAO;EACT;EAEA,oBACEG,KAAA,CAAC;IAAOC,SAAA,EAAWT,SAAA;IAAWU,OAAA,EAASJ,MAAA;IAAQK,IAAA,EAAK;4BAClDC,IAAA,CAAC;gBAAML,CAAA,CAAE;qBACTK,IAAA,CAACT,YAAA;;AAGP","ignoreList":[]}
@@ -1,7 +0,0 @@
1
- import type { BlockJSX } from 'payload';
2
- /**
3
- * @internal
4
- * @experimental - API may change in minor releases
5
- */
6
- export declare const codeConverter: BlockJSX;
7
- //# sourceMappingURL=converter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"converter.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/premade/CodeBlock/converter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,QAyC3B,CAAA"}
@@ -1,46 +0,0 @@
1
- /**
2
- * @internal
3
- * @experimental - API may change in minor releases
4
- */export const codeConverter = {
5
- customEndRegex: {
6
- optional: true,
7
- regExp: /[ \t]*```$/
8
- },
9
- customStartRegex: /^[ \t]*```(\w+)?/,
10
- doNotTrimChildren: true,
11
- export: ({
12
- fields
13
- }) => {
14
- const isSingleLine = !fields.code.includes('\n') && !fields.language?.length;
15
- if (isSingleLine) {
16
- return '```' + fields.code + '```';
17
- }
18
- return '```' + (fields.language || '') + (fields.code ? '\n' + fields.code : '') + '\n' + '```';
19
- },
20
- import: ({
21
- children,
22
- closeMatch,
23
- openMatch
24
- }) => {
25
- const language = openMatch?.[1];
26
- // Removed first and last \n from children if present
27
- if (children.startsWith('\n')) {
28
- children = children.slice(1);
29
- }
30
- if (children.endsWith('\n')) {
31
- children = children.slice(0, -1);
32
- }
33
- const isSingleLineAndComplete = !!closeMatch && !children.includes('\n') && openMatch?.input?.trim() !== '```' + language;
34
- if (isSingleLineAndComplete) {
35
- return {
36
- code: language + (children?.length ? children : ''),
37
- language: ''
38
- };
39
- }
40
- return {
41
- code: children,
42
- language
43
- };
44
- }
45
- };
46
- //# sourceMappingURL=converter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"converter.js","names":["codeConverter","customEndRegex","optional","regExp","customStartRegex","doNotTrimChildren","export","fields","isSingleLine","code","includes","language","length","import","children","closeMatch","openMatch","startsWith","slice","endsWith","isSingleLineAndComplete","input","trim"],"sources":["../../../../../src/features/blocks/premade/CodeBlock/converter.ts"],"sourcesContent":["import type { BlockJSX } from 'payload'\n\n/**\n * @internal\n * @experimental - API may change in minor releases\n */\nexport const codeConverter: BlockJSX = {\n customEndRegex: {\n optional: true,\n regExp: /[ \\t]*```$/,\n },\n customStartRegex: /^[ \\t]*```(\\w+)?/,\n doNotTrimChildren: true,\n export: ({ fields }) => {\n const isSingleLine = !fields.code.includes('\\n') && !fields.language?.length\n if (isSingleLine) {\n return '```' + fields.code + '```'\n }\n\n return '```' + (fields.language || '') + (fields.code ? '\\n' + fields.code : '') + '\\n' + '```'\n },\n import: ({ children, closeMatch, openMatch }) => {\n const language = openMatch?.[1]\n\n // Removed first and last \\n from children if present\n if (children.startsWith('\\n')) {\n children = children.slice(1)\n }\n if (children.endsWith('\\n')) {\n children = children.slice(0, -1)\n }\n\n const isSingleLineAndComplete =\n !!closeMatch && !children.includes('\\n') && openMatch?.input?.trim() !== '```' + language\n\n if (isSingleLineAndComplete) {\n return {\n code: language + (children?.length ? children : ''), // No need to add space to children as they are not trimmed\n language: '',\n }\n }\n\n return {\n code: children,\n language,\n }\n },\n}\n"],"mappings":"AAEA;;;GAIA,OAAO,MAAMA,aAAA,GAA0B;EACrCC,cAAA,EAAgB;IACdC,QAAA,EAAU;IACVC,MAAA,EAAQ;EACV;EACAC,gBAAA,EAAkB;EAClBC,iBAAA,EAAmB;EACnBC,MAAA,EAAQA,CAAC;IAAEC;EAAM,CAAE;IACjB,MAAMC,YAAA,GAAe,CAACD,MAAA,CAAOE,IAAI,CAACC,QAAQ,CAAC,SAAS,CAACH,MAAA,CAAOI,QAAQ,EAAEC,MAAA;IACtE,IAAIJ,YAAA,EAAc;MAChB,OAAO,QAAQD,MAAA,CAAOE,IAAI,GAAG;IAC/B;IAEA,OAAO,SAASF,MAAA,CAAOI,QAAQ,IAAI,EAAC,KAAMJ,MAAA,CAAOE,IAAI,GAAG,OAAOF,MAAA,CAAOE,IAAI,GAAG,EAAC,IAAK,OAAO;EAC5F;EACAI,MAAA,EAAQA,CAAC;IAAEC,QAAQ;IAAEC,UAAU;IAAEC;EAAS,CAAE;IAC1C,MAAML,QAAA,GAAWK,SAAA,GAAY,EAAE;IAE/B;IACA,IAAIF,QAAA,CAASG,UAAU,CAAC,OAAO;MAC7BH,QAAA,GAAWA,QAAA,CAASI,KAAK,CAAC;IAC5B;IACA,IAAIJ,QAAA,CAASK,QAAQ,CAAC,OAAO;MAC3BL,QAAA,GAAWA,QAAA,CAASI,KAAK,CAAC,GAAG,CAAC;IAChC;IAEA,MAAME,uBAAA,GACJ,CAAC,CAACL,UAAA,IAAc,CAACD,QAAA,CAASJ,QAAQ,CAAC,SAASM,SAAA,EAAWK,KAAA,EAAOC,IAAA,OAAW,QAAQX,QAAA;IAEnF,IAAIS,uBAAA,EAAyB;MAC3B,OAAO;QACLX,IAAA,EAAME,QAAA,IAAYG,QAAA,EAAUF,MAAA,GAASE,QAAA,GAAW,EAAC;QACjDH,QAAA,EAAU;MACZ;IACF;IAEA,OAAO;MACLF,IAAA,EAAMK,QAAA;MACNH;IACF;EACF;AACF","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- export { codeConverter as codeConverterClient } from './converter.js';
2
- //# sourceMappingURL=converterClient.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"converterClient.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/premade/CodeBlock/converterClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,IAAI,mBAAmB,EAAE,MAAM,gBAAgB,CAAA"}
@@ -1,4 +0,0 @@
1
- 'use client';
2
-
3
- export { codeConverter as codeConverterClient } from './converter.js';
4
- //# sourceMappingURL=converterClient.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"converterClient.js","names":["codeConverter","codeConverterClient"],"sources":["../../../../../src/features/blocks/premade/CodeBlock/converterClient.ts"],"sourcesContent":["'use client'\n\nexport { codeConverter as codeConverterClient } from './converter.js'\n"],"mappings":"AAAA;;AAEA,SAASA,aAAA,IAAiBC,mBAAmB,QAAQ","ignoreList":[]}
@@ -1,7 +0,0 @@
1
- import type { Block } from 'payload';
2
- import type { AdditionalCodeComponentProps } from './Component/Code.js';
3
- /**
4
- * @experimental - this API may change in future, minor releases
5
- */
6
- export declare const CodeBlock: (args?: AdditionalCodeComponentProps) => Block;
7
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/premade/CodeBlock/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAA;AAIvE;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,CAAC,IAAI,CAAC,EAAE,4BAA4B,KAAK,KAkDhE,CAAA"}
@@ -1,52 +0,0 @@
1
- import { codeConverter } from './converter.js';
2
- /**
3
- * @experimental - this API may change in future, minor releases
4
- */
5
- export const CodeBlock = args => {
6
- const languages = args?.languages || {
7
- js: 'JavaScript',
8
- plaintext: 'Plain Text',
9
- ts: 'TypeScript'
10
- };
11
- return {
12
- slug: args?.slug || 'Code',
13
- admin: {
14
- components: {
15
- Block: {
16
- clientProps: {
17
- languages
18
- },
19
- path: '@payloadcms/richtext-lexical/client#CodeBlockBlockComponent'
20
- }
21
- },
22
- jsx: '@payloadcms/richtext-lexical/client#codeConverterClient'
23
- },
24
- fields: [{
25
- name: 'language',
26
- type: 'select',
27
- admin: {
28
- // We'll manually render this field into the block component header
29
- hidden: true
30
- },
31
- defaultValue: args?.defaultLanguage || Object.keys(languages)[0],
32
- options: Object.entries(languages).map(([key, value]) => ({
33
- label: value,
34
- value: key
35
- }))
36
- }, {
37
- name: 'code',
38
- type: 'code',
39
- admin: {
40
- components: {
41
- Field: {
42
- clientProps: args,
43
- path: '@payloadcms/richtext-lexical/client#CodeComponent'
44
- }
45
- }
46
- },
47
- label: ''
48
- }],
49
- jsx: codeConverter
50
- };
51
- };
52
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["codeConverter","CodeBlock","args","languages","js","plaintext","ts","slug","admin","components","Block","clientProps","path","jsx","fields","name","type","hidden","defaultValue","defaultLanguage","Object","keys","options","entries","map","key","value","label","Field"],"sources":["../../../../../src/features/blocks/premade/CodeBlock/index.ts"],"sourcesContent":["import type { Block } from 'payload'\n\nimport type { AdditionalCodeComponentProps } from './Component/Code.js'\n\nimport { codeConverter } from './converter.js'\n\n/**\n * @experimental - this API may change in future, minor releases\n */\nexport const CodeBlock: (args?: AdditionalCodeComponentProps) => Block = (args) => {\n const languages = args?.languages || {\n js: 'JavaScript',\n plaintext: 'Plain Text',\n ts: 'TypeScript',\n }\n\n return {\n slug: args?.slug || 'Code',\n admin: {\n components: {\n Block: {\n clientProps: {\n languages,\n },\n path: '@payloadcms/richtext-lexical/client#CodeBlockBlockComponent',\n },\n },\n jsx: '@payloadcms/richtext-lexical/client#codeConverterClient',\n },\n fields: [\n {\n name: 'language',\n type: 'select',\n admin: {\n // We'll manually render this field into the block component header\n hidden: true,\n },\n defaultValue: args?.defaultLanguage || Object.keys(languages)[0],\n options: Object.entries(languages).map(([key, value]) => ({\n label: value,\n value: key,\n })),\n },\n {\n name: 'code',\n type: 'code',\n admin: {\n components: {\n Field: {\n clientProps: args,\n path: '@payloadcms/richtext-lexical/client#CodeComponent',\n },\n },\n },\n label: '',\n },\n ],\n jsx: codeConverter,\n }\n}\n"],"mappings":"AAIA,SAASA,aAAa,QAAQ;AAE9B;;;AAGA,OAAO,MAAMC,SAAA,GAA6DC,IAAA;EACxE,MAAMC,SAAA,GAAYD,IAAA,EAAMC,SAAA,IAAa;IACnCC,EAAA,EAAI;IACJC,SAAA,EAAW;IACXC,EAAA,EAAI;EACN;EAEA,OAAO;IACLC,IAAA,EAAML,IAAA,EAAMK,IAAA,IAAQ;IACpBC,KAAA,EAAO;MACLC,UAAA,EAAY;QACVC,KAAA,EAAO;UACLC,WAAA,EAAa;YACXR;UACF;UACAS,IAAA,EAAM;QACR;MACF;MACAC,GAAA,EAAK;IACP;IACAC,MAAA,EAAQ,CACN;MACEC,IAAA,EAAM;MACNC,IAAA,EAAM;MACNR,KAAA,EAAO;QACL;QACAS,MAAA,EAAQ;MACV;MACAC,YAAA,EAAchB,IAAA,EAAMiB,eAAA,IAAmBC,MAAA,CAAOC,IAAI,CAAClB,SAAA,CAAU,CAAC,EAAE;MAChEmB,OAAA,EAASF,MAAA,CAAOG,OAAO,CAACpB,SAAA,EAAWqB,GAAG,CAAC,CAAC,CAACC,GAAA,EAAKC,KAAA,CAAM,MAAM;QACxDC,KAAA,EAAOD,KAAA;QACPA,KAAA,EAAOD;MACT;IACF,GACA;MACEV,IAAA,EAAM;MACNC,IAAA,EAAM;MACNR,KAAA,EAAO;QACLC,UAAA,EAAY;UACVmB,KAAA,EAAO;YACLjB,WAAA,EAAaT,IAAA;YACbU,IAAA,EAAM;UACR;QACF;MACF;MACAe,KAAA,EAAO;IACT,EACD;IACDd,GAAA,EAAKb;EACP;AACF","ignoreList":[]}
@@ -1,6 +0,0 @@
1
- import type { NodeWithHooks } from '../../../typesServer.js';
2
- import { type Transformer } from '../../../../packages/@lexical/markdown/index.js';
3
- export declare function getLexicalToMarkdown(allNodes: Array<NodeWithHooks>, allTransformers: Transformer[]): (args: {
4
- editorState: Record<string, any>;
5
- }) => string;
6
- //# sourceMappingURL=getLexicalToMarkdown.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getLexicalToMarkdown.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/server/markdown/getLexicalToMarkdown.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAG5D,OAAO,EAEL,KAAK,WAAW,EACjB,MAAM,iDAAiD,CAAA;AACxD,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,KAAK,CAAC,aAAa,CAAC,EAC9B,eAAe,EAAE,WAAW,EAAE,GAC7B,CAAC,IAAI,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE,KAAK,MAAM,CAsBxD"}
@@ -1,27 +0,0 @@
1
- import { createHeadlessEditor } from '@lexical/headless';
2
- import { getEnabledNodesFromServerNodes } from '../../../../lexical/nodes/index.js';
3
- import { $convertToMarkdownString } from '../../../../packages/@lexical/markdown/index.js';
4
- export function getLexicalToMarkdown(allNodes, allTransformers) {
5
- const lexicalToMarkdown = ({
6
- editorState
7
- }) => {
8
- const headlessEditor = createHeadlessEditor({
9
- nodes: getEnabledNodesFromServerNodes({
10
- nodes: allNodes
11
- })
12
- });
13
- try {
14
- headlessEditor.setEditorState(headlessEditor.parseEditorState(editorState)) // This should commit the editor state immediately
15
- ;
16
- } catch (e) {
17
- console.error('getLexicalToMarkdown: ERROR parsing editor state', e);
18
- }
19
- let markdown = '';
20
- headlessEditor.getEditorState().read(() => {
21
- markdown = $convertToMarkdownString(allTransformers);
22
- });
23
- return markdown;
24
- };
25
- return lexicalToMarkdown;
26
- }
27
- //# sourceMappingURL=getLexicalToMarkdown.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getLexicalToMarkdown.js","names":["createHeadlessEditor","getEnabledNodesFromServerNodes","$convertToMarkdownString","getLexicalToMarkdown","allNodes","allTransformers","lexicalToMarkdown","editorState","headlessEditor","nodes","setEditorState","parseEditorState","e","console","error","markdown","getEditorState","read"],"sources":["../../../../../src/features/blocks/server/markdown/getLexicalToMarkdown.ts"],"sourcesContent":["import { createHeadlessEditor } from '@lexical/headless'\n\nimport type { NodeWithHooks } from '../../../typesServer.js'\n\nimport { getEnabledNodesFromServerNodes } from '../../../../lexical/nodes/index.js'\nimport {\n $convertToMarkdownString,\n type Transformer,\n} from '../../../../packages/@lexical/markdown/index.js'\nexport function getLexicalToMarkdown(\n allNodes: Array<NodeWithHooks>,\n allTransformers: Transformer[],\n): (args: { editorState: Record<string, any> }) => string {\n const lexicalToMarkdown = ({ editorState }: { editorState: Record<string, any> }): string => {\n const headlessEditor = createHeadlessEditor({\n nodes: getEnabledNodesFromServerNodes({\n nodes: allNodes,\n }),\n })\n\n try {\n headlessEditor.setEditorState(headlessEditor.parseEditorState(editorState as any)) // This should commit the editor state immediately\n } catch (e) {\n console.error('getLexicalToMarkdown: ERROR parsing editor state', e)\n }\n\n let markdown: string = ''\n headlessEditor.getEditorState().read(() => {\n markdown = $convertToMarkdownString(allTransformers)\n })\n\n return markdown\n }\n return lexicalToMarkdown\n}\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ;AAIrC,SAASC,8BAA8B,QAAQ;AAC/C,SACEC,wBAAwB,QAEnB;AACP,OAAO,SAASC,qBACdC,QAA8B,EAC9BC,eAA8B;EAE9B,MAAMC,iBAAA,GAAoBA,CAAC;IAAEC;EAAW,CAAwC;IAC9E,MAAMC,cAAA,GAAiBR,oBAAA,CAAqB;MAC1CS,KAAA,EAAOR,8BAAA,CAA+B;QACpCQ,KAAA,EAAOL;MACT;IACF;IAEA,IAAI;MACFI,cAAA,CAAeE,cAAc,CAACF,cAAA,CAAeG,gBAAgB,CAACJ,WAAA,GAAqB;MAAA;IACrF,EAAE,OAAOK,CAAA,EAAG;MACVC,OAAA,CAAQC,KAAK,CAAC,oDAAoDF,CAAA;IACpE;IAEA,IAAIG,QAAA,GAAmB;IACvBP,cAAA,CAAeQ,cAAc,GAAGC,IAAI,CAAC;MACnCF,QAAA,GAAWb,wBAAA,CAAyBG,eAAA;IACtC;IAEA,OAAOU,QAAA;EACT;EACA,OAAOT,iBAAA;AACT","ignoreList":[]}
@@ -1,7 +0,0 @@
1
- import type { SerializedEditorState } from 'lexical';
2
- import type { NodeWithHooks } from '../../../typesServer.js';
3
- import { type Transformer } from '../../../../packages/@lexical/markdown/index.js';
4
- export declare function getMarkdownToLexical(allNodes: Array<NodeWithHooks>, allTransformers: Transformer[]): (args: {
5
- markdown: string;
6
- }) => SerializedEditorState;
7
- //# sourceMappingURL=getMarkdownToLexical.d.ts.map