@payloadcms/richtext-lexical 3.0.0-beta.36 → 3.0.0-beta.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/field/features/align/feature.client.d.ts.map +1 -1
- package/dist/field/features/align/feature.client.js +12 -4
- package/dist/field/features/align/feature.client.js.map +1 -1
- package/dist/field/features/align/feature.server.d.ts.map +1 -1
- package/dist/field/features/align/feature.server.js +2 -0
- package/dist/field/features/align/feature.server.js.map +1 -1
- package/dist/field/features/align/i18n.d.ts +3 -0
- package/dist/field/features/align/i18n.d.ts.map +1 -0
- package/dist/field/features/align/i18n.js +196 -0
- package/dist/field/features/align/i18n.js.map +1 -0
- package/dist/field/features/blockquote/feature.client.d.ts.map +1 -1
- package/dist/field/features/blockquote/feature.client.js +22 -21
- package/dist/field/features/blockquote/feature.client.js.map +1 -1
- package/dist/field/features/blockquote/feature.server.d.ts.map +1 -1
- package/dist/field/features/blockquote/feature.server.js +2 -0
- package/dist/field/features/blockquote/feature.server.js.map +1 -1
- package/dist/field/features/blockquote/i18n.d.ts +3 -0
- package/dist/field/features/blockquote/i18n.d.ts.map +1 -0
- package/dist/field/features/blockquote/i18n.js +100 -0
- package/dist/field/features/blockquote/i18n.js.map +1 -0
- package/dist/field/features/blocks/feature.client.d.ts.map +1 -1
- package/dist/field/features/blocks/feature.client.js +3 -1
- package/dist/field/features/blocks/feature.client.js.map +1 -1
- package/dist/field/features/blocks/feature.server.d.ts.map +1 -1
- package/dist/field/features/blocks/feature.server.js +2 -0
- package/dist/field/features/blocks/feature.server.js.map +1 -1
- package/dist/field/features/blocks/i18n.d.ts +3 -0
- package/dist/field/features/blocks/i18n.d.ts.map +1 -0
- package/dist/field/features/blocks/i18n.js +100 -0
- package/dist/field/features/blocks/i18n.js.map +1 -0
- package/dist/field/features/blocks/populationPromise.js +1 -1
- package/dist/field/features/blocks/populationPromise.js.map +1 -1
- package/dist/field/features/converters/html/field/index.d.ts.map +1 -1
- package/dist/field/features/converters/html/field/index.js +30 -2
- package/dist/field/features/converters/html/field/index.js.map +1 -1
- package/dist/field/features/heading/feature.client.d.ts.map +1 -1
- package/dist/field/features/heading/feature.client.js +26 -21
- package/dist/field/features/heading/feature.client.js.map +1 -1
- package/dist/field/features/heading/feature.server.d.ts.map +1 -1
- package/dist/field/features/heading/feature.server.js +2 -0
- package/dist/field/features/heading/feature.server.js.map +1 -1
- package/dist/field/features/heading/i18n.d.ts +3 -0
- package/dist/field/features/heading/i18n.d.ts.map +1 -0
- package/dist/field/features/heading/i18n.js +100 -0
- package/dist/field/features/heading/i18n.js.map +1 -0
- package/dist/field/features/horizontalRule/feature.client.d.ts.map +1 -1
- package/dist/field/features/horizontalRule/feature.client.js +21 -20
- package/dist/field/features/horizontalRule/feature.client.js.map +1 -1
- package/dist/field/features/horizontalRule/feature.server.d.ts.map +1 -1
- package/dist/field/features/horizontalRule/feature.server.js +2 -0
- package/dist/field/features/horizontalRule/feature.server.js.map +1 -1
- package/dist/field/features/horizontalRule/i18n.d.ts +3 -0
- package/dist/field/features/horizontalRule/i18n.d.ts.map +1 -0
- package/dist/field/features/horizontalRule/i18n.js +100 -0
- package/dist/field/features/horizontalRule/i18n.js.map +1 -0
- package/dist/field/features/indent/feature.client.d.ts.map +1 -1
- package/dist/field/features/indent/feature.client.js +6 -2
- package/dist/field/features/indent/feature.client.js.map +1 -1
- package/dist/field/features/indent/feature.server.d.ts.map +1 -1
- package/dist/field/features/indent/feature.server.js +2 -0
- package/dist/field/features/indent/feature.server.js.map +1 -1
- package/dist/field/features/indent/i18n.d.ts +3 -0
- package/dist/field/features/indent/i18n.d.ts.map +1 -0
- package/dist/field/features/indent/i18n.js +132 -0
- package/dist/field/features/indent/i18n.js.map +1 -0
- package/dist/field/features/link/feature.client.d.ts.map +1 -1
- package/dist/field/features/link/feature.client.js +7 -1
- package/dist/field/features/link/feature.client.js.map +1 -1
- package/dist/field/features/link/feature.server.d.ts.map +1 -1
- package/dist/field/features/link/feature.server.js +10 -2
- package/dist/field/features/link/feature.server.js.map +1 -1
- package/dist/field/features/link/i18n.d.ts +3 -0
- package/dist/field/features/link/i18n.d.ts.map +1 -0
- package/dist/field/features/link/i18n.js +100 -0
- package/dist/field/features/link/i18n.js.map +1 -0
- package/dist/field/features/link/markdownTransformer.d.ts +6 -0
- package/dist/field/features/link/markdownTransformer.d.ts.map +1 -0
- package/dist/field/features/link/markdownTransformer.js +50 -0
- package/dist/field/features/link/markdownTransformer.js.map +1 -0
- package/dist/field/features/link/populationPromise.js +1 -1
- package/dist/field/features/link/populationPromise.js.map +1 -1
- package/dist/field/features/lists/checklist/feature.client.d.ts.map +1 -1
- package/dist/field/features/lists/checklist/feature.client.js +21 -20
- package/dist/field/features/lists/checklist/feature.client.js.map +1 -1
- package/dist/field/features/lists/checklist/feature.server.d.ts.map +1 -1
- package/dist/field/features/lists/checklist/feature.server.js +2 -0
- package/dist/field/features/lists/checklist/feature.server.js.map +1 -1
- package/dist/field/features/lists/checklist/i18n.d.ts +3 -0
- package/dist/field/features/lists/checklist/i18n.d.ts.map +1 -0
- package/dist/field/features/lists/checklist/i18n.js +100 -0
- package/dist/field/features/lists/checklist/i18n.js.map +1 -0
- package/dist/field/features/lists/orderedList/feature.client.d.ts.map +1 -1
- package/dist/field/features/lists/orderedList/feature.client.js +19 -18
- package/dist/field/features/lists/orderedList/feature.client.js.map +1 -1
- package/dist/field/features/lists/orderedList/feature.server.d.ts.map +1 -1
- package/dist/field/features/lists/orderedList/feature.server.js +3 -1
- package/dist/field/features/lists/orderedList/feature.server.js.map +1 -1
- package/dist/field/features/lists/orderedList/i18n.d.ts +3 -0
- package/dist/field/features/lists/orderedList/i18n.d.ts.map +1 -0
- package/dist/field/features/lists/orderedList/i18n.js +100 -0
- package/dist/field/features/lists/orderedList/i18n.js.map +1 -0
- package/dist/field/features/lists/shared/slashMenuListGroup.d.ts +3 -0
- package/dist/field/features/lists/shared/slashMenuListGroup.d.ts.map +1 -0
- package/dist/field/features/lists/shared/slashMenuListGroup.js +11 -0
- package/dist/field/features/lists/shared/slashMenuListGroup.js.map +1 -0
- package/dist/field/features/lists/unorderedList/feature.client.d.ts.map +1 -1
- package/dist/field/features/lists/unorderedList/feature.client.js +19 -18
- package/dist/field/features/lists/unorderedList/feature.client.js.map +1 -1
- package/dist/field/features/lists/unorderedList/feature.server.d.ts.map +1 -1
- package/dist/field/features/lists/unorderedList/feature.server.js +2 -0
- package/dist/field/features/lists/unorderedList/feature.server.js.map +1 -1
- package/dist/field/features/lists/unorderedList/i18n.d.ts +3 -0
- package/dist/field/features/lists/unorderedList/i18n.d.ts.map +1 -0
- package/dist/field/features/lists/unorderedList/i18n.js +100 -0
- package/dist/field/features/lists/unorderedList/i18n.js.map +1 -0
- package/dist/field/features/paragraph/feature.client.d.ts.map +1 -1
- package/dist/field/features/paragraph/feature.client.js +24 -23
- package/dist/field/features/paragraph/feature.client.js.map +1 -1
- package/dist/field/features/paragraph/feature.server.d.ts.map +1 -1
- package/dist/field/features/paragraph/feature.server.js +2 -0
- package/dist/field/features/paragraph/feature.server.js.map +1 -1
- package/dist/field/features/paragraph/i18n.d.ts +3 -0
- package/dist/field/features/paragraph/i18n.d.ts.map +1 -0
- package/dist/field/features/paragraph/i18n.js +132 -0
- package/dist/field/features/paragraph/i18n.js.map +1 -0
- package/dist/field/features/relationship/feature.client.d.ts.map +1 -1
- package/dist/field/features/relationship/feature.client.js +23 -22
- package/dist/field/features/relationship/feature.client.js.map +1 -1
- package/dist/field/features/relationship/feature.server.d.ts.map +1 -1
- package/dist/field/features/relationship/feature.server.js +2 -0
- package/dist/field/features/relationship/feature.server.js.map +1 -1
- package/dist/field/features/relationship/i18n.d.ts +3 -0
- package/dist/field/features/relationship/i18n.d.ts.map +1 -0
- package/dist/field/features/relationship/i18n.js +100 -0
- package/dist/field/features/relationship/i18n.js.map +1 -0
- package/dist/field/features/shared/slashMenu/basicGroup.d.ts +3 -0
- package/dist/field/features/shared/slashMenu/basicGroup.d.ts.map +1 -0
- package/dist/field/features/shared/slashMenu/basicGroup.js +11 -0
- package/dist/field/features/shared/slashMenu/basicGroup.js.map +1 -0
- package/dist/field/features/toolbars/types.d.ts +1 -1
- package/dist/field/features/toolbars/types.d.ts.map +1 -1
- package/dist/field/features/toolbars/types.js.map +1 -1
- package/dist/field/features/types.d.ts +21 -2
- package/dist/field/features/types.d.ts.map +1 -1
- package/dist/field/features/types.js.map +1 -1
- package/dist/field/features/upload/feature.client.d.ts.map +1 -1
- package/dist/field/features/upload/feature.client.js +26 -25
- package/dist/field/features/upload/feature.client.js.map +1 -1
- package/dist/field/features/upload/feature.server.d.ts.map +1 -1
- package/dist/field/features/upload/feature.server.js +2 -0
- package/dist/field/features/upload/feature.server.js.map +1 -1
- package/dist/field/features/upload/i18n.d.ts +3 -0
- package/dist/field/features/upload/i18n.d.ts.map +1 -0
- package/dist/field/features/upload/i18n.js +100 -0
- package/dist/field/features/upload/i18n.js.map +1 -0
- package/dist/field/features/upload/populationPromise.js +1 -1
- package/dist/field/features/upload/populationPromise.js.map +1 -1
- package/dist/field/lexical/LexicalEditor.d.ts.map +1 -1
- package/dist/field/lexical/LexicalEditor.js +3 -1
- package/dist/field/lexical/LexicalEditor.js.map +1 -1
- package/dist/field/lexical/config/server/sanitize.d.ts.map +1 -1
- package/dist/field/lexical/config/server/sanitize.js +11 -0
- package/dist/field/lexical/config/server/sanitize.js.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts +2 -2
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
- package/dist/field/lexical/utils/url.d.ts.map +1 -1
- package/dist/field/lexical/utils/url.js +10 -2
- package/dist/field/lexical/utils/url.js.map +1 -1
- package/dist/i18n.d.ts +3 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +164 -0
- package/dist/i18n.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/package.json +12 -11
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Transformer } from '@lexical/markdown';
|
|
2
|
-
import type { I18nClient } from '@payloadcms/translations';
|
|
2
|
+
import type { GenericLanguages, I18nClient } from '@payloadcms/translations';
|
|
3
3
|
import type { JSONSchema4 } from 'json-schema';
|
|
4
4
|
import type { Klass, LexicalEditor, LexicalNode, SerializedEditorState } from 'lexical';
|
|
5
5
|
import type { SerializedLexicalNode } from 'lexical';
|
|
@@ -241,6 +241,25 @@ export type ServerFeature<ServerProps, ClientFeatureProps> = {
|
|
|
241
241
|
isRequired: boolean;
|
|
242
242
|
}) => JSONSchema4;
|
|
243
243
|
};
|
|
244
|
+
/**
|
|
245
|
+
* Here you can provide i18n translations for your feature. These will only be available on the server and client.
|
|
246
|
+
*
|
|
247
|
+
* Translations here are automatically scoped to `lexical.featureKey.yourKey`
|
|
248
|
+
*
|
|
249
|
+
* @Example
|
|
250
|
+
* ```ts
|
|
251
|
+
* i18n: {
|
|
252
|
+
* en: {
|
|
253
|
+
* label: 'Horizontal Rule',
|
|
254
|
+
* },
|
|
255
|
+
* de: {
|
|
256
|
+
* label: 'Trennlinie',
|
|
257
|
+
* },
|
|
258
|
+
* }
|
|
259
|
+
* ```
|
|
260
|
+
* In order to access these translations, you would use `i18n.t('lexical:horizontalRule:label')`.
|
|
261
|
+
*/
|
|
262
|
+
i18n?: Partial<GenericLanguages>;
|
|
244
263
|
markdownTransformers?: Transformer[];
|
|
245
264
|
nodes?: Array<NodeWithHooks>;
|
|
246
265
|
/** Props which were passed into your feature will have to be passed here. This will allow them to be used / read in other places of the code, e.g. wherever you can use useEditorConfigContext */
|
|
@@ -292,7 +311,7 @@ export type SanitizedPlugin = {
|
|
|
292
311
|
key: string;
|
|
293
312
|
position: 'belowContainer';
|
|
294
313
|
};
|
|
295
|
-
export type SanitizedServerFeatures = Required<Pick<ResolvedServerFeature<unknown, unknown>, 'markdownTransformers' | 'nodes'>> & {
|
|
314
|
+
export type SanitizedServerFeatures = Required<Pick<ResolvedServerFeature<unknown, unknown>, 'i18n' | 'markdownTransformers' | 'nodes'>> & {
|
|
296
315
|
/** The node types mapped to their converters */
|
|
297
316
|
converters: {
|
|
298
317
|
html: HTMLConverter[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/field/features/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,KAAK,EAAQ,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACvF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EACV,KAAK,EACL,sBAAsB,EACtB,UAAU,EACV,aAAa,EACb,eAAe,EAChB,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACxF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kEAAkE,CAAA;AACtG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAA;AACzE,OAAO,KAAK,E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../../src/field/features/types.ts"],"sourcesContent":["import type { Transformer } from '@lexical/markdown'\nimport type { I18n, I18nClient } from '@payloadcms/translations'\nimport type { JSONSchema4 } from 'json-schema'\nimport type { Klass, LexicalEditor, LexicalNode, SerializedEditorState } from 'lexical'\nimport type { SerializedLexicalNode } from 'lexical'\nimport type { LexicalNodeReplacement } from 'lexical'\nimport type { RequestContext } from 'payload'\nimport type { SanitizedConfig } from 'payload/config'\nimport type {\n Field,\n PayloadRequestWithData,\n ReplaceAny,\n RichTextField,\n ValidateOptions,\n} from 'payload/types'\nimport type React from 'react'\n\nimport type { AdapterProps } from '../../types.js'\nimport type { ClientEditorConfig, ServerEditorConfig } from '../lexical/config/types.js'\nimport type { SlashMenuGroup } from '../lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js'\nimport type { HTMLConverter } from './converters/html/converter/types.js'\nimport type { ToolbarGroup } from './toolbars/types.js'\n\nexport type PopulationPromise<T extends SerializedLexicalNode = SerializedLexicalNode> = ({\n context,\n currentDepth,\n depth,\n editorPopulationPromises,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n node,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n}: {\n context: RequestContext\n currentDepth: number\n depth: number\n draft: boolean\n /**\n * This maps all population promises to the node type\n */\n editorPopulationPromises: Map<string, Array<PopulationPromise>>\n field: RichTextField<SerializedEditorState, AdapterProps>\n /**\n * fieldPromises are used for things like field hooks. They will be awaited before awaiting populationPromises\n */\n fieldPromises: Promise<void>[]\n findMany: boolean\n flattenLocales: boolean\n node: T\n overrideAccess: boolean\n populationPromises: Promise<void>[]\n req: PayloadRequestWithData\n showHiddenFields: boolean\n siblingDoc: Record<string, unknown>\n}) => void\n\nexport type NodeValidation<T extends SerializedLexicalNode = SerializedLexicalNode> = ({\n node,\n nodeValidations,\n validation,\n}: {\n node: T\n nodeValidations: Map<string, Array<NodeValidation>>\n validation: {\n options: ValidateOptions<unknown, unknown, RichTextField>\n value: SerializedEditorState\n }\n}) => Promise<string | true> | string | true\n\nexport type FeatureProviderProviderServer<ServerFeatureProps, ClientFeatureProps> = (\n props?: ServerFeatureProps,\n) => FeatureProviderServer<ServerFeatureProps, ClientFeatureProps>\n\nexport type FeatureProviderServer<ServerFeatureProps, ClientFeatureProps> = {\n /** Keys of dependencies needed for this feature. These dependencies do not have to be loaded first */\n dependencies?: string[]\n /** Keys of priority dependencies needed for this feature. These dependencies have to be loaded first and are available in the `feature` property*/\n dependenciesPriority?: string[]\n /** Keys of soft-dependencies needed for this feature. The FeatureProviders dependencies are optional, but are considered as last-priority in the loading process */\n dependenciesSoft?: string[]\n\n /**\n * This is being called during the payload sanitization process\n */\n feature: (props: {\n config: SanitizedConfig\n /** unSanitizedEditorConfig.features, but mapped */\n featureProviderMap: ServerFeatureProviderMap\n isRoot?: boolean\n // other resolved features, which have been loaded before this one. All features declared in 'dependencies' should be available here\n resolvedFeatures: ResolvedServerFeatureMap\n // unSanitized EditorConfig,\n unSanitizedEditorConfig: ServerEditorConfig\n }) =>\n | Promise<ServerFeature<ServerFeatureProps, ClientFeatureProps>>\n | ServerFeature<ServerFeatureProps, ClientFeatureProps>\n key: string\n /** Props which were passed into your feature will have to be passed here. This will allow them to be used / read in other places of the code, e.g. wherever you can use useEditorConfigContext */\n serverFeatureProps: ServerFeatureProps\n}\n\nexport type FeatureProviderProviderClient<ClientFeatureProps> = (\n props: ClientComponentProps<ClientFeatureProps>,\n) => FeatureProviderClient<ClientFeatureProps>\n\n/**\n * No dependencies => Features need to be sorted on the server first, then sent to client in right order\n */\nexport type FeatureProviderClient<ClientFeatureProps> = {\n /**\n * Return props, to make it easy to retrieve passed in props to this Feature for the client if anyone wants to\n */\n clientFeatureProps: ClientComponentProps<ClientFeatureProps>\n feature: (props: {\n clientFunctions: Record<string, any>\n /** unSanitizedEditorConfig.features, but mapped */\n featureProviderMap: ClientFeatureProviderMap\n // other resolved features, which have been loaded before this one. All features declared in 'dependencies' should be available here\n resolvedFeatures: ResolvedClientFeatureMap\n // unSanitized EditorConfig,\n unSanitizedEditorConfig: ClientEditorConfig\n }) => ClientFeature<ClientFeatureProps>\n}\n\nexport type PluginComponent<ClientFeatureProps = any> = React.FC<{\n clientProps: ClientFeatureProps\n}>\nexport type PluginComponentWithAnchor<ClientFeatureProps = any> = React.FC<{\n anchorElem: HTMLElement\n clientProps: ClientFeatureProps\n}>\n\nexport type ClientFeature<ClientFeatureProps> = {\n /**\n * Return props, to make it easy to retrieve passed in props to this Feature for the client if anyone wants to\n */\n clientFeatureProps: ClientComponentProps<ClientFeatureProps>\n hooks?: {\n load?: ({\n incomingEditorState,\n }: {\n incomingEditorState: SerializedEditorState\n }) => SerializedEditorState\n save?: ({\n incomingEditorState,\n }: {\n incomingEditorState: SerializedEditorState\n }) => SerializedEditorState\n }\n markdownTransformers?: Transformer[]\n nodes?: Array<Klass<LexicalNode> | LexicalNodeReplacement>\n /**\n * Plugins are react components which get added to the editor. You can use them to interact with lexical, e.g. to create a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n */\n plugins?: Array<\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: PluginComponent<ClientFeatureProps>\n position: 'aboveContainer' // Determines at which position the Component will be added.\n }\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: PluginComponent<ClientFeatureProps>\n position: 'bottom' // Determines at which position the Component will be added.\n }\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: PluginComponent<ClientFeatureProps>\n position: 'normal' // Determines at which position the Component will be added.\n }\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: PluginComponent<ClientFeatureProps>\n position: 'top' // Determines at which position the Component will be added.\n }\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: PluginComponentWithAnchor<ClientFeatureProps>\n position: 'floatingAnchorElem' // Determines at which position the Component will be added.\n }\n | {\n Component: PluginComponent<ClientFeatureProps>\n position: 'belowContainer' // Determines at which position the Component will be added.\n }\n >\n slashMenu?: {\n /**\n * Dynamic groups allow you to add different groups depending on the query string (so, the text after the slash).\n * Thus, to re-calculate the available groups, this function will be called every time you type after the /.\n *\n * The groups provided by dynamicGroups will be merged with the static groups provided by the groups property.\n */\n dynamicGroups?: ({\n editor,\n queryString,\n }: {\n editor: LexicalEditor\n queryString: string\n }) => SlashMenuGroup[]\n /**\n * Static array of groups together with the items in them. These will always be present.\n * While typing after the /, they will be filtered by the query string and the keywords, key and display name of the items.\n */\n groups?: SlashMenuGroup[]\n }\n /**\n * An opt-in, classic fixed toolbar which stays at the top of the editor\n */\n toolbarFixed?: {\n groups: ToolbarGroup[]\n }\n /**\n * The default, floating toolbar which appears when you select text.\n */\n toolbarInline?: {\n /**\n * Array of toolbar groups / sections. Each section can contain multiple toolbar items.\n */\n groups: ToolbarGroup[]\n }\n}\n\nexport type ClientComponentProps<ClientFeatureProps> = ClientFeatureProps extends undefined\n ? {\n featureKey: string\n order: number\n }\n : {\n featureKey: string\n order: number\n } & ClientFeatureProps\n\nexport type FieldNodeHookArgs<T extends SerializedLexicalNode> = {\n context: RequestContext\n /** Boolean to denote if this hook is running against finding one, or finding many within the afterRead hook. */\n findMany?: boolean\n /** The value of the field. */\n node?: T\n /** A string relating to which operation the field type is currently executing within. Useful within beforeValidate, beforeChange, and afterChange hooks to differentiate between create and update operations. */\n operation?: 'create' | 'delete' | 'read' | 'update'\n overrideAccess?: boolean\n /** The Express request object. It is mocked for Local API operations. */\n req: PayloadRequestWithData\n}\n\nexport type FieldNodeHook<T extends SerializedLexicalNode> = (\n args: FieldNodeHookArgs<T>,\n) => Promise<T> | T\n\n// Define the node with hooks that use the node's exportJSON return type\nexport type NodeWithHooks<T extends LexicalNode = any> = {\n converters?: {\n html?: HTMLConverter<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>\n }\n hooks?: {\n afterChange?: Array<FieldNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n afterRead?: Array<FieldNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n beforeChange?: Array<FieldNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n /**\n * Runs before a document is duplicated to prevent errors in unique fields or return null to use defaultValue.\n */\n beforeDuplicate?: Array<FieldNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n beforeValidate?: Array<FieldNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n }\n node: Klass<T> | LexicalNodeReplacement\n populationPromises?: Array<\n PopulationPromise<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>\n >\n validations?: Array<NodeValidation<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n}\n\nexport type ServerFeature<ServerProps, ClientFeatureProps> = {\n ClientComponent?: React.FC<ClientComponentProps<ClientFeatureProps>>\n /**\n * This determines what props will be available on the Client.\n */\n clientFeatureProps?: ClientFeatureProps\n generateComponentMap?: (args: {\n config: SanitizedConfig\n i18n: I18nClient\n props: ServerProps\n schemaPath: string\n }) => {\n [key: string]: React.FC<{ componentKey: string; featureKey: string }>\n }\n generateSchemaMap?: (args: {\n config: SanitizedConfig\n i18n: I18nClient\n props: ServerProps\n schemaMap: Map<string, Field[]>\n schemaPath: string\n }) => Map<string, Field[]> | null\n generatedTypes?: {\n modifyOutputSchema: ({\n collectionIDFieldTypes,\n config,\n currentSchema,\n field,\n interfaceNameDefinitions,\n isRequired,\n }: {\n collectionIDFieldTypes: { [key: string]: 'number' | 'string' }\n config?: SanitizedConfig\n /**\n * Current schema which will be modified by this function.\n */\n currentSchema: JSONSchema4\n field: RichTextField<SerializedEditorState, AdapterProps>\n /**\n * Allows you to define new top-level interfaces that can be re-used in the output schema.\n */\n interfaceNameDefinitions: Map<string, JSONSchema4>\n isRequired: boolean\n }) => JSONSchema4\n }\n markdownTransformers?: Transformer[]\n nodes?: Array<NodeWithHooks>\n\n /** Props which were passed into your feature will have to be passed here. This will allow them to be used / read in other places of the code, e.g. wherever you can use useEditorConfigContext */\n serverFeatureProps: ServerProps\n}\n\nexport type ResolvedServerFeature<ServerProps, ClientFeatureProps> = ServerFeature<\n ServerProps,\n ClientFeatureProps\n> &\n Required<\n Pick<\n FeatureProviderServer<ServerProps, ClientFeatureProps>,\n 'dependencies' | 'dependenciesPriority' | 'dependenciesSoft' | 'key'\n >\n > & {\n order: number\n }\n\nexport type ResolvedClientFeature<ClientFeatureProps> = ClientFeature<ClientFeatureProps> & {\n key: string\n order: number\n}\n\nexport type ResolvedServerFeatureMap = Map<string, ResolvedServerFeature<unknown, unknown>>\nexport type ResolvedClientFeatureMap = Map<string, ResolvedClientFeature<unknown>>\n\nexport type ServerFeatureProviderMap = Map<string, FeatureProviderServer<unknown, unknown>>\nexport type ClientFeatureProviderMap = Map<string, FeatureProviderClient<unknown>>\n\n/**\n * Plugins are react components which get added to the editor. You can use them to interact with lexical, e.g. to create a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n */\nexport type SanitizedPlugin =\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: PluginComponent\n clientProps: any\n key: string\n position: 'bottom' // Determines at which position the Component will be added.\n }\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: PluginComponent\n clientProps: any\n key: string\n position: 'normal' // Determines at which position the Component will be added.\n }\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: PluginComponent\n clientProps: any\n key: string\n position: 'top' // Determines at which position the Component will be added.\n }\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: PluginComponentWithAnchor\n clientProps: any\n desktopOnly?: boolean\n key: string\n position: 'floatingAnchorElem' // Determines at which position the Component will be added.\n }\n | {\n Component: PluginComponent\n clientProps: any\n key: string\n position: 'aboveContainer'\n }\n | {\n Component: PluginComponent\n clientProps: any\n key: string\n position: 'belowContainer'\n }\nexport type SanitizedServerFeatures = Required<\n Pick<ResolvedServerFeature<unknown, unknown>, 'markdownTransformers' | 'nodes'>\n> & {\n /** The node types mapped to their converters */\n converters: {\n html: HTMLConverter[]\n }\n /** The keys of all enabled features */\n enabledFeatures: string[]\n generatedTypes: {\n modifyOutputSchemas: Array<\n ({\n collectionIDFieldTypes,\n config,\n currentSchema,\n field,\n interfaceNameDefinitions,\n isRequired,\n }: {\n collectionIDFieldTypes: { [key: string]: 'number' | 'string' }\n config?: SanitizedConfig\n /**\n * Current schema which will be modified by this function.\n */\n currentSchema: JSONSchema4\n field: RichTextField<SerializedEditorState, AdapterProps>\n /**\n * Allows you to define new top-level interfaces that can be re-used in the output schema.\n */\n interfaceNameDefinitions: Map<string, JSONSchema4>\n isRequired: boolean\n }) => JSONSchema4\n >\n }\n /** The node types mapped to their hooks */\n\n hooks?: {\n afterChange?: Map<string, Array<FieldNodeHook<SerializedLexicalNode>>>\n afterRead?: Map<string, Array<FieldNodeHook<SerializedLexicalNode>>>\n beforeChange?: Map<string, Array<FieldNodeHook<SerializedLexicalNode>>>\n /**\n * Runs before a document is duplicated to prevent errors in unique fields or return null to use defaultValue.\n */\n beforeDuplicate?: Map<string, Array<FieldNodeHook<SerializedLexicalNode>>>\n beforeValidate?: Map<string, Array<FieldNodeHook<SerializedLexicalNode>>>\n } /** The node types mapped to their populationPromises */\n populationPromises: Map<string, Array<PopulationPromise>>\n /** The node types mapped to their validations */\n validations: Map<string, Array<NodeValidation>>\n}\n\nexport type SanitizedClientFeatures = Required<\n Pick<\n ResolvedClientFeature<unknown>,\n 'markdownTransformers' | 'nodes' | 'toolbarFixed' | 'toolbarInline'\n >\n> & {\n /** The keys of all enabled features */\n enabledFeatures: string[]\n hooks: {\n load: Array<\n ({\n incomingEditorState,\n }: {\n incomingEditorState: SerializedEditorState\n }) => SerializedEditorState\n >\n save: Array<\n ({\n incomingEditorState,\n }: {\n incomingEditorState: SerializedEditorState\n }) => SerializedEditorState\n >\n }\n /**\n * Plugins are react components which get added to the editor. You can use them to interact with lexical, e.g. to create a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n */\n plugins?: Array<SanitizedPlugin>\n slashMenu: {\n /**\n * Dynamic groups allow you to add different groups depending on the query string (so, the text after the slash).\n * Thus, to re-calculate the available groups, this function will be called every time you type after the /.\n *\n * The groups provided by dynamicGroups will be merged with the static groups provided by the groups property.\n */\n dynamicGroups: Array<\n ({ editor, queryString }: { editor: LexicalEditor; queryString: string }) => SlashMenuGroup[]\n >\n /**\n * Static array of groups together with the items in them. These will always be present.\n * While typing after the /, they will be filtered by the query string and the keywords, key and display name of the items.\n */\n groups: SlashMenuGroup[]\n }\n}\n"],"names":[],"rangeMappings":"","mappings":"AAgcA,WA4CC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/field/features/types.ts"],"sourcesContent":["import type { Transformer } from '@lexical/markdown'\nimport type { GenericLanguages, I18n, I18nClient } from '@payloadcms/translations'\nimport type { JSONSchema4 } from 'json-schema'\nimport type { Klass, LexicalEditor, LexicalNode, SerializedEditorState } from 'lexical'\nimport type { SerializedLexicalNode } from 'lexical'\nimport type { LexicalNodeReplacement } from 'lexical'\nimport type { RequestContext } from 'payload'\nimport type { SanitizedConfig } from 'payload/config'\nimport type {\n Field,\n PayloadRequestWithData,\n ReplaceAny,\n RichTextField,\n ValidateOptions,\n} from 'payload/types'\nimport type React from 'react'\n\nimport type { AdapterProps } from '../../types.js'\nimport type { ClientEditorConfig, ServerEditorConfig } from '../lexical/config/types.js'\nimport type { SlashMenuGroup } from '../lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js'\nimport type { HTMLConverter } from './converters/html/converter/types.js'\nimport type { ToolbarGroup } from './toolbars/types.js'\n\nexport type PopulationPromise<T extends SerializedLexicalNode = SerializedLexicalNode> = ({\n context,\n currentDepth,\n depth,\n editorPopulationPromises,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n node,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n}: {\n context: RequestContext\n currentDepth: number\n depth: number\n draft: boolean\n /**\n * This maps all population promises to the node type\n */\n editorPopulationPromises: Map<string, Array<PopulationPromise>>\n field: RichTextField<SerializedEditorState, AdapterProps>\n /**\n * fieldPromises are used for things like field hooks. They will be awaited before awaiting populationPromises\n */\n fieldPromises: Promise<void>[]\n findMany: boolean\n flattenLocales: boolean\n node: T\n overrideAccess: boolean\n populationPromises: Promise<void>[]\n req: PayloadRequestWithData\n showHiddenFields: boolean\n siblingDoc: Record<string, unknown>\n}) => void\n\nexport type NodeValidation<T extends SerializedLexicalNode = SerializedLexicalNode> = ({\n node,\n nodeValidations,\n validation,\n}: {\n node: T\n nodeValidations: Map<string, Array<NodeValidation>>\n validation: {\n options: ValidateOptions<unknown, unknown, RichTextField>\n value: SerializedEditorState\n }\n}) => Promise<string | true> | string | true\n\nexport type FeatureProviderProviderServer<ServerFeatureProps, ClientFeatureProps> = (\n props?: ServerFeatureProps,\n) => FeatureProviderServer<ServerFeatureProps, ClientFeatureProps>\n\nexport type FeatureProviderServer<ServerFeatureProps, ClientFeatureProps> = {\n /** Keys of dependencies needed for this feature. These dependencies do not have to be loaded first */\n dependencies?: string[]\n /** Keys of priority dependencies needed for this feature. These dependencies have to be loaded first and are available in the `feature` property*/\n dependenciesPriority?: string[]\n /** Keys of soft-dependencies needed for this feature. The FeatureProviders dependencies are optional, but are considered as last-priority in the loading process */\n dependenciesSoft?: string[]\n\n /**\n * This is being called during the payload sanitization process\n */\n feature: (props: {\n config: SanitizedConfig\n /** unSanitizedEditorConfig.features, but mapped */\n featureProviderMap: ServerFeatureProviderMap\n isRoot?: boolean\n // other resolved features, which have been loaded before this one. All features declared in 'dependencies' should be available here\n resolvedFeatures: ResolvedServerFeatureMap\n // unSanitized EditorConfig,\n unSanitizedEditorConfig: ServerEditorConfig\n }) =>\n | Promise<ServerFeature<ServerFeatureProps, ClientFeatureProps>>\n | ServerFeature<ServerFeatureProps, ClientFeatureProps>\n key: string\n /** Props which were passed into your feature will have to be passed here. This will allow them to be used / read in other places of the code, e.g. wherever you can use useEditorConfigContext */\n serverFeatureProps: ServerFeatureProps\n}\n\nexport type FeatureProviderProviderClient<ClientFeatureProps> = (\n props: ClientComponentProps<ClientFeatureProps>,\n) => FeatureProviderClient<ClientFeatureProps>\n\n/**\n * No dependencies => Features need to be sorted on the server first, then sent to client in right order\n */\nexport type FeatureProviderClient<ClientFeatureProps> = {\n /**\n * Return props, to make it easy to retrieve passed in props to this Feature for the client if anyone wants to\n */\n clientFeatureProps: ClientComponentProps<ClientFeatureProps>\n feature: (props: {\n clientFunctions: Record<string, any>\n /** unSanitizedEditorConfig.features, but mapped */\n featureProviderMap: ClientFeatureProviderMap\n // other resolved features, which have been loaded before this one. All features declared in 'dependencies' should be available here\n resolvedFeatures: ResolvedClientFeatureMap\n // unSanitized EditorConfig,\n unSanitizedEditorConfig: ClientEditorConfig\n }) => ClientFeature<ClientFeatureProps>\n}\n\nexport type PluginComponent<ClientFeatureProps = any> = React.FC<{\n clientProps: ClientFeatureProps\n}>\nexport type PluginComponentWithAnchor<ClientFeatureProps = any> = React.FC<{\n anchorElem: HTMLElement\n clientProps: ClientFeatureProps\n}>\n\nexport type ClientFeature<ClientFeatureProps> = {\n /**\n * Return props, to make it easy to retrieve passed in props to this Feature for the client if anyone wants to\n */\n clientFeatureProps: ClientComponentProps<ClientFeatureProps>\n hooks?: {\n load?: ({\n incomingEditorState,\n }: {\n incomingEditorState: SerializedEditorState\n }) => SerializedEditorState\n save?: ({\n incomingEditorState,\n }: {\n incomingEditorState: SerializedEditorState\n }) => SerializedEditorState\n }\n markdownTransformers?: Transformer[]\n nodes?: Array<Klass<LexicalNode> | LexicalNodeReplacement>\n /**\n * Plugins are react components which get added to the editor. You can use them to interact with lexical, e.g. to create a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n */\n plugins?: Array<\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: PluginComponent<ClientFeatureProps>\n position: 'aboveContainer' // Determines at which position the Component will be added.\n }\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: PluginComponent<ClientFeatureProps>\n position: 'bottom' // Determines at which position the Component will be added.\n }\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: PluginComponent<ClientFeatureProps>\n position: 'normal' // Determines at which position the Component will be added.\n }\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: PluginComponent<ClientFeatureProps>\n position: 'top' // Determines at which position the Component will be added.\n }\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: PluginComponentWithAnchor<ClientFeatureProps>\n position: 'floatingAnchorElem' // Determines at which position the Component will be added.\n }\n | {\n Component: PluginComponent<ClientFeatureProps>\n position: 'belowContainer' // Determines at which position the Component will be added.\n }\n >\n slashMenu?: {\n /**\n * Dynamic groups allow you to add different groups depending on the query string (so, the text after the slash).\n * Thus, to re-calculate the available groups, this function will be called every time you type after the /.\n *\n * The groups provided by dynamicGroups will be merged with the static groups provided by the groups property.\n */\n dynamicGroups?: ({\n editor,\n queryString,\n }: {\n editor: LexicalEditor\n queryString: string\n }) => SlashMenuGroup[]\n /**\n * Static array of groups together with the items in them. These will always be present.\n * While typing after the /, they will be filtered by the query string and the keywords, key and display name of the items.\n */\n groups?: SlashMenuGroup[]\n }\n /**\n * An opt-in, classic fixed toolbar which stays at the top of the editor\n */\n toolbarFixed?: {\n groups: ToolbarGroup[]\n }\n /**\n * The default, floating toolbar which appears when you select text.\n */\n toolbarInline?: {\n /**\n * Array of toolbar groups / sections. Each section can contain multiple toolbar items.\n */\n groups: ToolbarGroup[]\n }\n}\n\nexport type ClientComponentProps<ClientFeatureProps> = ClientFeatureProps extends undefined\n ? {\n featureKey: string\n order: number\n }\n : {\n featureKey: string\n order: number\n } & ClientFeatureProps\n\nexport type FieldNodeHookArgs<T extends SerializedLexicalNode> = {\n context: RequestContext\n /** Boolean to denote if this hook is running against finding one, or finding many within the afterRead hook. */\n findMany?: boolean\n /** The value of the field. */\n node?: T\n /** A string relating to which operation the field type is currently executing within. Useful within beforeValidate, beforeChange, and afterChange hooks to differentiate between create and update operations. */\n operation?: 'create' | 'delete' | 'read' | 'update'\n overrideAccess?: boolean\n /** The Express request object. It is mocked for Local API operations. */\n req: PayloadRequestWithData\n}\n\nexport type FieldNodeHook<T extends SerializedLexicalNode> = (\n args: FieldNodeHookArgs<T>,\n) => Promise<T> | T\n\n// Define the node with hooks that use the node's exportJSON return type\nexport type NodeWithHooks<T extends LexicalNode = any> = {\n converters?: {\n html?: HTMLConverter<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>\n }\n hooks?: {\n afterChange?: Array<FieldNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n afterRead?: Array<FieldNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n beforeChange?: Array<FieldNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n /**\n * Runs before a document is duplicated to prevent errors in unique fields or return null to use defaultValue.\n */\n beforeDuplicate?: Array<FieldNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n beforeValidate?: Array<FieldNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n }\n node: Klass<T> | LexicalNodeReplacement\n populationPromises?: Array<\n PopulationPromise<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>\n >\n validations?: Array<NodeValidation<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n}\n\nexport type ServerFeature<ServerProps, ClientFeatureProps> = {\n ClientComponent?: React.FC<ClientComponentProps<ClientFeatureProps>>\n /**\n * This determines what props will be available on the Client.\n */\n clientFeatureProps?: ClientFeatureProps\n generateComponentMap?: (args: {\n config: SanitizedConfig\n i18n: I18nClient\n props: ServerProps\n schemaPath: string\n }) => {\n [key: string]: React.FC<{ componentKey: string; featureKey: string }>\n }\n generateSchemaMap?: (args: {\n config: SanitizedConfig\n i18n: I18nClient\n props: ServerProps\n schemaMap: Map<string, Field[]>\n schemaPath: string\n }) => Map<string, Field[]> | null\n generatedTypes?: {\n modifyOutputSchema: ({\n collectionIDFieldTypes,\n config,\n currentSchema,\n field,\n interfaceNameDefinitions,\n isRequired,\n }: {\n collectionIDFieldTypes: { [key: string]: 'number' | 'string' }\n config?: SanitizedConfig\n /**\n * Current schema which will be modified by this function.\n */\n currentSchema: JSONSchema4\n field: RichTextField<SerializedEditorState, AdapterProps>\n /**\n * Allows you to define new top-level interfaces that can be re-used in the output schema.\n */\n interfaceNameDefinitions: Map<string, JSONSchema4>\n isRequired: boolean\n }) => JSONSchema4\n }\n /**\n * Here you can provide i18n translations for your feature. These will only be available on the server and client.\n *\n * Translations here are automatically scoped to `lexical.featureKey.yourKey`\n *\n * @Example\n * ```ts\n * i18n: {\n * en: {\n * label: 'Horizontal Rule',\n * },\n * de: {\n * label: 'Trennlinie',\n * },\n * }\n * ```\n * In order to access these translations, you would use `i18n.t('lexical:horizontalRule:label')`.\n */\n i18n?: Partial<GenericLanguages>\n markdownTransformers?: Transformer[]\n nodes?: Array<NodeWithHooks>\n\n /** Props which were passed into your feature will have to be passed here. This will allow them to be used / read in other places of the code, e.g. wherever you can use useEditorConfigContext */\n serverFeatureProps: ServerProps\n}\n\nexport type ResolvedServerFeature<ServerProps, ClientFeatureProps> = ServerFeature<\n ServerProps,\n ClientFeatureProps\n> &\n Required<\n Pick<\n FeatureProviderServer<ServerProps, ClientFeatureProps>,\n 'dependencies' | 'dependenciesPriority' | 'dependenciesSoft' | 'key'\n >\n > & {\n order: number\n }\n\nexport type ResolvedClientFeature<ClientFeatureProps> = ClientFeature<ClientFeatureProps> & {\n key: string\n order: number\n}\n\nexport type ResolvedServerFeatureMap = Map<string, ResolvedServerFeature<unknown, unknown>>\nexport type ResolvedClientFeatureMap = Map<string, ResolvedClientFeature<unknown>>\n\nexport type ServerFeatureProviderMap = Map<string, FeatureProviderServer<unknown, unknown>>\nexport type ClientFeatureProviderMap = Map<string, FeatureProviderClient<unknown>>\n\n/**\n * Plugins are react components which get added to the editor. You can use them to interact with lexical, e.g. to create a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n */\nexport type SanitizedPlugin =\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: PluginComponent\n clientProps: any\n key: string\n position: 'bottom' // Determines at which position the Component will be added.\n }\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: PluginComponent\n clientProps: any\n key: string\n position: 'normal' // Determines at which position the Component will be added.\n }\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: PluginComponent\n clientProps: any\n key: string\n position: 'top' // Determines at which position the Component will be added.\n }\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: PluginComponentWithAnchor\n clientProps: any\n desktopOnly?: boolean\n key: string\n position: 'floatingAnchorElem' // Determines at which position the Component will be added.\n }\n | {\n Component: PluginComponent\n clientProps: any\n key: string\n position: 'aboveContainer'\n }\n | {\n Component: PluginComponent\n clientProps: any\n key: string\n position: 'belowContainer'\n }\n\nexport type SanitizedServerFeatures = Required<\n Pick<ResolvedServerFeature<unknown, unknown>, 'i18n' | 'markdownTransformers' | 'nodes'>\n> & {\n /** The node types mapped to their converters */\n converters: {\n html: HTMLConverter[]\n }\n /** The keys of all enabled features */\n enabledFeatures: string[]\n generatedTypes: {\n modifyOutputSchemas: Array<\n ({\n collectionIDFieldTypes,\n config,\n currentSchema,\n field,\n interfaceNameDefinitions,\n isRequired,\n }: {\n collectionIDFieldTypes: { [key: string]: 'number' | 'string' }\n config?: SanitizedConfig\n /**\n * Current schema which will be modified by this function.\n */\n currentSchema: JSONSchema4\n field: RichTextField<SerializedEditorState, AdapterProps>\n /**\n * Allows you to define new top-level interfaces that can be re-used in the output schema.\n */\n interfaceNameDefinitions: Map<string, JSONSchema4>\n isRequired: boolean\n }) => JSONSchema4\n >\n }\n /** The node types mapped to their hooks */\n\n hooks?: {\n afterChange?: Map<string, Array<FieldNodeHook<SerializedLexicalNode>>>\n afterRead?: Map<string, Array<FieldNodeHook<SerializedLexicalNode>>>\n beforeChange?: Map<string, Array<FieldNodeHook<SerializedLexicalNode>>>\n /**\n * Runs before a document is duplicated to prevent errors in unique fields or return null to use defaultValue.\n */\n beforeDuplicate?: Map<string, Array<FieldNodeHook<SerializedLexicalNode>>>\n beforeValidate?: Map<string, Array<FieldNodeHook<SerializedLexicalNode>>>\n } /** The node types mapped to their populationPromises */\n populationPromises: Map<string, Array<PopulationPromise>>\n /** The node types mapped to their validations */\n validations: Map<string, Array<NodeValidation>>\n}\n\nexport type SanitizedClientFeatures = Required<\n Pick<\n ResolvedClientFeature<unknown>,\n 'markdownTransformers' | 'nodes' | 'toolbarFixed' | 'toolbarInline'\n >\n> & {\n /** The keys of all enabled features */\n enabledFeatures: string[]\n hooks: {\n load: Array<\n ({\n incomingEditorState,\n }: {\n incomingEditorState: SerializedEditorState\n }) => SerializedEditorState\n >\n save: Array<\n ({\n incomingEditorState,\n }: {\n incomingEditorState: SerializedEditorState\n }) => SerializedEditorState\n >\n }\n /**\n * Plugins are react components which get added to the editor. You can use them to interact with lexical, e.g. to create a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n */\n plugins?: Array<SanitizedPlugin>\n slashMenu: {\n /**\n * Dynamic groups allow you to add different groups depending on the query string (so, the text after the slash).\n * Thus, to re-calculate the available groups, this function will be called every time you type after the /.\n *\n * The groups provided by dynamicGroups will be merged with the static groups provided by the groups property.\n */\n dynamicGroups: Array<\n ({ editor, queryString }: { editor: LexicalEditor; queryString: string }) => SlashMenuGroup[]\n >\n /**\n * Static array of groups together with the items in them. These will always be present.\n * While typing after the /, they will be filtered by the query string and the keywords, key and display name of the items.\n */\n groups: SlashMenuGroup[]\n }\n}\n"],"names":[],"rangeMappings":"","mappings":"AAodA,WA4CC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/upload/feature.client.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/upload/feature.client.tsx"],"names":[],"mappings":";AAcA,MAAM,MAAM,wBAAwB,GAAG;IACrC,WAAW,EAAE;QACX,CAAC,UAAU,EAAE,MAAM,GAAG;YACpB,cAAc,EAAE,OAAO,CAAA;SACxB,CAAA;KACF,CAAA;CACF,CAAA;AA+DD,eAAO,MAAM,4BAA4B;;;6BAA6C,CAAA"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { $isNodeSelection } from 'lexical';
|
|
3
3
|
import { UploadIcon } from '../../lexical/ui/icons/Upload/index.js';
|
|
4
4
|
import { createClientComponent } from '../createClientComponent.js';
|
|
5
|
+
import { slashMenuBasicGroupWithItems } from '../shared/slashMenu/basicGroup.js';
|
|
5
6
|
import { toolbarAddDropdownGroupWithItems } from '../shared/toolbar/addDropdownGroup.js';
|
|
6
7
|
import { INSERT_UPLOAD_WITH_DRAWER_COMMAND } from './drawer/commands.js';
|
|
7
8
|
import { $isUploadNode, UploadNode } from './nodes/UploadNode.js';
|
|
@@ -22,31 +23,29 @@ const UploadFeatureClient = (props)=>{
|
|
|
22
23
|
],
|
|
23
24
|
slashMenu: {
|
|
24
25
|
groups: [
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
26
|
+
slashMenuBasicGroupWithItems([
|
|
27
|
+
{
|
|
28
|
+
Icon: UploadIcon,
|
|
29
|
+
key: 'upload',
|
|
30
|
+
keywords: [
|
|
31
|
+
'upload',
|
|
32
|
+
'image',
|
|
33
|
+
'file',
|
|
34
|
+
'img',
|
|
35
|
+
'picture',
|
|
36
|
+
'photo',
|
|
37
|
+
'media'
|
|
38
|
+
],
|
|
39
|
+
label: ({ i18n })=>{
|
|
40
|
+
return i18n.t('lexical:upload:label');
|
|
41
|
+
},
|
|
42
|
+
onSelect: ({ editor })=>{
|
|
43
|
+
editor.dispatchCommand(INSERT_UPLOAD_WITH_DRAWER_COMMAND, {
|
|
44
|
+
replace: false
|
|
45
|
+
});
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
label: 'Basic'
|
|
49
|
-
}
|
|
47
|
+
}
|
|
48
|
+
])
|
|
50
49
|
]
|
|
51
50
|
},
|
|
52
51
|
toolbarFixed: {
|
|
@@ -62,7 +61,9 @@ const UploadFeatureClient = (props)=>{
|
|
|
62
61
|
return $isUploadNode(firstNode);
|
|
63
62
|
},
|
|
64
63
|
key: 'upload',
|
|
65
|
-
label:
|
|
64
|
+
label: ({ i18n })=>{
|
|
65
|
+
return i18n.t('lexical:upload:label');
|
|
66
|
+
},
|
|
66
67
|
onSelect: ({ editor })=>{
|
|
67
68
|
editor.dispatchCommand(INSERT_UPLOAD_WITH_DRAWER_COMMAND, {
|
|
68
69
|
replace: false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/field/features/upload/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport { $isNodeSelection } from 'lexical'\n\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { UploadIcon } from '../../lexical/ui/icons/Upload/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { toolbarAddDropdownGroupWithItems } from '../shared/toolbar/addDropdownGroup.js'\nimport { INSERT_UPLOAD_WITH_DRAWER_COMMAND } from './drawer/commands.js'\nimport { $isUploadNode, UploadNode } from './nodes/UploadNode.js'\nimport { UploadPlugin } from './plugin/index.js'\n\nexport type UploadFeaturePropsClient = {\n collections: {\n [collection: string]: {\n hasExtraFields: boolean\n }\n }\n}\n\nconst UploadFeatureClient: FeatureProviderProviderClient<UploadFeaturePropsClient> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n nodes: [UploadNode],\n plugins: [\n {\n Component: UploadPlugin,\n position: 'normal',\n },\n ],\n slashMenu: {\n groups: [\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/features/upload/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport { $isNodeSelection } from 'lexical'\n\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { UploadIcon } from '../../lexical/ui/icons/Upload/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { slashMenuBasicGroupWithItems } from '../shared/slashMenu/basicGroup.js'\nimport { toolbarAddDropdownGroupWithItems } from '../shared/toolbar/addDropdownGroup.js'\nimport { INSERT_UPLOAD_WITH_DRAWER_COMMAND } from './drawer/commands.js'\nimport { $isUploadNode, UploadNode } from './nodes/UploadNode.js'\nimport { UploadPlugin } from './plugin/index.js'\n\nexport type UploadFeaturePropsClient = {\n collections: {\n [collection: string]: {\n hasExtraFields: boolean\n }\n }\n}\n\nconst UploadFeatureClient: FeatureProviderProviderClient<UploadFeaturePropsClient> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n nodes: [UploadNode],\n plugins: [\n {\n Component: UploadPlugin,\n position: 'normal',\n },\n ],\n slashMenu: {\n groups: [\n slashMenuBasicGroupWithItems([\n {\n Icon: UploadIcon,\n key: 'upload',\n keywords: ['upload', 'image', 'file', 'img', 'picture', 'photo', 'media'],\n label: ({ i18n }) => {\n return i18n.t('lexical:upload:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_UPLOAD_WITH_DRAWER_COMMAND, {\n replace: false,\n })\n },\n },\n ]),\n ],\n },\n toolbarFixed: {\n groups: [\n toolbarAddDropdownGroupWithItems([\n {\n ChildComponent: UploadIcon,\n isActive: ({ selection }) => {\n if (!$isNodeSelection(selection) || !selection.getNodes().length) {\n return false\n }\n\n const firstNode = selection.getNodes()[0]\n return $isUploadNode(firstNode)\n },\n key: 'upload',\n label: ({ i18n }) => {\n return i18n.t('lexical:upload:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_UPLOAD_WITH_DRAWER_COMMAND, {\n replace: false,\n })\n },\n },\n ]),\n ],\n },\n }),\n }\n}\n\nexport const UploadFeatureClientComponent = createClientComponent(UploadFeatureClient)\n"],"names":["$isNodeSelection","UploadIcon","createClientComponent","slashMenuBasicGroupWithItems","toolbarAddDropdownGroupWithItems","INSERT_UPLOAD_WITH_DRAWER_COMMAND","$isUploadNode","UploadNode","UploadPlugin","UploadFeatureClient","props","clientFeatureProps","feature","nodes","plugins","Component","position","slashMenu","groups","Icon","key","keywords","label","i18n","t","onSelect","editor","dispatchCommand","replace","toolbarFixed","ChildComponent","isActive","selection","getNodes","length","firstNode","UploadFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAEA,SAASA,gBAAgB,QAAQ,UAAS;AAI1C,SAASC,UAAU,QAAQ,yCAAwC;AACnE,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,4BAA4B,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H;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAMQ,+BAA+BlC,sBAAsBO,qBAAoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../src/field/features/upload/feature.server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAA2C,MAAM,eAAe,CAAA;AAKnF,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAChE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../src/field/features/upload/feature.server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAA2C,MAAM,eAAe,CAAA;AAKnF,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAChE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AASnE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,WAAW,CAAC,EAAE;QACZ,CAAC,UAAU,EAAE,MAAM,GAAG;YACpB,MAAM,EAAE,KAAK,EAAE,CAAA;SAChB,CAAA;KACF,CAAA;IACD;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AASD,eAAO,MAAM,aAAa,EAAE,6BAA6B,CACvD,kBAAkB,EAClB,wBAAwB,CAsJzB,CAAA"}
|
|
@@ -2,6 +2,7 @@ import { traverseFields } from '@payloadcms/next/utilities';
|
|
|
2
2
|
import { sanitizeFields } from 'payload/config';
|
|
3
3
|
import { createNode } from '../typeUtilities.js';
|
|
4
4
|
import { UploadFeatureClientComponent } from './feature.client.js';
|
|
5
|
+
import { i18n } from './i18n.js';
|
|
5
6
|
import { UploadNode } from './nodes/UploadNode.js';
|
|
6
7
|
import { uploadPopulationPromiseHOC } from './populationPromise.js';
|
|
7
8
|
import { uploadValidation } from './validate.js';
|
|
@@ -61,6 +62,7 @@ export const UploadFeature = (props)=>{
|
|
|
61
62
|
}
|
|
62
63
|
return schemaMap;
|
|
63
64
|
},
|
|
65
|
+
i18n,
|
|
64
66
|
nodes: [
|
|
65
67
|
createNode({
|
|
66
68
|
converters: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/field/features/upload/feature.server.ts"],"sourcesContent":["import type { Config } from 'payload/config'\nimport type { Field, FileData, FileSize, Payload, TypeWithID } from 'payload/types'\n\nimport { traverseFields } from '@payloadcms/next/utilities'\nimport { sanitizeFields } from 'payload/config'\n\nimport type { FeatureProviderProviderServer } from '../types.js'\nimport type { UploadFeaturePropsClient } from './feature.client.js'\n\nimport { createNode } from '../typeUtilities.js'\nimport { UploadFeatureClientComponent } from './feature.client.js'\nimport { UploadNode } from './nodes/UploadNode.js'\nimport { uploadPopulationPromiseHOC } from './populationPromise.js'\nimport { uploadValidation } from './validate.js'\n\nexport type UploadFeatureProps = {\n collections?: {\n [collection: string]: {\n fields: Field[]\n }\n }\n /**\n * Sets a maximum population depth for this upload (not the fields for this upload), regardless of the remaining depth when the respective field is reached.\n * This behaves exactly like the maxDepth properties of relationship and upload fields.\n *\n * {@link https://payloadcms.com/docs/getting-started/concepts#field-level-max-depth}\n */\n maxDepth?: number\n}\n\n/**\n * Get the absolute URL for an upload URL by potentially prepending the serverURL\n */\nfunction getAbsoluteURL(url: string, payload: Payload): string {\n return url?.startsWith('http') ? url : (payload?.config?.serverURL || '') + url\n}\n\nexport const UploadFeature: FeatureProviderProviderServer<\n UploadFeatureProps,\n UploadFeaturePropsClient\n> = (props) => {\n if (!props) {\n props = { collections: {} }\n }\n\n const clientProps: UploadFeaturePropsClient = {\n collections: {},\n }\n if (props.collections) {\n for (const collection in props.collections) {\n clientProps.collections[collection] = {\n hasExtraFields: props.collections[collection].fields.length >= 1,\n }\n }\n }\n\n return {\n feature: async ({ config: _config, isRoot }) => {\n const validRelationships = _config.collections.map((c) => c.slug) || []\n\n for (const collection in props.collections) {\n if (props.collections[collection].fields?.length) {\n props.collections[collection].fields = await sanitizeFields({\n config: _config as unknown as Config,\n fields: props.collections[collection].fields,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n }\n }\n\n return {\n ClientComponent: UploadFeatureClientComponent,\n clientFeatureProps: clientProps,\n generateSchemaMap: ({ config, i18n, props }) => {\n if (!props?.collections) return null\n\n const schemaMap = new Map<string, Field[]>()\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n for (const collection in props.collections) {\n if (props.collections[collection].fields?.length) {\n schemaMap.set(collection, props.collections[collection].fields)\n traverseFields({\n config,\n fields: props.collections[collection].fields,\n i18n,\n schemaMap,\n schemaPath: collection,\n validRelationships,\n })\n }\n }\n\n return schemaMap\n },\n nodes: [\n createNode({\n converters: {\n html: {\n converter: async ({ node, payload }) => {\n // @ts-expect-error\n const id = node?.value?.id || node?.value // for backwards-compatibility\n\n if (payload) {\n let uploadDocument: TypeWithID & FileData\n\n try {\n uploadDocument = (await payload.findByID({\n id,\n collection: node.relationTo,\n })) as TypeWithID & FileData\n } catch (ignored) {\n // eslint-disable-next-line no-console\n console.error(\n 'Lexical upload node HTML converter: error fetching upload file',\n ignored,\n 'Node:',\n node,\n )\n return `<img />`\n }\n\n const url = getAbsoluteURL(uploadDocument?.url, payload)\n\n /**\n * If the upload is not an image, return a link to the upload\n */\n if (!uploadDocument?.mimeType?.startsWith('image')) {\n return `<a href=\"${url}\" rel=\"noopener noreferrer\">${uploadDocument.filename}</a>`\n }\n\n /**\n * If the upload is a simple image with no different sizes, return a simple img tag\n */\n if (!uploadDocument?.sizes || !Object.keys(uploadDocument?.sizes).length) {\n return `<img src=\"${url}\" alt=\"${uploadDocument?.filename}\" width=\"${uploadDocument?.width}\" height=\"${uploadDocument?.height}\"/>`\n }\n\n /**\n * If the upload is an image with different sizes, return a picture element\n */\n let pictureHTML = '<picture>'\n\n // Iterate through each size in the data.sizes object\n for (const size in uploadDocument.sizes) {\n const imageSize: FileSize & {\n url?: string\n } = uploadDocument.sizes[size]\n\n // Skip if any property of the size object is null\n if (\n !imageSize.width ||\n !imageSize.height ||\n !imageSize.mimeType ||\n !imageSize.filesize ||\n !imageSize.filename ||\n !imageSize.url\n ) {\n continue\n }\n const imageSizeURL = getAbsoluteURL(imageSize?.url, payload)\n\n pictureHTML += `<source srcset=\"${imageSizeURL}\" media=\"(max-width: ${imageSize.width}px)\" type=\"${imageSize.mimeType}\">`\n }\n\n // Add the default img tag\n pictureHTML += `<img src=\"${url}\" alt=\"Image\" width=\"${uploadDocument.width}\" height=\"${uploadDocument.height}\">`\n pictureHTML += '</picture>'\n return pictureHTML\n } else {\n return `<img src=\"${id}\" />`\n }\n },\n nodeTypes: [UploadNode.getType()],\n },\n },\n node: UploadNode,\n populationPromises: [uploadPopulationPromiseHOC(props)],\n validations: [uploadValidation(props)],\n }),\n ],\n serverFeatureProps: props,\n }\n },\n key: 'upload',\n serverFeatureProps: props,\n }\n}\n"],"names":["traverseFields","sanitizeFields","createNode","UploadFeatureClientComponent","UploadNode","uploadPopulationPromiseHOC","uploadValidation","getAbsoluteURL","url","payload","startsWith","config","serverURL","UploadFeature","props","collections","clientProps","collection","hasExtraFields","fields","length","feature","_config","isRoot","validRelationships","map","c","slug","requireFieldLevelRichTextEditor","ClientComponent","clientFeatureProps","generateSchemaMap","i18n","schemaMap","Map","set","schemaPath","nodes","converters","html","converter","node","id","value","uploadDocument","findByID","relationTo","ignored","console","error","mimeType","filename","sizes","Object","keys","width","height","pictureHTML","size","imageSize","filesize","imageSizeURL","nodeTypes","getType","populationPromises","validations","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,cAAc,QAAQ,6BAA4B;AA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,oBAAoBpD;IACtB;AACF,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/features/upload/feature.server.ts"],"sourcesContent":["import type { Config } from 'payload/config'\nimport type { Field, FileData, FileSize, Payload, TypeWithID } from 'payload/types'\n\nimport { traverseFields } from '@payloadcms/next/utilities'\nimport { sanitizeFields } from 'payload/config'\n\nimport type { FeatureProviderProviderServer } from '../types.js'\nimport type { UploadFeaturePropsClient } from './feature.client.js'\n\nimport { createNode } from '../typeUtilities.js'\nimport { UploadFeatureClientComponent } from './feature.client.js'\nimport { i18n } from './i18n.js'\nimport { UploadNode } from './nodes/UploadNode.js'\nimport { uploadPopulationPromiseHOC } from './populationPromise.js'\nimport { uploadValidation } from './validate.js'\n\nexport type UploadFeatureProps = {\n collections?: {\n [collection: string]: {\n fields: Field[]\n }\n }\n /**\n * Sets a maximum population depth for this upload (not the fields for this upload), regardless of the remaining depth when the respective field is reached.\n * This behaves exactly like the maxDepth properties of relationship and upload fields.\n *\n * {@link https://payloadcms.com/docs/getting-started/concepts#field-level-max-depth}\n */\n maxDepth?: number\n}\n\n/**\n * Get the absolute URL for an upload URL by potentially prepending the serverURL\n */\nfunction getAbsoluteURL(url: string, payload: Payload): string {\n return url?.startsWith('http') ? url : (payload?.config?.serverURL || '') + url\n}\n\nexport const UploadFeature: FeatureProviderProviderServer<\n UploadFeatureProps,\n UploadFeaturePropsClient\n> = (props) => {\n if (!props) {\n props = { collections: {} }\n }\n\n const clientProps: UploadFeaturePropsClient = {\n collections: {},\n }\n if (props.collections) {\n for (const collection in props.collections) {\n clientProps.collections[collection] = {\n hasExtraFields: props.collections[collection].fields.length >= 1,\n }\n }\n }\n\n return {\n feature: async ({ config: _config, isRoot }) => {\n const validRelationships = _config.collections.map((c) => c.slug) || []\n\n for (const collection in props.collections) {\n if (props.collections[collection].fields?.length) {\n props.collections[collection].fields = await sanitizeFields({\n config: _config as unknown as Config,\n fields: props.collections[collection].fields,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n }\n }\n\n return {\n ClientComponent: UploadFeatureClientComponent,\n clientFeatureProps: clientProps,\n generateSchemaMap: ({ config, i18n, props }) => {\n if (!props?.collections) return null\n\n const schemaMap = new Map<string, Field[]>()\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n for (const collection in props.collections) {\n if (props.collections[collection].fields?.length) {\n schemaMap.set(collection, props.collections[collection].fields)\n traverseFields({\n config,\n fields: props.collections[collection].fields,\n i18n,\n schemaMap,\n schemaPath: collection,\n validRelationships,\n })\n }\n }\n\n return schemaMap\n },\n i18n,\n nodes: [\n createNode({\n converters: {\n html: {\n converter: async ({ node, payload }) => {\n // @ts-expect-error\n const id = node?.value?.id || node?.value // for backwards-compatibility\n\n if (payload) {\n let uploadDocument: TypeWithID & FileData\n\n try {\n uploadDocument = (await payload.findByID({\n id,\n collection: node.relationTo,\n })) as TypeWithID & FileData\n } catch (ignored) {\n // eslint-disable-next-line no-console\n console.error(\n 'Lexical upload node HTML converter: error fetching upload file',\n ignored,\n 'Node:',\n node,\n )\n return `<img />`\n }\n\n const url = getAbsoluteURL(uploadDocument?.url, payload)\n\n /**\n * If the upload is not an image, return a link to the upload\n */\n if (!uploadDocument?.mimeType?.startsWith('image')) {\n return `<a href=\"${url}\" rel=\"noopener noreferrer\">${uploadDocument.filename}</a>`\n }\n\n /**\n * If the upload is a simple image with no different sizes, return a simple img tag\n */\n if (!uploadDocument?.sizes || !Object.keys(uploadDocument?.sizes).length) {\n return `<img src=\"${url}\" alt=\"${uploadDocument?.filename}\" width=\"${uploadDocument?.width}\" height=\"${uploadDocument?.height}\"/>`\n }\n\n /**\n * If the upload is an image with different sizes, return a picture element\n */\n let pictureHTML = '<picture>'\n\n // Iterate through each size in the data.sizes object\n for (const size in uploadDocument.sizes) {\n const imageSize: FileSize & {\n url?: string\n } = uploadDocument.sizes[size]\n\n // Skip if any property of the size object is null\n if (\n !imageSize.width ||\n !imageSize.height ||\n !imageSize.mimeType ||\n !imageSize.filesize ||\n !imageSize.filename ||\n !imageSize.url\n ) {\n continue\n }\n const imageSizeURL = getAbsoluteURL(imageSize?.url, payload)\n\n pictureHTML += `<source srcset=\"${imageSizeURL}\" media=\"(max-width: ${imageSize.width}px)\" type=\"${imageSize.mimeType}\">`\n }\n\n // Add the default img tag\n pictureHTML += `<img src=\"${url}\" alt=\"Image\" width=\"${uploadDocument.width}\" height=\"${uploadDocument.height}\">`\n pictureHTML += '</picture>'\n return pictureHTML\n } else {\n return `<img src=\"${id}\" />`\n }\n },\n nodeTypes: [UploadNode.getType()],\n },\n },\n node: UploadNode,\n populationPromises: [uploadPopulationPromiseHOC(props)],\n validations: [uploadValidation(props)],\n }),\n ],\n serverFeatureProps: props,\n }\n },\n key: 'upload',\n serverFeatureProps: props,\n }\n}\n"],"names":["traverseFields","sanitizeFields","createNode","UploadFeatureClientComponent","i18n","UploadNode","uploadPopulationPromiseHOC","uploadValidation","getAbsoluteURL","url","payload","startsWith","config","serverURL","UploadFeature","props","collections","clientProps","collection","hasExtraFields","fields","length","feature","_config","isRoot","validRelationships","map","c","slug","requireFieldLevelRichTextEditor","ClientComponent","clientFeatureProps","generateSchemaMap","schemaMap","Map","set","schemaPath","nodes","converters","html","converter","node","id","value","uploadDocument","findByID","relationTo","ignored","console","error","mimeType","filename","sizes","Object","keys","width","height","pictureHTML","size","imageSize","filesize","imageSizeURL","nodeTypes","getType","populationPromises","validations","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,cAAc,QAAQ,6BAA4B;AAC3D,SAASC,cAAc,QAAQ,iBAAgB;AAK/C,SAASC,UAAU,QAAQ,sBAAqB;AAChD,SAASC,4BAA4B,QAAQ,sBAAqB;AAClE,SAASC,IAAI,QAAQ,YAAW;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oot":"","sources":["../../../../src/field/features/upload/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAEhE,eAAO,MAAM,IAAI,EAAE,OAAO,CAAC,gBAAgB,CAiG1C,CAAA"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
export const i18n = {
|
|
2
|
+
ar: {
|
|
3
|
+
label: 'تحميل'
|
|
4
|
+
},
|
|
5
|
+
az: {
|
|
6
|
+
label: 'Yükləyin'
|
|
7
|
+
},
|
|
8
|
+
bg: {
|
|
9
|
+
label: 'Качване'
|
|
10
|
+
},
|
|
11
|
+
cs: {
|
|
12
|
+
label: 'Nahrát'
|
|
13
|
+
},
|
|
14
|
+
de: {
|
|
15
|
+
label: 'Datei'
|
|
16
|
+
},
|
|
17
|
+
en: {
|
|
18
|
+
label: 'Upload'
|
|
19
|
+
},
|
|
20
|
+
es: {
|
|
21
|
+
label: 'Subir'
|
|
22
|
+
},
|
|
23
|
+
fa: {
|
|
24
|
+
label: 'بارگذاری'
|
|
25
|
+
},
|
|
26
|
+
fr: {
|
|
27
|
+
label: 'Télécharger'
|
|
28
|
+
},
|
|
29
|
+
he: {
|
|
30
|
+
label: 'העלה'
|
|
31
|
+
},
|
|
32
|
+
hr: {
|
|
33
|
+
label: 'Prenesi'
|
|
34
|
+
},
|
|
35
|
+
hu: {
|
|
36
|
+
label: 'Feltöltés'
|
|
37
|
+
},
|
|
38
|
+
it: {
|
|
39
|
+
label: 'Carica'
|
|
40
|
+
},
|
|
41
|
+
ja: {
|
|
42
|
+
label: 'アップロード'
|
|
43
|
+
},
|
|
44
|
+
ko: {
|
|
45
|
+
label: '업로드'
|
|
46
|
+
},
|
|
47
|
+
my: {
|
|
48
|
+
label: 'တင်ပြီး'
|
|
49
|
+
},
|
|
50
|
+
nb: {
|
|
51
|
+
label: 'Last opp'
|
|
52
|
+
},
|
|
53
|
+
nl: {
|
|
54
|
+
label: 'Uploaden'
|
|
55
|
+
},
|
|
56
|
+
pl: {
|
|
57
|
+
label: 'Prześlij'
|
|
58
|
+
},
|
|
59
|
+
pt: {
|
|
60
|
+
label: 'Carregar'
|
|
61
|
+
},
|
|
62
|
+
ro: {
|
|
63
|
+
label: 'Încarcă'
|
|
64
|
+
},
|
|
65
|
+
rs: {
|
|
66
|
+
label: 'Otpremi'
|
|
67
|
+
},
|
|
68
|
+
'rs-latin': {
|
|
69
|
+
label: 'Otpremi'
|
|
70
|
+
},
|
|
71
|
+
ru: {
|
|
72
|
+
label: 'Загрузить'
|
|
73
|
+
},
|
|
74
|
+
sk: {
|
|
75
|
+
label: 'Nahrať'
|
|
76
|
+
},
|
|
77
|
+
sv: {
|
|
78
|
+
label: 'Ladda upp'
|
|
79
|
+
},
|
|
80
|
+
th: {
|
|
81
|
+
label: 'อัปโหลด'
|
|
82
|
+
},
|
|
83
|
+
tr: {
|
|
84
|
+
label: 'Yükle'
|
|
85
|
+
},
|
|
86
|
+
uk: {
|
|
87
|
+
label: 'Завантажити'
|
|
88
|
+
},
|
|
89
|
+
vi: {
|
|
90
|
+
label: 'Tải lên'
|
|
91
|
+
},
|
|
92
|
+
zh: {
|
|
93
|
+
label: '上传'
|
|
94
|
+
},
|
|
95
|
+
'zh-TW': {
|
|
96
|
+
label: '上傳'
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
//# sourceMappingURL=i18n.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/features/upload/i18n.ts"],"sourcesContent":["import type { GenericLanguages } from '@payloadcms/translations'\n\nexport const i18n: Partial<GenericLanguages> = {\n ar: {\n label: 'تحميل',\n },\n az: {\n label: 'Yükləyin',\n },\n bg: {\n label: 'Качване',\n },\n cs: {\n label: 'Nahrát',\n },\n de: {\n label: 'Datei',\n },\n en: {\n label: 'Upload',\n },\n es: {\n label: 'Subir',\n },\n fa: {\n label: 'بارگذاری',\n },\n fr: {\n label: 'Télécharger',\n },\n he: {\n label: 'העלה',\n },\n hr: {\n label: 'Prenesi',\n },\n hu: {\n label: 'Feltöltés',\n },\n it: {\n label: 'Carica',\n },\n ja: {\n label: 'アップロード',\n },\n ko: {\n label: '업로드',\n },\n my: {\n label: 'တင်ပြီး',\n },\n nb: {\n label: 'Last opp',\n },\n nl: {\n label: 'Uploaden',\n },\n pl: {\n label: 'Prześlij',\n },\n pt: {\n label: 'Carregar',\n },\n ro: {\n label: 'Încarcă',\n },\n rs: {\n label: 'Otpremi',\n },\n 'rs-latin': {\n label: 'Otpremi',\n },\n ru: {\n label: 'Загрузить',\n },\n sk: {\n label: 'Nahrať',\n },\n sv: {\n label: 'Ladda upp',\n },\n th: {\n label: 'อัปโหลด',\n },\n tr: {\n label: 'Yükle',\n },\n uk: {\n label: 'Завантажити',\n },\n vi: {\n label: 'Tải lên',\n },\n zh: {\n label: '上传',\n },\n 'zh-TW': {\n label: '上傳',\n },\n}\n"],"names":["i18n","ar","label","az","bg","cs","de","en","es","fa","fr","he","hr","hu","it","ja","ko","my","nb","nl","pl","pt","ro","rs","ru","sk","sv","th","tr","uk","vi","zh"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,OAAO,MAAMA,OAAkC;IAC7CC,IAAI;QACFC,OAAO;IACT;IACAC,IAAI;QACFD,OAAO;IACT;IACAE,IAAI;QACFF,OAAO;IACT;IACAG,IAAI;QACFH,OAAO;IACT;IACAI,IAAI;QACFJ,OAAO;IACT;IACAK,IAAI;QACFL,OAAO;IACT;IACAM,IAAI;QACFN,OAAO;IACT;IACAO,IAAI;QACFP,OAAO;IACT;IACAQ,IAAI;QACFR,OAAO;IACT;IACAS,IAAI;QACFT,OAAO;IACT;IACAU,IAAI;QACFV,OAAO;IACT;IACAW,IAAI;QACFX,OAAO;IACT;IACAY,IAAI;QACFZ,OAAO;IACT;IACAa,IAAI;QACFb,OAAO;IACT;IACAc,IAAI;QACFd,OAAO;IACT;IACAe,IAAI;QACFf,OAAO;IACT;IACAgB,IAAI;QACFhB,OAAO;IACT;IACAiB,IAAI;QACFjB,OAAO;IACT;IACAkB,IAAI;QACFlB,OAAO;IACT;IACAmB,IAAI;QACFnB,OAAO;IACT;IACAoB,IAAI;QACFpB,OAAO;IACT;IACAqB,IAAI;QACFrB,OAAO;IACT;IACA,YAAY;QACVA,OAAO;IACT;IACAsB,IAAI;QACFtB,OAAO;IACT;IACAuB,IAAI;QACFvB,OAAO;IACT;IACAwB,IAAI;QACFxB,OAAO;IACT;IACAyB,IAAI;QACFzB,OAAO;IACT;IACA0B,IAAI;QACF1B,OAAO;IACT;IACA2B,IAAI;QACF3B,OAAO;IACT;IACA4B,IAAI;QACF5B,OAAO;IACT;IACA6B,IAAI;QACF7B,OAAO;IACT;IACA,SAAS;QACPA,OAAO;IACT;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/field/features/upload/populationPromise.ts"],"sourcesContent":["import type { PopulationPromise } from '../types.js'\nimport type { UploadFeatureProps } from './feature.server.js'\nimport type { SerializedUploadNode } from './nodes/UploadNode.js'\n\nimport { populate } from '../../../populate/populate.js'\nimport { recurseNestedFields } from '../../../populate/recurseNestedFields.js'\n\nexport const uploadPopulationPromiseHOC = (\n props?: UploadFeatureProps,\n): PopulationPromise<SerializedUploadNode> => {\n return ({\n context,\n currentDepth,\n depth,\n draft,\n editorPopulationPromises,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n node,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n }) => {\n if (node?.value) {\n const collection = req.payload.collections[node?.relationTo]\n\n if (collection) {\n // @ts-expect-error\n const id = node?.value?.id || node?.value // for backwards-compatibility\n\n const populateDepth =\n props?.maxDepth !== undefined && props?.maxDepth < depth ? props?.maxDepth : depth\n\n populationPromises.push(\n populate({\n id,\n collection,\n currentDepth,\n data: node,\n depth: populateDepth,\n draft,\n field,\n key: 'value',\n overrideAccess,\n req,\n showHiddenFields,\n }),\n )\n }\n if (Array.isArray(props?.collections?.[node?.relationTo]?.fields)) {\n if (!props?.collections?.[node?.relationTo]?.fields?.length) {\n return\n }\n recurseNestedFields({\n context,\n currentDepth,\n data: node.fields || {},\n depth,\n draft,\n editorPopulationPromises,\n fieldPromises,\n fields: props?.collections?.[node?.relationTo]?.fields,\n findMany,\n flattenLocales
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/features/upload/populationPromise.ts"],"sourcesContent":["import type { PopulationPromise } from '../types.js'\nimport type { UploadFeatureProps } from './feature.server.js'\nimport type { SerializedUploadNode } from './nodes/UploadNode.js'\n\nimport { populate } from '../../../populate/populate.js'\nimport { recurseNestedFields } from '../../../populate/recurseNestedFields.js'\n\nexport const uploadPopulationPromiseHOC = (\n props?: UploadFeatureProps,\n): PopulationPromise<SerializedUploadNode> => {\n return ({\n context,\n currentDepth,\n depth,\n draft,\n editorPopulationPromises,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n node,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n }) => {\n if (node?.value) {\n const collection = req.payload.collections[node?.relationTo]\n\n if (collection) {\n // @ts-expect-error\n const id = node?.value?.id || node?.value // for backwards-compatibility\n\n const populateDepth =\n props?.maxDepth !== undefined && props?.maxDepth < depth ? props?.maxDepth : depth\n\n populationPromises.push(\n populate({\n id,\n collection,\n currentDepth,\n data: node,\n depth: populateDepth,\n draft,\n field,\n key: 'value',\n overrideAccess,\n req,\n showHiddenFields,\n }),\n )\n }\n if (Array.isArray(props?.collections?.[node?.relationTo]?.fields)) {\n if (!props?.collections?.[node?.relationTo]?.fields?.length) {\n return\n }\n recurseNestedFields({\n context,\n currentDepth,\n data: node.fields || {},\n depth,\n draft,\n editorPopulationPromises,\n fieldPromises,\n fields: props?.collections?.[node?.relationTo]?.fields,\n findMany,\n flattenLocales: false, // Disable localization handling which does not work properly yet. Once we fully support hooks, this can be enabled (pass through flattenLocales again)\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc: node.fields || {},\n })\n }\n }\n }\n}\n"],"names":["populate","recurseNestedFields","uploadPopulationPromiseHOC","props","context","currentDepth","depth","draft","editorPopulationPromises","field","fieldPromises","findMany","flattenLocales","node","overrideAccess","populationPromises","req","showHiddenFields","value","collection","payload","collections","relationTo","id","populateDepth","maxDepth","undefined","push","data","key","Array","isArray","fields","length","siblingDoc"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAIA,SAASA,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,mBAAmB,QAAQ,2CAA0C;AAE9E,OAAO,MAAMC,6BAA6B,CACxCC;IAEA,OAAO,CAAC,EACNC,OAAO,EACPC,YAAY,EACZC,KAAK,EACLC,KAAK,EACLC,wBAAwB,EACxBC,KAAK,EACLC,aAAa,EACbC,QAAQ,EACRC,cAAc,EACdC,IAAI,EACJC,cAAc,EACdC,kBAAkB,EAClBC,GAAG,EACHC,gBAAgB,EACjB;QACC,IAAIJ,MAAMK,OAAO;YACf,MAAMC,aAAaH,IAAII,OAAO,CAACC,WAAW,CAACR,MAAMS,WAAW;YAE5D,IAAIH,YAAY;gBACd,mBAAmB;gBACnB,MAAMI,KAAKV,MAAMK,OAAOK,MAAMV,MAAMK,MAAM,8BAA8B;;gBAExE,MAAMM,gBACJrB,OAAOsB,aAAaC,aAAavB,OAAOsB,WAAWnB,QAAQH,OAAOsB,WAAWnB;gBAE/ES,mBAAmBY,IAAI,CACrB3B,SAAS;oBACPuB;oBACAJ;oBACAd;oBACAuB,MAAMf;oBACNP,OAAOkB;oBACPjB;oBACAE;oBACAoB,KAAK;oBACLf;oBACAE;oBACAC;gBACF;YAEJ;YACA,IAAIa,MAAMC,OAAO,CAAC5B,OAAOkB,aAAa,CAACR,MAAMS,WAAW,EAAEU,SAAS;gBACjE,IAAI,CAAC7B,OAAOkB,aAAa,CAACR,MAAMS,WAAW,EAAEU,QAAQC,QAAQ;oBAC3D;gBACF;gBACAhC,oBAAoB;oBAClBG;oBACAC;oBACAuB,MAAMf,KAAKmB,MAAM,IAAI,CAAC;oBACtB1B;oBACAC;oBACAC;oBACAE;oBACAsB,QAAQ7B,OAAOkB,aAAa,CAACR,MAAMS,WAAW,EAAEU;oBAChDrB;oBACAC,gBAAgB;oBAChBE;oBACAC;oBACAC;oBACAC;oBACAiB,YAAYrB,KAAKmB,MAAM,IAAI,CAAC;gBAC9B;YACF;QACF;IACF;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LexicalEditor.d.ts","sourceRoot":"","sources":["../../../src/field/lexical/LexicalEditor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LexicalEditor.d.ts","sourceRoot":"","sources":["../../../src/field/lexical/LexicalEditor.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAIhE,OAAO,sBAAsB,CAAA;AAQ7B,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,cAAc,GAAG,UAAU,CAAC,CA8J3F,CAAA"}
|
|
@@ -7,6 +7,7 @@ import { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js';
|
|
|
7
7
|
import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js';
|
|
8
8
|
import { TabIndentationPlugin } from '@lexical/react/LexicalTabIndentationPlugin.js';
|
|
9
9
|
import { mergeRegister } from '@lexical/utils';
|
|
10
|
+
import { useTranslation } from '@payloadcms/ui/providers/Translation';
|
|
10
11
|
import { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical';
|
|
11
12
|
import * as React from 'react';
|
|
12
13
|
import { useEffect, useState } from 'react';
|
|
@@ -24,6 +25,7 @@ export const LexicalEditor = (props)=>{
|
|
|
24
25
|
const editorConfigContext = useEditorConfigContext();
|
|
25
26
|
const [editor] = useLexicalComposerContext();
|
|
26
27
|
const editorFocus = useEditorFocus();
|
|
28
|
+
const { t } = useTranslation();
|
|
27
29
|
const [floatingAnchorElem, setFloatingAnchorElem] = useState(null);
|
|
28
30
|
const onRef = (_floatingAnchorElem)=>{
|
|
29
31
|
if (_floatingAnchorElem !== null) {
|
|
@@ -95,7 +97,7 @@ export const LexicalEditor = (props)=>{
|
|
|
95
97
|
}),
|
|
96
98
|
placeholder: /*#__PURE__*/ _jsx("p", {
|
|
97
99
|
className: "editor-placeholder",
|
|
98
|
-
children:
|
|
100
|
+
children: t('lexical:general:placeholder')
|
|
99
101
|
})
|
|
100
102
|
}),
|
|
101
103
|
/*#__PURE__*/ _jsx(OnChangePlugin, {
|