@payloadcms/richtext-lexical 3.0.0-beta.0 → 3.0.0-beta.2
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/field/features/blocks/feature.server.d.ts +4 -3
- package/dist/field/features/blocks/feature.server.d.ts.map +1 -1
- package/dist/field/features/blocks/feature.server.js +1 -0
- package/dist/field/features/blocks/feature.server.js.map +1 -1
- package/dist/field/features/upload/component/index.d.ts.map +1 -1
- package/dist/field/features/upload/component/index.js +2 -2
- package/dist/field/features/upload/component/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
- package/src/index.ts +5 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { Block, FieldWithRichTextRequiredEditor } from 'payload/types';
|
|
2
2
|
import type { FeatureProviderProviderServer } from '../types.js';
|
|
3
3
|
import type { BlocksFeatureClientProps } from './feature.client.js';
|
|
4
|
+
export type LexicalBlock = Omit<Block, 'fields'> & {
|
|
5
|
+
fields: FieldWithRichTextRequiredEditor[];
|
|
6
|
+
};
|
|
4
7
|
export type BlocksFeatureProps = {
|
|
5
|
-
blocks:
|
|
6
|
-
fields: FieldWithRichTextRequiredEditor[];
|
|
7
|
-
}>;
|
|
8
|
+
blocks: LexicalBlock[];
|
|
8
9
|
};
|
|
9
10
|
export declare const BlocksFeature: FeatureProviderProviderServer<BlocksFeatureProps, BlocksFeatureClientProps>;
|
|
10
11
|
//# sourceMappingURL=feature.server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../src/field/features/blocks/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAqB,+BAA+B,EAAE,MAAM,eAAe,CAAA;AAK9F,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAChE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAQnE,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../src/field/features/blocks/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAqB,+BAA+B,EAAE,MAAM,eAAe,CAAA;AAK9F,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAChE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAQnE,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG;IACjD,MAAM,EAAE,+BAA+B,EAAE,CAAA;CAC1C,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,YAAY,EAAE,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,6BAA6B,CACvD,kBAAkB,EAClB,wBAAwB,CAyIzB,CAAA"}
|
|
@@ -12,6 +12,7 @@ export const BlocksFeature = (props)=>{
|
|
|
12
12
|
const blockCopy = cloneDeep(block);
|
|
13
13
|
return {
|
|
14
14
|
...blockCopy,
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
15
16
|
fields: blockCopy.fields.concat(baseBlockFields),
|
|
16
17
|
labels: !blockCopy.labels ? formatLabels(blockCopy.slug) : blockCopy.labels
|
|
17
18
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/field/features/blocks/feature.server.ts"],"sourcesContent":["import type { Block, BlockField, Field, FieldWithRichTextRequiredEditor } from 'payload/types'\n\nimport { baseBlockFields, sanitizeFields } from 'payload/config'\nimport { fieldsToJSONSchema, formatLabels } from 'payload/utilities'\n\nimport type { FeatureProviderProviderServer } from '../types.js'\nimport type { BlocksFeatureClientProps } from './feature.client.js'\n\nimport { cloneDeep } from '../../lexical/utils/cloneDeep.js'\nimport { BlocksFeatureClientComponent } from './feature.client.js'\nimport { BlockNode } from './nodes/BlocksNode.js'\nimport { blockPopulationPromiseHOC } from './populationPromise.js'\nimport { blockValidationHOC } from './validate.js'\n\nexport type
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/features/blocks/feature.server.ts"],"sourcesContent":["import type { Block, BlockField, Field, FieldWithRichTextRequiredEditor } from 'payload/types'\n\nimport { baseBlockFields, sanitizeFields } from 'payload/config'\nimport { fieldsToJSONSchema, formatLabels } from 'payload/utilities'\n\nimport type { FeatureProviderProviderServer } from '../types.js'\nimport type { BlocksFeatureClientProps } from './feature.client.js'\n\nimport { cloneDeep } from '../../lexical/utils/cloneDeep.js'\nimport { BlocksFeatureClientComponent } from './feature.client.js'\nimport { BlockNode } from './nodes/BlocksNode.js'\nimport { blockPopulationPromiseHOC } from './populationPromise.js'\nimport { blockValidationHOC } from './validate.js'\n\nexport type LexicalBlock = Omit<Block, 'fields'> & {\n fields: FieldWithRichTextRequiredEditor[]\n}\n\nexport type BlocksFeatureProps = {\n blocks: LexicalBlock[]\n}\n\nexport const BlocksFeature: FeatureProviderProviderServer<\n BlocksFeatureProps,\n BlocksFeatureClientProps\n> = (props) => {\n // Sanitization taken from payload/src/fields/config/sanitize.ts\n\n if (props?.blocks?.length) {\n props.blocks = props.blocks.map((block) => {\n const blockCopy = cloneDeep(block)\n\n return {\n ...blockCopy,\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n fields: blockCopy.fields.concat(baseBlockFields as FieldWithRichTextRequiredEditor[]),\n labels: !blockCopy.labels ? formatLabels(blockCopy.slug) : blockCopy.labels,\n }\n })\n // unSanitizedBlock.fields are sanitized in the React component and not here.\n // That's because we do not have access to the payload config here.\n }\n\n // Build clientProps\n const clientProps: BlocksFeatureClientProps = {\n reducedBlocks: [],\n }\n for (const block of props.blocks) {\n clientProps.reducedBlocks.push({\n slug: block.slug,\n fieldMap: [],\n imageAltText: block.imageAltText,\n imageURL: block.imageURL,\n labels: block.labels,\n })\n }\n\n return {\n feature: () => {\n return {\n ClientComponent: BlocksFeatureClientComponent,\n clientFeatureProps: clientProps,\n generateSchemaMap: ({ config, props, schemaMap: schemaMapFromProps, schemaPath }) => {\n const schemaMap: {\n [key: string]: Field[]\n } = {}\n\n /**\n * Add sub-fields to the schemaMap. E.g. if you have an array field as part of the block and it runs addRow, it will request these\n * sub-fields from the component map. Thus we need to put them in the component map here.\n */\n const handleFields = (parentPath: string, fields: Field[]) => {\n for (const field of fields) {\n if ('name' in field && 'fields' in field) {\n schemaMap[parentPath + '.' + field.name] = field.fields\n handleFields(parentPath + '.' + field.name, field.fields)\n }\n if ('blocks' in field) {\n for (const block of field.blocks) {\n schemaMap[parentPath + '.' + field.name + '.' + block.slug] = block.fields || []\n handleFields(parentPath + '.' + field.name + '.' + block.slug, block.fields)\n }\n }\n if ('tabs' in field) {\n for (const tab of field.tabs) {\n if ('name' in tab) {\n schemaMap[parentPath + '.' + tab.name] = tab.fields || []\n handleFields(parentPath + '.' + tab.name, tab.fields)\n } else {\n handleFields(parentPath, tab.fields)\n }\n }\n }\n }\n }\n\n for (const block of props.blocks) {\n schemaMap[block.slug] = block.fields || []\n handleFields(block.slug, block.fields)\n }\n\n return schemaMap\n },\n generatedTypes: {\n modifyOutputSchema: ({\n collectionIDFieldTypes,\n config,\n currentSchema,\n field,\n interfaceNameDefinitions,\n }) => {\n if (!props?.blocks?.length) {\n return currentSchema\n }\n\n // sanitize blocks\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n const sanitizedBlocks = props.blocks.map((block) => {\n const blockCopy = cloneDeep(block)\n return {\n ...blockCopy,\n fields: sanitizeFields({\n config,\n fields: blockCopy.fields,\n requireFieldLevelRichTextEditor: true,\n validRelationships,\n }),\n }\n })\n\n const blocksField: BlockField = {\n name: field?.name + '_lexical_blocks',\n type: 'blocks',\n blocks: sanitizedBlocks,\n }\n // This is only done so that interfaceNameDefinitions sets those block's interfaceNames.\n // we don't actually use the JSON Schema itself in the generated types yet.\n fieldsToJSONSchema(\n collectionIDFieldTypes,\n [blocksField],\n interfaceNameDefinitions,\n config,\n )\n\n return currentSchema\n },\n },\n nodes: [\n {\n node: BlockNode,\n populationPromises: [blockPopulationPromiseHOC(props)],\n validations: [blockValidationHOC(props)],\n },\n ],\n serverFeatureProps: props,\n }\n },\n key: 'blocks',\n serverFeatureProps: props,\n }\n}\n"],"names":["baseBlockFields","sanitizeFields","fieldsToJSONSchema","formatLabels","cloneDeep","BlocksFeatureClientComponent","BlockNode","blockPopulationPromiseHOC","blockValidationHOC","BlocksFeature","props","blocks","length","map","block","blockCopy","fields","concat","labels","slug","clientProps","reducedBlocks","push","fieldMap","imageAltText","imageURL","feature","ClientComponent","clientFeatureProps","generateSchemaMap","config","schemaMap","schemaMapFromProps","schemaPath","handleFields","parentPath","field","name","tab","tabs","generatedTypes","modifyOutputSchema","collectionIDFieldTypes","currentSchema","interfaceNameDefinitions","validRelationships","collections","c","sanitizedBlocks","requireFieldLevelRichTextEditor","blocksField","type","nodes","node","populationPromises","validations","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,eAAe,EAAEC,cAAc,QAAQ,iBAAgB;AAChE,SAASC,kBAAkB,EAAEC,YAAY,QAAQ,oBAAmB;AAKpE,SAASC,SAAS,QAAQ,mCAAkC;AAC5D,SAASC,4BAA4B,QAAQ,sBAAqB;AAClE,SAASC,SAAS,QAAQ,wBAAuB;AACjD,SAASC,yBAAyB,QAAQ,yBAAwB;AAClE,SAASC,kBAAkB,QAAQ,gBAAe;AAUlD,OAAO,MAAMC,gBAGT,CAACC;IACH,gEAAgE;IAEhE,IAAIA,OAAOC,QAAQC,QAAQ;QACzBF,MAAMC,MAAM,GAAGD,MAAMC,MAAM,CA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;wBACA,wFAAwF;wBACxF,2EAA2E;wBAC3E9C,mBACEwC,wBACA;4BAACQ;yBAAY,EACbN,0BACAd;wBAGF,OAAOa;oBACT;gBACF;gBACAS,OAAO;oBACL;wBACEC,MAAM/C;wBACNgD,oBAAoB;4BAAC/C,0BAA0BG;yBAAO;wBACtD6C,aAAa;4BAAC/C,mBAAmBE;yBAAO;oBAC1C;iBACD;gBACD8C,oBAAoB9C;YACtB;QACF;QACA+C,KAAK;QACLD,oBAAoB9C;IACtB;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/upload/component/index.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAA4C,MAAM,OAAO,CAAA;AAIhE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAMxD,OAAO,cAAc,CAAA;AAQrB,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,UAAU,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAEhB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/upload/component/index.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAA4C,MAAM,OAAO,CAAA;AAIhE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAMxD,OAAO,cAAc,CAAA;AAQrB,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,UAAU,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAEhB,CAAA;AAkJD,eAAO,MAAM,eAAe,UAAW,YAAY,KAAG,MAAM,SAM3D,CAAA"}
|
|
@@ -128,11 +128,11 @@ const Component = (props)=>{
|
|
|
128
128
|
className: `${baseClass}__doc-drawer-toggler`
|
|
129
129
|
}, /*#__PURE__*/ React.createElement("strong", null, data?.filename)))), value?.id && /*#__PURE__*/ React.createElement(DocumentDrawer, {
|
|
130
130
|
onSave: updateUpload
|
|
131
|
-
}), /*#__PURE__*/ React.createElement(ExtraFieldsUploadDrawer, {
|
|
131
|
+
}), hasExtraFields ? /*#__PURE__*/ React.createElement(ExtraFieldsUploadDrawer, {
|
|
132
132
|
drawerSlug: drawerSlug,
|
|
133
133
|
relatedCollection: relatedCollection,
|
|
134
134
|
...props
|
|
135
|
-
}));
|
|
135
|
+
}) : null);
|
|
136
136
|
};
|
|
137
137
|
export const UploadComponent = (props)=>{
|
|
138
138
|
return /*#__PURE__*/ React.createElement(EnabledRelationshipsCondition, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/features/upload/component/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientCollectionConfig } from 'payload/types'\n\nimport lexicalComposerContextImport from '@lexical/react/LexicalComposerContext.js'\nconst { useLexicalComposerContext } = lexicalComposerContextImport\nimport { useLexicalNodeSelection } from '@lexical/react/useLexicalNodeSelection.js'\nimport { getTranslation } from '@payloadcms/translations'\nimport lexicalImport from 'lexical'\nconst { $getNodeByKey } = lexicalImport\n\nimport { Button } from '@payloadcms/ui/elements/Button'\nimport { useDocumentDrawer } from '@payloadcms/ui/elements/DocumentDrawer'\nimport { DrawerToggler } from '@payloadcms/ui/elements/Drawer'\nimport { useDrawerSlug } from '@payloadcms/ui/elements/Drawer'\nimport { File } from '@payloadcms/ui/graphics/File'\nimport usePayloadAPI from '@payloadcms/ui/hooks/usePayloadAPI'\nimport { useConfig } from '@payloadcms/ui/providers/Config'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport React, { useCallback, useReducer, useState } from 'react'\n\nimport type { ClientComponentProps } from '../../types.js'\nimport type { UploadFeaturePropsClient } from '../feature.client.js'\nimport type { UploadData } from '../nodes/UploadNode.js'\n\nimport { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js'\nimport { EnabledRelationshipsCondition } from '../../relationship/utils/EnabledRelationshipsCondition.js'\nimport { INSERT_UPLOAD_WITH_DRAWER_COMMAND } from '../drawer/commands.js'\nimport { ExtraFieldsUploadDrawer } from './ExtraFieldsDrawer/index.js'\nimport './index.scss'\n\nconst baseClass = 'lexical-upload'\n\nconst initialParams = {\n depth: 0,\n}\n\nexport type ElementProps = {\n data: UploadData\n nodeKey: string\n //uploadProps: UploadFeatureProps\n}\n\nconst Component: React.FC<ElementProps> = (props) => {\n const {\n data: { fields, relationTo, value },\n nodeKey,\n } = props\n\n const {\n collections,\n routes: { api },\n serverURL,\n } = useConfig()\n\n const [editor] = useLexicalComposerContext()\n const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey)\n const { editorConfig, field } = useEditorConfigContext()\n\n const { i18n, t } = useTranslation()\n const [cacheBust, dispatchCacheBust] = useReducer((state) => state + 1, 0)\n const [relatedCollection, setRelatedCollection] = useState<ClientCollectionConfig>(() =>\n collections.find((coll) => coll.slug === relationTo),\n )\n\n const drawerSlug = useDrawerSlug('upload-drawer')\n\n const [DocumentDrawer, DocumentDrawerToggler, { closeDrawer }] = useDocumentDrawer({\n id: value?.id,\n collectionSlug: relatedCollection.slug,\n })\n\n // Get the referenced document\n const [{ data }, { setParams }] = usePayloadAPI(\n `${serverURL}${api}/${relatedCollection.slug}/${value?.id}`,\n { initialParams },\n )\n\n const thumbnailSRC = data?.thumbnailURL || data?.url\n\n const removeUpload = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey).remove()\n })\n }, [editor, nodeKey])\n\n const updateUpload = useCallback(\n (json) => {\n setParams({\n ...initialParams,\n cacheBust, // do this to get the usePayloadAPI to re-fetch the data even though the URL string hasn't changed\n })\n\n dispatchCacheBust()\n closeDrawer()\n },\n [setParams, cacheBust, closeDrawer],\n )\n\n const hasExtraFields = (\n editorConfig?.resolvedFeatureMap?.get('upload')\n ?.clientFeatureProps as ClientComponentProps<UploadFeaturePropsClient>\n ).collections?.[relatedCollection.slug]?.hasExtraFields\n\n return (\n <div\n className={[baseClass, isSelected && `${baseClass}--selected`].filter(Boolean).join(' ')}\n contentEditable={false}\n >\n <div className={`${baseClass}__card`}>\n <div className={`${baseClass}__topRow`}>\n {/* TODO: migrate to use @payloadcms/ui/elements/Thumbnail component */}\n <div className={`${baseClass}__thumbnail`}>\n {thumbnailSRC ? <img alt={data?.filename} src={thumbnailSRC} /> : <File />}\n </div>\n <div className={`${baseClass}__topRowRightPanel`}>\n <div className={`${baseClass}__collectionLabel`}>\n {getTranslation(relatedCollection.labels.singular, i18n)}\n </div>\n {editor.isEditable() && (\n <div className={`${baseClass}__actions`}>\n {hasExtraFields ? (\n <DrawerToggler\n className={`${baseClass}__upload-drawer-toggler`}\n disabled={field?.readOnly}\n slug={drawerSlug}\n >\n <Button\n buttonStyle=\"icon-label\"\n el=\"div\"\n icon=\"edit\"\n onClick={(e) => {\n e.preventDefault()\n }}\n round\n tooltip={t('fields:editRelationship')}\n />\n </DrawerToggler>\n ) : null}\n\n <Button\n buttonStyle=\"icon-label\"\n disabled={field?.readOnly}\n el=\"div\"\n icon=\"swap\"\n onClick={() => {\n editor.dispatchCommand(INSERT_UPLOAD_WITH_DRAWER_COMMAND, {\n replace: { nodeKey },\n })\n }}\n round\n tooltip={t('fields:swapUpload')}\n />\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={field?.readOnly}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeUpload()\n }}\n round\n tooltip={t('fields:removeUpload')}\n />\n </div>\n )}\n </div>\n </div>\n <div className={`${baseClass}__bottomRow`}>\n <DocumentDrawerToggler className={`${baseClass}__doc-drawer-toggler`}>\n <strong>{data?.filename}</strong>\n </DocumentDrawerToggler>\n </div>\n </div>\n {value?.id && <DocumentDrawer onSave={updateUpload} />}\n <ExtraFieldsUploadDrawer\n drawerSlug={drawerSlug}\n relatedCollection={relatedCollection}\n {...props}\n />\n </div>\n )\n}\n\nexport const UploadComponent = (props: ElementProps): React.ReactNode => {\n return (\n <EnabledRelationshipsCondition {...props} uploads>\n <Component {...props} />\n </EnabledRelationshipsCondition>\n )\n}\n"],"names":["lexicalComposerContextImport","useLexicalComposerContext","useLexicalNodeSelection","getTranslation","lexicalImport","$getNodeByKey","Button","useDocumentDrawer","DrawerToggler","useDrawerSlug","File","usePayloadAPI","useConfig","useTranslation","React","useCallback","useReducer","useState","useEditorConfigContext","EnabledRelationshipsCondition","INSERT_UPLOAD_WITH_DRAWER_COMMAND","ExtraFieldsUploadDrawer","baseClass","initialParams","depth","Component","props","data","fields","relationTo","value","nodeKey","collections","routes","api","serverURL","editor","isSelected","setSelected","clearSelection","editorConfig","field","i18n","t","cacheBust","dispatchCacheBust","state","relatedCollection","setRelatedCollection","find","coll","slug","drawerSlug","DocumentDrawer","DocumentDrawerToggler","closeDrawer","id","collectionSlug","setParams","thumbnailSRC","thumbnailURL","url","removeUpload","update","remove","updateUpload","json","hasExtraFields","resolvedFeatureMap","get","clientFeatureProps","div","className","filter","Boolean","join","contentEditable","img","alt","filename","src","labels","singular","isEditable","disabled","readOnly","buttonStyle","el","icon","onClick","e","preventDefault","round","tooltip","dispatchCommand","replace","strong","onSave","UploadComponent","uploads"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAGA,OAAOA,kCAAkC,2CAA0C;AACnF,MAAM,EAAEC,yBAAyB,EAAE,GAAGD;AACtC,SAASE,uBAAuB,QAAQ,4CAA2C;AACnF,SAASC,cAAc,QAAQ,2BAA0B;AACzD,OAAOC,mBAAmB,UAAS;AACnC,MAAM,EAAEC,aAAa,EAAE,GAAGD;AAE1B,SAASE,MAAM,QAAQ,iCAAgC;AACvD,SAASC,iBAAiB,QAAQ,yCAAwC;AAC1E,SAASC,aAAa,QAAQ,iCAAgC;AAC9D,SAASC,aAAa,QAAQ,iCAAgC;AAC9D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oBAACZ;QAAIC,WAAW,CAAC,EAAElD,UAAU,SAAS,CAAC;OACpC6C,+BACC,oBAAC3D;QACCgE,WAAW,CAAC,EAAElD,UAAU,uBAAuB,CAAC;QAChD8D,UAAU3C,OAAO4C;QACjBlC,MAAMC;qBAEN,oBAAC9C;QACCgF,aAAY;QACZC,IAAG;QACHC,MAAK;QACLC,SAAS,CAACC;YACRA,EAAEC,cAAc;QAClB;QACAC,OAAAA;QACAC,SAASlD,EAAE;UAGb,oBAEJ,oBAACrC;QACCgF,aAAY;QACZF,UAAU3C,OAAO4C;QACjBE,IAAG;QACHC,MAAK;QACLC,SAAS;YACPrD,OAAO0D,eAAe,CAAC1E,mCAAmC;gBACxD2E,SAAS;oBAAEhE;gBAAQ;YACrB;QACF;QACA6D,OAAAA;QACAC,SAASlD,EAAE;sBAEb,oBAACrC;QACCgF,aAAY;QACZd,WAAW,CAAC,EAAElD,UAAU,cAAc,CAAC;QACvC8D,UAAU3C,OAAO4C;QACjBG,MAAK;QACLC,SAAS,CAACC;YACRA,EAAEC,cAAc;YAChB7B;QACF;QACA8B,OAAAA;QACAC,SAASlD,EAAE;yBAMrB,oBAAC4B;QAAIC,WAAW,CAAC,EAAElD,UAAU,WAAW,CAAC;qBACvC,oBAACgC;QAAsBkB,WAAW,CAAC,EAAElD,UAAU,oBAAoB,CAAC;qBAClE,oBAAC0E,gBAAQrE,MAAMoD,cAIpBjD,OAAO0B,oBAAM,oBAACH;QAAe4C,QAAQhC;sBACtC,oBAAC5C;QACC+B,YAAYA;QACZL,mBAAmBA;QAClB,GAAGrB,KAAK;;AAIjB;AAEA,OAAO,MAAMwE,kBAAkB,CAACxE;IAC9B,qBACE,oBAACP;QAA+B,GAAGO,KAAK;QAAEyE,SAAAA;qBACxC,oBAAC1E,WAAcC;AAGrB,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/features/upload/component/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientCollectionConfig } from 'payload/types'\n\nimport lexicalComposerContextImport from '@lexical/react/LexicalComposerContext.js'\nconst { useLexicalComposerContext } = lexicalComposerContextImport\nimport { useLexicalNodeSelection } from '@lexical/react/useLexicalNodeSelection.js'\nimport { getTranslation } from '@payloadcms/translations'\nimport lexicalImport from 'lexical'\nconst { $getNodeByKey } = lexicalImport\n\nimport { Button } from '@payloadcms/ui/elements/Button'\nimport { useDocumentDrawer } from '@payloadcms/ui/elements/DocumentDrawer'\nimport { DrawerToggler } from '@payloadcms/ui/elements/Drawer'\nimport { useDrawerSlug } from '@payloadcms/ui/elements/Drawer'\nimport { File } from '@payloadcms/ui/graphics/File'\nimport usePayloadAPI from '@payloadcms/ui/hooks/usePayloadAPI'\nimport { useConfig } from '@payloadcms/ui/providers/Config'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport React, { useCallback, useReducer, useState } from 'react'\n\nimport type { ClientComponentProps } from '../../types.js'\nimport type { UploadFeaturePropsClient } from '../feature.client.js'\nimport type { UploadData } from '../nodes/UploadNode.js'\n\nimport { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js'\nimport { EnabledRelationshipsCondition } from '../../relationship/utils/EnabledRelationshipsCondition.js'\nimport { INSERT_UPLOAD_WITH_DRAWER_COMMAND } from '../drawer/commands.js'\nimport { ExtraFieldsUploadDrawer } from './ExtraFieldsDrawer/index.js'\nimport './index.scss'\n\nconst baseClass = 'lexical-upload'\n\nconst initialParams = {\n depth: 0,\n}\n\nexport type ElementProps = {\n data: UploadData\n nodeKey: string\n //uploadProps: UploadFeatureProps\n}\n\nconst Component: React.FC<ElementProps> = (props) => {\n const {\n data: { fields, relationTo, value },\n nodeKey,\n } = props\n\n const {\n collections,\n routes: { api },\n serverURL,\n } = useConfig()\n\n const [editor] = useLexicalComposerContext()\n const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey)\n const { editorConfig, field } = useEditorConfigContext()\n\n const { i18n, t } = useTranslation()\n const [cacheBust, dispatchCacheBust] = useReducer((state) => state + 1, 0)\n const [relatedCollection, setRelatedCollection] = useState<ClientCollectionConfig>(() =>\n collections.find((coll) => coll.slug === relationTo),\n )\n\n const drawerSlug = useDrawerSlug('upload-drawer')\n\n const [DocumentDrawer, DocumentDrawerToggler, { closeDrawer }] = useDocumentDrawer({\n id: value?.id,\n collectionSlug: relatedCollection.slug,\n })\n\n // Get the referenced document\n const [{ data }, { setParams }] = usePayloadAPI(\n `${serverURL}${api}/${relatedCollection.slug}/${value?.id}`,\n { initialParams },\n )\n\n const thumbnailSRC = data?.thumbnailURL || data?.url\n\n const removeUpload = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey).remove()\n })\n }, [editor, nodeKey])\n\n const updateUpload = useCallback(\n (json) => {\n setParams({\n ...initialParams,\n cacheBust, // do this to get the usePayloadAPI to re-fetch the data even though the URL string hasn't changed\n })\n\n dispatchCacheBust()\n closeDrawer()\n },\n [setParams, cacheBust, closeDrawer],\n )\n\n const hasExtraFields = (\n editorConfig?.resolvedFeatureMap?.get('upload')\n ?.clientFeatureProps as ClientComponentProps<UploadFeaturePropsClient>\n ).collections?.[relatedCollection.slug]?.hasExtraFields\n\n return (\n <div\n className={[baseClass, isSelected && `${baseClass}--selected`].filter(Boolean).join(' ')}\n contentEditable={false}\n >\n <div className={`${baseClass}__card`}>\n <div className={`${baseClass}__topRow`}>\n {/* TODO: migrate to use @payloadcms/ui/elements/Thumbnail component */}\n <div className={`${baseClass}__thumbnail`}>\n {thumbnailSRC ? <img alt={data?.filename} src={thumbnailSRC} /> : <File />}\n </div>\n <div className={`${baseClass}__topRowRightPanel`}>\n <div className={`${baseClass}__collectionLabel`}>\n {getTranslation(relatedCollection.labels.singular, i18n)}\n </div>\n {editor.isEditable() && (\n <div className={`${baseClass}__actions`}>\n {hasExtraFields ? (\n <DrawerToggler\n className={`${baseClass}__upload-drawer-toggler`}\n disabled={field?.readOnly}\n slug={drawerSlug}\n >\n <Button\n buttonStyle=\"icon-label\"\n el=\"div\"\n icon=\"edit\"\n onClick={(e) => {\n e.preventDefault()\n }}\n round\n tooltip={t('fields:editRelationship')}\n />\n </DrawerToggler>\n ) : null}\n\n <Button\n buttonStyle=\"icon-label\"\n disabled={field?.readOnly}\n el=\"div\"\n icon=\"swap\"\n onClick={() => {\n editor.dispatchCommand(INSERT_UPLOAD_WITH_DRAWER_COMMAND, {\n replace: { nodeKey },\n })\n }}\n round\n tooltip={t('fields:swapUpload')}\n />\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={field?.readOnly}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeUpload()\n }}\n round\n tooltip={t('fields:removeUpload')}\n />\n </div>\n )}\n </div>\n </div>\n <div className={`${baseClass}__bottomRow`}>\n <DocumentDrawerToggler className={`${baseClass}__doc-drawer-toggler`}>\n <strong>{data?.filename}</strong>\n </DocumentDrawerToggler>\n </div>\n </div>\n {value?.id && <DocumentDrawer onSave={updateUpload} />}\n {hasExtraFields ? (\n <ExtraFieldsUploadDrawer\n drawerSlug={drawerSlug}\n relatedCollection={relatedCollection}\n {...props}\n />\n ) : null}\n </div>\n )\n}\n\nexport const UploadComponent = (props: ElementProps): React.ReactNode => {\n return (\n <EnabledRelationshipsCondition {...props} uploads>\n <Component {...props} />\n </EnabledRelationshipsCondition>\n )\n}\n"],"names":["lexicalComposerContextImport","useLexicalComposerContext","useLexicalNodeSelection","getTranslation","lexicalImport","$getNodeByKey","Button","useDocumentDrawer","DrawerToggler","useDrawerSlug","File","usePayloadAPI","useConfig","useTranslation","React","useCallback","useReducer","useState","useEditorConfigContext","EnabledRelationshipsCondition","INSERT_UPLOAD_WITH_DRAWER_COMMAND","ExtraFieldsUploadDrawer","baseClass","initialParams","depth","Component","props","data","fields","relationTo","value","nodeKey","collections","routes","api","serverURL","editor","isSelected","setSelected","clearSelection","editorConfig","field","i18n","t","cacheBust","dispatchCacheBust","state","relatedCollection","setRelatedCollection","find","coll","slug","drawerSlug","DocumentDrawer","DocumentDrawerToggler","closeDrawer","id","collectionSlug","setParams","thumbnailSRC","thumbnailURL","url","removeUpload","update","remove","updateUpload","json","hasExtraFields","resolvedFeatureMap","get","clientFeatureProps","div","className","filter","Boolean","join","contentEditable","img","alt","filename","src","labels","singular","isEditable","disabled","readOnly","buttonStyle","el","icon","onClick","e","preventDefault","round","tooltip","dispatchCommand","replace","strong","onSave","UploadComponent","uploads"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAGA,OAAOA,kCAAkC,2CAA0C;AACnF,MAAM,EAAEC,yBAAyB,EAAE,GAAGD;AACtC,SAASE,uBAAuB,QAAQ,4CAA2C;AACnF,SAASC,cAAc,QAAQ,2BAA0B;AACzD,OAAOC,mBAAmB,UAAS;AACnC,MAAM,EAAEC,aAAa,EAAE,GAAGD;AAE1B,SAASE,MAAM,QAAQ,iCAAgC;AACvD,SAASC,iBAAiB,QAAQ,yCAAwC;AAC1E,SAASC,aAAa,QAAQ,iCAAgC;AAC9D,SAASC,aAAa,QAAQ,iCAAgC;AAC9D,SAASC,IAAI,QAAQ,+BAA8B;AACnD,OAAOC,mBAAmB,qCAAoC;AAC9D,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,cAAc,QAAQ,uCAAsC;AACrE,OAAOC,SAASC,WAAW,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,QAAO;AAMhE,SAASC,sBAAsB,QAAQ,yDAAwD;AAC/F,SAASC,6BAA6B,QAAQ,4DAA2D;AACzG,SAASC,iCAAiC,QAAQ,wBAAuB;AACzE,SAASC,uBAAuB,QAAQ,+BAA8B;AACtE,OAAO,eAAc;AAErB,MAAMC,YAAY;AAElB,MAAMC,gBAAgB;IACpBC,OAAO;AACT;AAQA,MAAMC,YAAoC,CAACC;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oBAAEhE;gBAAQ;YACrB;QACF;QACA6D,OAAAA;QACAC,SAASlD,EAAE;sBAEb,oBAACrC;QACCgF,aAAY;QACZd,WAAW,CAAC,EAAElD,UAAU,cAAc,CAAC;QACvC8D,UAAU3C,OAAO4C;QACjBG,MAAK;QACLC,SAAS,CAACC;YACRA,EAAEC,cAAc;YAChB7B;QACF;QACA8B,OAAAA;QACAC,SAASlD,EAAE;yBAMrB,oBAAC4B;QAAIC,WAAW,CAAC,EAAElD,UAAU,WAAW,CAAC;qBACvC,oBAACgC;QAAsBkB,WAAW,CAAC,EAAElD,UAAU,oBAAoB,CAAC;qBAClE,oBAAC0E,gBAAQrE,MAAMoD,cAIpBjD,OAAO0B,oBAAM,oBAACH;QAAe4C,QAAQhC;QACrCE,+BACC,oBAAC9C;QACC+B,YAAYA;QACZL,mBAAmBA;QAClB,GAAGrB,KAAK;SAET;AAGV;AAEA,OAAO,MAAMwE,kBAAkB,CAACxE;IAC9B,qBACE,oBAACP;QAA+B,GAAGO,KAAK;QAAEyE,SAAAA;qBACxC,oBAAC1E,WAAcC;AAGrB,EAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { AdapterProps, LexicalEditorProps, LexicalRichTextAdapter } from '.
|
|
|
2
2
|
export declare function lexicalEditor(props?: LexicalEditorProps): LexicalRichTextAdapter;
|
|
3
3
|
export { AlignFeature } from './field/features/align/feature.server.js';
|
|
4
4
|
export { BlockQuoteFeature } from './field/features/blockquote/feature.server.js';
|
|
5
|
-
export { BlocksFeature, type BlocksFeatureProps } from './field/features/blocks/feature.server.js';
|
|
5
|
+
export { BlocksFeature, type BlocksFeatureProps, type LexicalBlock, } from './field/features/blocks/feature.server.js';
|
|
6
6
|
export { $createBlockNode, $isBlockNode, type BlockFields, BlockNode, type SerializedBlockNode, } from './field/features/blocks/nodes/BlocksNode.js';
|
|
7
7
|
export { TextDropdownSectionWithEntries } from './field/features/common/floatingSelectToolbarTextDropdownSection/index.js';
|
|
8
8
|
export { LinebreakHTMLConverter } from './field/features/converters/html/converter/converters/linebreak.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAiB1F,wBAAgB,aAAa,CAAC,KAAK,CAAC,EAAE,kBAAkB,GAAG,sBAAsB,CAyLhF;AAED,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAA;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAA;AACjF,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAiB1F,wBAAgB,aAAa,CAAC,KAAK,CAAC,EAAE,kBAAkB,GAAG,sBAAsB,CAyLhF;AAED,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAA;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAA;AACjF,OAAO,EACL,aAAa,EACb,KAAK,kBAAkB,EACvB,KAAK,YAAY,GAClB,MAAM,2CAA2C,CAAA;AAClD,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,KAAK,WAAW,EAChB,SAAS,EACT,KAAK,mBAAmB,GACzB,MAAM,6CAA6C,CAAA;AAEpD,OAAO,EAAE,8BAA8B,EAAE,MAAM,2EAA2E,CAAA;AAC1H,OAAO,EAAE,sBAAsB,EAAE,MAAM,oEAAoE,CAAA;AAC3G,OAAO,EAAE,sBAAsB,EAAE,MAAM,oEAAoE,CAAA;AAE3G,OAAO,EAAE,iBAAiB,EAAE,MAAM,+DAA+D,CAAA;AACjG,OAAO,EAAE,qBAAqB,EAAE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+1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\nimport type { EditorConfig as LexicalEditorConfig } from 'lexical/LexicalEditor.js'\n\nimport { withMergedProps } from '@payloadcms/ui/elements/withMergedProps'\nimport { withNullableJSONSchemaType } from 'payload/utilities'\n\nimport type { FeatureProviderServer, ResolvedServerFeatureMap } from './field/features/types.js'\nimport type { SanitizedServerEditorConfig } from './field/lexical/config/types.js'\nimport type { AdapterProps, LexicalEditorProps, LexicalRichTextAdapter } from './types.js'\n\nimport { RichTextCell } from './cell/index.js'\nimport { RichTextField } from './field/index.js'\nimport {\n defaultEditorConfig,\n defaultEditorFeatures,\n defaultSanitizedServerEditorConfig,\n} from './field/lexical/config/server/default.js'\nimport { loadFeatures } from './field/lexical/config/server/loader.js'\nimport { sanitizeServerFeatures } from './field/lexical/config/server/sanitize.js'\nimport { cloneDeep } from './field/lexical/utils/cloneDeep.js'\nimport { getGenerateComponentMap } from './generateComponentMap.js'\nimport { getGenerateSchemaMap } from './generateSchemaMap.js'\nimport { richTextRelationshipPromise } from './populate/richTextRelationshipPromise.js'\nimport { richTextValidateHOC } from './validate/index.js'\n\nexport function lexicalEditor(props?: LexicalEditorProps): LexicalRichTextAdapter {\n let resolvedFeatureMap: ResolvedServerFeatureMap = null\n\n let finalSanitizedEditorConfig: SanitizedServerEditorConfig // For server only\n if (!props || (!props.features && !props.lexical)) {\n finalSanitizedEditorConfig = cloneDeep(defaultSanitizedServerEditorConfig)\n resolvedFeatureMap = finalSanitizedEditorConfig.resolvedFeatureMap\n } else {\n let features: FeatureProviderServer<unknown, unknown>[] =\n props.features && typeof props.features === 'function'\n ? props.features({ defaultFeatures: cloneDeep(defaultEditorFeatures) })\n : (props.features as FeatureProviderServer<unknown, unknown>[])\n if (!features) {\n features = cloneDeep(defaultEditorFeatures)\n }\n\n const lexical: LexicalEditorConfig = props.lexical\n\n resolvedFeatureMap = loadFeatures({\n unSanitizedEditorConfig: {\n features,\n lexical: lexical ? lexical : defaultEditorConfig.lexical,\n },\n })\n\n finalSanitizedEditorConfig = {\n features: sanitizeServerFeatures(resolvedFeatureMap),\n lexical: lexical ? lexical : defaultEditorConfig.lexical,\n resolvedFeatureMap,\n }\n }\n\n return {\n CellComponent: withMergedProps({\n Component: RichTextCell,\n toMergeIntoProps: { lexicalEditorConfig: finalSanitizedEditorConfig.lexical },\n }),\n FieldComponent: withMergedProps({\n Component: RichTextField,\n toMergeIntoProps: { lexicalEditorConfig: finalSanitizedEditorConfig.lexical },\n }),\n afterReadPromise: ({ field, incomingEditorState, siblingDoc }) => {\n return new Promise<void>((resolve, reject) => {\n const promises: Promise<void>[] = []\n\n if (finalSanitizedEditorConfig?.features?.hooks?.afterReadPromises?.length) {\n for (const afterReadPromise of finalSanitizedEditorConfig.features.hooks\n .afterReadPromises) {\n const promise = afterReadPromise({\n field,\n incomingEditorState,\n siblingDoc,\n })\n if (promise) {\n promises.push(promise)\n }\n }\n }\n\n Promise.all(promises)\n .then(() => resolve())\n .catch((error) => reject(error))\n })\n },\n editorConfig: finalSanitizedEditorConfig,\n generateComponentMap: getGenerateComponentMap({\n resolvedFeatureMap,\n }),\n generateSchemaMap: getGenerateSchemaMap({\n resolvedFeatureMap,\n }),\n outputSchema: ({\n collectionIDFieldTypes,\n config,\n field,\n interfaceNameDefinitions,\n isRequired,\n }) => {\n let outputSchema: JSONSchema4 = {\n // This schema matches the SerializedEditorState type so far, that it's possible to cast SerializedEditorState to this schema without any errors.\n // In the future, we should\n // 1) allow recursive children\n // 2) Pass in all the different types for every node added to the editorconfig. This can be done with refs in the schema.\n type: withNullableJSONSchemaType('object', isRequired),\n properties: {\n root: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: {\n type: 'string',\n },\n children: {\n type: 'array',\n items: {\n type: 'object',\n additionalProperties: true,\n properties: {\n type: {\n type: 'string',\n },\n version: {\n type: 'integer',\n },\n },\n required: ['type', 'version'],\n },\n },\n direction: {\n oneOf: [\n {\n enum: ['ltr', 'rtl'],\n },\n {\n type: 'null',\n },\n ],\n },\n format: {\n type: 'string',\n enum: ['left', 'start', 'center', 'right', 'end', 'justify', ''], // ElementFormatType, since the root node is an element\n },\n indent: {\n type: 'integer',\n },\n version: {\n type: 'integer',\n },\n },\n required: ['children', 'direction', 'format', 'indent', 'type', 'version'],\n },\n },\n required: ['root'],\n }\n for (const modifyOutputSchema of finalSanitizedEditorConfig.features.generatedTypes\n .modifyOutputSchemas) {\n outputSchema = modifyOutputSchema({\n collectionIDFieldTypes,\n config,\n currentSchema: outputSchema,\n field,\n interfaceNameDefinitions,\n isRequired,\n })\n }\n\n return outputSchema\n },\n populationPromise({\n context,\n currentDepth,\n depth,\n field,\n findMany,\n flattenLocales,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n }) {\n // check if there are any features with nodes which have populationPromises for this field\n if (finalSanitizedEditorConfig?.features?.populationPromises?.size) {\n return richTextRelationshipPromise({\n context,\n currentDepth,\n depth,\n editorPopulationPromises: finalSanitizedEditorConfig.features.populationPromises,\n field,\n findMany,\n flattenLocales,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n })\n }\n\n return null\n },\n validate: richTextValidateHOC({\n editorConfig: finalSanitizedEditorConfig,\n }),\n }\n}\n\nexport { AlignFeature } from './field/features/align/feature.server.js'\nexport { BlockQuoteFeature } from './field/features/blockquote/feature.server.js'\nexport { BlocksFeature, type BlocksFeatureProps } from './field/features/blocks/feature.server.js'\nexport {\n $createBlockNode,\n $isBlockNode,\n type BlockFields,\n BlockNode,\n type SerializedBlockNode,\n} from './field/features/blocks/nodes/BlocksNode.js'\n\nexport { TextDropdownSectionWithEntries } from './field/features/common/floatingSelectToolbarTextDropdownSection/index.js'\nexport { LinebreakHTMLConverter } from './field/features/converters/html/converter/converters/linebreak.js'\nexport { ParagraphHTMLConverter } from './field/features/converters/html/converter/converters/paragraph.js'\n\nexport { TextHTMLConverter } from './field/features/converters/html/converter/converters/text.js'\nexport { defaultHTMLConverters } from './field/features/converters/html/converter/defaultConverters.js'\nexport {\n convertLexicalNodesToHTML,\n convertLexicalToHTML,\n} from './field/features/converters/html/converter/index.js'\nexport type { HTMLConverter } from './field/features/converters/html/converter/types.js'\nexport {\n HTMLConverterFeature,\n type HTMLConverterFeatureProps,\n} from './field/features/converters/html/feature.server.js'\nexport {\n consolidateHTMLConverters,\n lexicalHTML,\n} from './field/features/converters/html/field/index.js'\nexport { createClientComponent } from './field/features/createClientComponent.js'\nexport { TestRecorderFeature } from './field/features/debug/testrecorder/feature.server.js'\nexport { TreeViewFeature } from './field/features/debug/treeview/feature.server.js'\nexport { BoldFeature } from './field/features/format/bold/feature.server.js'\nexport { SectionWithEntries as FormatSectionWithEntries } from './field/features/format/common/floatingSelectToolbarSection.js'\nexport { InlineCodeFeature } from './field/features/format/inlinecode/feature.server.js'\nexport { ItalicFeature } from './field/features/format/italic/feature.server.js'\nexport { StrikethroughFeature } from './field/features/format/strikethrough/feature.server.js'\nexport { SubscriptFeature } from './field/features/format/subscript/feature.server.js'\nexport { SuperscriptFeature } from './field/features/format/superscript/feature.server.js'\nexport { UnderlineFeature } from './field/features/format/underline/feature.server.js'\n\nexport { HeadingFeature } from './field/features/heading/feature.server.js'\nexport { IndentFeature } from './field/features/indent/feature.server.js'\n\nexport { LinkFeature, type LinkFeatureServerProps } from './field/features/link/feature.server.js'\nexport {\n $createAutoLinkNode,\n $isAutoLinkNode,\n AutoLinkNode,\n} from './field/features/link/nodes/AutoLinkNode.js'\nexport {\n $createLinkNode,\n $isLinkNode,\n LinkNode,\n TOGGLE_LINK_COMMAND,\n} from './field/features/link/nodes/LinkNode.js'\nexport type {\n LinkFields,\n SerializedAutoLinkNode,\n SerializedLinkNode,\n} from './field/features/link/nodes/types.js'\nexport { CheckListFeature } from './field/features/lists/checklist/feature.server.js'\nexport { OrderedListFeature } from './field/features/lists/orderedlist/feature.server.js'\nexport { UnorderedListFeature } from './field/features/lists/unorderedlist/feature.server.js'\nexport { LexicalPluginToLexicalFeature } from './field/features/migrations/lexicalPluginToLexical/feature.server.js'\nexport { SlateBlockquoteConverter } from './field/features/migrations/slateToLexical/converter/converters/blockquote/index.js'\nexport { SlateHeadingConverter } from './field/features/migrations/slateToLexical/converter/converters/heading/index.js'\nexport { SlateIndentConverter } from './field/features/migrations/slateToLexical/converter/converters/indent/index.js'\nexport { SlateLinkConverter } from './field/features/migrations/slateToLexical/converter/converters/link/index.js'\nexport { SlateListItemConverter } from './field/features/migrations/slateToLexical/converter/converters/listItem/index.js'\nexport { SlateOrderedListConverter } from './field/features/migrations/slateToLexical/converter/converters/orderedList/index.js'\nexport { SlateRelationshipConverter } from './field/features/migrations/slateToLexical/converter/converters/relationship/index.js'\nexport { SlateUnknownConverter } from './field/features/migrations/slateToLexical/converter/converters/unknown/index.js'\nexport { SlateUnorderedListConverter } from './field/features/migrations/slateToLexical/converter/converters/unorderedList/index.js'\n\nexport { SlateUploadConverter } from './field/features/migrations/slateToLexical/converter/converters/upload/index.js'\nexport { defaultSlateConverters } from './field/features/migrations/slateToLexical/converter/defaultConverters.js'\nexport {\n convertSlateNodesToLexical,\n convertSlateToLexical,\n} from './field/features/migrations/slateToLexical/converter/index.js'\n\nexport type {\n SlateNode,\n SlateNodeConverter,\n} from './field/features/migrations/slateToLexical/converter/types.js'\nexport { SlateToLexicalFeature } from './field/features/migrations/slateToLexical/feature.server.js'\nexport { ParagraphFeature } from './field/features/paragraph/feature.server.js'\nexport { RelationshipFeature } from './field/features/relationship/feature.server.js'\nexport {\n $createRelationshipNode,\n $isRelationshipNode,\n type RelationshipData,\n RelationshipNode,\n type SerializedRelationshipNode,\n} from './field/features/relationship/nodes/RelationshipNode.js'\nexport type {\n ClientFeature,\n ClientFeatureProviderMap,\n FeatureProviderClient,\n FeatureProviderProviderClient,\n FeatureProviderProviderServer,\n FeatureProviderServer,\n NodeValidation,\n PopulationPromise,\n ResolvedClientFeature,\n ResolvedClientFeatureMap,\n ResolvedServerFeature,\n ResolvedServerFeatureMap,\n SanitizedClientFeatures,\n SanitizedPlugin,\n SanitizedServerFeatures,\n ServerFeature,\n ServerFeatureProviderMap,\n} from './field/features/types.js'\nexport { UploadFeature } from './field/features/upload/feature.server.js'\n\nexport type { UploadFeatureProps } from './field/features/upload/feature.server.js'\n\nexport type { RawUploadPayload } from './field/features/upload/nodes/UploadNode.js'\n\nexport {\n $createUploadNode,\n $isUploadNode,\n type SerializedUploadNode,\n type UploadData,\n UploadNode,\n} from './field/features/upload/nodes/UploadNode.js'\nexport {\n EditorConfigProvider,\n useEditorConfigContext,\n} from './field/lexical/config/client/EditorConfigProvider.js'\nexport {\n sanitizeClientEditorConfig,\n sanitizeClientFeatures,\n} from './field/lexical/config/client/sanitize.js'\nexport {\n defaultEditorConfig,\n defaultEditorFeatures,\n defaultEditorLexicalConfig,\n defaultSanitizedServerEditorConfig,\n} from './field/lexical/config/server/default.js'\nexport {\n loadFeatures,\n sortFeaturesForOptimalLoading,\n} from './field/lexical/config/server/loader.js'\nexport {\n sanitizeServerEditorConfig,\n sanitizeServerFeatures,\n} from './field/lexical/config/server/sanitize.js'\n\nexport type {\n ClientEditorConfig,\n SanitizedClientEditorConfig,\n SanitizedServerEditorConfig,\n ServerEditorConfig,\n} from './field/lexical/config/types.js'\nexport { getEnabledNodes } from './field/lexical/nodes/index.js'\n\nexport {\n type FloatingToolbarSection,\n type FloatingToolbarSectionEntry,\n} from './field/lexical/plugins/FloatingSelectToolbar/types.js'\nexport { ENABLE_SLASH_MENU_COMMAND } from './field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js'\nexport type { AdapterProps }\n\nexport {\n SlashMenuGroup,\n SlashMenuOption,\n} from './field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js'\nexport { CAN_USE_DOM } from './field/lexical/utils/canUseDOM.js'\nexport { cloneDeep } from './field/lexical/utils/cloneDeep.js'\nexport { getDOMRangeRect } from './field/lexical/utils/getDOMRangeRect.js'\nexport { getSelectedNode } from './field/lexical/utils/getSelectedNode.js'\nexport { isHTMLElement } from './field/lexical/utils/guard.js'\nexport { invariant } from './field/lexical/utils/invariant.js'\nexport { joinClasses } from './field/lexical/utils/joinClasses.js'\nexport { createBlockNode } from './field/lexical/utils/markdown/createBlockNode.js'\nexport {\n DETAIL_TYPE_TO_DETAIL,\n DOUBLE_LINE_BREAK,\n ELEMENT_FORMAT_TO_TYPE,\n ELEMENT_TYPE_TO_FORMAT,\n IS_ALL_FORMATTING,\n LTR_REGEX,\n NON_BREAKING_SPACE,\n NodeFormat,\n RTL_REGEX,\n TEXT_MODE_TO_TYPE,\n TEXT_TYPE_TO_FORMAT,\n TEXT_TYPE_TO_MODE,\n} from './field/lexical/utils/nodeFormat.js'\nexport { Point, isPoint } from './field/lexical/utils/point.js'\nexport { Rect } from './field/lexical/utils/rect.js'\nexport { setFloatingElemPosition } from './field/lexical/utils/setFloatingElemPosition.js'\nexport { setFloatingElemPositionForLinkEditor } from './field/lexical/utils/setFloatingElemPositionForLinkEditor.js'\nexport {\n addSwipeDownListener,\n addSwipeLeftListener,\n addSwipeRightListener,\n addSwipeUpListener,\n} from './field/lexical/utils/swipe.js'\nexport { sanitizeUrl, validateUrl } from './field/lexical/utils/url.js'\nexport { defaultRichTextValue } from './populate/defaultValue.js'\n\nexport type { LexicalEditorProps, LexicalRichTextAdapter } from './types.js'\n"],"names":["withMergedProps","withNullableJSONSchemaType","RichTextCell","RichTextField","defaultEditorConfig","defaultEditorFeatures","defaultSanitizedServerEditorConfig","loadFeatures","sanitizeServerFeatures","cloneDeep","getGenerateComponentMap","getGenerateSchemaMap","richTextRelationshipPromise","richTextValidateHOC","lexicalEditor","props","resolvedFeatureMap","finalSanitizedEditorConfig","features","lexical","defaultFeatures","unSanitizedEditorConfig","CellComponent","Component","toMergeIntoProps","lexicalEditorConfig","FieldComponent","afterReadPromise","field","incomingEditorState","siblingDoc","Promise","resolve","reject","promises","hooks","afterReadPromises","length","promise","push","all","then","catch","error","editorConfig","generateComponentMap","generateSchemaMap","outputSchema","collectionIDFieldTypes","config","interfaceNameDefinitions","isRequired","type","properties","root","additionalProperties","children","items","version","required","direction","oneOf","enum","format","indent","modifyOutputSchema","generatedTypes","modifyOutputSchemas","currentSchema","populationPromise","context","currentDepth","depth","findMany","flattenLocales","overrideAccess","populationPromises","req","showHiddenFields","size","editorPopulationPromises","validate","AlignFeature","BlockQuoteFeature","BlocksFeature","$createBlockNode","$isBlockNode","BlockNode","TextDropdownSectionWithEntries","LinebreakHTMLConverter","ParagraphHTMLConverter","TextHTMLConverter","defaultHTMLConverters","convertLexicalNodesToHTML","convertLexicalToHTML","HTMLConverterFeature","consolidateHTMLConverters","lexicalHTML","createClientComponent","TestRecorderFeature","TreeViewFeature","BoldFeature","SectionWithEntries","FormatSectionWithEntries","InlineCodeFeature","ItalicFeature","StrikethroughFeature","SubscriptFeature","SuperscriptFeature","UnderlineFeature","HeadingFeature","IndentFeature","LinkFeature","$createAutoLinkNode","$isAutoLinkNode","AutoLinkNode","$createLinkNode","$isLinkNode","LinkNode","TOGGLE_LINK_COMMAND","CheckListFeature","OrderedListFeature","UnorderedListFeature","LexicalPluginToLexicalFeature","SlateBlockquoteConverter","SlateHeadingConverter","SlateIndentConverter","SlateLinkConverter","SlateListItemConverter","SlateOrderedListConverter","SlateRelationshipConverter","SlateUnknownConverter","SlateUnorderedListConverter","SlateUploadConverter","defaultSlateConverters","convertSlateNodesToLexical","convertSlateToLexical","SlateToLexicalFeature","ParagraphFeature","RelationshipFeature","$createRelationshipNode","$isRelationshipNode","RelationshipNode","UploadFeature","$createUploadNode","$isUploadNode","UploadNode","EditorConfigProvider","useEditorConfigContext","sanitizeClientEditorConfig","sanitizeClientFeatures","defaultEditorLexicalConfig","sortFeaturesForOptimalLoading","sanitizeServerEditorConfig","getEnabledNodes","ENABLE_SLASH_MENU_COMMAND","SlashMenuGroup","SlashMenuOption","CAN_USE_DOM","getDOMRangeRect","getSelectedNode","isHTMLElement","invariant","joinClasses","createBlockNode","DETAIL_TYPE_TO_DETAIL","DOUBLE_LINE_BREAK","ELEMENT_FORMAT_TO_TYPE","ELEMENT_TYPE_TO_FORMAT","IS_ALL_FORMATTING","LTR_REGEX","NON_BREAKING_SPACE","NodeFormat","RTL_REGEX","TEXT_MODE_TO_TYPE","TEXT_TYPE_TO_FORMAT","TEXT_TYPE_TO_MODE","Point","isPoint","Rect","setFloatingElemPosition","setFloatingElemPositionForLinkEditor","addSwipeDownListener","addSwipeLeftListener","addSwipeRightListener","addSwipeUpListener","sanitizeUrl","validateUrl","defaultRichTextValue"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,eAAe,QAAQ,0CAAyC;AACzE,SAASC,0BAA0B,QAAQ,oBAAmB;AAM9D,SAASC,YAAY,QAAQ,kBAAiB;AAC9C,SAASC,aAAa,QAAQ,mBAAkB;AAChD,SACEC,mBAAmB,EACnBC,qBAAqB,EACrBC,kCAAkC,QAC7B,2CAA0C;AACjD,SAASC,YAAY,QAAQ,0CAAyC;AACtE,SAASC,sBAAsB,QAAQ,4CAA2C;AAClF,SAASC,SAAS,QAAQ,qCAAoC;AAC9D,SAASC,uBAAuB,QAAQ,4BAA2B;AACnE,SAASC,oBAAoB,QAAQ,yBAAwB;AAC7D,SAASC,2BAA2B,QAAQ,4CAA2C;AACvF,SAASC,mBAAmB,QAAQ,sBAAqB;AAEzD,OAAO,SAASC,cAAcC,KAA0B;IACtD,IAAIC,qBAA+C;IAEnD,I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AgC;AACvC,SAASC,WAAW,EAAEC,WAAW,QAAQ,+BAA8B;AACvE,SAASC,oBAAoB,QAAQ,6BAA4B"}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\nimport type { EditorConfig as LexicalEditorConfig } from 'lexical/LexicalEditor.js'\n\nimport { withMergedProps } from '@payloadcms/ui/elements/withMergedProps'\nimport { withNullableJSONSchemaType } from 'payload/utilities'\n\nimport type { FeatureProviderServer, ResolvedServerFeatureMap } from './field/features/types.js'\nimport type { SanitizedServerEditorConfig } from './field/lexical/config/types.js'\nimport type { AdapterProps, LexicalEditorProps, LexicalRichTextAdapter } from './types.js'\n\nimport { RichTextCell } from './cell/index.js'\nimport { RichTextField } from './field/index.js'\nimport {\n defaultEditorConfig,\n defaultEditorFeatures,\n defaultSanitizedServerEditorConfig,\n} from './field/lexical/config/server/default.js'\nimport { loadFeatures } from './field/lexical/config/server/loader.js'\nimport { sanitizeServerFeatures } from './field/lexical/config/server/sanitize.js'\nimport { cloneDeep } from './field/lexical/utils/cloneDeep.js'\nimport { getGenerateComponentMap } from './generateComponentMap.js'\nimport { getGenerateSchemaMap } from './generateSchemaMap.js'\nimport { richTextRelationshipPromise } from './populate/richTextRelationshipPromise.js'\nimport { richTextValidateHOC } from './validate/index.js'\n\nexport function lexicalEditor(props?: LexicalEditorProps): LexicalRichTextAdapter {\n let resolvedFeatureMap: ResolvedServerFeatureMap = null\n\n let finalSanitizedEditorConfig: SanitizedServerEditorConfig // For server only\n if (!props || (!props.features && !props.lexical)) {\n finalSanitizedEditorConfig = cloneDeep(defaultSanitizedServerEditorConfig)\n resolvedFeatureMap = finalSanitizedEditorConfig.resolvedFeatureMap\n } else {\n let features: FeatureProviderServer<unknown, unknown>[] =\n props.features && typeof props.features === 'function'\n ? props.features({ defaultFeatures: cloneDeep(defaultEditorFeatures) })\n : (props.features as FeatureProviderServer<unknown, unknown>[])\n if (!features) {\n features = cloneDeep(defaultEditorFeatures)\n }\n\n const lexical: LexicalEditorConfig = props.lexical\n\n resolvedFeatureMap = loadFeatures({\n unSanitizedEditorConfig: {\n features,\n lexical: lexical ? lexical : defaultEditorConfig.lexical,\n },\n })\n\n finalSanitizedEditorConfig = {\n features: sanitizeServerFeatures(resolvedFeatureMap),\n lexical: lexical ? lexical : defaultEditorConfig.lexical,\n resolvedFeatureMap,\n }\n }\n\n return {\n CellComponent: withMergedProps({\n Component: RichTextCell,\n toMergeIntoProps: { lexicalEditorConfig: finalSanitizedEditorConfig.lexical },\n }),\n FieldComponent: withMergedProps({\n Component: RichTextField,\n toMergeIntoProps: { lexicalEditorConfig: finalSanitizedEditorConfig.lexical },\n }),\n afterReadPromise: ({ field, incomingEditorState, siblingDoc }) => {\n return new Promise<void>((resolve, reject) => {\n const promises: Promise<void>[] = []\n\n if (finalSanitizedEditorConfig?.features?.hooks?.afterReadPromises?.length) {\n for (const afterReadPromise of finalSanitizedEditorConfig.features.hooks\n .afterReadPromises) {\n const promise = afterReadPromise({\n field,\n incomingEditorState,\n siblingDoc,\n })\n if (promise) {\n promises.push(promise)\n }\n }\n }\n\n Promise.all(promises)\n .then(() => resolve())\n .catch((error) => reject(error))\n })\n },\n editorConfig: finalSanitizedEditorConfig,\n generateComponentMap: getGenerateComponentMap({\n resolvedFeatureMap,\n }),\n generateSchemaMap: getGenerateSchemaMap({\n resolvedFeatureMap,\n }),\n outputSchema: ({\n collectionIDFieldTypes,\n config,\n field,\n interfaceNameDefinitions,\n isRequired,\n }) => {\n let outputSchema: JSONSchema4 = {\n // This schema matches the SerializedEditorState type so far, that it's possible to cast SerializedEditorState to this schema without any errors.\n // In the future, we should\n // 1) allow recursive children\n // 2) Pass in all the different types for every node added to the editorconfig. This can be done with refs in the schema.\n type: withNullableJSONSchemaType('object', isRequired),\n properties: {\n root: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: {\n type: 'string',\n },\n children: {\n type: 'array',\n items: {\n type: 'object',\n additionalProperties: true,\n properties: {\n type: {\n type: 'string',\n },\n version: {\n type: 'integer',\n },\n },\n required: ['type', 'version'],\n },\n },\n direction: {\n oneOf: [\n {\n enum: ['ltr', 'rtl'],\n },\n {\n type: 'null',\n },\n ],\n },\n format: {\n type: 'string',\n enum: ['left', 'start', 'center', 'right', 'end', 'justify', ''], // ElementFormatType, since the root node is an element\n },\n indent: {\n type: 'integer',\n },\n version: {\n type: 'integer',\n },\n },\n required: ['children', 'direction', 'format', 'indent', 'type', 'version'],\n },\n },\n required: ['root'],\n }\n for (const modifyOutputSchema of finalSanitizedEditorConfig.features.generatedTypes\n .modifyOutputSchemas) {\n outputSchema = modifyOutputSchema({\n collectionIDFieldTypes,\n config,\n currentSchema: outputSchema,\n field,\n interfaceNameDefinitions,\n isRequired,\n })\n }\n\n return outputSchema\n },\n populationPromise({\n context,\n currentDepth,\n depth,\n field,\n findMany,\n flattenLocales,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n }) {\n // check if there are any features with nodes which have populationPromises for this field\n if (finalSanitizedEditorConfig?.features?.populationPromises?.size) {\n return richTextRelationshipPromise({\n context,\n currentDepth,\n depth,\n editorPopulationPromises: finalSanitizedEditorConfig.features.populationPromises,\n field,\n findMany,\n flattenLocales,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n })\n }\n\n return null\n },\n validate: richTextValidateHOC({\n editorConfig: finalSanitizedEditorConfig,\n }),\n }\n}\n\nexport { AlignFeature } from './field/features/align/feature.server.js'\nexport { BlockQuoteFeature } from './field/features/blockquote/feature.server.js'\nexport {\n BlocksFeature,\n type BlocksFeatureProps,\n type LexicalBlock,\n} from './field/features/blocks/feature.server.js'\nexport {\n $createBlockNode,\n $isBlockNode,\n type BlockFields,\n BlockNode,\n type SerializedBlockNode,\n} from './field/features/blocks/nodes/BlocksNode.js'\n\nexport { TextDropdownSectionWithEntries } from './field/features/common/floatingSelectToolbarTextDropdownSection/index.js'\nexport { LinebreakHTMLConverter } from './field/features/converters/html/converter/converters/linebreak.js'\nexport { ParagraphHTMLConverter } from './field/features/converters/html/converter/converters/paragraph.js'\n\nexport { TextHTMLConverter } from './field/features/converters/html/converter/converters/text.js'\nexport { defaultHTMLConverters } from './field/features/converters/html/converter/defaultConverters.js'\nexport {\n convertLexicalNodesToHTML,\n convertLexicalToHTML,\n} from './field/features/converters/html/converter/index.js'\nexport type { HTMLConverter } from './field/features/converters/html/converter/types.js'\nexport {\n HTMLConverterFeature,\n type HTMLConverterFeatureProps,\n} from './field/features/converters/html/feature.server.js'\nexport {\n consolidateHTMLConverters,\n lexicalHTML,\n} from './field/features/converters/html/field/index.js'\nexport { createClientComponent } from './field/features/createClientComponent.js'\nexport { TestRecorderFeature } from './field/features/debug/testrecorder/feature.server.js'\nexport { TreeViewFeature } from './field/features/debug/treeview/feature.server.js'\nexport { BoldFeature } from './field/features/format/bold/feature.server.js'\nexport { SectionWithEntries as FormatSectionWithEntries } from './field/features/format/common/floatingSelectToolbarSection.js'\nexport { InlineCodeFeature } from './field/features/format/inlinecode/feature.server.js'\nexport { ItalicFeature } from './field/features/format/italic/feature.server.js'\nexport { StrikethroughFeature } from './field/features/format/strikethrough/feature.server.js'\nexport { SubscriptFeature } from './field/features/format/subscript/feature.server.js'\nexport { SuperscriptFeature } from './field/features/format/superscript/feature.server.js'\nexport { UnderlineFeature } from './field/features/format/underline/feature.server.js'\n\nexport { HeadingFeature } from './field/features/heading/feature.server.js'\nexport { IndentFeature } from './field/features/indent/feature.server.js'\n\nexport { LinkFeature, type LinkFeatureServerProps } from './field/features/link/feature.server.js'\nexport {\n $createAutoLinkNode,\n $isAutoLinkNode,\n AutoLinkNode,\n} from './field/features/link/nodes/AutoLinkNode.js'\nexport {\n $createLinkNode,\n $isLinkNode,\n LinkNode,\n TOGGLE_LINK_COMMAND,\n} from './field/features/link/nodes/LinkNode.js'\nexport type {\n LinkFields,\n SerializedAutoLinkNode,\n SerializedLinkNode,\n} from './field/features/link/nodes/types.js'\nexport { CheckListFeature } from './field/features/lists/checklist/feature.server.js'\nexport { OrderedListFeature } from './field/features/lists/orderedlist/feature.server.js'\nexport { UnorderedListFeature } from './field/features/lists/unorderedlist/feature.server.js'\nexport { LexicalPluginToLexicalFeature } from './field/features/migrations/lexicalPluginToLexical/feature.server.js'\nexport { SlateBlockquoteConverter } from './field/features/migrations/slateToLexical/converter/converters/blockquote/index.js'\nexport { SlateHeadingConverter } from './field/features/migrations/slateToLexical/converter/converters/heading/index.js'\nexport { SlateIndentConverter } from './field/features/migrations/slateToLexical/converter/converters/indent/index.js'\nexport { SlateLinkConverter } from './field/features/migrations/slateToLexical/converter/converters/link/index.js'\nexport { SlateListItemConverter } from './field/features/migrations/slateToLexical/converter/converters/listItem/index.js'\nexport { SlateOrderedListConverter } from './field/features/migrations/slateToLexical/converter/converters/orderedList/index.js'\nexport { SlateRelationshipConverter } from './field/features/migrations/slateToLexical/converter/converters/relationship/index.js'\nexport { SlateUnknownConverter } from './field/features/migrations/slateToLexical/converter/converters/unknown/index.js'\nexport { SlateUnorderedListConverter } from './field/features/migrations/slateToLexical/converter/converters/unorderedList/index.js'\n\nexport { SlateUploadConverter } from './field/features/migrations/slateToLexical/converter/converters/upload/index.js'\nexport { defaultSlateConverters } from './field/features/migrations/slateToLexical/converter/defaultConverters.js'\nexport {\n convertSlateNodesToLexical,\n convertSlateToLexical,\n} from './field/features/migrations/slateToLexical/converter/index.js'\n\nexport type {\n SlateNode,\n SlateNodeConverter,\n} from './field/features/migrations/slateToLexical/converter/types.js'\nexport { SlateToLexicalFeature } from './field/features/migrations/slateToLexical/feature.server.js'\nexport { ParagraphFeature } from './field/features/paragraph/feature.server.js'\nexport { RelationshipFeature } from './field/features/relationship/feature.server.js'\nexport {\n $createRelationshipNode,\n $isRelationshipNode,\n type RelationshipData,\n RelationshipNode,\n type SerializedRelationshipNode,\n} from './field/features/relationship/nodes/RelationshipNode.js'\nexport type {\n ClientFeature,\n ClientFeatureProviderMap,\n FeatureProviderClient,\n FeatureProviderProviderClient,\n FeatureProviderProviderServer,\n FeatureProviderServer,\n NodeValidation,\n PopulationPromise,\n ResolvedClientFeature,\n ResolvedClientFeatureMap,\n ResolvedServerFeature,\n ResolvedServerFeatureMap,\n SanitizedClientFeatures,\n SanitizedPlugin,\n SanitizedServerFeatures,\n ServerFeature,\n ServerFeatureProviderMap,\n} from './field/features/types.js'\nexport { UploadFeature } from './field/features/upload/feature.server.js'\n\nexport type { UploadFeatureProps } from './field/features/upload/feature.server.js'\n\nexport type { RawUploadPayload } from './field/features/upload/nodes/UploadNode.js'\n\nexport {\n $createUploadNode,\n $isUploadNode,\n type SerializedUploadNode,\n type UploadData,\n UploadNode,\n} from './field/features/upload/nodes/UploadNode.js'\nexport {\n EditorConfigProvider,\n useEditorConfigContext,\n} from './field/lexical/config/client/EditorConfigProvider.js'\nexport {\n sanitizeClientEditorConfig,\n sanitizeClientFeatures,\n} from './field/lexical/config/client/sanitize.js'\nexport {\n defaultEditorConfig,\n defaultEditorFeatures,\n defaultEditorLexicalConfig,\n defaultSanitizedServerEditorConfig,\n} from './field/lexical/config/server/default.js'\nexport {\n loadFeatures,\n sortFeaturesForOptimalLoading,\n} from './field/lexical/config/server/loader.js'\nexport {\n sanitizeServerEditorConfig,\n sanitizeServerFeatures,\n} from './field/lexical/config/server/sanitize.js'\n\nexport type {\n ClientEditorConfig,\n SanitizedClientEditorConfig,\n SanitizedServerEditorConfig,\n ServerEditorConfig,\n} from './field/lexical/config/types.js'\nexport { getEnabledNodes } from './field/lexical/nodes/index.js'\n\nexport {\n type FloatingToolbarSection,\n type FloatingToolbarSectionEntry,\n} from './field/lexical/plugins/FloatingSelectToolbar/types.js'\nexport { ENABLE_SLASH_MENU_COMMAND } from './field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js'\nexport type { AdapterProps }\n\nexport {\n SlashMenuGroup,\n SlashMenuOption,\n} from './field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js'\nexport { CAN_USE_DOM } from './field/lexical/utils/canUseDOM.js'\nexport { cloneDeep } from './field/lexical/utils/cloneDeep.js'\nexport { getDOMRangeRect } from './field/lexical/utils/getDOMRangeRect.js'\nexport { getSelectedNode } from './field/lexical/utils/getSelectedNode.js'\nexport { isHTMLElement } from './field/lexical/utils/guard.js'\nexport { invariant } from './field/lexical/utils/invariant.js'\nexport { joinClasses } from './field/lexical/utils/joinClasses.js'\nexport { createBlockNode } from './field/lexical/utils/markdown/createBlockNode.js'\nexport {\n DETAIL_TYPE_TO_DETAIL,\n DOUBLE_LINE_BREAK,\n ELEMENT_FORMAT_TO_TYPE,\n ELEMENT_TYPE_TO_FORMAT,\n IS_ALL_FORMATTING,\n LTR_REGEX,\n NON_BREAKING_SPACE,\n NodeFormat,\n RTL_REGEX,\n TEXT_MODE_TO_TYPE,\n TEXT_TYPE_TO_FORMAT,\n TEXT_TYPE_TO_MODE,\n} from './field/lexical/utils/nodeFormat.js'\nexport { Point, isPoint } from './field/lexical/utils/point.js'\nexport { Rect } from './field/lexical/utils/rect.js'\nexport { setFloatingElemPosition } from './field/lexical/utils/setFloatingElemPosition.js'\nexport { setFloatingElemPositionForLinkEditor } from './field/lexical/utils/setFloatingElemPositionForLinkEditor.js'\nexport {\n addSwipeDownListener,\n addSwipeLeftListener,\n addSwipeRightListener,\n addSwipeUpListener,\n} from './field/lexical/utils/swipe.js'\nexport { sanitizeUrl, validateUrl } from './field/lexical/utils/url.js'\nexport { defaultRichTextValue } from './populate/defaultValue.js'\n\nexport type { LexicalEditorProps, LexicalRichTextAdapter } from './types.js'\n"],"names":["withMergedProps","withNullableJSONSchemaType","RichTextCell","RichTextField","defaultEditorConfig","defaultEditorFeatures","defaultSanitizedServerEditorConfig","loadFeatures","sanitizeServerFeatures","cloneDeep","getGenerateComponentMap","getGenerateSchemaMap","richTextRelationshipPromise","richTextValidateHOC","lexicalEditor","props","resolvedFeatureMap","finalSanitizedEditorConfig","features","lexical","defaultFeatures","unSanitizedEditorConfig","CellComponent","Component","toMergeIntoProps","lexicalEditorConfig","FieldComponent","afterReadPromise","field","incomingEditorState","siblingDoc","Promise","resolve","reject","promises","hooks","afterReadPromises","length","promise","push","all","then","catch","error","editorConfig","generateComponentMap","generateSchemaMap","outputSchema","collectionIDFieldTypes","config","interfaceNameDefinitions","isRequired","type","properties","root","additionalProperties","children","items","version","required","direction","oneOf","enum","format","indent","modifyOutputSchema","generatedTypes","modifyOutputSchemas","currentSchema","populationPromise","context","currentDepth","depth","findMany","flattenLocales","overrideAccess","populationPromises","req","showHiddenFields","size","editorPopulationPromises","validate","AlignFeature","BlockQuoteFeature","BlocksFeature","$createBlockNode","$isBlockNode","BlockNode","TextDropdownSectionWithEntries","LinebreakHTMLConverter","ParagraphHTMLConverter","TextHTMLConverter","defaultHTMLConverters","convertLexicalNodesToHTML","convertLexicalToHTML","HTMLConverterFeature","consolidateHTMLConverters","lexicalHTML","createClientComponent","TestRecorderFeature","TreeViewFeature","BoldFeature","SectionWithEntries","FormatSectionWithEntries","InlineCodeFeature","ItalicFeature","StrikethroughFeature","SubscriptFeature","SuperscriptFeature","UnderlineFeature","HeadingFeature","IndentFeature","LinkFeature","$createAutoLinkNode","$isAutoLinkNode","AutoLinkNode","$createLinkNode","$isLinkNode","LinkNode","TOGGLE_LINK_COMMAND","CheckListFeature","OrderedListFeature","UnorderedListFeature","LexicalPluginToLexicalFeature","SlateBlockquoteConverter","SlateHeadingConverter","SlateIndentConverter","SlateLinkConverter","SlateListItemConverter","SlateOrderedListConverter","SlateRelationshipConverter","SlateUnknownConverter","SlateUnorderedListConverter","SlateUploadConverter","defaultSlateConverters","convertSlateNodesToLexical","convertSlateToLexical","SlateToLexicalFeature","ParagraphFeature","RelationshipFeature","$createRelationshipNode","$isRelationshipNode","RelationshipNode","UploadFeature","$createUploadNode","$isUploadNode","UploadNode","EditorConfigProvider","useEditorConfigContext","sanitizeClientEditorConfig","sanitizeClientFeatures","defaultEditorLexicalConfig","sortFeaturesForOptimalLoading","sanitizeServerEditorConfig","getEnabledNodes","ENABLE_SLASH_MENU_COMMAND","SlashMenuGroup","SlashMenuOption","CAN_USE_DOM","getDOMRangeRect","getSelectedNode","isHTMLElement","invariant","joinClasses","createBlockNode","DETAIL_TYPE_TO_DETAIL","DOUBLE_LINE_BREAK","ELEMENT_FORMAT_TO_TYPE","ELEMENT_TYPE_TO_FORMAT","IS_ALL_FORMATTING","LTR_REGEX","NON_BREAKING_SPACE","NodeFormat","RTL_REGEX","TEXT_MODE_TO_TYPE","TEXT_TYPE_TO_FORMAT","TEXT_TYPE_TO_MODE","Point","isPoint","Rect","setFloatingElemPosition","setFloatingElemPositionForLinkEditor","addSwipeDownListener","addSwipeLeftListener","addSwipeRightListener","addSwipeUpListener","sanitizeUrl","validateUrl","defaultRichTextValue"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,eAAe,QAAQ,0CAAyC;AACzE,SAASC,0BAA0B,QAAQ,oBAAmB;AAM9D,SAASC,YAAY,QAAQ,kBAAiB;AAC9C,SAASC,aAAa,QAAQ,mBAAkB;AAChD,SACEC,mBAAmB,EACnBC,qBAAqB,EACrBC,kCAAkC,QAC7B,2CAA0C;AACjD,SAASC,YAAY,QAAQ,0CAAyC;AACtE,SAASC,sBAAsB,QAAQ,4CAA2C;AAClF,SAASC,SAAS,QAAQ,qCAAoC;AAC9D,SAASC,uBAAuB,QAAQ,4BAA2B;AACnE,SAASC,oBAAoB,QAAQ,yBAAwB;AAC7D,SAASC,2BAA2B,QAAQ,4CAA2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,oCAAoC,QAAQ,gEAA+D;AACpH,SACEC,oBAAoB,EACpBC,oBAAoB,EACpBC,qBAAqB,EACrBC,kBAAkB,QACb,iCAAgC;AACvC,SAASC,WAAW,EAAEC,WAAW,QAAQ,+BAA8B;AACvE,SAASC,oBAAoB,QAAQ,6BAA4B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/richtext-lexical",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.2",
|
|
4
4
|
"description": "The officially supported Lexical richtext adapter for Payload",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -40,17 +40,17 @@
|
|
|
40
40
|
"@types/node": "20.12.5",
|
|
41
41
|
"@types/react": "18.2.74",
|
|
42
42
|
"@types/react-dom": "18.2.24",
|
|
43
|
-
"
|
|
44
|
-
"@payloadcms/translations": "3.0.0-beta.
|
|
45
|
-
"@payloadcms/
|
|
46
|
-
"@payloadcms/
|
|
47
|
-
"
|
|
43
|
+
"@payloadcms/eslint-config": "1.1.1",
|
|
44
|
+
"@payloadcms/translations": "3.0.0-beta.2",
|
|
45
|
+
"@payloadcms/ui": "3.0.0-beta.2",
|
|
46
|
+
"@payloadcms/next": "3.0.0-beta.2",
|
|
47
|
+
"payload": "3.0.0-beta.2"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@payloadcms/translations": "3.0.0-beta.
|
|
51
|
-
"@payloadcms/ui": "3.0.0-beta.
|
|
52
|
-
"@payloadcms/next": "3.0.0-beta.
|
|
53
|
-
"payload": "3.0.0-beta.
|
|
50
|
+
"@payloadcms/translations": "3.0.0-beta.2",
|
|
51
|
+
"@payloadcms/ui": "3.0.0-beta.2",
|
|
52
|
+
"@payloadcms/next": "3.0.0-beta.2",
|
|
53
|
+
"payload": "3.0.0-beta.2"
|
|
54
54
|
},
|
|
55
55
|
"exports": {
|
|
56
56
|
".": {
|
package/src/index.ts
CHANGED
|
@@ -212,7 +212,11 @@ export function lexicalEditor(props?: LexicalEditorProps): LexicalRichTextAdapte
|
|
|
212
212
|
|
|
213
213
|
export { AlignFeature } from './field/features/align/feature.server.js'
|
|
214
214
|
export { BlockQuoteFeature } from './field/features/blockquote/feature.server.js'
|
|
215
|
-
export {
|
|
215
|
+
export {
|
|
216
|
+
BlocksFeature,
|
|
217
|
+
type BlocksFeatureProps,
|
|
218
|
+
type LexicalBlock,
|
|
219
|
+
} from './field/features/blocks/feature.server.js'
|
|
216
220
|
export {
|
|
217
221
|
$createBlockNode,
|
|
218
222
|
$isBlockNode,
|