@payloadcms/richtext-lexical 3.0.0-beta.65 → 3.0.0-beta.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/exports/client/Field-6VQ73D3D.js +2 -0
- package/dist/exports/client/Field-6VQ73D3D.js.map +7 -0
- package/dist/exports/client/RelationshipComponent-FFJCVTWM.js +2 -0
- package/dist/exports/client/RelationshipComponent-FFJCVTWM.js.map +7 -0
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/chunk-EBB2CEB6.js +2 -0
- package/dist/exports/client/chunk-EBB2CEB6.js.map +7 -0
- package/dist/exports/client/{chunk-LGMNC5KQ.js → chunk-HO42U3IJ.js} +2 -2
- package/dist/exports/client/chunk-JELGBZLY.js +2 -0
- package/dist/exports/client/chunk-JELGBZLY.js.map +7 -0
- package/dist/exports/client/component-TYPMHBL7.js +2 -0
- package/dist/exports/client/component-TYPMHBL7.js.map +7 -0
- package/dist/exports/client/componentInline-FQNXWTOE.js +2 -0
- package/dist/exports/client/componentInline-FQNXWTOE.js.map +7 -0
- package/dist/exports/client/index.js +7 -7
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/blocks/component/BlockContent.d.ts +3 -2
- package/dist/features/blocks/component/BlockContent.d.ts.map +1 -1
- package/dist/features/blocks/component/BlockContent.js +5 -2
- package/dist/features/blocks/component/BlockContent.js.map +1 -1
- package/dist/features/blocks/component/index.d.ts +0 -4
- package/dist/features/blocks/component/index.d.ts.map +1 -1
- package/dist/features/blocks/component/index.js +6 -2
- package/dist/features/blocks/component/index.js.map +1 -1
- package/dist/features/blocks/componentInline/index.d.ts +10 -0
- package/dist/features/blocks/componentInline/index.d.ts.map +1 -0
- package/dist/features/blocks/componentInline/index.js +133 -0
- package/dist/features/blocks/componentInline/index.js.map +1 -0
- package/dist/features/blocks/feature.client.d.ts +6 -1
- package/dist/features/blocks/feature.client.d.ts.map +1 -1
- package/dist/features/blocks/feature.client.js +70 -8
- package/dist/features/blocks/feature.client.js.map +1 -1
- package/dist/features/blocks/feature.server.d.ts +2 -1
- package/dist/features/blocks/feature.server.d.ts.map +1 -1
- package/dist/features/blocks/feature.server.js +99 -34
- package/dist/features/blocks/feature.server.js.map +1 -1
- package/dist/features/blocks/graphQLPopulationPromise.d.ts +3 -2
- package/dist/features/blocks/graphQLPopulationPromise.d.ts.map +1 -1
- package/dist/features/blocks/graphQLPopulationPromise.js +2 -2
- package/dist/features/blocks/graphQLPopulationPromise.js.map +1 -1
- package/dist/features/blocks/i18n.d.ts.map +1 -1
- package/dist/features/blocks/i18n.js +192 -0
- package/dist/features/blocks/i18n.js.map +1 -1
- package/dist/features/blocks/nodes/BlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/nodes/BlocksNode.js +0 -1
- package/dist/features/blocks/nodes/BlocksNode.js.map +1 -1
- package/dist/features/blocks/nodes/InlineBlocksNode.d.ts +39 -0
- package/dist/features/blocks/nodes/InlineBlocksNode.d.ts.map +1 -0
- package/dist/features/blocks/nodes/InlineBlocksNode.js +93 -0
- package/dist/features/blocks/nodes/InlineBlocksNode.js.map +1 -0
- package/dist/features/blocks/plugin/commands.d.ts +5 -0
- package/dist/features/blocks/plugin/commands.d.ts.map +1 -1
- package/dist/features/blocks/plugin/commands.js +2 -0
- package/dist/features/blocks/plugin/commands.js.map +1 -1
- package/dist/features/blocks/plugin/index.d.ts.map +1 -1
- package/dist/features/blocks/plugin/index.js +76 -7
- package/dist/features/blocks/plugin/index.js.map +1 -1
- package/dist/features/blocks/validate.d.ts +3 -2
- package/dist/features/blocks/validate.d.ts.map +1 -1
- package/dist/features/blocks/validate.js +2 -2
- package/dist/features/blocks/validate.js.map +1 -1
- package/dist/features/relationship/nodes/components/RelationshipComponent.d.ts +0 -1
- package/dist/features/relationship/nodes/components/RelationshipComponent.d.ts.map +1 -1
- package/dist/features/relationship/nodes/components/RelationshipComponent.js +2 -3
- package/dist/features/relationship/nodes/components/RelationshipComponent.js.map +1 -1
- package/dist/field/index.js +8 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lexical/LexicalProvider.js +2 -2
- package/dist/lexical/LexicalProvider.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts +4 -4
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts +0 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +1 -20
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts +2 -2
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/index.d.ts.map +1 -1
- package/dist/lexical/plugins/SlashMenu/index.js +43 -41
- package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
- package/dist/lexical/ui/icons/InlineBlocks/index.d.ts +3 -0
- package/dist/lexical/ui/icons/InlineBlocks/index.d.ts.map +1 -0
- package/dist/lexical/ui/icons/InlineBlocks/index.js +20 -0
- package/dist/lexical/ui/icons/InlineBlocks/index.js.map +1 -0
- package/package.json +9 -9
- package/dist/exports/client/Field-5KHQLTCU.js +0 -2
- package/dist/exports/client/Field-5KHQLTCU.js.map +0 -7
- package/dist/exports/client/RelationshipComponent-EJB6LBDR.js +0 -2
- package/dist/exports/client/RelationshipComponent-EJB6LBDR.js.map +0 -7
- package/dist/exports/client/chunk-SVDDFJRT.js +0 -2
- package/dist/exports/client/chunk-SVDDFJRT.js.map +0 -7
- package/dist/exports/client/component-Z5R2PHH3.js +0 -2
- package/dist/exports/client/component-Z5R2PHH3.js.map +0 -7
- package/dist/features/blocks/drawer/index.d.ts +0 -9
- package/dist/features/blocks/drawer/index.d.ts.map +0 -1
- package/dist/features/blocks/drawer/index.js +0 -78
- package/dist/features/blocks/drawer/index.js.map +0 -1
- /package/dist/exports/client/{chunk-LGMNC5KQ.js.map → chunk-HO42U3IJ.js.map} +0 -0
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
|
|
4
|
-
import { BlocksDrawer, formatDrawerSlug, useEditDepth, useModal, useTranslation } from '@payloadcms/ui';
|
|
5
|
-
import { $getNodeByKey, COMMAND_PRIORITY_EDITOR, createCommand } from 'lexical';
|
|
6
|
-
import React, { useCallback, useEffect, useState } from 'react';
|
|
7
|
-
import { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js';
|
|
8
|
-
import { $createBlockNode } from '../nodes/BlocksNode.js';
|
|
9
|
-
import { INSERT_BLOCK_COMMAND } from '../plugin/commands.js';
|
|
10
|
-
const baseClass = 'lexical-blocks-drawer';
|
|
11
|
-
export const INSERT_BLOCK_WITH_DRAWER_COMMAND = createCommand('INSERT_BLOCK_WITH_DRAWER_COMMAND');
|
|
12
|
-
const insertBlock = ({ blockType, editor, replaceNodeKey })=>{
|
|
13
|
-
if (!replaceNodeKey) {
|
|
14
|
-
editor.dispatchCommand(INSERT_BLOCK_COMMAND, {
|
|
15
|
-
id: null,
|
|
16
|
-
blockName: '',
|
|
17
|
-
blockType
|
|
18
|
-
});
|
|
19
|
-
} else {
|
|
20
|
-
editor.update(()=>{
|
|
21
|
-
const node = $getNodeByKey(replaceNodeKey);
|
|
22
|
-
if (node) {
|
|
23
|
-
node.replace($createBlockNode({
|
|
24
|
-
id: null,
|
|
25
|
-
blockName: '',
|
|
26
|
-
blockType
|
|
27
|
-
}));
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
export const BlocksDrawerComponent = ()=>{
|
|
33
|
-
const [editor] = useLexicalComposerContext();
|
|
34
|
-
const { editorConfig, uuid } = useEditorConfigContext();
|
|
35
|
-
const [replaceNodeKey, setReplaceNodeKey] = useState(null);
|
|
36
|
-
const editDepth = useEditDepth();
|
|
37
|
-
const { t } = useTranslation();
|
|
38
|
-
const { openModal } = useModal();
|
|
39
|
-
const labels = {
|
|
40
|
-
plural: t('fields:blocks') || 'Blocks',
|
|
41
|
-
singular: t('fields:block') || 'Block'
|
|
42
|
-
};
|
|
43
|
-
const addRow = useCallback((rowIndex, blockType)=>{
|
|
44
|
-
insertBlock({
|
|
45
|
-
blockType,
|
|
46
|
-
editor,
|
|
47
|
-
replaceNodeKey
|
|
48
|
-
});
|
|
49
|
-
}, [
|
|
50
|
-
editor,
|
|
51
|
-
replaceNodeKey
|
|
52
|
-
]);
|
|
53
|
-
const drawerSlug = formatDrawerSlug({
|
|
54
|
-
slug: `lexical-rich-text-blocks-` + uuid,
|
|
55
|
-
depth: editDepth
|
|
56
|
-
});
|
|
57
|
-
const reducedBlocks = editorConfig?.resolvedFeatureMap?.get('blocks')?.sanitizedClientFeatureProps?.reducedBlocks;
|
|
58
|
-
useEffect(()=>{
|
|
59
|
-
return editor.registerCommand(INSERT_BLOCK_WITH_DRAWER_COMMAND, (payload)=>{
|
|
60
|
-
setReplaceNodeKey(payload?.replace ? payload?.replace.nodeKey : null);
|
|
61
|
-
openModal(drawerSlug);
|
|
62
|
-
return true;
|
|
63
|
-
}, COMMAND_PRIORITY_EDITOR);
|
|
64
|
-
}, [
|
|
65
|
-
editor,
|
|
66
|
-
drawerSlug,
|
|
67
|
-
openModal
|
|
68
|
-
]);
|
|
69
|
-
return /*#__PURE__*/ _jsx(BlocksDrawer, {
|
|
70
|
-
addRow: addRow,
|
|
71
|
-
addRowIndex: 0,
|
|
72
|
-
blocks: reducedBlocks,
|
|
73
|
-
drawerSlug: drawerSlug,
|
|
74
|
-
labels: labels
|
|
75
|
-
});
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/features/blocks/drawer/index.tsx"],"sourcesContent":["'use client'\nimport type { LexicalCommand, LexicalEditor } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport {\n BlocksDrawer,\n formatDrawerSlug,\n useEditDepth,\n useModal,\n useTranslation,\n} from '@payloadcms/ui'\nimport { $getNodeByKey, COMMAND_PRIORITY_EDITOR, createCommand } from 'lexical'\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport type { ClientComponentProps } from '../../typesClient.js'\nimport type { BlocksFeatureClientProps } from '../feature.client.js'\n\nimport { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js'\nimport { $createBlockNode } from '../nodes/BlocksNode.js'\nimport { INSERT_BLOCK_COMMAND } from '../plugin/commands.js'\nconst baseClass = 'lexical-blocks-drawer'\n\nexport const INSERT_BLOCK_WITH_DRAWER_COMMAND: LexicalCommand<{\n replace: { nodeKey: string } | false\n}> = createCommand('INSERT_BLOCK_WITH_DRAWER_COMMAND')\n\nconst insertBlock = ({\n blockType,\n editor,\n replaceNodeKey,\n}: {\n blockType: string\n editor: LexicalEditor\n replaceNodeKey: null | string\n}) => {\n if (!replaceNodeKey) {\n editor.dispatchCommand(INSERT_BLOCK_COMMAND, {\n id: null,\n blockName: '',\n blockType,\n })\n } else {\n editor.update(() => {\n const node = $getNodeByKey(replaceNodeKey)\n if (node) {\n node.replace(\n $createBlockNode({\n id: null,\n blockName: '',\n blockType,\n }),\n )\n }\n })\n }\n}\n\nexport const BlocksDrawerComponent: React.FC = () => {\n const [editor] = useLexicalComposerContext()\n const { editorConfig, uuid } = useEditorConfigContext()\n\n const [replaceNodeKey, setReplaceNodeKey] = useState<null | string>(null)\n const editDepth = useEditDepth()\n const { t } = useTranslation()\n const { openModal } = useModal()\n\n const labels = {\n plural: t('fields:blocks') || 'Blocks',\n singular: t('fields:block') || 'Block',\n }\n\n const addRow = useCallback(\n (rowIndex: number, blockType: string) => {\n insertBlock({\n blockType,\n editor,\n replaceNodeKey,\n })\n },\n [editor, replaceNodeKey],\n )\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-rich-text-blocks-` + uuid,\n depth: editDepth,\n })\n\n const reducedBlocks = (\n editorConfig?.resolvedFeatureMap?.get('blocks')\n ?.sanitizedClientFeatureProps as ClientComponentProps<BlocksFeatureClientProps>\n )?.reducedBlocks\n\n useEffect(() => {\n return editor.registerCommand<{\n replace: { nodeKey: string } | false\n }>(\n INSERT_BLOCK_WITH_DRAWER_COMMAND,\n (payload) => {\n setReplaceNodeKey(payload?.replace ? payload?.replace.nodeKey : null)\n openModal(drawerSlug)\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n )\n }, [editor, drawerSlug, openModal])\n\n return (\n <BlocksDrawer\n addRow={addRow}\n addRowIndex={0}\n blocks={reducedBlocks}\n drawerSlug={drawerSlug}\n labels={labels}\n />\n )\n}\n"],"names":["useLexicalComposerContext","BlocksDrawer","formatDrawerSlug","useEditDepth","useModal","useTranslation","$getNodeByKey","COMMAND_PRIORITY_EDITOR","createCommand","React","useCallback","useEffect","useState","useEditorConfigContext","$createBlockNode","INSERT_BLOCK_COMMAND","baseClass","INSERT_BLOCK_WITH_DRAWER_COMMAND","insertBlock","blockType","editor","replaceNodeKey","dispatchCommand","id","blockName","update","node","replace","BlocksDrawerComponent","editorConfig","uuid","setReplaceNodeKey","editDepth","t","openModal","labels","plural","singular","addRow","rowIndex","drawerSlug","slug","depth","reducedBlocks","resolvedFeatureMap","get","sanitizedClientFeatureProps","registerCommand","payload","nodeKey","addRowIndex","blocks"],"mappings":"AAAA;;AAGA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SACEC,YAAY,EACZC,gBAAgB,EAChBC,YAAY,EACZC,QAAQ,EACRC,cAAc,QACT,iBAAgB;AACvB,SAASC,aAAa,EAAEC,uBAAuB,EAAEC,aAAa,QAAQ,UAAS;AAC/E,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAK/D,SAASC,sBAAsB,QAAQ,yDAAwD;AAC/F,SAASC,gBAAgB,QAAQ,yBAAwB;AACzD,SAASC,oBAAoB,QAAQ,wBAAuB;AAC5D,MAAMC,YAAY;AAElB,OAAO,MAAMC,mCAERT,cAAc,oCAAmC;AAEtD,MAAMU,cAAc,CAAC,EACnBC,SAAS,EACTC,MAAM,EACNC,cAAc,EAKf;IACC,IAAI,CAACA,gBAAgB;QACnBD,OAAOE,eAAe,CAACP,sBAAsB;YAC3CQ,IAAI;YACJC,WAAW;YACXL;QACF;IACF,OAAO;QACLC,OAAOK,MAAM,CAAC;YACZ,MAAMC,OAAOpB,cAAce;YAC3B,IAAIK,MAAM;gBACRA,KAAKC,OAAO,CACVb,iBAAiB;oBACfS,IAAI;oBACJC,WAAW;oBACXL;gBACF;YAEJ;QACF;IACF;AACF;AAEA,OAAO,MAAMS,wBAAkC;IAC7C,MAAM,CAACR,OAAO,GAAGpB;IACjB,MAAM,EAAE6B,YAAY,EAAEC,IAAI,EAAE,GAAGjB;IAE/B,MAAM,CAACQ,gBAAgBU,kBAAkB,GAAGnB,SAAwB;IACpE,MAAMoB,YAAY7B;IAClB,MAAM,EAAE8B,CAAC,EAAE,GAAG5B;IACd,MAAM,EAAE6B,SAAS,EAAE,GAAG9B;IAEtB,MAAM+B,SAAS;QACbC,QAAQH,EAAE,oBAAoB;QAC9BI,UAAUJ,EAAE,mBAAmB;IACjC;IAEA,MAAMK,SAAS5B,YACb,CAAC6B,UAAkBpB;QACjBD,YAAY;YACVC;YACAC;YACAC;QACF;IACF,GACA;QAACD;QAAQC;KAAe;IAG1B,MAAMmB,aAAatC,iBAAiB;QAClCuC,MAAM,CAAC,yBAAyB,CAAC,GAAGX;QACpCY,OAAOV;IACT;IAEA,MAAMW,gBACJd,cAAce,oBAAoBC,IAAI,WAClCC,6BACHH;IAEHhC,UAAU;QACR,OAAOS,OAAO2B,eAAe,CAG3B9B,kCACA,CAAC+B;YACCjB,kBAAkBiB,SAASrB,UAAUqB,SAASrB,QAAQsB,UAAU;YAChEf,UAAUM;YACV,OAAO;QACT,GACAjC;IAEJ,GAAG;QAACa;QAAQoB;QAAYN;KAAU;IAElC,qBACE,KAACjC;QACCqC,QAAQA;QACRY,aAAa;QACbC,QAAQR;QACRH,YAAYA;QACZL,QAAQA;;AAGd,EAAC"}
|
|
File without changes
|