@payloadcms/richtext-lexical 3.60.0-canary.0 → 3.60.0-internal.40d58c0
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/RelationshipComponent-JXQOFHXF.js +2 -0
- package/dist/exports/client/RelationshipComponent-JXQOFHXF.js.map +7 -0
- package/dist/exports/client/{chunk-XNERFY6G.js → chunk-IBFFIWII.js} +2 -2
- package/dist/exports/client/{chunk-XNERFY6G.js.map → chunk-IBFFIWII.js.map} +2 -2
- package/dist/exports/client/chunk-O6XRT2H3.js +2 -0
- package/dist/exports/client/{chunk-BQCXN3B4.js.map → chunk-O6XRT2H3.js.map} +4 -4
- package/dist/exports/client/component-WT25HAJA.js +2 -0
- package/dist/exports/client/component-WT25HAJA.js.map +7 -0
- package/dist/exports/client/componentInline-ZHQ2OTFH.js +2 -0
- package/dist/exports/client/index.d.ts +1 -1
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +22 -22
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/blocks/premade/CodeBlock/index.d.ts +3 -1
- package/dist/features/blocks/premade/CodeBlock/index.d.ts.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/index.js +7 -2
- package/dist/features/blocks/premade/CodeBlock/index.js.map +1 -1
- package/dist/features/blocks/server/nodes/BlocksNode.d.ts +2 -3
- package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
- package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +2 -3
- package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
- package/dist/features/heading/server/index.d.ts +1 -1
- package/dist/features/heading/server/index.d.ts.map +1 -1
- package/dist/features/heading/server/index.js.map +1 -1
- package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +2 -3
- package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
- package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
- package/dist/features/relationship/client/components/RelationshipComponent.d.ts +1 -1
- package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
- package/dist/features/relationship/client/components/RelationshipComponent.js +1 -6
- package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
- package/dist/features/relationship/client/drawer/index.d.ts +3 -2
- package/dist/features/relationship/client/drawer/index.d.ts.map +1 -1
- package/dist/features/relationship/client/drawer/index.js +72 -59
- package/dist/features/relationship/client/drawer/index.js.map +1 -1
- package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
- package/dist/features/relationship/client/plugins/index.js +41 -49
- package/dist/features/relationship/client/plugins/index.js.map +1 -1
- package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts +13 -0
- package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -0
- package/dist/features/relationship/client/utils/useEnabledRelationships.js +64 -0
- package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -0
- package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +2 -3
- package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
- package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
- package/dist/features/upload/client/component/index.d.ts +1 -1
- package/dist/features/upload/client/component/index.d.ts.map +1 -1
- package/dist/features/upload/client/component/index.js +1 -11
- package/dist/features/upload/client/component/index.js.map +1 -1
- package/dist/features/upload/client/drawer/index.d.ts +3 -2
- package/dist/features/upload/client/drawer/index.d.ts.map +1 -1
- package/dist/features/upload/client/drawer/index.js +8 -9
- package/dist/features/upload/client/drawer/index.js.map +1 -1
- package/dist/features/upload/client/index.d.ts +2 -1
- package/dist/features/upload/client/index.d.ts.map +1 -1
- package/dist/features/upload/client/index.js.map +1 -1
- package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
- package/dist/features/upload/client/plugin/index.js +72 -75
- package/dist/features/upload/client/plugin/index.js.map +1 -1
- package/dist/features/upload/server/index.d.ts +18 -3
- package/dist/features/upload/server/index.d.ts.map +1 -1
- package/dist/features/upload/server/index.js +6 -0
- package/dist/features/upload/server/index.js.map +1 -1
- package/dist/features/upload/server/nodes/UploadNode.d.ts +2 -3
- package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
- package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/nodeTypes.d.ts +23 -14
- package/dist/nodeTypes.d.ts.map +1 -1
- package/dist/nodeTypes.js.map +1 -1
- package/dist/utilities/buildEditorState.d.ts +47 -6
- package/dist/utilities/buildEditorState.d.ts.map +1 -1
- package/dist/utilities/buildEditorState.js +9 -1
- package/dist/utilities/buildEditorState.js.map +1 -1
- package/package.json +6 -6
- package/dist/exports/client/RelationshipComponent-TSIENULZ.js +0 -2
- package/dist/exports/client/RelationshipComponent-TSIENULZ.js.map +0 -7
- package/dist/exports/client/chunk-BQCXN3B4.js +0 -2
- package/dist/exports/client/component-CYFKY3IL.js +0 -2
- package/dist/exports/client/component-CYFKY3IL.js.map +0 -7
- package/dist/exports/client/componentInline-NGTRUSGB.js +0 -2
- package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.d.ts +0 -7
- package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.d.ts.map +0 -1
- package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.js +0 -96
- package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.js.map +0 -1
- /package/dist/exports/client/{componentInline-NGTRUSGB.js.map → componentInline-ZHQ2OTFH.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","$getNodeByKey","COMMAND_PRIORITY_EDITOR","React","useCallback","useEffect","useState","useLexicalListDrawer","$createRelationshipNode","INSERT_RELATIONSHIP_COMMAND","
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","toast","$getNodeByKey","COMMAND_PRIORITY_EDITOR","React","useCallback","useEffect","useState","useLexicalListDrawer","$createRelationshipNode","INSERT_RELATIONSHIP_COMMAND","INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND","insertRelationship","editor","relationTo","replaceNodeKey","value","dispatchCommand","update","node","replace","RelationshipDrawerComponent","t0","$","enabledCollectionSlugs","setReplaceNodeKey","t1","t2","collectionSlugs","selectedCollection","closeListDrawer","ListDrawer","openListDrawer","t3","t4","registerCommand","payload","nodeKey","t5","t6","collectionSlug","doc","id","onSelect","_jsx","RelationshipDrawerComponentFallback","_temp","RelationshipDrawer","length","error"],"sources":["../../../../../src/features/relationship/client/drawer/index.tsx"],"sourcesContent":["'use client'\nimport type { LexicalEditor } from 'lexical'\nimport type { CollectionSlug } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { type ListDrawerProps, toast } from '@payloadcms/ui'\nimport { $getNodeByKey, COMMAND_PRIORITY_EDITOR } from 'lexical'\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport { useLexicalListDrawer } from '../../../../utilities/fieldsDrawer/useLexicalListDrawer.js'\nimport { $createRelationshipNode } from '../nodes/RelationshipNode.js'\nimport { INSERT_RELATIONSHIP_COMMAND } from '../plugins/index.js'\nimport { INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND } from './commands.js'\n\nconst insertRelationship = ({\n editor,\n relationTo,\n replaceNodeKey,\n value,\n}: {\n editor: LexicalEditor\n relationTo: string\n replaceNodeKey: null | string\n value: number | string\n}) => {\n if (!replaceNodeKey) {\n editor.dispatchCommand(INSERT_RELATIONSHIP_COMMAND, {\n relationTo,\n value,\n })\n } else {\n editor.update(() => {\n const node = $getNodeByKey(replaceNodeKey)\n if (node) {\n node.replace($createRelationshipNode({ relationTo, value }))\n }\n })\n }\n}\n\ntype Props = {\n enabledCollectionSlugs: CollectionSlug[]\n}\n\nconst RelationshipDrawerComponent: React.FC<Props> = ({ enabledCollectionSlugs }) => {\n const [editor] = useLexicalComposerContext()\n\n const [replaceNodeKey, setReplaceNodeKey] = useState<null | string>(null)\n\n const { closeListDrawer, ListDrawer, openListDrawer } = useLexicalListDrawer({\n collectionSlugs: enabledCollectionSlugs,\n selectedCollection: enabledCollectionSlugs?.[0],\n })\n\n useEffect(() => {\n return editor.registerCommand<{\n replace: { nodeKey: string } | false\n }>(\n INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND,\n (payload) => {\n setReplaceNodeKey(payload?.replace ? payload?.replace.nodeKey : null)\n openListDrawer()\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n )\n }, [editor, openListDrawer])\n\n const onSelect = useCallback<NonNullable<ListDrawerProps['onSelect']>>(\n ({ collectionSlug, doc }) => {\n insertRelationship({\n editor,\n relationTo: collectionSlug,\n replaceNodeKey,\n value: doc.id,\n })\n closeListDrawer()\n },\n [editor, closeListDrawer, replaceNodeKey],\n )\n\n return <ListDrawer onSelect={onSelect} />\n}\n\nconst RelationshipDrawerComponentFallback: React.FC = () => {\n const [editor] = useLexicalComposerContext()\n\n useEffect(() => {\n return editor.registerCommand<{\n replace: { nodeKey: string } | false\n }>(\n INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND,\n () => {\n toast.error('No relationship collections enabled')\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n )\n }, [editor])\n\n return null\n}\n\nexport const RelationshipDrawer = ({ enabledCollectionSlugs }: Props): React.ReactNode => {\n if (!enabledCollectionSlugs?.length) {\n return <RelationshipDrawerComponentFallback />\n }\n\n return <RelationshipDrawerComponent enabledCollectionSlugs={enabledCollectionSlugs} />\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,SAASC,yBAAyB,QAAQ;AAC1C,SAA+BC,KAAK,QAAQ;AAC5C,SAASC,aAAa,EAAEC,uBAA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AxB,EAAA;EACpD,OAAAc,MAAA,IAAiBb,yBAAA;EAAA,IAAAsB,EAAA;EAAA,IAAAI,EAAA;EAAA,IAAAH,CAAA,QAAAV,MAAA;IAEPS,EAAA,GAAAA,CAAA,KACDT,MAAA,CAAAsB,eAAA,CAAAxB,uCAAA,EAAAmC,KAAA,EAAA3C,uBAQL;IAEDuB,EAAA,IAACb,MAAA;IAAOU,CAAA,MAAAV,MAAA;IAAAU,CAAA,MAAAD,EAAA;IAAAC,CAAA,MAAAG,EAAA;EAAA;IAAAJ,EAAA,GAAAC,CAAA;IAAAG,EAAA,GAAAH,CAAA;EAAA;EAXXjB,SAAA,CAAUgB,EAWV,EAAGI,EAAQ;EAAA;AAAA,CAGb;AAEA,OAAO,MAAMqB,kBAAA,GAAqBA,CAAC;EAAEvB;AAAsB,CAAS;EAClE,IAAI,CAACA,sBAAA,EAAwBwB,MAAA,EAAQ;IACnC,oBAAOJ,IAAA,CAACC,mCAAA;EACV;EAEA,oBAAOD,IAAA,CAACvB,2BAAA;IAA4BG,sBAAA,EAAwBA;;AAC9D;AAzBsD,SAAAsB,MAAA;EAS9C7C,KAAA,CAAAgD,KAAA,CAAY;EAAA;AAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/relationship/client/plugins/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/relationship/client/plugins/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAc7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAA;AAM9E,eAAO,MAAM,2BAA2B,EAAE,cAAc,CAAC,gBAAgB,CAExE,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,eAAe,CAAC,wBAAwB,CAuCxE,CAAA"}
|
|
@@ -4,74 +4,66 @@ import { c as _c } from "react/compiler-runtime";
|
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
5
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
|
|
6
6
|
import { $insertNodeToNearestRoot } from '@lexical/utils';
|
|
7
|
-
import { useConfig } from '@payloadcms/ui';
|
|
8
7
|
import { $getPreviousSelection, $getSelection, $isParagraphNode, $isRangeSelection, COMMAND_PRIORITY_EDITOR, createCommand } from 'lexical';
|
|
9
8
|
import { useEffect } from 'react';
|
|
10
9
|
import { RelationshipDrawer } from '../drawer/index.js';
|
|
11
10
|
import { $createRelationshipNode, RelationshipNode } from '../nodes/RelationshipNode.js';
|
|
11
|
+
import { useEnabledRelationships } from '../utils/useEnabledRelationships.js';
|
|
12
12
|
export const INSERT_RELATIONSHIP_COMMAND = createCommand('INSERT_RELATIONSHIP_COMMAND');
|
|
13
13
|
export const RelationshipPlugin = t0 => {
|
|
14
|
-
const $ = _c(
|
|
14
|
+
const $ = _c(8);
|
|
15
15
|
const {
|
|
16
16
|
clientProps
|
|
17
17
|
} = t0;
|
|
18
18
|
const [editor] = useLexicalComposerContext();
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
const t1 = clientProps?.disabledCollections;
|
|
20
|
+
const t2 = clientProps?.enabledCollections;
|
|
21
|
+
let t3;
|
|
22
|
+
if ($[0] !== t1 || $[1] !== t2) {
|
|
23
|
+
t3 = {
|
|
24
|
+
collectionSlugsBlacklist: t1,
|
|
25
|
+
collectionSlugsWhitelist: t2
|
|
26
|
+
};
|
|
27
|
+
$[0] = t1;
|
|
28
|
+
$[1] = t2;
|
|
29
|
+
$[2] = t3;
|
|
28
30
|
} else {
|
|
29
|
-
|
|
30
|
-
let t2;
|
|
31
|
-
if ($[0] !== clientProps?.disabledCollections) {
|
|
32
|
-
t2 = t3 => {
|
|
33
|
-
const {
|
|
34
|
-
slug
|
|
35
|
-
} = t3;
|
|
36
|
-
return !clientProps?.disabledCollections?.includes(slug);
|
|
37
|
-
};
|
|
38
|
-
$[0] = clientProps?.disabledCollections;
|
|
39
|
-
$[1] = t2;
|
|
40
|
-
} else {
|
|
41
|
-
t2 = $[1];
|
|
42
|
-
}
|
|
43
|
-
enabledRelations = collections.filter(t2).map(_temp);
|
|
44
|
-
}
|
|
31
|
+
t3 = $[2];
|
|
45
32
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
33
|
+
const {
|
|
34
|
+
enabledCollectionSlugs
|
|
35
|
+
} = useEnabledRelationships(t3);
|
|
36
|
+
let t4;
|
|
37
|
+
let t5;
|
|
38
|
+
if ($[3] !== editor) {
|
|
39
|
+
t4 = () => {
|
|
50
40
|
if (!editor.hasNodes([RelationshipNode])) {
|
|
51
41
|
throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");
|
|
52
42
|
}
|
|
53
|
-
return editor.registerCommand(INSERT_RELATIONSHIP_COMMAND,
|
|
43
|
+
return editor.registerCommand(INSERT_RELATIONSHIP_COMMAND, _temp, COMMAND_PRIORITY_EDITOR);
|
|
54
44
|
};
|
|
55
|
-
|
|
56
|
-
$[
|
|
57
|
-
$[
|
|
58
|
-
$[
|
|
45
|
+
t5 = [editor];
|
|
46
|
+
$[3] = editor;
|
|
47
|
+
$[4] = t4;
|
|
48
|
+
$[5] = t5;
|
|
49
|
+
} else {
|
|
50
|
+
t4 = $[4];
|
|
51
|
+
t5 = $[5];
|
|
52
|
+
}
|
|
53
|
+
useEffect(t4, t5);
|
|
54
|
+
let t6;
|
|
55
|
+
if ($[6] !== enabledCollectionSlugs) {
|
|
56
|
+
t6 = _jsx(RelationshipDrawer, {
|
|
57
|
+
enabledCollectionSlugs
|
|
58
|
+
});
|
|
59
|
+
$[6] = enabledCollectionSlugs;
|
|
60
|
+
$[7] = t6;
|
|
59
61
|
} else {
|
|
60
|
-
|
|
61
|
-
t3 = $[4];
|
|
62
|
+
t6 = $[7];
|
|
62
63
|
}
|
|
63
|
-
|
|
64
|
-
return _jsx(RelationshipDrawer, {
|
|
65
|
-
enabledCollectionSlugs: enabledRelations
|
|
66
|
-
});
|
|
64
|
+
return t6;
|
|
67
65
|
};
|
|
68
|
-
function _temp(
|
|
69
|
-
const {
|
|
70
|
-
slug: slug_0
|
|
71
|
-
} = t0;
|
|
72
|
-
return slug_0;
|
|
73
|
-
}
|
|
74
|
-
function _temp2(payload) {
|
|
66
|
+
function _temp(payload) {
|
|
75
67
|
const selection = $getSelection() || $getPreviousSelection();
|
|
76
68
|
if ($isRangeSelection(selection)) {
|
|
77
69
|
const relationshipNode = $createRelationshipNode(payload);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","$insertNodeToNearestRoot","
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","$insertNodeToNearestRoot","$getPreviousSelection","$getSelection","$isParagraphNode","$isRangeSelection","COMMAND_PRIORITY_EDITOR","createCommand","useEffect","RelationshipDrawer","$createRelationshipNode","RelationshipNode","useEnabledRelationships","INSERT_RELATIONSHIP_COMMAND","RelationshipPlugin","t0","$","clientProps","editor","t1","disabledCollections","t2","enabledCollections","t3","collectionSlugsBlacklist","collectionSlugsWhitelist","enabledCollectionSlugs","t4","t5","hasNodes","Error","registerCommand","_temp","t6","_jsx","payload","selection","relationshipNode","focus","focusNode","getNode","__first","remove"],"sources":["../../../../../src/features/relationship/client/plugins/index.tsx"],"sourcesContent":["'use client'\nimport type { LexicalCommand } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { $insertNodeToNearestRoot } from '@lexical/utils'\nimport {\n $getPreviousSelection,\n $getSelection,\n $isParagraphNode,\n $isRangeSelection,\n COMMAND_PRIORITY_EDITOR,\n createCommand,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { PluginComponent } from '../../../typesClient.js'\nimport type { RelationshipFeatureProps } from '../../server/index.js'\nimport type { RelationshipData } from '../../server/nodes/RelationshipNode.js'\n\nimport { RelationshipDrawer } from '../drawer/index.js'\nimport { $createRelationshipNode, RelationshipNode } from '../nodes/RelationshipNode.js'\nimport { useEnabledRelationships } from '../utils/useEnabledRelationships.js'\n\nexport const INSERT_RELATIONSHIP_COMMAND: LexicalCommand<RelationshipData> = createCommand(\n 'INSERT_RELATIONSHIP_COMMAND',\n)\n\nexport const RelationshipPlugin: PluginComponent<RelationshipFeatureProps> = ({ clientProps }) => {\n const [editor] = useLexicalComposerContext()\n\n const { enabledCollectionSlugs } = useEnabledRelationships({\n collectionSlugsBlacklist: clientProps?.disabledCollections,\n collectionSlugsWhitelist: clientProps?.enabledCollections,\n })\n\n useEffect(() => {\n if (!editor.hasNodes([RelationshipNode])) {\n throw new Error('RelationshipPlugin: RelationshipNode not registered on editor')\n }\n\n return editor.registerCommand<RelationshipData>(\n INSERT_RELATIONSHIP_COMMAND,\n (payload) => {\n const selection = $getSelection() || $getPreviousSelection()\n\n if ($isRangeSelection(selection)) {\n const relationshipNode = $createRelationshipNode(payload)\n // we need to get the focus node before inserting the block node, as $insertNodeToNearestRoot can change the focus node\n const { focus } = selection\n const focusNode = focus.getNode()\n // Insert relationship node BEFORE potentially removing focusNode, as $insertNodeToNearestRoot errors if the focusNode doesn't exist\n $insertNodeToNearestRoot(relationshipNode)\n\n // Delete the node it it's an empty paragraph\n if ($isParagraphNode(focusNode) && !focusNode.__first) {\n focusNode.remove()\n }\n }\n\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n )\n }, [editor])\n\n return <RelationshipDrawer enabledCollectionSlugs={enabledCollectionSl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,IAACV,MAAA;IAAOF,CAAA,MAAAE,MAAA;IAAAF,CAAA,MAAAW,EAAA;IAAAX,CAAA,MAAAY,EAAA;EAAA;IAAAD,EAAA,GAAAX,CAAA;IAAAY,EAAA,GAAAZ,CAAA;EAAA;EA5BXR,SAAA,CAAUmB,EA4BV,EAAGC,EAAQ;EAAA,IAAAK,EAAA;EAAA,IAAAjB,CAAA,QAAAU,sBAAA;IAEJO,EAAA,GAAAC,IAAA,CAAAzB,kBAAA;MAAAiB;IAAA,C;;;;;;SAAAO,E;CACT;AAvC6E,SAAAD,MAAAG,OAAA;EAgBrE,MAAAC,SAAA,GAAkBjC,aAAA,MAAmBD,qBAAA;EAAA,IAEjCG,iBAAA,CAAkB+B,SAAA;IACpB,MAAAC,gBAAA,GAAyB3B,uBAAA,CAAwByB,OAAA;IAEjD;MAAAG;IAAA,IAAkBF,SAAA;IAClB,MAAAG,SAAA,GAAkBD,KAAA,CAAAE,OAAA,CAAa;IAE/BvC,wBAAA,CAAyBoC,gBAAA;IAAA,IAGrBjC,gBAAA,CAAiBmC,SAAA,MAAeA,SAAA,CAAAE,OAAiB;MACnDF,SAAA,CAAAG,MAAA,CAAgB;IAAA;EAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ClientCollectionConfig, CollectionSlug } from 'payload';
|
|
2
|
+
type UseEnabledRelationshipsOptions = {
|
|
3
|
+
collectionSlugsBlacklist?: string[];
|
|
4
|
+
collectionSlugsWhitelist?: string[];
|
|
5
|
+
uploads?: boolean;
|
|
6
|
+
};
|
|
7
|
+
type UseEnabledRelationshipsResult = {
|
|
8
|
+
enabledCollections: ClientCollectionConfig[];
|
|
9
|
+
enabledCollectionSlugs: CollectionSlug[];
|
|
10
|
+
};
|
|
11
|
+
export declare const useEnabledRelationships: (options?: UseEnabledRelationshipsOptions) => UseEnabledRelationshipsResult;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=useEnabledRelationships.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEnabledRelationships.d.ts","sourceRoot":"","sources":["../../../../../src/features/relationship/client/utils/useEnabledRelationships.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAKrE,KAAK,8BAA8B,GAAG;IACpC,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAA;IACnC,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAA;IACnC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,KAAK,6BAA6B,GAAG;IACnC,kBAAkB,EAAE,sBAAsB,EAAE,CAAA;IAC5C,sBAAsB,EAAE,cAAc,EAAE,CAAA;CACzC,CAAA;AAED,eAAO,MAAM,uBAAuB,aACxB,8BAA8B,KACvC,6BAsDF,CAAA"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useConfig, useEntityVisibility } from '@payloadcms/ui';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
export const useEnabledRelationships = options => {
|
|
6
|
+
const {
|
|
7
|
+
collectionSlugsBlacklist,
|
|
8
|
+
collectionSlugsWhitelist,
|
|
9
|
+
uploads = false
|
|
10
|
+
} = options || {};
|
|
11
|
+
const {
|
|
12
|
+
config: {
|
|
13
|
+
collections
|
|
14
|
+
}
|
|
15
|
+
} = useConfig();
|
|
16
|
+
const {
|
|
17
|
+
visibleEntities
|
|
18
|
+
} = useEntityVisibility();
|
|
19
|
+
const result = React.useMemo(() => {
|
|
20
|
+
const enabledCollectionSlugs = [];
|
|
21
|
+
const enabledCollections = [];
|
|
22
|
+
const whitelistSet = collectionSlugsWhitelist ? new Set(collectionSlugsWhitelist) : null;
|
|
23
|
+
const blacklistSet = collectionSlugsBlacklist ? new Set(collectionSlugsBlacklist) : null;
|
|
24
|
+
for (const collection of collections) {
|
|
25
|
+
const {
|
|
26
|
+
slug,
|
|
27
|
+
admin: {
|
|
28
|
+
enableRichTextRelationship
|
|
29
|
+
},
|
|
30
|
+
upload
|
|
31
|
+
} = collection;
|
|
32
|
+
// Check visibility
|
|
33
|
+
if (!visibleEntities?.collections.includes(slug)) {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
// Check rich text relationship and upload settings
|
|
37
|
+
if (uploads) {
|
|
38
|
+
if (!enableRichTextRelationship || !upload) {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
if (upload || !enableRichTextRelationship) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// Check whitelist (if provided, only include slugs in the whitelist)
|
|
47
|
+
if (whitelistSet && !whitelistSet.has(slug)) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
// Check blacklist (if provided, exclude slugs in the blacklist)
|
|
51
|
+
if (blacklistSet && blacklistSet.has(slug)) {
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
enabledCollectionSlugs.push(slug);
|
|
55
|
+
enabledCollections.push(collection);
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
enabledCollections,
|
|
59
|
+
enabledCollectionSlugs
|
|
60
|
+
};
|
|
61
|
+
}, [collections, visibleEntities, uploads, collectionSlugsWhitelist, collectionSlugsBlacklist]);
|
|
62
|
+
return result;
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=useEnabledRelationships.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEnabledRelationships.js","names":["useConfig","useEntityVisibility","React","useEnabledRelationships","options","collectionSlugsBlacklist","collectionSlugsWhitelist","uploads","config","collections","visibleEntities","result","useMemo","enabledCollectionSlugs","enabledCollections","whitelistSet","Set","blacklistSet","collection","slug","admin","enableRichTextRelationship","upload","includes","has","push"],"sources":["../../../../../src/features/relationship/client/utils/useEnabledRelationships.tsx"],"sourcesContent":["'use client'\nimport type { ClientCollectionConfig, CollectionSlug } from 'payload'\n\nimport { useConfig, useEntityVisibility } from '@payloadcms/ui'\nimport * as React from 'react'\n\ntype UseEnabledRelationshipsOptions = {\n collectionSlugsBlacklist?: string[]\n collectionSlugsWhitelist?: string[]\n uploads?: boolean\n}\n\ntype UseEnabledRelationshipsResult = {\n enabledCollections: ClientCollectionConfig[]\n enabledCollectionSlugs: CollectionSlug[]\n}\n\nexport const useEnabledRelationships = (\n options?: UseEnabledRelationshipsOptions,\n): UseEnabledRelationshipsResult => {\n const { collectionSlugsBlacklist, collectionSlugsWhitelist, uploads = false } = options || {}\n const {\n config: { collections },\n } = useConfig()\n const { visibleEntities } = useEntityVisibility()\n\n const result = React.useMemo(() => {\n const enabledCollectionSlugs: string[] = []\n const enabledCollections: ClientCollectionConfig[] = []\n const whitelistSet = collectionSlugsWhitelist ? new Set(collectionSlugsWhitelist) : null\n const blacklistSet = collectionSlugsBlacklist ? new Set(collectionSlugsBlacklist) : null\n\n for (const collection of collections) {\n const {\n slug,\n admin: { enableRichTextRelationship },\n upload,\n } = collection\n\n // Check visibility\n if (!visibleEntities?.collections.includes(slug)) {\n continue\n }\n\n // Check rich text relationship and upload settings\n if (uploads) {\n if (!enableRichTextRelationship || !upload) {\n continue\n }\n } else {\n if (upload || !enableRichTextRelationship) {\n continue\n }\n }\n\n // Check whitelist (if provided, only include slugs in the whitelist)\n if (whitelistSet && !whitelistSet.has(slug)) {\n continue\n }\n\n // Check blacklist (if provided, exclude slugs in the blacklist)\n if (blacklistSet && blacklistSet.has(slug)) {\n continue\n }\n\n enabledCollectionSlugs.push(slug)\n enabledCollections.push(collection)\n }\n\n return { enabledCollections, enabledCollectionSlugs }\n }, [collections, visibleEntities, uploads, collectionSlugsWhitelist, collectionSlugsBlacklist])\n\n return result\n}\n"],"mappings":"AAAA;;AAGA,SAASA,SAAS,EAAEC,mBAAmB,QAAQ;AAC/C,YAAYC,KAAA,MAAW;AAavB,OAAO,MAAMC,uBAA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,eAAA,EAAiBH,OAAA,EAASD,wBAAA,EAA0BD,wBAAA,CAAyB;EAE9F,OAAOM,MAAA;AACT","ignoreList":[]}
|
|
@@ -9,10 +9,9 @@ export type RelationshipData = {
|
|
|
9
9
|
value: DataFromCollectionSlug<TCollectionSlug> | number | string;
|
|
10
10
|
};
|
|
11
11
|
}[CollectionSlug];
|
|
12
|
-
export type SerializedRelationshipNode = {
|
|
13
|
-
children?: never;
|
|
12
|
+
export type SerializedRelationshipNode = Omit<{
|
|
14
13
|
type: 'relationship';
|
|
15
|
-
} & Spread<RelationshipData, SerializedDecoratorBlockNode>;
|
|
14
|
+
} & Spread<RelationshipData, Omit<SerializedDecoratorBlockNode, 'type'>>, 'children'>;
|
|
16
15
|
export declare class RelationshipServerNode extends DecoratorBlockNode {
|
|
17
16
|
__data: RelationshipData;
|
|
18
17
|
constructor({ data, format, key, }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelationshipNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/relationship/server/nodes/RelationshipNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAA;AAC/F,OAAO,KAAK,EACV,gBAAgB,EAEhB,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,OAAO,EACP,MAAM,EACP,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AACrE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAA;AAEhF,MAAM,MAAM,gBAAgB,GAAG;KAC5B,eAAe,IAAI,cAAc,GAAG;QACnC,UAAU,EAAE,eAAe,CAAA;QAC3B,KAAK,EAAE,sBAAsB,CAAC,eAAe,CAAC,GAAG,MAAM,GAAG,MAAM,CAAA;KACjE;CACF,CAAC,cAAc,CAAC,CAAA;AAEjB,MAAM,MAAM,0BAA0B,GAAG
|
|
1
|
+
{"version":3,"file":"RelationshipNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/relationship/server/nodes/RelationshipNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAA;AAC/F,OAAO,KAAK,EACV,gBAAgB,EAEhB,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,OAAO,EACP,MAAM,EACP,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AACrE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAA;AAEhF,MAAM,MAAM,gBAAgB,GAAG;KAC5B,eAAe,IAAI,cAAc,GAAG;QACnC,UAAU,EAAE,eAAe,CAAA;QAC3B,KAAK,EAAE,sBAAsB,CAAC,eAAe,CAAC,GAAG,MAAM,GAAG,MAAM,CAAA;KACjE;CACF,CAAC,cAAc,CAAC,CAAA;AAEjB,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAC3C;IACE,IAAI,EAAE,cAAc,CAAA;CACrB,GAAG,MAAM,CAAC,gBAAgB,EAAE,IAAI,CAAC,4BAA4B,EAAE,MAAM,CAAC,CAAC,EACxE,UAAU,CACX,CAAA;AAgBD,qBAAa,sBAAuB,SAAQ,kBAAkB;IAC5D,MAAM,EAAE,gBAAgB,CAAA;gBAEZ,EACV,IAAI,EACJ,MAAM,EACN,GAAG,GACJ,EAAE;QACD,IAAI,EAAE,gBAAgB,CAAA;QACtB,MAAM,CAAC,EAAE,iBAAiB,CAAA;QAC1B,GAAG,CAAC,EAAE,OAAO,CAAA;KACd;WAKe,KAAK,CAAC,IAAI,EAAE,sBAAsB,GAAG,sBAAsB;WAQ3D,OAAO,IAAI,MAAM;WAIjB,SAAS,IAAI,gBAAgB,CAAC,cAAc,CAAC,GAAG,IAAI;WAiBpD,UAAU,CAAC,cAAc,EAAE,0BAA0B,GAAG,sBAAsB;IAc9F,MAAM,CAAC,QAAQ,IAAI,KAAK;IAIf,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO;IAIpE,SAAS,IAAI,eAAe;IAa5B,UAAU,IAAI,0BAA0B;IASjD,OAAO,IAAI,gBAAgB;IAIlB,cAAc,IAAI,MAAM;IAIjC,OAAO,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;CAItC;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,gBAAgB,GAAG,sBAAsB,CAI5F;AAED,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,sBAAsB,GAAG,SAAS,GAC5D,IAAI,IAAI,sBAAsB,CAEhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelationshipNode.js","names":["DecoratorBlockNode","$relationshipElementToServerNode","domNode","id","getAttribute","relationTo","node","$createServerRelationshipNode","value","RelationshipServerNode","__data","constructor","data","format","key","clone","__format","__key","getType","importDOM","div","hasAttribute","conversion","priority","importJSON","serializedNode","version","importedData","setFormat","isInline","decorate","_editor","_config","exportDOM","element","document","createElement","setAttribute","String","text","createTextNode","getTextContent","append","exportJSON","getData","type","getLatest","setData","writable","getWritable","$isServerRelationshipNode"],"sources":["../../../../../src/features/relationship/server/nodes/RelationshipNode.tsx"],"sourcesContent":["import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type {\n DOMConversionMap,\n DOMConversionOutput,\n DOMExportOutput,\n EditorConfig,\n ElementFormatType,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n Spread,\n} from 'lexical'\nimport type { CollectionSlug, DataFromCollectionSlug } from 'payload'\nimport type { JSX } from 'react'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\n\nexport type RelationshipData = {\n [TCollectionSlug in CollectionSlug]: {\n relationTo: TCollectionSlug\n value: DataFromCollectionSlug<TCollectionSlug> | number | string\n }\n}[CollectionSlug]\n\nexport type SerializedRelationshipNode =
|
|
1
|
+
{"version":3,"file":"RelationshipNode.js","names":["DecoratorBlockNode","$relationshipElementToServerNode","domNode","id","getAttribute","relationTo","node","$createServerRelationshipNode","value","RelationshipServerNode","__data","constructor","data","format","key","clone","__format","__key","getType","importDOM","div","hasAttribute","conversion","priority","importJSON","serializedNode","version","importedData","setFormat","isInline","decorate","_editor","_config","exportDOM","element","document","createElement","setAttribute","String","text","createTextNode","getTextContent","append","exportJSON","getData","type","getLatest","setData","writable","getWritable","$isServerRelationshipNode"],"sources":["../../../../../src/features/relationship/server/nodes/RelationshipNode.tsx"],"sourcesContent":["import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type {\n DOMConversionMap,\n DOMConversionOutput,\n DOMExportOutput,\n EditorConfig,\n ElementFormatType,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n Spread,\n} from 'lexical'\nimport type { CollectionSlug, DataFromCollectionSlug } from 'payload'\nimport type { JSX } from 'react'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\n\nexport type RelationshipData = {\n [TCollectionSlug in CollectionSlug]: {\n relationTo: TCollectionSlug\n value: DataFromCollectionSlug<TCollectionSlug> | number | string\n }\n}[CollectionSlug]\n\nexport type SerializedRelationshipNode = Omit<\n {\n type: 'relationship'\n } & Spread<RelationshipData, Omit<SerializedDecoratorBlockNode, 'type'>>,\n 'children'\n>\n\nfunction $relationshipElementToServerNode(domNode: HTMLDivElement): DOMConversionOutput | null {\n const id = domNode.getAttribute('data-lexical-relationship-id')\n const relationTo = domNode.getAttribute('data-lexical-relationship-relationTo')\n\n if (id != null && relationTo != null) {\n const node = $createServerRelationshipNode({\n relationTo,\n value: id,\n })\n return { node }\n }\n return null\n}\n\nexport class RelationshipServerNode extends DecoratorBlockNode {\n __data: RelationshipData\n\n constructor({\n data,\n format,\n key,\n }: {\n data: RelationshipData\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__data = data\n }\n\n static override clone(node: RelationshipServerNode): RelationshipServerNode {\n return new this({\n data: node.__data,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'relationship'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {\n div: (domNode: HTMLDivElement) => {\n if (\n !domNode.hasAttribute('data-lexical-relationship-relationTo') ||\n !domNode.hasAttribute('data-lexical-relationship-id')\n ) {\n return null\n }\n return {\n conversion: $relationshipElementToServerNode,\n priority: 2,\n }\n },\n }\n }\n\n static override importJSON(serializedNode: SerializedRelationshipNode): RelationshipServerNode {\n if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {\n serializedNode.value = (serializedNode.value as unknown as { id: string }).id\n }\n\n const importedData: RelationshipData = {\n relationTo: serializedNode.relationTo,\n value: serializedNode.value,\n }\n const node = $createServerRelationshipNode(importedData)\n node.setFormat(serializedNode.format)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n override decorate(_editor: LexicalEditor, _config: EditorConfig): JSX.Element {\n return null as unknown as JSX.Element\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('div')\n element.setAttribute(\n 'data-lexical-relationship-id',\n String(typeof this.__data?.value === 'object' ? this.__data?.value?.id : this.__data?.value),\n )\n element.setAttribute('data-lexical-relationship-relationTo', this.__data?.relationTo)\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedRelationshipNode {\n return {\n ...super.exportJSON(),\n ...this.getData(),\n type: 'relationship',\n version: 2,\n }\n }\n\n getData(): RelationshipData {\n return this.getLatest().__data\n }\n\n override getTextContent(): string {\n return `${this.__data?.relationTo} relation to ${typeof this.__data?.value === 'object' ? this.__data?.value?.id : this.__data?.value}`\n }\n\n setData(data: RelationshipData): void {\n const writable = this.getWritable()\n writable.__data = data\n }\n}\n\nexport function $createServerRelationshipNode(data: RelationshipData): RelationshipServerNode {\n return new RelationshipServerNode({\n data,\n })\n}\n\nexport function $isServerRelationshipNode(\n node: LexicalNode | null | RelationshipServerNode | undefined,\n): node is RelationshipServerNode {\n return node instanceof RelationshipServerNode\n}\n"],"mappings":"AAeA,SAASA,kBAAkB,QAAQ;AAgBnC,SAASC,iCAAiCC,OAAuB;EAC/D,MAAMC,EAAA,GAAKD,OAAA,CAAQE,YAAY,CAAC;EAChC,MAAMC,UAAA,GAAaH,OAAA,CAAQE,YAAY,CAAC;EAExC,IAAID,EAAA,IAAM,QAAQE,UAAA,IAAc,MAAM;IACpC,MAAMC,IAAA,GAAOC,6BAAA,CAA8B;MACzCF,UAAA;MACAG,KAAA,EAAOL;IACT;IACA,OAAO;MAAEG;IAAK;EAChB;EACA,OAAO;AACT;AAEA,OAAO,MAAMG,sBAAA,SAA+BT,kBAAA;EAC1CU,MAAA;EAEAC,YAAY;IACVC,IAAI;IACJC,MAAM;IACNC;EAAG,CAKJ,EAAE;IACD,KAAK,CAACD,MAAA,EAAQC,GAAA;IACd,IAAI,CAACJ,MAAM,GAAGE,IAAA;EAChB;EAEA,OAAgBG,MAAMT,IAA4B,EAA0B;IAC1E,OAAO,IAAI,IAAI,CAAC;MACdM,IAAA,EAAMN,IAAA,CAAKI,MAAM;MACjBG,MAAA,EAAQP,IAAA,CAAKU,QAAQ;MACrBF,GAAA,EAAKR,IAAA,CAAKW;IACZ;EACF;EAEA,OAAgBC,QAAA,EAAkB;IAChC,OAAO;EACT;EAEA,OAAgBC,UAAA,EAAqD;IACnE,OAAO;MACLC,GAAA,EAAMlB,OAAA;QACJ,IACE,CAACA,OAAA,CAAQmB,YAAY,CAAC,2CACtB,CAACnB,OAAA,CAAQmB,YAAY,CAAC,iCACtB;UACA,OAAO;QACT;QACA,OAAO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;EACF;EAEAkB,QAAA,EAA4B;IAC1B,OAAO,IAAI,CAACE,SAAS,GAAGpC,MAAM;EAChC;EAES+B,eAAA,EAAyB;IAChC,OAAO,GAAG,IAAI,CAAC/B,MAAM,EAAEL,UAAA,gBAA0B,OAAO,IAAI,CAACK,MAAM,EAAEF,KAAA,KAAU,WAAW,IAAI,CAACE,MAAM,EAAEF,KAAA,EAAOL,EAAA,GAAK,IAAI,CAACO,MAAM,EAAEF,KAAA,EAAO;EACzI;EAEAuC,QAAQnC,IAAsB,EAAQ;IACpC,MAAMoC,QAAA,GAAW,IAAI,CAACC,WAAW;IACjCD,QAAA,CAAStC,MAAM,GAAGE,IAAA;EACpB;AACF;AAEA,OAAO,SAASL,8BAA8BK,IAAsB;EAClE,OAAO,IAAIH,sBAAA,CAAuB;IAChCG;EACF;AACF;AAEA,OAAO,SAASsC,0BACd5C,IAA6D;EAE7D,OAAOA,IAAA,YAAgBG,sBAAA;AACzB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/upload/client/component/index.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAE/D,OAAO,KAA2D,MAAM,OAAO,CAAA;AAG/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AASlE,OAAO,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/upload/client/component/index.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAE/D,OAAO,KAA2D,MAAM,OAAO,CAAA;AAG/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AASlE,OAAO,cAAc,CAAA;AAQrB,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,UAAU,CAAA;IAChB,MAAM,CAAC,EAAE,iBAAiB,CAAA;IAC1B,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAyMlD,CAAA"}
|
|
@@ -12,13 +12,12 @@ import { useEditorConfigContext } from '../../../../lexical/config/client/Editor
|
|
|
12
12
|
import { FieldsDrawer } from '../../../../utilities/fieldsDrawer/Drawer.js';
|
|
13
13
|
import { useLexicalDocumentDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDocumentDrawer.js';
|
|
14
14
|
import { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js';
|
|
15
|
-
import { EnabledRelationshipsCondition } from '../../../relationship/client/utils/EnabledRelationshipsCondition.js';
|
|
16
15
|
import { INSERT_UPLOAD_WITH_DRAWER_COMMAND } from '../drawer/commands.js';
|
|
17
16
|
const baseClass = 'lexical-upload';
|
|
18
17
|
const initialParams = {
|
|
19
18
|
depth: 0
|
|
20
19
|
};
|
|
21
|
-
const
|
|
20
|
+
export const UploadComponent = props => {
|
|
22
21
|
const {
|
|
23
22
|
data: {
|
|
24
23
|
fields,
|
|
@@ -202,13 +201,4 @@ const Component = props => {
|
|
|
202
201
|
}) : null]
|
|
203
202
|
});
|
|
204
203
|
};
|
|
205
|
-
export const UploadComponent = props => {
|
|
206
|
-
return /*#__PURE__*/_jsx(EnabledRelationshipsCondition, {
|
|
207
|
-
...props,
|
|
208
|
-
uploads: true,
|
|
209
|
-
children: /*#__PURE__*/_jsx(Component, {
|
|
210
|
-
...props
|
|
211
|
-
})
|
|
212
|
-
});
|
|
213
|
-
};
|
|
214
204
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["useLexicalComposerContext","useLexicalEditable","getTranslation","Button","formatDrawerSlug","Thumbnail","useConfig","useEditDepth","usePayloadAPI","useTranslation","$getNodeByKey","isImage","React","useCallback","useId","useReducer","useRef","useState","useEditorConfigContext","FieldsDrawer","useLexicalDocumentDrawer","useLexicalDrawer","EnabledRelationshipsCondition","INSERT_UPLOAD_WITH_DRAWER_COMMAND","baseClass","initialParams","depth","Component","props","data","fields","relationTo","value","nodeKey","Error","config","routes","api","serverURL","getEntityConfig","uploadRef","uuid","editDepth","editor","editorConfig","fieldProps","schemaPath","isEditable","i18n","t","cacheBust","dispatchCacheBust","state","relatedCollection","collectionSlug","componentID","extraFieldsDrawerSlug","slug","toggleDrawer","closeDocumentDrawer","DocumentDrawer","DocumentDrawerToggler","id","setParams","thumbnailSRC","thumbnailURL","url","removeUpload","update","remove","updateUpload","hasExtraFields","resolvedFeatureMap","get","sanitizedClientFeatureProps","collections","onExtraFieldsDrawerSubmit","_","uploadNode","newData","getData","setData","aspectRatio","width","height","_jsxs","className","filename","ref","_jsx","fileSrc","mimeType","size","role","buttonStyle","disabled","el","icon","onClick","round","tooltip","dispatchCommand","replace","e","preventDefault","labels","singular","onSave","drawerSlug","drawerTitle","label","featureKey","handleDrawerSubmit","schemaPathSuffix","UploadComponent","uploads"],"sources":["../../../../../src/features/upload/client/component/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientCollectionConfig, Data, FormState, JsonObject } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n formatDrawerSlug,\n Thumbnail,\n useConfig,\n useEditDepth,\n usePayloadAPI,\n useTranslation,\n} from '@payloadcms/ui'\nimport { $getNodeByKey, type ElementFormatType } from 'lexical'\nimport { isImage } from 'payload/shared'\nimport React, { useCallback, useId, useReducer, useRef, useState } from 'react'\n\nimport type { BaseClientFeatureProps } from '../../../typesClient.js'\nimport type { UploadData } from '../../server/nodes/UploadNode.js'\nimport type { UploadFeaturePropsClient } from '../index.js'\nimport type { UploadNode } from '../nodes/UploadNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { FieldsDrawer } from '../../../../utilities/fieldsDrawer/Drawer.js'\nimport { useLexicalDocumentDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDocumentDrawer.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { EnabledRelationshipsCondition } from '../../../relationship/client/utils/EnabledRelationshipsCondition.js'\nimport './index.scss'\nimport { INSERT_UPLOAD_WITH_DRAWER_COMMAND } from '../drawer/commands.js'\n\nconst baseClass = 'lexical-upload'\n\nconst initialParams = {\n depth: 0,\n}\n\nexport type ElementProps = {\n data: UploadData\n format?: ElementFormatType\n nodeKey: string\n}\n\nconst Component: React.FC<ElementProps> = (props) => {\n const {\n data: { fields, relationTo, value },\n nodeKey,\n } = props\n\n if (typeof value === 'object') {\n throw new Error(\n 'Upload value should be a string or number. The Lexical Upload component should not receive the populated value object.',\n )\n }\n\n const {\n config: {\n routes: { api },\n serverURL,\n },\n getEntityConfig,\n } = useConfig()\n const uploadRef = useRef<HTMLDivElement | null>(null)\n const { uuid } = useEditorConfigContext()\n const editDepth = useEditDepth()\n const [editor] = useLexicalComposerContext()\n\n const {\n editorConfig,\n fieldProps: { schemaPath },\n } = useEditorConfigContext()\n const isEditable = useLexicalEditable()\n const { i18n, t } = useTranslation()\n const [cacheBust, dispatchCacheBust] = useReducer((state) => state + 1, 0)\n const [relatedCollection] = useState<ClientCollectionConfig>(() =>\n getEntityConfig({ collectionSlug: relationTo }),\n )\n\n const componentID = useId()\n\n const extraFieldsDrawerSlug = formatDrawerSlug({\n slug: `lexical-upload-drawer-` + uuid + componentID, // There can be multiple upload components, each with their own drawer, in one single editor => separate them by componentID\n depth: editDepth,\n })\n\n // Need to use hook to initialize useEffect that restores cursor position\n const { toggleDrawer } = useLexicalDrawer(extraFieldsDrawerSlug, true)\n\n const { closeDocumentDrawer, DocumentDrawer, DocumentDrawerToggler } = useLexicalDocumentDrawer({\n id: value,\n collectionSlug: relatedCollection.slug,\n })\n\n // Get the referenced document\n const [{ data }, { setParams }] = usePayloadAPI(\n `${serverURL}${api}/${relatedCollection.slug}/${value}`,\n { initialParams },\n )\n\n const thumbnailSRC = data?.thumbnailURL || data?.url\n\n const removeUpload = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const updateUpload = useCallback(\n (data: Data) => {\n setParams({\n ...initialParams,\n cacheBust, // do this to get the usePayloadAPI to re-fetch the data even though the URL string hasn't changed\n })\n\n dispatchCacheBust()\n closeDocumentDrawer()\n },\n [setParams, cacheBust, closeDocumentDrawer],\n )\n\n const hasExtraFields = (\n editorConfig?.resolvedFeatureMap?.get('upload')\n ?.sanitizedClientFeatureProps as BaseClientFeatureProps<UploadFeaturePropsClient>\n ).collections?.[relatedCollection.slug]?.hasExtraFields\n\n const onExtraFieldsDrawerSubmit = useCallback(\n (_: FormState, data: JsonObject) => {\n // Update lexical node (with key nodeKey) with new data\n editor.update(() => {\n const uploadNode: null | UploadNode = $getNodeByKey(nodeKey)\n if (uploadNode) {\n const newData: UploadData = {\n ...uploadNode.getData(),\n fields: data,\n }\n uploadNode.setData(newData)\n }\n })\n },\n [editor, nodeKey],\n )\n\n const aspectRatio =\n thumbnailSRC && data?.width && data?.height\n ? data.width > data.height\n ? 'landscape'\n : 'portrait'\n : 'landscape'\n\n return (\n <div\n className={`${baseClass} ${baseClass}--${aspectRatio}`}\n data-filename={data?.filename}\n ref={uploadRef}\n >\n <div className={`${baseClass}__card`}>\n <div className={`${baseClass}__media`}>\n <Thumbnail\n collectionSlug={relationTo}\n fileSrc={isImage(data?.mimeType) ? thumbnailSRC : null}\n height={data?.height}\n size=\"none\"\n width={data?.width}\n />\n\n {isEditable && (\n <div className={`${baseClass}__overlay ${baseClass}__floater`}>\n <div className={`${baseClass}__actions`} role=\"toolbar\">\n {hasExtraFields ? (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__upload-drawer-toggler`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"edit\"\n onClick={toggleDrawer}\n round\n size=\"medium\"\n tooltip={t('fields:editRelationship')}\n />\n ) : null}\n\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__swap-drawer-toggler`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"swap\"\n onClick={() => {\n editor.dispatchCommand(INSERT_UPLOAD_WITH_DRAWER_COMMAND, {\n replace: { nodeKey },\n })\n }}\n round\n size=\"medium\"\n tooltip={t('fields:swapUpload')}\n />\n\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeUpload()\n }}\n round\n size=\"medium\"\n tooltip={t('fields:removeUpload')}\n />\n </div>\n </div>\n )}\n </div>\n\n <div className={`${baseClass}__metaOverlay ${baseClass}__floater`}>\n <DocumentDrawerToggler className={`${baseClass}__doc-drawer-toggler`}>\n <strong className={`${baseClass}__filename`}>\n {data?.filename || t('general:untitled')}\n </strong>\n </DocumentDrawerToggler>\n <div className={`${baseClass}__collectionLabel`}>\n {getTranslation(relatedCollection.labels.singular, i18n)}\n </div>\n </div>\n </div>\n\n {value ? <DocumentDrawer onSave={updateUpload} /> : null}\n {hasExtraFields ? (\n <FieldsDrawer\n data={fields}\n drawerSlug={extraFieldsDrawerSlug}\n drawerTitle={t('general:editLabel', {\n label: getTranslation(relatedCollection.labels.singular, i18n),\n })}\n featureKey=\"upload\"\n handleDrawerSubmit={onExtraFieldsDrawerSubmit}\n schemaPath={schemaPath}\n schemaPathSuffix={relatedCollection.slug}\n />\n ) : null}\n </div>\n )\n}\n\nexport const UploadComponent = (props: ElementProps): React.ReactNode => {\n return (\n <EnabledRelationshipsCondition {...props} uploads>\n <Component {...props} />\n </EnabledRelationshipsCondition>\n )\n}\n"],"mappings":"AAAA;;;AAGA,SAASA,yBAAyB,QAAQ;AAC1C,SAASC,kBAAkB,QAAQ;AACnC,SAASC,cAAc,Q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;sBACxCK,IAAA,EAAM0D,QAAA,IAAYtC,CAAA,CAAE;;yBAGzBwC,IAAA,CAAC;UAAIH,SAAA,EAAW,GAAG9D,SAAA,mBAA4B;oBAC5CtB,cAAA,CAAemD,iBAAA,CAAkBoD,MAAM,CAACC,QAAQ,EAAE1D,IAAA;;;QAKxDhB,KAAA,gBAAQyD,IAAA,CAAC7B,cAAA;MAAe+C,MAAA,EAAQrC;SAAmB,MACnDC,cAAA,gBACCkB,IAAA,CAACtE,YAAA;MACCU,IAAA,EAAMC,MAAA;MACN8E,UAAA,EAAYpD,qBAAA;MACZqD,WAAA,EAAa5D,CAAA,CAAE,qBAAqB;QAClC6D,KAAA,EAAO5G,cAAA,CAAemD,iBAAA,CAAkBoD,MAAM,CAACC,QAAQ,EAAE1D,IAAA;MAC3D;MACA+D,UAAA,EAAW;MACXC,kBAAA,EAAoBpC,yBAAA;MACpB9B,UAAA,EAAYA,UAAA;MACZmE,gBAAA,EAAkB5D,iBAAA,CAAkBI;SAEpC;;AAGV;AAEA,OAAO,MAAMyD,eAAA,GAAmBtF,KAAA;EAC9B,oBACE6D,IAAA,CAACnE,6BAAA;IAA+B,GAAGM,KAAK;IAAEuF,OAAO;cAC/C,aAAA1B,IAAA,CAAC9D,SAAA;MAAW,GAAGC;;;AAGrB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["useLexicalComposerContext","useLexicalEditable","getTranslation","Button","formatDrawerSlug","Thumbnail","useConfig","useEditDepth","usePayloadAPI","useTranslation","$getNodeByKey","isImage","React","useCallback","useId","useReducer","useRef","useState","useEditorConfigContext","FieldsDrawer","useLexicalDocumentDrawer","useLexicalDrawer","INSERT_UPLOAD_WITH_DRAWER_COMMAND","baseClass","initialParams","depth","UploadComponent","props","data","fields","relationTo","value","nodeKey","Error","config","routes","api","serverURL","getEntityConfig","uploadRef","uuid","editDepth","editor","editorConfig","fieldProps","schemaPath","isEditable","i18n","t","cacheBust","dispatchCacheBust","state","relatedCollection","collectionSlug","componentID","extraFieldsDrawerSlug","slug","toggleDrawer","closeDocumentDrawer","DocumentDrawer","DocumentDrawerToggler","id","setParams","thumbnailSRC","thumbnailURL","url","removeUpload","update","remove","updateUpload","hasExtraFields","resolvedFeatureMap","get","sanitizedClientFeatureProps","collections","onExtraFieldsDrawerSubmit","_","uploadNode","newData","getData","setData","aspectRatio","width","height","_jsxs","className","filename","ref","_jsx","fileSrc","mimeType","size","role","buttonStyle","disabled","el","icon","onClick","round","tooltip","dispatchCommand","replace","e","preventDefault","labels","singular","onSave","drawerSlug","drawerTitle","label","featureKey","handleDrawerSubmit","schemaPathSuffix"],"sources":["../../../../../src/features/upload/client/component/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientCollectionConfig, Data, FormState, JsonObject } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n formatDrawerSlug,\n Thumbnail,\n useConfig,\n useEditDepth,\n usePayloadAPI,\n useTranslation,\n} from '@payloadcms/ui'\nimport { $getNodeByKey, type ElementFormatType } from 'lexical'\nimport { isImage } from 'payload/shared'\nimport React, { useCallback, useId, useReducer, useRef, useState } from 'react'\n\nimport type { BaseClientFeatureProps } from '../../../typesClient.js'\nimport type { UploadData } from '../../server/nodes/UploadNode.js'\nimport type { UploadFeaturePropsClient } from '../index.js'\nimport type { UploadNode } from '../nodes/UploadNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { FieldsDrawer } from '../../../../utilities/fieldsDrawer/Drawer.js'\nimport { useLexicalDocumentDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDocumentDrawer.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { INSERT_UPLOAD_WITH_DRAWER_COMMAND } from '../drawer/commands.js'\nimport './index.scss'\n\nconst baseClass = 'lexical-upload'\n\nconst initialParams = {\n depth: 0,\n}\n\nexport type ElementProps = {\n data: UploadData\n format?: ElementFormatType\n nodeKey: string\n}\n\nexport const UploadComponent: React.FC<ElementProps> = (props) => {\n const {\n data: { fields, relationTo, value },\n nodeKey,\n } = props\n\n if (typeof value === 'object') {\n throw new Error(\n 'Upload value should be a string or number. The Lexical Upload component should not receive the populated value object.',\n )\n }\n\n const {\n config: {\n routes: { api },\n serverURL,\n },\n getEntityConfig,\n } = useConfig()\n const uploadRef = useRef<HTMLDivElement | null>(null)\n const { uuid } = useEditorConfigContext()\n const editDepth = useEditDepth()\n const [editor] = useLexicalComposerContext()\n\n const {\n editorConfig,\n fieldProps: { schemaPath },\n } = useEditorConfigContext()\n const isEditable = useLexicalEditable()\n const { i18n, t } = useTranslation()\n const [cacheBust, dispatchCacheBust] = useReducer((state) => state + 1, 0)\n const [relatedCollection] = useState<ClientCollectionConfig>(() =>\n getEntityConfig({ collectionSlug: relationTo }),\n )\n\n const componentID = useId()\n\n const extraFieldsDrawerSlug = formatDrawerSlug({\n slug: `lexical-upload-drawer-` + uuid + componentID, // There can be multiple upload components, each with their own drawer, in one single editor => separate them by componentID\n depth: editDepth,\n })\n\n // Need to use hook to initialize useEffect that restores cursor position\n const { toggleDrawer } = useLexicalDrawer(extraFieldsDrawerSlug, true)\n\n const { closeDocumentDrawer, DocumentDrawer, DocumentDrawerToggler } = useLexicalDocumentDrawer({\n id: value,\n collectionSlug: relatedCollection.slug,\n })\n\n // Get the referenced document\n const [{ data }, { setParams }] = usePayloadAPI(\n `${serverURL}${api}/${relatedCollection.slug}/${value}`,\n { initialParams },\n )\n\n const thumbnailSRC = data?.thumbnailURL || data?.url\n\n const removeUpload = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const updateUpload = useCallback(\n (data: Data) => {\n setParams({\n ...initialParams,\n cacheBust, // do this to get the usePayloadAPI to re-fetch the data even though the URL string hasn't changed\n })\n\n dispatchCacheBust()\n closeDocumentDrawer()\n },\n [setParams, cacheBust, closeDocumentDrawer],\n )\n\n const hasExtraFields = (\n editorConfig?.resolvedFeatureMap?.get('upload')\n ?.sanitizedClientFeatureProps as BaseClientFeatureProps<UploadFeaturePropsClient>\n ).collections?.[relatedCollection.slug]?.hasExtraFields\n\n const onExtraFieldsDrawerSubmit = useCallback(\n (_: FormState, data: JsonObject) => {\n // Update lexical node (with key nodeKey) with new data\n editor.update(() => {\n const uploadNode: null | UploadNode = $getNodeByKey(nodeKey)\n if (uploadNode) {\n const newData: UploadData = {\n ...uploadNode.getData(),\n fields: data,\n }\n uploadNode.setData(newData)\n }\n })\n },\n [editor, nodeKey],\n )\n\n const aspectRatio =\n thumbnailSRC && data?.width && data?.height\n ? data.width > data.height\n ? 'landscape'\n : 'portrait'\n : 'landscape'\n\n return (\n <div\n className={`${baseClass} ${baseClass}--${aspectRatio}`}\n data-filename={data?.filename}\n ref={uploadRef}\n >\n <div className={`${baseClass}__card`}>\n <div className={`${baseClass}__media`}>\n <Thumbnail\n collectionSlug={relationTo}\n fileSrc={isImage(data?.mimeType) ? thumbnailSRC : null}\n height={data?.height}\n size=\"none\"\n width={data?.width}\n />\n\n {isEditable && (\n <div className={`${baseClass}__overlay ${baseClass}__floater`}>\n <div className={`${baseClass}__actions`} role=\"toolbar\">\n {hasExtraFields ? (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__upload-drawer-toggler`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"edit\"\n onClick={toggleDrawer}\n round\n size=\"medium\"\n tooltip={t('fields:editRelationship')}\n />\n ) : null}\n\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__swap-drawer-toggler`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"swap\"\n onClick={() => {\n editor.dispatchCommand(INSERT_UPLOAD_WITH_DRAWER_COMMAND, {\n replace: { nodeKey },\n })\n }}\n round\n size=\"medium\"\n tooltip={t('fields:swapUpload')}\n />\n\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeUpload()\n }}\n round\n size=\"medium\"\n tooltip={t('fields:removeUpload')}\n />\n </div>\n </div>\n )}\n </div>\n\n <div className={`${baseClass}__metaOverlay ${baseClass}__floater`}>\n <DocumentDrawerToggler className={`${baseClass}__doc-drawer-toggler`}>\n <strong className={`${baseClass}__filename`}>\n {data?.filename || t('general:untitled')}\n </strong>\n </DocumentDrawerToggler>\n <div className={`${baseClass}__collectionLabel`}>\n {getTranslation(relatedCollection.labels.singular, i18n)}\n </div>\n </div>\n </div>\n\n {value ? <DocumentDrawer onSave={updateUpload} /> : null}\n {hasExtraFields ? (\n <FieldsDrawer\n data={fields}\n drawerSlug={extraFieldsDrawerSlug}\n drawerTitle={t('general:editLabel', {\n label: getTranslation(relatedCollection.labels.singular, i18n),\n })}\n featureKey=\"upload\"\n handleDrawerSubmit={onExtraFieldsDrawerSubmit}\n schemaPath={schemaPath}\n schemaPathSuffix={relatedCollection.slug}\n />\n ) : null}\n </div>\n )\n}\n"],"mappings":"AAAA;;;AAGA,SAASA,yBAAyB,QAAQ;AAC1C,SAASC,kBAAkB,QAAQ;AACnC,SAASC,cAAc,QAAQ;AAC/B,SACEC,MAAM,EACNC,gBAAgB,EAChBC,SAAS,EACTC,SAAS,EACTC,YAAY,EACZC,aAAa,EACbC,cAAc,QACT;AACP,SAASC,aAAa,QAAgC;AACtD,SAASC,OAAO,QAAQ;AACxB,OAAOC,KAAA,IAASC,WAAW,EAAEC,KAAK,EAAEC,UAAU,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AAOxE,SAASC,sBAAsB,QAAQ;AACvC,SAASC,YAAY,QAAQ;AAC7B,SAASC,wBAAwB,QAAQ;AACzC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,iCAAiC,QAAQ;AAGlD,MAAMC,SAAA,GAAY;AAElB,MAAMC,aAAA,GAAgB;EACpB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CAACC,QAAQ,EAAE1D,IAAA;MAC3D;MACA+D,UAAA,EAAW;MACXC,kBAAA,EAAoBpC,yBAAA;MACpB9B,UAAA,EAAYA,UAAA;MACZmE,gBAAA,EAAkB5D,iBAAA,CAAkBI;SAEpC;;AAGV","ignoreList":[]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { UploadCollectionSlug } from 'payload';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
type Props = {
|
|
3
|
-
enabledCollectionSlugs:
|
|
4
|
+
enabledCollectionSlugs: UploadCollectionSlug[];
|
|
4
5
|
};
|
|
5
|
-
export declare const UploadDrawer: (
|
|
6
|
+
export declare const UploadDrawer: ({ enabledCollectionSlugs }: Props) => React.ReactNode;
|
|
6
7
|
export {};
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/upload/client/drawer/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/upload/client/drawer/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAKnD,OAAO,KAA2C,MAAM,OAAO,CAAA;AA4C/D,KAAK,KAAK,GAAG;IACX,sBAAsB,EAAE,oBAAoB,EAAE,CAAA;CAC/C,CAAA;AA6DD,eAAO,MAAM,YAAY,+BAAgC,KAAK,KAAG,KAAK,CAAC,SAMtE,CAAA"}
|
|
@@ -7,7 +7,6 @@ import { toast } from '@payloadcms/ui';
|
|
|
7
7
|
import { $getNodeByKey, COMMAND_PRIORITY_EDITOR } from 'lexical';
|
|
8
8
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
9
9
|
import { useLexicalListDrawer } from '../../../../utilities/fieldsDrawer/useLexicalListDrawer.js';
|
|
10
|
-
import { EnabledRelationshipsCondition } from '../../../relationship/client/utils/EnabledRelationshipsCondition.js';
|
|
11
10
|
import { $createUploadNode } from '../nodes/UploadNode.js';
|
|
12
11
|
import { INSERT_UPLOAD_COMMAND } from '../plugin/index.js';
|
|
13
12
|
import { INSERT_UPLOAD_WITH_DRAWER_COMMAND } from './commands.js';
|
|
@@ -135,14 +134,14 @@ const UploadDrawerComponentFallback = () => {
|
|
|
135
134
|
useEffect(t0, t1);
|
|
136
135
|
return null;
|
|
137
136
|
};
|
|
138
|
-
export const UploadDrawer =
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
137
|
+
export const UploadDrawer = ({
|
|
138
|
+
enabledCollectionSlugs
|
|
139
|
+
}) => {
|
|
140
|
+
if (!enabledCollectionSlugs?.length) {
|
|
141
|
+
return /*#__PURE__*/_jsx(UploadDrawerComponentFallback, {});
|
|
142
|
+
}
|
|
143
|
+
return /*#__PURE__*/_jsx(UploadDrawerComponent, {
|
|
144
|
+
enabledCollectionSlugs: enabledCollectionSlugs
|
|
146
145
|
});
|
|
147
146
|
};
|
|
148
147
|
function _temp() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","toast","$getNodeByKey","COMMAND_PRIORITY_EDITOR","React","useCallback","useEffect","useState","useLexicalListDrawer","
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","toast","$getNodeByKey","COMMAND_PRIORITY_EDITOR","React","useCallback","useEffect","useState","useLexicalListDrawer","$createUploadNode","INSERT_UPLOAD_COMMAND","INSERT_UPLOAD_WITH_DRAWER_COMMAND","insertUpload","editor","relationTo","replaceNodeKey","value","dispatchCommand","fields","update","node","replace","data","UploadDrawerComponent","t0","$","enabledCollectionSlugs","setReplaceNodeKey","t1","collectionSlugs","uploads","closeListDrawer","ListDrawer","openListDrawer","t2","t3","registerCommand","payload","nodeKey","t4","t5","collectionSlug","doc","id","onSelect","_jsx","UploadDrawerComponentFallback","_temp","UploadDrawer","length","error"],"sources":["../../../../../src/features/upload/client/drawer/index.tsx"],"sourcesContent":["'use client'\nimport type { ListDrawerProps } from '@payloadcms/ui'\nimport type { LexicalEditor } from 'lexical'\nimport type { UploadCollectionSlug } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { toast } from '@payloadcms/ui'\nimport { $getNodeByKey, COMMAND_PRIORITY_EDITOR } from 'lexical'\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport { useLexicalListDrawer } from '../../../../utilities/fieldsDrawer/useLexicalListDrawer.js'\nimport { $createUploadNode } from '../nodes/UploadNode.js'\nimport { INSERT_UPLOAD_COMMAND } from '../plugin/index.js'\nimport { INSERT_UPLOAD_WITH_DRAWER_COMMAND } from './commands.js'\n\nconst insertUpload = ({\n editor,\n relationTo,\n replaceNodeKey,\n value,\n}: {\n editor: LexicalEditor\n relationTo: string\n replaceNodeKey: null | string\n value: number | string\n}) => {\n if (!replaceNodeKey) {\n editor.dispatchCommand(INSERT_UPLOAD_COMMAND, {\n // @ts-expect-error - TODO: fix this\n fields: null,\n relationTo,\n value,\n })\n } else {\n editor.update(() => {\n const node = $getNodeByKey(replaceNodeKey)\n if (node) {\n node.replace(\n $createUploadNode({\n data: {\n // @ts-expect-error - TODO: fix this\n fields: null,\n relationTo,\n value,\n },\n }),\n )\n }\n })\n }\n}\n\ntype Props = {\n enabledCollectionSlugs: UploadCollectionSlug[]\n}\n\nconst UploadDrawerComponent: React.FC<Props> = ({ enabledCollectionSlugs }) => {\n const [editor] = useLexicalComposerContext()\n\n const [replaceNodeKey, setReplaceNodeKey] = useState<null | string>(null)\n\n const { closeListDrawer, ListDrawer, openListDrawer } = useLexicalListDrawer({\n collectionSlugs: enabledCollectionSlugs,\n uploads: true,\n })\n\n useEffect(() => {\n return editor.registerCommand<{\n replace: { nodeKey: string } | false\n }>(\n INSERT_UPLOAD_WITH_DRAWER_COMMAND,\n (payload) => {\n setReplaceNodeKey(payload?.replace ? payload?.replace.nodeKey : null)\n openListDrawer()\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n )\n }, [editor, openListDrawer])\n\n const onSelect = useCallback<NonNullable<ListDrawerProps['onSelect']>>(\n ({ collectionSlug, doc }) => {\n closeListDrawer()\n insertUpload({\n editor,\n relationTo: collectionSlug,\n replaceNodeKey,\n value: doc.id,\n })\n },\n [editor, closeListDrawer, replaceNodeKey],\n )\n\n return <ListDrawer onSelect={onSelect} />\n}\n\nconst UploadDrawerComponentFallback: React.FC = () => {\n const [editor] = useLexicalComposerContext()\n\n useEffect(() => {\n return editor.registerCommand<{\n replace: { nodeKey: string } | false\n }>(\n INSERT_UPLOAD_WITH_DRAWER_COMMAND,\n () => {\n toast.error('No upload collections enabled')\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n )\n }, [editor])\n\n return null\n}\n\nexport const UploadDrawer = ({ enabledCollectionSlugs }: Props): React.ReactNode => {\n if (!enabledCollectionSlugs?.length) {\n return <UploadDrawerComponentFallback />\n }\n\n return <UploadDrawerComponent enabledCollectionSlugs={enabledCollectionSlugs} />\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAKA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,KAAK,QAAQ;AACtB,SAASC,aAAa,EAAEC,uBAAuB,QAAQ;AACvD,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ;AAExD,SAASC,oBAAoB,QAAQ;AACrC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,qBAAqB,QAAQ;AACtC,SAASC,iCAAiC,QAAQ;AAElD,MAAMC,YAAA,GAAeA,CAAC;EACpBC,MAAM;EACNC,UAAU;EACVC,cAAc;EACdC;AAAK,CAMN;EACC,IAAI,CAACD,cAAA,EAAgB;IACnBF,MAAA,CAAOI,eAAe,CAACP,qBAAA,EAAuB;MAC5C;MACAQ,MAAA,EAAQ;MACRJ,UAAA;MACAE;I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,EAAQ;EAAA;AAAA,CAGb;AAEA,OAAO,MAAMoB,YAAA,GAAeA,CAAC;EAAEtB;AAAsB,CAAS;EAC5D,IAAI,CAACA,sBAAA,EAAwBuB,MAAA,EAAQ;IACnC,oBAAOJ,IAAA,CAACC,6BAAA;EACV;EAEA,oBAAOD,IAAA,CAACtB,qBAAA;IAAsBG,sBAAA,EAAwBA;;AACxD;AAzBgD,SAAAqB,MAAA;EASxC9C,KAAA,CAAAiD,KAAA,CAAY;EAAA;AAAA","ignoreList":[]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import type { ExclusiveUploadFeatureProps } from '../server/index.js';
|
|
1
2
|
export type UploadFeaturePropsClient = {
|
|
2
3
|
collections: {
|
|
3
4
|
[collection: string]: {
|
|
4
5
|
hasExtraFields: boolean;
|
|
5
6
|
};
|
|
6
7
|
};
|
|
7
|
-
};
|
|
8
|
+
} & ExclusiveUploadFeatureProps;
|
|
8
9
|
export declare const UploadFeatureClient: import("../../typesClient.js").FeatureProviderProviderClient<UploadFeaturePropsClient, UploadFeaturePropsClient>;
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/upload/client/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/upload/client/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAA;AAUrE,MAAM,MAAM,wBAAwB,GAAG;IACrC,WAAW,EAAE;QACX,CAAC,UAAU,EAAE,MAAM,GAAG;YACpB,cAAc,EAAE,OAAO,CAAA;SACxB,CAAA;KACF,CAAA;CACF,GAAG,2BAA2B,CAAA;AAE/B,eAAO,MAAM,mBAAmB,kHAqD9B,CAAA"}
|