@payloadcms/richtext-lexical 3.33.0-canary.1 → 3.33.0-canary.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/index.d.ts +1 -0
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +10 -10
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/debug/jsxConverter/client/index.d.ts +2 -0
- package/dist/features/debug/jsxConverter/client/index.d.ts.map +1 -0
- package/dist/features/debug/jsxConverter/client/index.js +11 -0
- package/dist/features/debug/jsxConverter/client/index.js.map +1 -0
- package/dist/features/debug/jsxConverter/client/plugin/index.d.ts +2 -0
- package/dist/features/debug/jsxConverter/client/plugin/index.d.ts.map +1 -0
- package/dist/features/debug/jsxConverter/client/plugin/index.js +52 -0
- package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -0
- package/dist/features/debug/jsxConverter/server/index.d.ts +2 -0
- package/dist/features/debug/jsxConverter/server/index.d.ts.map +1 -0
- package/dist/features/debug/jsxConverter/server/index.js +8 -0
- package/dist/features/debug/jsxConverter/server/index.js.map +1 -0
- package/dist/features/upload/server/validate.d.ts.map +1 -1
- package/dist/features/upload/server/validate.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/debug/jsxConverter/client/index.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,8BAA8B,uFAOzC,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { createClientFeature } from '../../../../utilities/createClientFeature.js';
|
|
4
|
+
import { RichTextPlugin } from './plugin/index.js';
|
|
5
|
+
export const DebugJsxConverterFeatureClient = createClientFeature({
|
|
6
|
+
plugins: [{
|
|
7
|
+
Component: RichTextPlugin,
|
|
8
|
+
position: 'bottom'
|
|
9
|
+
}]
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["createClientFeature","RichTextPlugin","DebugJsxConverterFeatureClient","plugins","Component","position"],"sources":["../../../../../src/features/debug/jsxConverter/client/index.tsx"],"sourcesContent":["'use client'\n\nimport { createClientFeature } from '../../../../utilities/createClientFeature.js'\nimport { RichTextPlugin } from './plugin/index.js'\n\nexport const DebugJsxConverterFeatureClient = createClientFeature({\n plugins: [\n {\n Component: RichTextPlugin,\n position: 'bottom',\n },\n ],\n})\n"],"mappings":"AAAA;;AAEA,SAASA,mBAAmB,QAAQ;AACpC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,8BAAA,GAAiCF,mBAAA,CAAoB;EAChEG,OAAA,EAAS,CACP;IACEC,SAAA,EAAWH,cAAA;IACXI,QAAA,EAAU;EACZ;AAEJ","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/features/debug/jsxConverter/client/plugin/index.tsx"],"names":[],"mappings":"AAQA,wBAAgB,cAAc,gCAW7B"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
6
|
+
import { useEffect, useState } from 'react';
|
|
7
|
+
// eslint-disable-next-line payload/no-imports-from-exports-dir
|
|
8
|
+
import { defaultJSXConverters, RichText } from '../../../../../exports/react/index.js';
|
|
9
|
+
export function RichTextPlugin() {
|
|
10
|
+
const $ = _c(7);
|
|
11
|
+
const [editor] = useLexicalComposerContext();
|
|
12
|
+
let t0;
|
|
13
|
+
if ($[0] !== editor) {
|
|
14
|
+
t0 = editor.getEditorState().toJSON();
|
|
15
|
+
$[0] = editor;
|
|
16
|
+
$[1] = t0;
|
|
17
|
+
} else {
|
|
18
|
+
t0 = $[1];
|
|
19
|
+
}
|
|
20
|
+
const [editorState, setEditorState] = useState(t0);
|
|
21
|
+
let t1;
|
|
22
|
+
let t2;
|
|
23
|
+
if ($[2] !== editor) {
|
|
24
|
+
t1 = () => editor.registerUpdateListener(t3 => {
|
|
25
|
+
const {
|
|
26
|
+
editorState: editorState_0
|
|
27
|
+
} = t3;
|
|
28
|
+
setEditorState(editorState_0.toJSON());
|
|
29
|
+
});
|
|
30
|
+
t2 = [editor];
|
|
31
|
+
$[2] = editor;
|
|
32
|
+
$[3] = t1;
|
|
33
|
+
$[4] = t2;
|
|
34
|
+
} else {
|
|
35
|
+
t1 = $[3];
|
|
36
|
+
t2 = $[4];
|
|
37
|
+
}
|
|
38
|
+
useEffect(t1, t2);
|
|
39
|
+
let t3;
|
|
40
|
+
if ($[5] !== editorState) {
|
|
41
|
+
t3 = _jsx(RichText, {
|
|
42
|
+
converters: defaultJSXConverters,
|
|
43
|
+
data: editorState
|
|
44
|
+
});
|
|
45
|
+
$[5] = editorState;
|
|
46
|
+
$[6] = t3;
|
|
47
|
+
} else {
|
|
48
|
+
t3 = $[6];
|
|
49
|
+
}
|
|
50
|
+
return t3;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","useEffect","useState","defaultJSXConverters","RichText","RichTextPlugin","$","editor","t0","getEditorState","toJSON","editorState","setEditorState","t1","t2","registerUpdateListener","t3","editorState_0","_jsx","converters","data"],"sources":["../../../../../../src/features/debug/jsxConverter/client/plugin/index.tsx"],"sourcesContent":["'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useEffect, useState } from 'react'\n\n// eslint-disable-next-line payload/no-imports-from-exports-dir\nimport { defaultJSXConverters, RichText } from '../../../../../exports/react/index.js'\n\nexport function RichTextPlugin() {\n const [editor] = useLexicalComposerContext()\n const [editorState, setEditorState] = useState(editor.getEditorState().toJSON())\n\n useEffect(() => {\n return editor.registerUpdateListener(({ editorState }) => {\n setEditorState(editorState.toJSON())\n })\n }, [editor])\n\n return <RichText converters={defaultJSXConverters} data={editorState} />\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAEA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,SAAS,EAAEC,QAAQ,QAAQ;AAEpC;AACA,SAASC,oBAAoB,EAAEC,QAAQ,QAAQ;AAE/C,OAAO,SAAAC,eAAA;EAAA,MAAAC,CAAA,GAAAP,EAAA;EACL,OAAAQ,MAAA,IAAiBP,yBAAA;EAAA,IAAAQ,EAAA;EAAA,IAAAF,CAAA,QAAAC,MAAA;IAC8BC,EAAA,GAAAD,MAAA,CAAAE,cAAA,CAAqB,EAAAC,MAAA,CAAS;IAAAJ,CAAA,MAAAC,MAAA;IAAAD,CAAA,MAAAE,EAAA;EAAA;IAAAA,EAAA,GAAAF,CAAA;EAAA;EAA7E,OAAAK,WAAA,EAAAC,cAAA,IAAsCV,QAAA,CAASM,EAA8B;EAAA,IAAAK,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAR,CAAA,QAAAC,MAAA;IAEnEM,EAAA,GAAAA,CAAA,KACDN,MAAA,CAAAQ,sBAAA,CAAAC,EAAA;MAA+B;QAAAL,WAAA,EAAAM;MAAA,IAAAD,EAAe;MACnDJ,cAAA,CAAeD,aAAA,CAAAD,MAAA,CAAkB;IAAA,CACnC;IACCI,EAAA,IAACP,MAAA;IAAOD,CAAA,MAAAC,MAAA;IAAAD,CAAA,MAAAO,EAAA;IAAAP,CAAA,MAAAQ,EAAA;EAAA;IAAAD,EAAA,GAAAP,CAAA;IAAAQ,EAAA,GAAAR,CAAA;EAAA;EAJXL,SAAA,CAAUY,EAIV,EAAGC,EAAQ;EAAA,IAAAE,EAAA;EAAA,IAAAV,CAAA,QAAAK,WAAA;IAEJK,EAAA,GAAAE,IAAA,CAAAd,QAAA;MAAAe,UAAA,EAAAhB,oBAAA;MAAAiB,IAAA,EAAkDT;IAAA,C;;;;;;SAAlDK,E","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/debug/jsxConverter/server/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,wBAAwB,kGAKnC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createServerFeature } from '../../../../utilities/createServerFeature.js';
|
|
2
|
+
export const DebugJsxConverterFeature = createServerFeature({
|
|
3
|
+
feature: {
|
|
4
|
+
ClientFeature: '@payloadcms/richtext-lexical/client#DebugJsxConverterFeatureClient'
|
|
5
|
+
},
|
|
6
|
+
key: 'jsxConverter'
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["createServerFeature","DebugJsxConverterFeature","feature","ClientFeature","key"],"sources":["../../../../../src/features/debug/jsxConverter/server/index.ts"],"sourcesContent":["import { createServerFeature } from '../../../../utilities/createServerFeature.js'\n\nexport const DebugJsxConverterFeature = createServerFeature({\n feature: {\n ClientFeature: '@payloadcms/richtext-lexical/client#DebugJsxConverterFeatureClient',\n },\n key: 'jsxConverter',\n})\n"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ;AAEpC,OAAO,MAAMC,wBAAA,GAA2BD,mBAAA,CAAoB;EAC1DE,OAAA,EAAS;IACPC,aAAA,EAAe;EACjB;EACAC,GAAA,EAAK;AACP","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../src/features/upload/server/validate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAEjE,eAAO,MAAM,gBAAgB,UACpB,kBAAkB,KACxB,cAAc,CAAC,oBAAoB,
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../src/features/upload/server/validate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAEjE,eAAO,MAAM,gBAAgB,UACpB,kBAAkB,KACxB,cAAc,CAAC,oBAAoB,CAqErC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","names":["fieldSchemasToFormState","isValidID","uploadValidation","props","node","validation","options","id","data","operation","preferences","req","payload","t","idType","collections","relationTo","customIDType","db","defaultIDType","nodeID","value","Object","keys","length","collection","fields","result","collectionSlug","documentData","fieldSchemaMap","undefined","initialBlockData","permissions","renderAllFields","schemaPath","errorPathsSet","Set","fieldKey","fieldState","errorPaths","errorPath","add","Array","from","join"],"sources":["../../../../src/features/upload/server/validate.ts"],"sourcesContent":["import { fieldSchemasToFormState } from '@payloadcms/ui/forms/fieldSchemasToFormState'\nimport { isValidID } from 'payload'\n\nimport type { NodeValidation } from '../../typesServer.js'\nimport type { UploadFeatureProps } from './index.js'\nimport type { SerializedUploadNode } from './nodes/UploadNode.js'\n\nexport const uploadValidation = (\n props: UploadFeatureProps,\n): NodeValidation<SerializedUploadNode> => {\n return async ({\n node,\n validation: {\n options: {\n id,\n data,\n operation,\n preferences,\n req,\n req: { payload, t },\n },\n },\n }) => {\n const idType = payload.collections[node.relationTo]?.customIDType || payload.db.defaultIDType\n // @ts-expect-error - Fix in Payload v4\n const nodeID = node?.value?.id || node?.value // for backwards-compatibility\n\n if (!isValidID(nodeID, idType)) {\n return t('validation:validUploadID')\n }\n\n if (!props?.collections) {\n return true\n }\n\n if (Object.keys(props?.collections).length === 0) {\n return true\n }\n\n const collection = props?.collections[node.relationTo]\n\n if (!collection?.fields?.length) {\n return true\n }\n\n const result = await fieldSchemasToFormState({\n id,\n collectionSlug: node.relationTo,\n
|
|
1
|
+
{"version":3,"file":"validate.js","names":["fieldSchemasToFormState","isValidID","uploadValidation","props","node","validation","options","id","data","operation","preferences","req","payload","t","idType","collections","relationTo","customIDType","db","defaultIDType","nodeID","value","Object","keys","length","collection","fields","result","collectionSlug","documentData","fieldSchemaMap","undefined","initialBlockData","permissions","renderAllFields","schemaPath","errorPathsSet","Set","fieldKey","fieldState","errorPaths","errorPath","add","Array","from","join"],"sources":["../../../../src/features/upload/server/validate.ts"],"sourcesContent":["import { fieldSchemasToFormState } from '@payloadcms/ui/forms/fieldSchemasToFormState'\nimport { isValidID } from 'payload'\n\nimport type { NodeValidation } from '../../typesServer.js'\nimport type { UploadFeatureProps } from './index.js'\nimport type { SerializedUploadNode } from './nodes/UploadNode.js'\n\nexport const uploadValidation = (\n props: UploadFeatureProps,\n): NodeValidation<SerializedUploadNode> => {\n return async ({\n node,\n validation: {\n options: {\n id,\n data,\n operation,\n preferences,\n req,\n req: { payload, t },\n },\n },\n }) => {\n const idType = payload.collections[node.relationTo]?.customIDType || payload.db.defaultIDType\n // @ts-expect-error - Fix in Payload v4\n const nodeID = node?.value?.id || node?.value // for backwards-compatibility\n\n if (!isValidID(nodeID, idType)) {\n return t('validation:validUploadID')\n }\n\n if (!props?.collections) {\n return true\n }\n\n if (Object.keys(props?.collections).length === 0) {\n return true\n }\n\n const collection = props?.collections[node.relationTo]\n\n if (!collection?.fields?.length) {\n return true\n }\n\n const result = await fieldSchemasToFormState({\n id,\n collectionSlug: node.relationTo,\n data: node?.fields ?? {},\n documentData: data,\n fields: collection.fields,\n fieldSchemaMap: undefined,\n initialBlockData: node?.fields ?? {},\n operation: operation === 'create' || operation === 'update' ? operation : 'update',\n permissions: {},\n preferences,\n renderAllFields: false,\n req,\n schemaPath: '',\n })\n\n const errorPathsSet = new Set<string>()\n for (const fieldKey in result) {\n const fieldState = result[fieldKey]\n if (fieldState?.errorPaths?.length) {\n for (const errorPath of fieldState.errorPaths) {\n errorPathsSet.add(errorPath)\n }\n }\n }\n const errorPaths = Array.from(errorPathsSet)\n\n if (errorPaths.length) {\n return 'The following fields are invalid: ' + errorPaths.join(', ')\n }\n\n return true\n }\n}\n"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ;AACxC,SAASC,SAAS,QAAQ;AAM1B,OAAO,MAAMC,gBAAA,GACXC,KAAA;EAEA,OAAO,OAAO;IACZC,IAAI;IACJC,UAAA,EAAY;MACVC,OAAA,EAAS;QACPC,EAAE;QACFC,IAAI;QACJC,SAAS;QACTC,WAAW;QACXC,GAAG;QACHA,GAAA,EAAK;UAAEC,OAAO;UAAEC;QAAC;MAAE;IACpB;EACF,CACF;IACC,MAAMC,MAAA,GAASF,OAAA,CAAQG,WAAW,CAACX,IAAA,CAAKY,UAAU,CAAC,EAAEC,YAAA,IAAgBL,OAAA,CAAQM,EAAE,CAACC,aAAa;IAC7F;IACA,MAAMC,MAAA,GAAShB,IAAA,EAAMiB,KAAA,EAAOd,EAAA,IAAMH,IAAA,EAAMiB,KAAA,CAAM;IAAA;IAE9C,IAAI,CAACpB,SAAA,CAAUmB,MAAA,EAAQN,MAAA,GAAS;MAC9B,OAAOD,CAAA,CAAE;IACX;IAEA,IAAI,CAACV,KAAA,EAAOY,WAAA,EAAa;MACvB,OAAO;IACT;IAEA,IAAIO,MAAA,CAAOC,IAAI,CAACpB,KAAA,EAAOY,WAAA,EAAaS,MAAM,KAAK,GAAG;MAChD,OAAO;I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