@payloadcms/richtext-lexical 3.0.0-beta.36 → 3.0.0-beta.38
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 +3 -1
- 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 +11 -3
- 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 +3 -1
- 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 +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, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/field/lexical/LexicalEditor.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport LexicalErrorBoundary from '@lexical/react/LexicalErrorBoundary.js'\nimport { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js'\nimport { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js'\nimport { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js'\nimport { TabIndentationPlugin } from '@lexical/react/LexicalTabIndentationPlugin.js'\nimport { mergeRegister } from '@lexical/utils'\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useState } from 'react'\n\nimport type { LexicalProviderProps } from './LexicalProvider.js'\n\nimport { useEditorFocus } from './EditorFocusProvider.js'\nimport { EditorPlugin } from './EditorPlugin.js'\nimport './LexicalEditor.scss'\nimport { useEditorConfigContext } from './config/client/EditorConfigProvider.js'\nimport { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js'\nimport { SlashMenuPlugin } from './plugins/SlashMenu/index.js'\nimport { AddBlockHandlePlugin } from './plugins/handles/AddBlockHandlePlugin/index.js'\nimport { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/index.js'\nimport { LexicalContentEditable } from './ui/ContentEditable.js'\n\nexport const LexicalEditor: React.FC<Pick<LexicalProviderProps, 'editorConfig' | 'onChange'>> = (\n props,\n) => {\n const { editorConfig, onChange } = props\n const editorConfigContext = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n const editorFocus = useEditorFocus()\n\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLDivElement | null>(null)\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem)\n }\n }\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand<MouseEvent>(\n FOCUS_COMMAND,\n () => {\n editorFocus.focusEditor(editor, editorConfigContext)\n return true\n },\n\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand<MouseEvent>(\n BLUR_COMMAND,\n () => {\n editorFocus.blurEditor()\n return true\n },\n\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor, editorConfig, editorConfigContext, editorFocus])\n\n const [isSmallWidthViewport, setIsSmallWidthViewport] = useState<boolean>(false)\n\n useEffect(() => {\n const updateViewPortWidth = () => {\n const isNextSmallWidthViewport = window.matchMedia('(max-width: 768px)').matches\n\n if (isNextSmallWidthViewport !== isSmallWidthViewport) {\n setIsSmallWidthViewport(isNextSmallWidthViewport)\n }\n }\n updateViewPortWidth()\n window.addEventListener('resize', updateViewPortWidth)\n\n return () => {\n window.removeEventListener('resize', updateViewPortWidth)\n }\n }, [isSmallWidthViewport])\n\n const ErrorBoundaryComponent = LexicalErrorBoundary.default || LexicalErrorBoundary\n\n return (\n <React.Fragment>\n {editorConfig.features.plugins.map((plugin) => {\n if (plugin.position === 'aboveContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n <div className=\"editor-container\">\n {editorConfig.features.plugins.map((plugin) => {\n if (plugin.position === 'top') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n <RichTextPlugin\n //@ts-expect-error ts being dumb\n ErrorBoundary={ErrorBoundaryComponent}\n contentEditable={\n <div className=\"editor-scroller\">\n <div className=\"editor\" ref={onRef}>\n <LexicalContentEditable />\n </div>\n </div>\n }\n placeholder={\n <p className=\"editor-placeholder\">\n Start typing, or press '/' for commands...\n </p>\n }\n />\n <OnChangePlugin\n // Selection changes can be ignored here, reducing the\n // frequency that the FieldComponent and Payload receive updates.\n // Selection changes are only needed if you are saving selection state\n ignoreSelectionChange\n onChange={(editorState, editor, tags) => {\n // Ignore any onChange event triggered by focus only\n if (!tags.has('focus') || tags.size > 1) {\n if (onChange != null) onChange(editorState, editor, tags)\n }\n }}\n />\n {floatingAnchorElem && (\n <React.Fragment>\n {!isSmallWidthViewport && editor.isEditable() && (\n <React.Fragment>\n <DraggableBlockPlugin anchorElem={floatingAnchorElem} />\n <AddBlockHandlePlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n {editorConfig.features.plugins.map((plugin) => {\n if (\n plugin.position === 'floatingAnchorElem' &&\n !(plugin.desktopOnly === true && isSmallWidthViewport)\n ) {\n return (\n <EditorPlugin\n anchorElem={floatingAnchorElem}\n clientProps={plugin.clientProps}\n key={plugin.key}\n plugin={plugin}\n />\n )\n }\n })}\n {editor.isEditable() && (\n <React.Fragment>\n <SlashMenuPlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n </React.Fragment>\n )}\n {editor.isEditable() && (\n <React.Fragment>\n <HistoryPlugin />\n {editorConfig?.features?.markdownTransformers?.length > 0 && <MarkdownShortcutPlugin />}\n </React.Fragment>\n )}\n\n <TabIndentationPlugin />\n {editorConfig.features.plugins.map((plugin) => {\n if (plugin.position === 'normal') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n {editorConfig.features.plugins.map((plugin) => {\n if (plugin.position === 'bottom') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n </div>\n {editorConfig.features.plugins.map((plugin) => {\n if (plugin.position === 'belowContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n </React.Fragment>\n )\n}\n"],"names":["useLexicalComposerContext","LexicalErrorBoundary","HistoryPlugin","OnChangePlugin","RichTextPlugin","TabIndentationPlugin","mergeRegister","BLUR_COMMAND","COMMAND_PRIORITY_LOW","FOCUS_COMMAND","React","useEffect","useState","useEditorFocus","EditorPlugin","useEditorConfigContext","MarkdownShortcutPlugin","SlashMenuPlugin","AddBlockHandlePlugin","DraggableBlockPlugin","LexicalContentEditable","LexicalEditor","props","editorConfig","onChange","editorConfigContext","editor","editorFocus","floatingAnchorElem","setFloatingAnchorElem","onRef","_floatingAnchorElem","registerCommand","focusEditor","blurEditor","isSmallWidthViewport","setIsSmallWidthViewport","updateViewPortWidth","isNextSmallWidthViewport","window","matchMedia","matches","addEventListener","removeEventListener","ErrorBoundaryComponent","default","Fragment","features","plugins","map","plugin","position","clientProps","key","div","className","ErrorBoundary","contentEditable","ref","placeholder","p","ignoreSelectionChange","editorState","tags","has","size","isEditable","anchorElem","desktopOnly","markdownTransformers","length"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AACA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,OAAOC,0BAA0B,yCAAwC;AACzE,SAASC,aAAa,QAAQ,yCAAwC;AACtE,SAASC,cAAc,QAAQ,0CAAyC;AACxE,SAASC,cAAc,QAAQ,0CAAyC;AACxE,SAASC,oBAAoB,QAAQ,gDAA+C;AACpF,SAASC,aAAa,QAAQ,iBAAgB;AAC9C,SAASC,YAAY,EAAEC,oBAAoB,EAAEC,aAAa,QAAQ,UAAS;AAC3E,YAAYC,WAAW,QAAO;AAC9B,SAASC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAI3C,SAASC,cAAc,QAAQ,2BAA0B;AACzD,SAASC,YAAY,QAAQ,oBAAmB;AAChD,OAAO,uBAAsB;AAC7B,SAASC,sBAAsB,QAAQ,0CAAyC;AAChF,SAASC,sBAAsB,QAAQ,sCAAqC;AAC5E,SAASC,eAAe,QAAQ,+BAA8B;AAC9D,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AMoC,QAAQ;0CACb,cAAA,KAAC7B;oCAAgBkD,YAAYvC;;;;;oBAKpCF,OAAOwC,UAAU,oBAChB,MAACxD,MAAMoC,QAAQ;;0CACb,KAAC5C;4BACAqB,cAAcwB,UAAUsB,sBAAsBC,SAAS,mBAAK,KAACtD;;;kCAIlE,KAACX;oBACAkB,aAAawB,QAAQ,CAACC,OAAO,CAACC,GAAG,CAAC,CAACC;wBAClC,IAAIA,OAAOC,QAAQ,KAAK,UAAU;4BAChC,qBACE,KAACrC;gCAAasC,aAAaF,OAAOE,WAAW;gCAAmBF,QAAQA;+BAApBA,OAAOG,GAAG;wBAElE;oBACF;oBACC9B,aAAawB,QAAQ,CAACC,OAAO,CAACC,GAAG,CAAC,CAACC;wBAClC,IAAIA,OAAOC,QAAQ,KAAK,UAAU;4BAChC,qBACE,KAACrC;gCAAasC,aAAaF,OAAOE,WAAW;gCAAmBF,QAAQA;+BAApBA,OAAOG,GAAG;wBAElE;oBACF;;;YAED9B,aAAawB,QAAQ,CAACC,OAAO,CAACC,GAAG,CAAC,CAACC;gBAClC,IAAIA,OAAOC,QAAQ,KAAK,kBAAkB;oBACxC,qBAAO,KAACrC;wBAAasC,aAAaF,OAAOE,WAAW;wBAAmBF,QAAQA;uBAApBA,OAAOG,GAAG;gBACvE;YACF;;;AAGN,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/field/lexical/LexicalEditor.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport LexicalErrorBoundary from '@lexical/react/LexicalErrorBoundary.js'\nimport { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js'\nimport { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js'\nimport { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js'\nimport { TabIndentationPlugin } from '@lexical/react/LexicalTabIndentationPlugin.js'\nimport { mergeRegister } from '@lexical/utils'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useState } from 'react'\n\nimport type { LexicalProviderProps } from './LexicalProvider.js'\n\nimport { useEditorFocus } from './EditorFocusProvider.js'\nimport { EditorPlugin } from './EditorPlugin.js'\nimport './LexicalEditor.scss'\nimport { useEditorConfigContext } from './config/client/EditorConfigProvider.js'\nimport { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js'\nimport { SlashMenuPlugin } from './plugins/SlashMenu/index.js'\nimport { AddBlockHandlePlugin } from './plugins/handles/AddBlockHandlePlugin/index.js'\nimport { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/index.js'\nimport { LexicalContentEditable } from './ui/ContentEditable.js'\n\nexport const LexicalEditor: React.FC<Pick<LexicalProviderProps, 'editorConfig' | 'onChange'>> = (\n props,\n) => {\n const { editorConfig, onChange } = props\n const editorConfigContext = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n const editorFocus = useEditorFocus()\n const { t } = useTranslation<{}, string>()\n\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLDivElement | null>(null)\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem)\n }\n }\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand<MouseEvent>(\n FOCUS_COMMAND,\n () => {\n editorFocus.focusEditor(editor, editorConfigContext)\n return true\n },\n\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand<MouseEvent>(\n BLUR_COMMAND,\n () => {\n editorFocus.blurEditor()\n return true\n },\n\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor, editorConfig, editorConfigContext, editorFocus])\n\n const [isSmallWidthViewport, setIsSmallWidthViewport] = useState<boolean>(false)\n\n useEffect(() => {\n const updateViewPortWidth = () => {\n const isNextSmallWidthViewport = window.matchMedia('(max-width: 768px)').matches\n\n if (isNextSmallWidthViewport !== isSmallWidthViewport) {\n setIsSmallWidthViewport(isNextSmallWidthViewport)\n }\n }\n updateViewPortWidth()\n window.addEventListener('resize', updateViewPortWidth)\n\n return () => {\n window.removeEventListener('resize', updateViewPortWidth)\n }\n }, [isSmallWidthViewport])\n\n const ErrorBoundaryComponent = LexicalErrorBoundary.default || LexicalErrorBoundary\n\n return (\n <React.Fragment>\n {editorConfig.features.plugins.map((plugin) => {\n if (plugin.position === 'aboveContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n <div className=\"editor-container\">\n {editorConfig.features.plugins.map((plugin) => {\n if (plugin.position === 'top') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n <RichTextPlugin\n //@ts-expect-error ts being dumb\n ErrorBoundary={ErrorBoundaryComponent}\n contentEditable={\n <div className=\"editor-scroller\">\n <div className=\"editor\" ref={onRef}>\n <LexicalContentEditable />\n </div>\n </div>\n }\n placeholder={<p className=\"editor-placeholder\">{t('lexical:general:placeholder')}</p>}\n />\n <OnChangePlugin\n // Selection changes can be ignored here, reducing the\n // frequency that the FieldComponent and Payload receive updates.\n // Selection changes are only needed if you are saving selection state\n ignoreSelectionChange\n onChange={(editorState, editor, tags) => {\n // Ignore any onChange event triggered by focus only\n if (!tags.has('focus') || tags.size > 1) {\n if (onChange != null) onChange(editorState, editor, tags)\n }\n }}\n />\n {floatingAnchorElem && (\n <React.Fragment>\n {!isSmallWidthViewport && editor.isEditable() && (\n <React.Fragment>\n <DraggableBlockPlugin anchorElem={floatingAnchorElem} />\n <AddBlockHandlePlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n {editorConfig.features.plugins.map((plugin) => {\n if (\n plugin.position === 'floatingAnchorElem' &&\n !(plugin.desktopOnly === true && isSmallWidthViewport)\n ) {\n return (\n <EditorPlugin\n anchorElem={floatingAnchorElem}\n clientProps={plugin.clientProps}\n key={plugin.key}\n plugin={plugin}\n />\n )\n }\n })}\n {editor.isEditable() && (\n <React.Fragment>\n <SlashMenuPlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n </React.Fragment>\n )}\n {editor.isEditable() && (\n <React.Fragment>\n <HistoryPlugin />\n {editorConfig?.features?.markdownTransformers?.length > 0 && <MarkdownShortcutPlugin />}\n </React.Fragment>\n )}\n\n <TabIndentationPlugin />\n {editorConfig.features.plugins.map((plugin) => {\n if (plugin.position === 'normal') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n {editorConfig.features.plugins.map((plugin) => {\n if (plugin.position === 'bottom') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n </div>\n {editorConfig.features.plugins.map((plugin) => {\n if (plugin.position === 'belowContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n </React.Fragment>\n )\n}\n"],"names":["useLexicalComposerContext","LexicalErrorBoundary","HistoryPlugin","OnChangePlugin","RichTextPlugin","TabIndentationPlugin","mergeRegister","useTranslation","BLUR_COMMAND","COMMAND_PRIORITY_LOW","FOCUS_COMMAND","React","useEffect","useState","useEditorFocus","EditorPlugin","useEditorConfigContext","MarkdownShortcutPlugin","SlashMenuPlugin","AddBlockHandlePlugin","DraggableBlockPlugin","LexicalContentEditable","LexicalEditor","props","editorConfig","onChange","editorConfigContext","editor","editorFocus","t","floatingAnchorElem","setFloatingAnchorElem","onRef","_floatingAnchorElem","registerCommand","focusEditor","blurEditor","isSmallWidthViewport","setIsSmallWidthViewport","updateViewPortWidth","isNextSmallWidthViewport","window","matchMedia","matches","addEventListener","removeEventListener","ErrorBoundaryComponent","default","Fragment","features","plugins","map","plugin","position","clientProps","key","div","className","ErrorBoundary","contentEditable","ref","placeholder","p","ignoreSelectionChange","editorState","tags","has","size","isEditable","anchorElem","desktopOnly","markdownTransformers","length"],"rang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OE,WAAW;gCAAmBF,QAAQA;+BAApBA,OAAOG,GAAG;wBAElE;oBACF;oBACC/B,aAAayB,QAAQ,CAACC,OAAO,CAACC,GAAG,CAAC,CAACC;wBAClC,IAAIA,OAAOC,QAAQ,KAAK,UAAU;4BAChC,qBACE,KAACtC;gCAAauC,aAAaF,OAAOE,WAAW;gCAAmBF,QAAQA;+BAApBA,OAAOG,GAAG;wBAElE;oBACF;;;YAED/B,aAAayB,QAAQ,CAACC,OAAO,CAACC,GAAG,CAAC,CAACC;gBAClC,IAAIA,OAAOC,QAAQ,KAAK,kBAAkB;oBACxC,qBAAO,KAACtC;wBAAauC,aAAaF,OAAOE,WAAW;wBAAmBF,QAAQA;uBAApBA,OAAOG,GAAG;gBACvE;YACF;;;AAGN,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../../../../src/field/lexical/config/server/sanitize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAE7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAA;AACnG,OAAO,KAAK,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAIlF,eAAO,MAAM,sBAAsB,0CAEhC,
|
|
1
|
+
{"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../../../../src/field/lexical/config/server/sanitize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAE7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAA;AACnG,OAAO,KAAK,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAIlF,eAAO,MAAM,sBAAsB,0CAEhC,uBAsFF,CAAA;AAED,wBAAsB,0BAA0B,CAC9C,YAAY,EAAE,kBAAkB,EAChC,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,2BAA2B,CAAC,CAWtC"}
|
|
@@ -15,6 +15,7 @@ export const sanitizeServerFeatures = (features)=>{
|
|
|
15
15
|
beforeDuplicate: new Map(),
|
|
16
16
|
beforeValidate: new Map()
|
|
17
17
|
},
|
|
18
|
+
i18n: {},
|
|
18
19
|
markdownTransformers: [],
|
|
19
20
|
nodes: [],
|
|
20
21
|
populationPromises: new Map(),
|
|
@@ -27,6 +28,16 @@ export const sanitizeServerFeatures = (features)=>{
|
|
|
27
28
|
if (feature?.generatedTypes?.modifyOutputSchema) {
|
|
28
29
|
sanitized.generatedTypes.modifyOutputSchemas.push(feature.generatedTypes.modifyOutputSchema);
|
|
29
30
|
}
|
|
31
|
+
if (feature?.i18n) {
|
|
32
|
+
for(const lang in feature.i18n){
|
|
33
|
+
if (!sanitized.i18n[lang]) {
|
|
34
|
+
sanitized.i18n[lang] = {
|
|
35
|
+
lexical: {}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
sanitized.i18n[lang].lexical[feature.key] = feature.i18n[lang];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
30
41
|
if (feature.nodes?.length) {
|
|
31
42
|
sanitized.nodes = sanitized.nodes.concat(feature.nodes);
|
|
32
43
|
feature.nodes.forEach((node)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/lexical/config/server/sanitize.ts"],"sourcesContent":["import type { Config, SanitizedConfig } from 'payload/config'\n\nimport type { ResolvedServerFeatureMap, SanitizedServerFeatures } from '../../../features/types.js'\nimport type { SanitizedServerEditorConfig, ServerEditorConfig } from '../types.js'\n\nimport { loadFeatures } from './loader.js'\n\nexport const sanitizeServerFeatures = (\n features: ResolvedServerFeatureMap,\n): SanitizedServerFeatures => {\n const sanitized: SanitizedServerFeatures = {\n converters: {\n html: [],\n },\n enabledFeatures: [],\n
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/lexical/config/server/sanitize.ts"],"sourcesContent":["import type { Config, SanitizedConfig } from 'payload/config'\n\nimport type { ResolvedServerFeatureMap, SanitizedServerFeatures } from '../../../features/types.js'\nimport type { SanitizedServerEditorConfig, ServerEditorConfig } from '../types.js'\n\nimport { loadFeatures } from './loader.js'\n\nexport const sanitizeServerFeatures = (\n features: ResolvedServerFeatureMap,\n): SanitizedServerFeatures => {\n const sanitized: SanitizedServerFeatures = {\n converters: {\n html: [],\n },\n enabledFeatures: [],\n generatedTypes: {\n modifyOutputSchemas: [],\n },\n\n hooks: {\n afterChange: new Map(),\n afterRead: new Map(),\n beforeChange: new Map(),\n beforeDuplicate: new Map(),\n beforeValidate: new Map(),\n },\n i18n: {},\n markdownTransformers: [],\n nodes: [],\n populationPromises: new Map(),\n\n validations: new Map(),\n }\n\n if (!features?.size) {\n return sanitized\n }\n\n features.forEach((feature) => {\n if (feature?.generatedTypes?.modifyOutputSchema) {\n sanitized.generatedTypes.modifyOutputSchemas.push(feature.generatedTypes.modifyOutputSchema)\n }\n\n if (feature?.i18n) {\n for (const lang in feature.i18n) {\n if (!sanitized.i18n[lang]) {\n sanitized.i18n[lang] = {\n lexical: {},\n }\n }\n sanitized.i18n[lang].lexical[feature.key] = feature.i18n[lang]\n }\n }\n\n if (feature.nodes?.length) {\n sanitized.nodes = sanitized.nodes.concat(feature.nodes)\n feature.nodes.forEach((node) => {\n const nodeType = 'with' in node.node ? node.node.replace.getType() : node.node.getType() // TODO: Idk if this works for node replacements\n if (node?.populationPromises?.length) {\n sanitized.populationPromises.set(nodeType, node.populationPromises)\n }\n if (node?.validations?.length) {\n sanitized.validations.set(nodeType, node.validations)\n }\n if (node?.converters?.html) {\n sanitized.converters.html.push(node.converters.html)\n }\n if (node?.hooks?.afterChange) {\n sanitized.hooks.afterChange.set(nodeType, node.hooks.afterChange)\n }\n if (node?.hooks?.afterRead) {\n sanitized.hooks.afterRead.set(nodeType, node.hooks.afterRead)\n }\n if (node?.hooks?.beforeChange) {\n sanitized.hooks.beforeChange.set(nodeType, node.hooks.beforeChange)\n }\n if (node?.hooks?.beforeDuplicate) {\n sanitized.hooks.beforeDuplicate.set(nodeType, node.hooks.beforeDuplicate)\n }\n if (node?.hooks?.beforeValidate) {\n sanitized.hooks.beforeValidate.set(nodeType, node.hooks.beforeValidate)\n }\n })\n }\n\n if (feature.markdownTransformers?.length) {\n sanitized.markdownTransformers = sanitized.markdownTransformers.concat(\n feature.markdownTransformers,\n )\n }\n\n sanitized.enabledFeatures.push(feature.key)\n })\n\n return sanitized\n}\n\nexport async function sanitizeServerEditorConfig(\n editorConfig: ServerEditorConfig,\n config: SanitizedConfig,\n): Promise<SanitizedServerEditorConfig> {\n const resolvedFeatureMap = await loadFeatures({\n config,\n unSanitizedEditorConfig: editorConfig,\n })\n\n return {\n features: sanitizeServerFeatures(resolvedFeatureMap),\n lexical: editorConfig.lexical,\n resolvedFeatureMap,\n }\n}\n"],"names":["loadFeatures","sanitizeServerFeatures","features","sanitized","converters","html","enabledFeatures","generatedTypes","modifyOutputSchemas","hooks","afterChange","Map","afterRead","beforeChange","beforeDuplicate","beforeValidate","i18n","markdownTransformers","nodes","populationPromises","validations","size","forEach","feature","modifyOutputSchema","push","lang","lexical","key","length","concat","node","nodeType","replace","getType","set","sanitizeServerEditorConfig","editorConfig","config","resolvedFeatureMap","unSanitizedEditorConfig"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAKA,SAASA,YAAY,QAAQ,cAAa;AAE1C,OAAO,MAAMC,yBAAyB,CACpCC;IAEA,MAAMC,YAAqC;QACzCC,YAAY;YACVC,MAAM,EAAE;QACV;QACAC,iBAAiB,EAAE;QACnBC,gBAAgB;YACdC,qBAAqB,EAAE;QACzB;QAEAC,OAAO;YACLC,aAAa,IAAIC;YACjBC,WAAW,IAAID;YACfE,cAAc,IAAIF;YAClBG,iBAAiB,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Shortcut?: string;
|
|
9
9
|
keywords?: Array<string>;
|
|
10
10
|
label?: (({ i18n }: {
|
|
11
|
-
i18n: I18nClient
|
|
11
|
+
i18n: I18nClient<{}, string>;
|
|
12
12
|
}) => string) | string;
|
|
13
13
|
onSelect: ({ editor, queryString }: {
|
|
14
14
|
editor: LexicalEditor;
|
|
@@ -19,7 +19,7 @@ export type SlashMenuGroup = {
|
|
|
19
19
|
items: Array<SlashMenuItem>;
|
|
20
20
|
key: string;
|
|
21
21
|
label?: (({ i18n }: {
|
|
22
|
-
i18n: I18nClient
|
|
22
|
+
i18n: I18nClient<{}, string>;
|
|
23
23
|
}) => string) | string;
|
|
24
24
|
};
|
|
25
25
|
export type SlashMenuItemInternal = SlashMenuItem & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAA;AAC7C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,MAAM,MAAM,aAAa,GAAG;IAE1B,IAAI,EAAE,KAAK,CAAC,EAAE,CAAA;IAGd,GAAG,EAAE,MAAM,CAAA;IAEX,gBAAgB,CAAC,EAAE,MAAM,CAAA;IAEzB,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACxB,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE,KAAK,MAAM,CAAC,GAAG,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/field/lexical/plugins/SlashMenu/Lexical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,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAAA;CACpC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.ts"],"sourcesContent":["import type { I18n, I18nClient } from '@payloadcms/translations'\nimport type { LexicalEditor } from 'lexical'\nimport type { MutableRefObject } from 'react'\nimport type React from 'react'\n\nexport type SlashMenuItem = {\n // Icon for display\n Icon: React.FC\n\n // Used for class names and, if label is not provided, for display.\n key: string\n // TBD\n keyboardShortcut?: string\n // For extra searching.\n keywords?: Array<string>\n label?: (({ i18n }: { i18n: I18nClient }) => string) | string\n // What happens when you select this item?\n onSelect: ({ editor, queryString }: { editor: LexicalEditor; queryString: string }) => void\n}\n\nexport type SlashMenuGroup = {\n items: Array<SlashMenuItem>\n key: string\n // Used for class names and, if label is not provided, for display.\n label?: (({ i18n }: { i18n: I18nClient }) => string) | string\n}\n\nexport type SlashMenuItemInternal = SlashMenuItem & {\n ref: MutableRefObject<HTMLButtonElement | null>\n}\n\nexport type SlashMenuGroupInternal = SlashMenuGroup & {\n items: Array<SlashMenuItemInternal>\n}\n"],"names":[],"rangeMappings":"","mappings":"AA+BA,WAEC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.ts"],"sourcesContent":["import type { I18n, I18nClient } from '@payloadcms/translations'\nimport type { LexicalEditor } from 'lexical'\nimport type { MutableRefObject } from 'react'\nimport type React from 'react'\n\nexport type SlashMenuItem = {\n // Icon for display\n Icon: React.FC\n\n // Used for class names and, if label is not provided, for display.\n key: string\n // TBD\n keyboardShortcut?: string\n // For extra searching.\n keywords?: Array<string>\n label?: (({ i18n }: { i18n: I18nClient<{}, string> }) => string) | string\n // What happens when you select this item?\n onSelect: ({ editor, queryString }: { editor: LexicalEditor; queryString: string }) => void\n}\n\nexport type SlashMenuGroup = {\n items: Array<SlashMenuItem>\n key: string\n // Used for class names and, if label is not provided, for display.\n label?: (({ i18n }: { i18n: I18nClient<{}, string> }) => string) | string\n}\n\nexport type SlashMenuItemInternal = SlashMenuItem & {\n ref: MutableRefObject<HTMLButtonElement | null>\n}\n\nexport type SlashMenuGroupInternal = SlashMenuGroup & {\n items: Array<SlashMenuItemInternal>\n}\n"],"names":[],"rangeMappings":"","mappings":"AA+BA,WAEC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../../src/field/lexical/utils/url.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAa/C;
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../../src/field/lexical/utils/url.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAa/C;AAgBD,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAuBhD"}
|
|
@@ -6,7 +6,13 @@ export function sanitizeUrl(url) {
|
|
|
6
6
|
return 'https://';
|
|
7
7
|
}
|
|
8
8
|
// Source: https://stackoverflow.com/a/8234912/2013580
|
|
9
|
-
const
|
|
9
|
+
const absoluteRegExp = /(?:[A-Za-z]{3,9}:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z\d.-]+)(?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*#?\w*/;
|
|
10
|
+
/**
|
|
11
|
+
* This regex checks for relative URLs starting with / or anchor links starting with # in a string. Tested for the following use cases:
|
|
12
|
+
* - /privacy-policy
|
|
13
|
+
* - /privacy-policy#primary-terms
|
|
14
|
+
* - #primary-terms
|
|
15
|
+
* */ const relativeOrAnchorRegExp = /^[\w\-./]*(?:#\w[\w-]*)?$/;
|
|
10
16
|
// Do not keep validateUrl function too loose. This is run when pasting in text, to determine if links are in that text and if it should create AutoLinkNodes.
|
|
11
17
|
// This is why we do not allow stuff like anchors here, as we don't want copied anchors to be turned into AutoLinkNodes.
|
|
12
18
|
export function validateUrl(url) {
|
|
@@ -15,7 +21,9 @@ export function validateUrl(url) {
|
|
|
15
21
|
if (!url) return false;
|
|
16
22
|
if (url === 'https://') return true;
|
|
17
23
|
// This makes sure URLs starting with www. instead of https are valid too
|
|
18
|
-
if (
|
|
24
|
+
if (absoluteRegExp.test(url)) return true;
|
|
25
|
+
// Check relative or anchor links
|
|
26
|
+
if (relativeOrAnchorRegExp.test(url)) return true;
|
|
19
27
|
// While this doesn't allow URLs starting with www (which is why we use the regex above), it does properly handle tel: URLs
|
|
20
28
|
try {
|
|
21
29
|
new URL(url);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/field/lexical/utils/url.ts"],"sourcesContent":["export function sanitizeUrl(url: string): string {\n /** A pattern that matches safe URLs. */\n const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi\n\n /** A pattern that matches safe data URLs. */\n const DATA_URL_PATTERN =\n /^data:(?:image\\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\\/(?:mpeg|mp4|ogg|webm)|audio\\/(?:mp3|oga|ogg|opus));base64,[a-z\\d+/]+=*$/i\n\n url = String(url).trim()\n\n if (url.match(SAFE_URL_PATTERN) != null || url.match(DATA_URL_PATTERN) != null) return url\n\n return 'https://'\n}\n\n// Source: https://stackoverflow.com/a/8234912/2013580\nconst
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/lexical/utils/url.ts"],"sourcesContent":["export function sanitizeUrl(url: string): string {\n /** A pattern that matches safe URLs. */\n const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi\n\n /** A pattern that matches safe data URLs. */\n const DATA_URL_PATTERN =\n /^data:(?:image\\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\\/(?:mpeg|mp4|ogg|webm)|audio\\/(?:mp3|oga|ogg|opus));base64,[a-z\\d+/]+=*$/i\n\n url = String(url).trim()\n\n if (url.match(SAFE_URL_PATTERN) != null || url.match(DATA_URL_PATTERN) != null) return url\n\n return 'https://'\n}\n\n// Source: https://stackoverflow.com/a/8234912/2013580\nconst absoluteRegExp =\n /(?:[A-Za-z]{3,9}:(?:\\/\\/)?(?:[-;:&=+$,\\w]+@)?[A-Za-z\\d.-]+|(?:www.|[-;:&=+$,\\w]+@)[A-Za-z\\d.-]+)(?:\\/[+~%/.\\w-]*)?\\??[-+=&;%@.\\w]*#?\\w*/\n\n/**\n * This regex checks for relative URLs starting with / or anchor links starting with # in a string. Tested for the following use cases:\n * - /privacy-policy\n * - /privacy-policy#primary-terms\n * - #primary-terms\n * */\nconst relativeOrAnchorRegExp = /^[\\w\\-./]*(?:#\\w[\\w-]*)?$/\n\n// Do not keep validateUrl function too loose. This is run when pasting in text, to determine if links are in that text and if it should create AutoLinkNodes.\n// This is why we do not allow stuff like anchors here, as we don't want copied anchors to be turned into AutoLinkNodes.\nexport function validateUrl(url: string): boolean {\n // TODO Fix UI for link insertion; it should never default to an invalid URL such as https://.\n // Maybe show a dialog where they user can type the URL before inserting it.\n\n if (!url) return false\n\n if (url === 'https://') return true\n\n // This makes sure URLs starting with www. instead of https are valid too\n if (absoluteRegExp.test(url)) return true\n\n // Check relative or anchor links\n if (relativeOrAnchorRegExp.test(url)) return true\n\n // While this doesn't allow URLs starting with www (which is why we use the regex above), it does properly handle tel: URLs\n try {\n new URL(url)\n return true\n } catch {\n /* empty */\n }\n\n return false\n}\n"],"names":["sanitizeUrl","url","SAFE_URL_PATTERN","DATA_URL_PATTERN","String","trim","match","absoluteRegExp","relativeOrAnchorRegExp","validateUrl","test","URL"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAO,SAASA,YAAYC,GAAW;IACrC,uCAAuC,GACvC,MAAMC,mBAAmB;IAEzB,2CAA2C,GAC3C,MAAMC,mBACJ;IAEFF,MAAMG,OAAOH,KAAKI,IAAI;IAEtB,IAAIJ,IAAIK,KAAK,CAACJ,qBAAqB,QAAQD,IAAIK,KAAK,CAACH,qBAAqB,MAAM,OAAOF;IAEvF,OAAO;AACT;AAEA,sDAAsD;AACtD,MAAMM,iBACJ;AAEF;;;;;IAKI,GACJ,MAAMC,yBAAyB;AAE/B,8JAA8J;AAC9J,wHAAwH;AACxH,OAAO,SAASC,YAAYR,GAAW;IACrC,8FAA8F;IAC9F,4EAA4E;IAE5E,IAAI,CAACA,KAAK,OAAO;IAEjB,IAAIA,QAAQ,YAAY,OAAO;IAE/B,yEAAyE;IACzE,IAAIM,eAAeG,IAAI,CAACT,MAAM,OAAO;IAErC,iCAAiC;IACjC,IAAIO,uBAAuBE,IAAI,CAACT,MAAM,OAAO;IAE7C,2HAA2H;IAC3H,IAAI;QACF,IAAIU,IAAIV;QACR,OAAO;IACT,EAAE,OAAM;IACN,SAAS,GACX;IAEA,OAAO;AACT"}
|
package/dist/i18n.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAEhE,eAAO,MAAM,IAAI,EAAE,OAAO,CAAC,gBAAgB,CAiK1C,CAAA"}
|
package/dist/i18n.js
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
export const i18n = {
|
|
2
|
+
ar: {
|
|
3
|
+
placeholder: "ابدأ بالكتابة، أو اضغط على '/' للأوامر ...",
|
|
4
|
+
slashMenuBasicGroupLabel: 'أساسي',
|
|
5
|
+
slashMenuListGroupLabel: 'قوائم'
|
|
6
|
+
},
|
|
7
|
+
az: {
|
|
8
|
+
placeholder: "Yazmağa başlayın və ya əmrlər üçün '/' düyməsini basın...",
|
|
9
|
+
slashMenuBasicGroupLabel: 'Əsas',
|
|
10
|
+
slashMenuListGroupLabel: 'Siyahılar'
|
|
11
|
+
},
|
|
12
|
+
bg: {
|
|
13
|
+
placeholder: "Започнете да пишете или натиснете '/' за команди...",
|
|
14
|
+
slashMenuBasicGroupLabel: 'Основен',
|
|
15
|
+
slashMenuListGroupLabel: 'Списъци'
|
|
16
|
+
},
|
|
17
|
+
cs: {
|
|
18
|
+
placeholder: "Začněte psát nebo stiskněte '/' pro příkazy...",
|
|
19
|
+
slashMenuBasicGroupLabel: 'Základní',
|
|
20
|
+
slashMenuListGroupLabel: 'Seznamy'
|
|
21
|
+
},
|
|
22
|
+
de: {
|
|
23
|
+
placeholder: "Beginne zu tippen oder drücke '/' für Befehle...",
|
|
24
|
+
slashMenuBasicGroupLabel: 'Basis',
|
|
25
|
+
slashMenuListGroupLabel: 'Listen'
|
|
26
|
+
},
|
|
27
|
+
en: {
|
|
28
|
+
placeholder: "Start typing, or press '/' for commands...",
|
|
29
|
+
slashMenuBasicGroupLabel: 'Basic',
|
|
30
|
+
slashMenuListGroupLabel: 'Lists'
|
|
31
|
+
},
|
|
32
|
+
es: {
|
|
33
|
+
placeholder: "Comience a escribir, o presione '/' para comandos...",
|
|
34
|
+
slashMenuBasicGroupLabel: 'Básico',
|
|
35
|
+
slashMenuListGroupLabel: 'Listas'
|
|
36
|
+
},
|
|
37
|
+
fa: {
|
|
38
|
+
placeholder: "شروع به تایپ کنید، یا برای دستورات '/' را فشار دهید ...",
|
|
39
|
+
slashMenuBasicGroupLabel: 'پایه',
|
|
40
|
+
slashMenuListGroupLabel: 'لیست ها'
|
|
41
|
+
},
|
|
42
|
+
fr: {
|
|
43
|
+
placeholder: "Commencez à taper, ou appuyez sur '/' pour les commandes...",
|
|
44
|
+
slashMenuBasicGroupLabel: 'De base',
|
|
45
|
+
slashMenuListGroupLabel: 'Listes'
|
|
46
|
+
},
|
|
47
|
+
he: {
|
|
48
|
+
placeholder: "התחיל להקליד, או לחץ על '/' עבור פקודות ...",
|
|
49
|
+
slashMenuBasicGroupLabel: 'בסיסי',
|
|
50
|
+
slashMenuListGroupLabel: 'רשימות'
|
|
51
|
+
},
|
|
52
|
+
hr: {
|
|
53
|
+
placeholder: "Počnite tipkati, ili pritisnite '/' za naredbe...",
|
|
54
|
+
slashMenuBasicGroupLabel: 'Osnovno',
|
|
55
|
+
slashMenuListGroupLabel: 'Popisi'
|
|
56
|
+
},
|
|
57
|
+
hu: {
|
|
58
|
+
placeholder: "Kezdje el gépelni, vagy nyomja meg a '/' billentyűt a parancsokhoz...",
|
|
59
|
+
slashMenuBasicGroupLabel: 'Alapvető',
|
|
60
|
+
slashMenuListGroupLabel: 'Listák'
|
|
61
|
+
},
|
|
62
|
+
it: {
|
|
63
|
+
placeholder: "Inizia a digitare, oppure premi '/' per i comandi...",
|
|
64
|
+
slashMenuBasicGroupLabel: 'Base',
|
|
65
|
+
slashMenuListGroupLabel: 'Elenchi'
|
|
66
|
+
},
|
|
67
|
+
ja: {
|
|
68
|
+
placeholder: "入力を開始するか、コマンドのために'/'を押してください…",
|
|
69
|
+
slashMenuBasicGroupLabel: '基本的な',
|
|
70
|
+
slashMenuListGroupLabel: 'リスト'
|
|
71
|
+
},
|
|
72
|
+
ko: {
|
|
73
|
+
placeholder: "타이핑을 시작하거나, 명령어를 입력하려면 '/'를 누르세요...",
|
|
74
|
+
slashMenuBasicGroupLabel: '기본적인',
|
|
75
|
+
slashMenuListGroupLabel: '목록'
|
|
76
|
+
},
|
|
77
|
+
my: {
|
|
78
|
+
placeholder: "Mula menaip, atau tekan '/' untuk arahan...",
|
|
79
|
+
slashMenuBasicGroupLabel: 'အခြေခံ',
|
|
80
|
+
slashMenuListGroupLabel: 'Senarai'
|
|
81
|
+
},
|
|
82
|
+
nb: {
|
|
83
|
+
placeholder: "Begynn å skrive, eller trykk '/' for kommandoer...",
|
|
84
|
+
slashMenuBasicGroupLabel: 'Grunnleggende',
|
|
85
|
+
slashMenuListGroupLabel: 'Lister'
|
|
86
|
+
},
|
|
87
|
+
nl: {
|
|
88
|
+
placeholder: "Begin met typen, of druk op '/' voor opdrachten...",
|
|
89
|
+
slashMenuBasicGroupLabel: 'Basis',
|
|
90
|
+
slashMenuListGroupLabel: 'Lijsten'
|
|
91
|
+
},
|
|
92
|
+
pl: {
|
|
93
|
+
placeholder: "Rozpocznij pisanie lub naciśnij '/' dla poleceń...",
|
|
94
|
+
slashMenuBasicGroupLabel: 'Podstawowy',
|
|
95
|
+
slashMenuListGroupLabel: 'Listy'
|
|
96
|
+
},
|
|
97
|
+
pt: {
|
|
98
|
+
placeholder: "Comece a digitar, ou pressione '/' para comandos...",
|
|
99
|
+
slashMenuBasicGroupLabel: 'Básico',
|
|
100
|
+
slashMenuListGroupLabel: 'Listas'
|
|
101
|
+
},
|
|
102
|
+
ro: {
|
|
103
|
+
placeholder: "Începeți să tastați sau apăsați '/' pentru comenzi...",
|
|
104
|
+
slashMenuBasicGroupLabel: 'De bază',
|
|
105
|
+
slashMenuListGroupLabel: 'Liste'
|
|
106
|
+
},
|
|
107
|
+
rs: {
|
|
108
|
+
placeholder: "Počnite da kucate, ili pritisnite '/' za komande...",
|
|
109
|
+
slashMenuBasicGroupLabel: 'Osnovno',
|
|
110
|
+
slashMenuListGroupLabel: 'Liste'
|
|
111
|
+
},
|
|
112
|
+
'rs-latin': {
|
|
113
|
+
placeholder: "Počnite da kucate, ili pritisnite '/' za komande...",
|
|
114
|
+
slashMenuBasicGroupLabel: 'Osnovno',
|
|
115
|
+
slashMenuListGroupLabel: 'Liste'
|
|
116
|
+
},
|
|
117
|
+
ru: {
|
|
118
|
+
placeholder: "Начните печатать или нажмите '/' для команд...",
|
|
119
|
+
slashMenuBasicGroupLabel: 'Базовый',
|
|
120
|
+
slashMenuListGroupLabel: 'Списки'
|
|
121
|
+
},
|
|
122
|
+
sk: {
|
|
123
|
+
placeholder: "Začnite písať alebo stlačte '/' pre príkazy...",
|
|
124
|
+
slashMenuBasicGroupLabel: 'Základný',
|
|
125
|
+
slashMenuListGroupLabel: 'Zoznamy'
|
|
126
|
+
},
|
|
127
|
+
sv: {
|
|
128
|
+
placeholder: "Börja skriva, eller tryck på '/' för kommandon...",
|
|
129
|
+
slashMenuBasicGroupLabel: 'Grundläggande',
|
|
130
|
+
slashMenuListGroupLabel: 'Listor'
|
|
131
|
+
},
|
|
132
|
+
th: {
|
|
133
|
+
placeholder: "เริ่มพิมพ์หรือกด '/' สำหรับคำสั่ง...",
|
|
134
|
+
slashMenuBasicGroupLabel: 'พื้นฐาน',
|
|
135
|
+
slashMenuListGroupLabel: 'รายการ'
|
|
136
|
+
},
|
|
137
|
+
tr: {
|
|
138
|
+
placeholder: "Yazmaya başlayın veya komutlar için '/' tuşuna basın...",
|
|
139
|
+
slashMenuBasicGroupLabel: 'Temel',
|
|
140
|
+
slashMenuListGroupLabel: 'Listeler'
|
|
141
|
+
},
|
|
142
|
+
uk: {
|
|
143
|
+
placeholder: "Почніть друкувати, або натисніть '/' для команд...",
|
|
144
|
+
slashMenuBasicGroupLabel: 'Базовий',
|
|
145
|
+
slashMenuListGroupLabel: 'Списки'
|
|
146
|
+
},
|
|
147
|
+
vi: {
|
|
148
|
+
placeholder: "Bắt đầu gõ, hoặc nhấn '/' để gọi lệnh...",
|
|
149
|
+
slashMenuBasicGroupLabel: 'Cơ bản',
|
|
150
|
+
slashMenuListGroupLabel: 'Danh sách'
|
|
151
|
+
},
|
|
152
|
+
zh: {
|
|
153
|
+
placeholder: "开始输入,或按'/'进行命令...",
|
|
154
|
+
slashMenuBasicGroupLabel: '基础',
|
|
155
|
+
slashMenuListGroupLabel: '列表'
|
|
156
|
+
},
|
|
157
|
+
'zh-TW': {
|
|
158
|
+
placeholder: "開始輸入,或按'/'以使用命令...",
|
|
159
|
+
slashMenuBasicGroupLabel: '基本的',
|
|
160
|
+
slashMenuListGroupLabel: '清單'
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
//# sourceMappingURL=i18n.js.map
|
package/dist/i18n.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/i18n.ts"],"sourcesContent":["import type { GenericLanguages } from '@payloadcms/translations'\n\nexport const i18n: Partial<GenericLanguages> = {\n ar: {\n placeholder: \"ابدأ بالكتابة، أو اضغط على '/' للأوامر ...\",\n slashMenuBasicGroupLabel: 'أساسي',\n slashMenuListGroupLabel: 'قوائم',\n },\n az: {\n placeholder: \"Yazmağa başlayın və ya əmrlər üçün '/' düyməsini basın...\",\n slashMenuBasicGroupLabel: 'Əsas',\n slashMenuListGroupLabel: 'Siyahılar',\n },\n bg: {\n placeholder: \"Започнете да пишете или натиснете '/' за команди...\",\n slashMenuBasicGroupLabel: 'Основен',\n slashMenuListGroupLabel: 'Списъци',\n },\n cs: {\n placeholder: \"Začněte psát nebo stiskněte '/' pro příkazy...\",\n slashMenuBasicGroupLabel: 'Základní',\n slashMenuListGroupLabel: 'Seznamy',\n },\n de: {\n placeholder: \"Beginne zu tippen oder drücke '/' für Befehle...\",\n slashMenuBasicGroupLabel: 'Basis',\n slashMenuListGroupLabel: 'Listen',\n },\n en: {\n placeholder: \"Start typing, or press '/' for commands...\",\n slashMenuBasicGroupLabel: 'Basic',\n slashMenuListGroupLabel: 'Lists',\n },\n es: {\n placeholder: \"Comience a escribir, o presione '/' para comandos...\",\n slashMenuBasicGroupLabel: 'Básico',\n slashMenuListGroupLabel: 'Listas',\n },\n fa: {\n placeholder: \"شروع به تایپ کنید، یا برای دستورات '/' را فشار دهید ...\",\n slashMenuBasicGroupLabel: 'پایه',\n slashMenuListGroupLabel: 'لیست ها',\n },\n fr: {\n placeholder: \"Commencez à taper, ou appuyez sur '/' pour les commandes...\",\n slashMenuBasicGroupLabel: 'De base',\n slashMenuListGroupLabel: 'Listes',\n },\n he: {\n placeholder: \"התחיל להקליד, או לחץ על '/' עבור פקודות ...\",\n slashMenuBasicGroupLabel: 'בסיסי',\n slashMenuListGroupLabel: 'רשימות',\n },\n hr: {\n placeholder: \"Počnite tipkati, ili pritisnite '/' za naredbe...\",\n slashMenuBasicGroupLabel: 'Osnovno',\n slashMenuListGroupLabel: 'Popisi',\n },\n hu: {\n placeholder: \"Kezdje el gépelni, vagy nyomja meg a '/' billentyűt a parancsokhoz...\",\n slashMenuBasicGroupLabel: 'Alapvető',\n slashMenuListGroupLabel: 'Listák',\n },\n it: {\n placeholder: \"Inizia a digitare, oppure premi '/' per i comandi...\",\n slashMenuBasicGroupLabel: 'Base',\n slashMenuListGroupLabel: 'Elenchi',\n },\n ja: {\n placeholder: \"入力を開始するか、コマンドのために'/'を押してください…\",\n slashMenuBasicGroupLabel: '基本的な',\n slashMenuListGroupLabel: 'リスト',\n },\n ko: {\n placeholder: \"타이핑을 시작하거나, 명령어를 입력하려면 '/'를 누르세요...\",\n slashMenuBasicGroupLabel: '기본적인',\n slashMenuListGroupLabel: '목록',\n },\n my: {\n placeholder: \"Mula menaip, atau tekan '/' untuk arahan...\",\n slashMenuBasicGroupLabel: 'အခြေခံ',\n slashMenuListGroupLabel: 'Senarai',\n },\n nb: {\n placeholder: \"Begynn å skrive, eller trykk '/' for kommandoer...\",\n slashMenuBasicGroupLabel: 'Grunnleggende',\n slashMenuListGroupLabel: 'Lister',\n },\n nl: {\n placeholder: \"Begin met typen, of druk op '/' voor opdrachten...\",\n slashMenuBasicGroupLabel: 'Basis',\n slashMenuListGroupLabel: 'Lijsten',\n },\n pl: {\n placeholder: \"Rozpocznij pisanie lub naciśnij '/' dla poleceń...\",\n slashMenuBasicGroupLabel: 'Podstawowy',\n slashMenuListGroupLabel: 'Listy',\n },\n pt: {\n placeholder: \"Comece a digitar, ou pressione '/' para comandos...\",\n slashMenuBasicGroupLabel: 'Básico',\n slashMenuListGroupLabel: 'Listas',\n },\n ro: {\n placeholder: \"Începeți să tastați sau apăsați '/' pentru comenzi...\",\n slashMenuBasicGroupLabel: 'De bază',\n slashMenuListGroupLabel: 'Liste',\n },\n rs: {\n placeholder: \"Počnite da kucate, ili pritisnite '/' za komande...\",\n slashMenuBasicGroupLabel: 'Osnovno',\n slashMenuListGroupLabel: 'Liste',\n },\n 'rs-latin': {\n placeholder: \"Počnite da kucate, ili pritisnite '/' za komande...\",\n slashMenuBasicGroupLabel: 'Osnovno',\n slashMenuListGroupLabel: 'Liste',\n },\n ru: {\n placeholder: \"Начните печатать или нажмите '/' для команд...\",\n slashMenuBasicGroupLabel: 'Базовый',\n slashMenuListGroupLabel: 'Списки',\n },\n sk: {\n placeholder: \"Začnite písať alebo stlačte '/' pre príkazy...\",\n slashMenuBasicGroupLabel: 'Základný',\n slashMenuListGroupLabel: 'Zoznamy',\n },\n sv: {\n placeholder: \"Börja skriva, eller tryck på '/' för kommandon...\",\n slashMenuBasicGroupLabel: 'Grundläggande',\n slashMenuListGroupLabel: 'Listor',\n },\n th: {\n placeholder: \"เริ่มพิมพ์หรือกด '/' สำหรับคำสั่ง...\",\n slashMenuBasicGroupLabel: 'พื้นฐาน',\n slashMenuListGroupLabel: 'รายการ',\n },\n tr: {\n placeholder: \"Yazmaya başlayın veya komutlar için '/' tuşuna basın...\",\n slashMenuBasicGroupLabel: 'Temel',\n slashMenuListGroupLabel: 'Listeler',\n },\n uk: {\n placeholder: \"Почніть друкувати, або натисніть '/' для команд...\",\n slashMenuBasicGroupLabel: 'Базовий',\n slashMenuListGroupLabel: 'Списки',\n },\n vi: {\n placeholder: \"Bắt đầu gõ, hoặc nhấn '/' để gọi lệnh...\",\n slashMenuBasicGroupLabel: 'Cơ bản',\n slashMenuListGroupLabel: 'Danh sách',\n },\n zh: {\n placeholder: \"开始输入,或按'/'进行命令...\",\n slashMenuBasicGroupLabel: '基础',\n slashMenuListGroupLabel: '列表',\n },\n 'zh-TW': {\n placeholder: \"開始輸入,或按'/'以使用命令...\",\n slashMenuBasicGroupLabel: '基本的',\n slashMenuListGroupLabel: '清單',\n },\n}\n"],"names":["i18n","ar","placeholder","slashMenuBasicGroupLabel","slashMenuListGroupLabel","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,aAAa;QACbC,0BAA0B;QAC1BC,yBAAyB;IAC3B;IACAC,IAAI;QACFH,aAAa;QACbC,0BAA0B;QAC1BC,yBAAyB;IAC3B;IACAE,IAAI;QACFJ,aAAa;QACbC,0BAA0B;QAC1BC,yBAAyB;IAC3B;IACAG,IAAI;QACFL,aAAa;QACbC,0BAA0B;QAC1BC,yBAAyB;IAC3B;IACAI,IAAI;QACFN,aAAa;QACbC,0BAA0B;QAC1BC,yBAAyB;IAC3B;IACAK,IAAI;QACFP,aAAa;QACbC,0BAA0B;QAC1BC,yBAAyB;IAC3B;IACAM,IAAI;QACFR,aAAa;QACbC,0BAA0B;QAC1BC,yBAAyB;IAC3B;IACAO,IAAI;QACFT,aAAa;QACbC,0BAA0B;QAC1BC,yBAAyB;IAC3B;IACAQ,IAAI;QACFV,aAAa;QACbC,0BAA0B;QAC1BC,yBAAyB;IAC3B;IACAS,IAAI;QACFX,aAAa;QACbC,0BAA0B;QAC1BC,yBAAyB;IAC3B;IACAU,IAAI;QACFZ,aAAa;QACbC,0BAA0B;QAC1BC,yBAAyB;IAC3B;IACAW,IAAI;QACFb,aAAa;QACbC,0BAA0B;QAC1BC,yBAAyB;IAC3B;IACAY,IAAI;QACFd,aAAa;QACbC,0BAA0B;QAC1BC,yBAAyB;IAC3B;IACAa,IAAI;QACFf,aAAa;QACbC,0BAA0B;QAC1BC,yBAAyB;IAC3B;IACAc,IAAI;Q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d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAElB,8BAA8B,EAC/B,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAElB,8BAA8B,EAC/B,MAAM,YAAY,CAAA;AAsBnB,wBAAgB,aAAa,CAAC,KAAK,CAAC,EAAE,kBAAkB,GAAG,8BAA8B,CAgTxF;AAED,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAA;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAA;AACjF,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,2CAA2C,CAAA;AAClG,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,KAAK,WAAW,EAChB,SAAS,EACT,KAAK,mBAAmB,GACzB,MAAM,6CAA6C,CAAA;AAEpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oEAAoE,CAAA;AAC3G,OAAO,EAAE,sBAAsB,EAAE,MAAM,oEAAoE,CAAA;AAC3G,OAAO,EAAE,iBAAiB,EAAE,MAAM,+DAA+D,CAAA;AAEjG,OAAO,EAAE,qBAAqB,EAAE,MAAM,iEAAiE,CAAA;AACvG,OAAO,EACL,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,qDAAqD,CAAA;AAC5D,YAAY,EAAE,aAAa,EAAE,MAAM,qDAAqD,CAAA;AACxF,OAAO,EACL,oBAAoB,EACpB,KAAK,yBAAyB,GAC/B,MAAM,oDAAoD,CAAA;AAC3D,OAAO,EACL,yBAAyB,EACzB,WAAW,GACZ,MAAM,iDAAiD,CAAA;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAA;AAC3F,OAAO,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAA;AACnF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
8
8
|
import { cloneDeep } from './field/lexical/utils/cloneDeep.js';
|
|
9
9
|
import { getGenerateComponentMap } from './generateComponentMap.js';
|
|
10
10
|
import { getGenerateSchemaMap } from './generateSchemaMap.js';
|
|
11
|
+
import { i18n } from './i18n.js';
|
|
11
12
|
import { populateLexicalPopulationPromises } from './populate/populateLexicalPopulationPromises.js';
|
|
12
13
|
import { richTextValidateHOC } from './validate/index.js';
|
|
13
14
|
let defaultSanitizedServerEditorConfig = null;
|
|
@@ -52,6 +53,15 @@ export function lexicalEditor(props) {
|
|
|
52
53
|
resolvedFeatureMap
|
|
53
54
|
};
|
|
54
55
|
}
|
|
56
|
+
const featureI18n = finalSanitizedEditorConfig.features.i18n;
|
|
57
|
+
for(const lang in i18n){
|
|
58
|
+
if (!featureI18n[lang]) {
|
|
59
|
+
featureI18n[lang] = {
|
|
60
|
+
lexical: {}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
featureI18n[lang].lexical.general = i18n[lang];
|
|
64
|
+
}
|
|
55
65
|
return {
|
|
56
66
|
CellComponent: withMergedProps({
|
|
57
67
|
Component: RichTextCell,
|
|
@@ -75,6 +85,7 @@ export function lexicalEditor(props) {
|
|
|
75
85
|
generateSchemaMap: getGenerateSchemaMap({
|
|
76
86
|
resolvedFeatureMap
|
|
77
87
|
}),
|
|
88
|
+
i18n: featureI18n,
|
|
78
89
|
/* hooks: {
|
|
79
90
|
afterChange: finalSanitizedEditorConfig.features.hooks.afterChange,
|
|
80
91
|
afterRead: finalSanitizedEditorConfig.features.hooks.afterRead,
|