@payloadcms/richtext-lexical 3.2.3-canary.2d2e7d5 → 3.2.3-canary.673b4b5
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/bundled.css +1 -1
- package/dist/exports/client/{chunk-YSJURFKK.js → chunk-H6YVKFZN.js} +2 -2
- package/dist/exports/client/chunk-H6YVKFZN.js.map +7 -0
- package/dist/exports/client/componentInline-WMS3WMBA.js +2 -0
- package/dist/exports/client/index.d.ts +4 -0
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +11 -11
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/align/server/i18n.d.ts.map +1 -1
- package/dist/features/align/server/i18n.js +6 -0
- package/dist/features/align/server/i18n.js.map +1 -1
- package/dist/features/blockquote/server/i18n.d.ts.map +1 -1
- package/dist/features/blockquote/server/i18n.js +3 -0
- package/dist/features/blockquote/server/i18n.js.map +1 -1
- package/dist/features/blocks/WrapperBlockNode.d.ts +1151 -0
- package/dist/features/blocks/WrapperBlockNode.d.ts.map +1 -0
- package/dist/features/blocks/WrapperBlockNode.js +113 -0
- package/dist/features/blocks/WrapperBlockNode.js.map +1 -0
- package/dist/features/blocks/client/component/index.d.ts +1 -1
- package/dist/features/blocks/client/component/index.d.ts.map +1 -1
- package/dist/features/blocks/client/component/index.js.map +1 -1
- package/dist/features/blocks/client/componentInline/index.d.ts +1 -1
- package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
- package/dist/features/blocks/client/componentInline/index.js.map +1 -1
- package/dist/features/blocks/client/index.d.ts.map +1 -1
- package/dist/features/blocks/client/index.js +65 -4
- package/dist/features/blocks/client/index.js.map +1 -1
- package/dist/features/blocks/client/nodes/BlocksNode.d.ts +2 -2
- package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/client/nodes/BlocksNode.js +1 -1
- package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
- package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts +2 -2
- package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/client/nodes/InlineBlocksNode.js +1 -1
- package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
- package/dist/features/blocks/client/plugin/commands.d.ts +12 -1
- package/dist/features/blocks/client/plugin/commands.d.ts.map +1 -1
- package/dist/features/blocks/client/plugin/commands.js +2 -0
- package/dist/features/blocks/client/plugin/commands.js.map +1 -1
- package/dist/features/blocks/client/plugin/index.d.ts +1 -1
- package/dist/features/blocks/client/plugin/index.d.ts.map +1 -1
- package/dist/features/blocks/client/plugin/index.js +30 -35
- package/dist/features/blocks/client/plugin/index.js.map +1 -1
- package/dist/features/blocks/client/plugin/wrapperBlocks/BlockEditor/index.d.ts +23 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/BlockEditor/index.d.ts.map +1 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/BlockEditor/index.js +330 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/BlockEditor/index.js.map +1 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/BlockEditor/useLexicalFormState.d.ts +22 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/BlockEditor/useLexicalFormState.d.ts.map +1 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/BlockEditor/useLexicalFormState.js +169 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/BlockEditor/useLexicalFormState.js.map +1 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockContainer.d.ts +5 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockContainer.d.ts.map +1 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockContainer.js +28 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockContainer.js.map +1 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockEditButton.d.ts +3 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockEditButton.d.ts.map +1 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockEditButton.js +22 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockEditButton.js.map +1 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockLabel.d.ts +3 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockLabel.d.ts.map +1 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockLabel.js +22 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockLabel.js.map +1 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockRemoveButton.d.ts +3 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockRemoveButton.d.ts.map +1 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockRemoveButton.js +22 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockRemoveButton.js.map +1 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/index.d.ts +9 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/index.d.ts.map +1 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/index.js +111 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/index.js.map +1 -0
- package/dist/features/blocks/server/graphQLPopulationPromise.d.ts +4 -3
- package/dist/features/blocks/server/graphQLPopulationPromise.d.ts.map +1 -1
- package/dist/features/blocks/server/graphQLPopulationPromise.js.map +1 -1
- package/dist/features/blocks/server/i18n.d.ts.map +1 -1
- package/dist/features/blocks/server/i18n.js +144 -33
- package/dist/features/blocks/server/i18n.js.map +1 -1
- package/dist/features/blocks/server/index.d.ts +5 -1
- package/dist/features/blocks/server/index.d.ts.map +1 -1
- package/dist/features/blocks/server/index.js +82 -2
- package/dist/features/blocks/server/index.js.map +1 -1
- package/dist/features/blocks/server/markdownTransformer.js +2 -2
- package/dist/features/blocks/server/markdownTransformer.js.map +1 -1
- package/dist/features/blocks/server/nodes/{BlocksNode.d.ts → BlockNode.d.ts} +2 -2
- package/dist/features/blocks/server/nodes/BlockNode.d.ts.map +1 -0
- package/dist/features/blocks/server/nodes/{BlocksNode.js → BlockNode.js} +1 -1
- package/dist/features/blocks/server/nodes/BlockNode.js.map +1 -0
- package/dist/features/blocks/server/nodes/{InlineBlocksNode.d.ts → InlineBlockNode.d.ts} +1 -1
- package/dist/features/blocks/server/nodes/InlineBlockNode.d.ts.map +1 -0
- package/dist/features/blocks/server/nodes/{InlineBlocksNode.js → InlineBlockNode.js} +1 -1
- package/dist/features/blocks/server/nodes/InlineBlockNode.js.map +1 -0
- package/dist/features/blocks/server/validate.d.ts +4 -3
- package/dist/features/blocks/server/validate.d.ts.map +1 -1
- package/dist/features/blocks/server/validate.js.map +1 -1
- package/dist/features/heading/server/i18n.d.ts.map +1 -1
- package/dist/features/heading/server/i18n.js +3 -0
- package/dist/features/heading/server/i18n.js.map +1 -1
- package/dist/features/horizontalRule/server/i18n.d.ts.map +1 -1
- package/dist/features/horizontalRule/server/i18n.js +3 -0
- package/dist/features/horizontalRule/server/i18n.js.map +1 -1
- package/dist/features/indent/server/i18n.d.ts.map +1 -1
- package/dist/features/indent/server/i18n.js +4 -0
- package/dist/features/indent/server/i18n.js.map +1 -1
- package/dist/features/link/server/i18n.d.ts.map +1 -1
- package/dist/features/link/server/i18n.js +4 -0
- package/dist/features/link/server/i18n.js.map +1 -1
- package/dist/features/lists/checklist/server/i18n.d.ts.map +1 -1
- package/dist/features/lists/checklist/server/i18n.js +3 -0
- package/dist/features/lists/checklist/server/i18n.js.map +1 -1
- package/dist/features/lists/orderedList/server/i18n.d.ts.map +1 -1
- package/dist/features/lists/orderedList/server/i18n.js +3 -0
- package/dist/features/lists/orderedList/server/i18n.js.map +1 -1
- package/dist/features/lists/unorderedList/server/i18n.d.ts.map +1 -1
- package/dist/features/lists/unorderedList/server/i18n.js +3 -0
- package/dist/features/lists/unorderedList/server/i18n.js.map +1 -1
- package/dist/features/paragraph/server/i18n.d.ts.map +1 -1
- package/dist/features/paragraph/server/i18n.js +4 -0
- package/dist/features/paragraph/server/i18n.js.map +1 -1
- package/dist/features/relationship/server/i18n.d.ts.map +1 -1
- package/dist/features/relationship/server/i18n.js +3 -0
- package/dist/features/relationship/server/i18n.js.map +1 -1
- package/dist/features/typesClient.d.ts +3 -2
- package/dist/features/typesClient.d.ts.map +1 -1
- package/dist/features/typesClient.js.map +1 -1
- package/dist/features/typesServer.d.ts +8 -1
- package/dist/features/typesServer.d.ts.map +1 -1
- package/dist/features/typesServer.js.map +1 -1
- package/dist/features/upload/server/i18n.d.ts.map +1 -1
- package/dist/features/upload/server/i18n.js +3 -0
- package/dist/features/upload/server/i18n.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/field/index.d.ts.map +1 -1
- package/dist/field/index.js +19 -16
- package/dist/field/index.js.map +1 -1
- package/dist/field/rscEntry.js +2 -0
- package/dist/field/rscEntry.js.map +1 -1
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +6 -0
- package/dist/i18n.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lexical/config/client/loader.d.ts +2 -1
- package/dist/lexical/config/client/loader.d.ts.map +1 -1
- package/dist/lexical/config/client/loader.js +2 -0
- package/dist/lexical/config/client/loader.js.map +1 -1
- package/dist/nodeTypes.d.ts +2 -2
- package/dist/nodeTypes.d.ts.map +1 -1
- package/dist/nodeTypes.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utilities/createClientFeature.d.ts +1 -0
- package/dist/utilities/createClientFeature.d.ts.map +1 -1
- package/dist/utilities/createClientFeature.js +2 -0
- package/dist/utilities/createClientFeature.js.map +1 -1
- package/dist/utilities/generateImportMap.d.ts.map +1 -1
- package/dist/utilities/generateImportMap.js +5 -2
- package/dist/utilities/generateImportMap.js.map +1 -1
- package/dist/utilities/initLexicalFeatures.d.ts +1 -0
- package/dist/utilities/initLexicalFeatures.d.ts.map +1 -1
- package/dist/utilities/initLexicalFeatures.js +18 -1
- package/dist/utilities/initLexicalFeatures.js.map +1 -1
- package/package.json +6 -6
- package/dist/exports/client/chunk-YSJURFKK.js.map +0 -7
- package/dist/exports/client/componentInline-OK3ZQ6YQ.js +0 -2
- package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +0 -1
- package/dist/features/blocks/server/nodes/BlocksNode.js.map +0 -1
- package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +0 -1
- package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +0 -1
- /package/dist/exports/client/{componentInline-OK3ZQ6YQ.js.map → componentInline-WMS3WMBA.js.map} +0 -0
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
4
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
|
|
5
|
+
import { $findMatchingParent, mergeRegister } from '@lexical/utils';
|
|
6
|
+
import { getTranslation } from '@payloadcms/translations';
|
|
7
|
+
import { CloseMenuIcon, Drawer, EditDepthProvider, EditIcon, Form, formatDrawerSlug, FormSubmit, RenderFields, useEditDepth, useTranslation } from '@payloadcms/ui';
|
|
8
|
+
import { $getSelection, $isLineBreakNode, $isRangeSelection, COMMAND_PRIORITY_HIGH, COMMAND_PRIORITY_LOW, KEY_ESCAPE_COMMAND, SELECTION_CHANGE_COMMAND } from 'lexical';
|
|
9
|
+
import { reduceFieldsToValues } from 'payload/shared';
|
|
10
|
+
import React, { createContext, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
11
|
+
import { v4 as uuid } from 'uuid';
|
|
12
|
+
import { useEditorConfigContext } from '../../../../../../lexical/config/client/EditorConfigProvider.js';
|
|
13
|
+
import { getSelectedNode } from '../../../../../../lexical/utils/getSelectedNode.js';
|
|
14
|
+
import { setFloatingElemPositionForLinkEditor } from '../../../../../../lexical/utils/setFloatingElemPositionForLinkEditor.js';
|
|
15
|
+
import { useLexicalDrawer } from '../../../../../../utilities/fieldsDrawer/useLexicalDrawer.js';
|
|
16
|
+
import { INSERT_WRAPPER_BLOCK_COMMAND, TOGGLE_WRAPPER_BLOCK_WITH_MODAL_COMMAND } from '../../commands.js';
|
|
17
|
+
import { useLexicalFormState } from './useLexicalFormState.js';
|
|
18
|
+
const WrapperBlockComponentContext = /*#__PURE__*/createContext({
|
|
19
|
+
formData: undefined,
|
|
20
|
+
initialState: false
|
|
21
|
+
});
|
|
22
|
+
export const useWrapperBlockComponentContext = () => {
|
|
23
|
+
return React.useContext(WrapperBlockComponentContext);
|
|
24
|
+
};
|
|
25
|
+
export function BlockEditor({
|
|
26
|
+
$createWrapperBlockNode,
|
|
27
|
+
$isWrapperBlockNode,
|
|
28
|
+
anchorElem
|
|
29
|
+
}) {
|
|
30
|
+
const [editor] = useLexicalComposerContext();
|
|
31
|
+
const [wrapperBlockNode, setWrapperBlockNode] = useState();
|
|
32
|
+
const editorRef = useRef(null);
|
|
33
|
+
const [wrapperBlockComponent, setWrapperBlockComponent] = useState(null);
|
|
34
|
+
const [wrapperBlockLabelComponent, setWrapperBlockLabelComponent] = useState(null);
|
|
35
|
+
const [clientBlock, setClientBlock] = useState(null);
|
|
36
|
+
const {
|
|
37
|
+
fieldProps: {
|
|
38
|
+
featureClientSchemaMap,
|
|
39
|
+
permissions,
|
|
40
|
+
schemaPath
|
|
41
|
+
},
|
|
42
|
+
uuid: uuidFromContext
|
|
43
|
+
} = useEditorConfigContext();
|
|
44
|
+
const [formData, setFormData] = useState();
|
|
45
|
+
const {
|
|
46
|
+
i18n,
|
|
47
|
+
t
|
|
48
|
+
} = useTranslation();
|
|
49
|
+
const [schemaFieldsPath, setSchemaFieldsPath] = React.useState(null);
|
|
50
|
+
const {
|
|
51
|
+
initialState,
|
|
52
|
+
loadInitialState,
|
|
53
|
+
onFormChange
|
|
54
|
+
} = useLexicalFormState({
|
|
55
|
+
onReceiveRenderedFields: ({
|
|
56
|
+
state
|
|
57
|
+
}) => {
|
|
58
|
+
setWrapperBlockComponent(state['_components']?.customComponents?.Block);
|
|
59
|
+
setWrapperBlockLabelComponent(state['_components']?.customComponents?.BlockLabel);
|
|
60
|
+
},
|
|
61
|
+
schemaFieldsPath
|
|
62
|
+
});
|
|
63
|
+
const editDepth = useEditDepth();
|
|
64
|
+
const [isWrapperBlockNode, setIsWrapperBlockNode] = useState(false);
|
|
65
|
+
const [selectedNodes, setSelectedNodes] = useState([]);
|
|
66
|
+
const drawerSlug = formatDrawerSlug({
|
|
67
|
+
slug: `lexical-rich-text-wrapper-block-` + uuidFromContext,
|
|
68
|
+
depth: editDepth
|
|
69
|
+
});
|
|
70
|
+
const {
|
|
71
|
+
toggleDrawer
|
|
72
|
+
} = useLexicalDrawer(drawerSlug);
|
|
73
|
+
const hideBlockPopup = useCallback(() => {
|
|
74
|
+
if (!isWrapperBlockNode) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
setIsWrapperBlockNode(false);
|
|
78
|
+
if (editorRef && editorRef.current) {
|
|
79
|
+
editorRef.current.style.opacity = '0';
|
|
80
|
+
editorRef.current.style.transform = 'translate(-10000px, -10000px)';
|
|
81
|
+
}
|
|
82
|
+
setWrapperBlockNode(null);
|
|
83
|
+
setWrapperBlockComponent(null);
|
|
84
|
+
setWrapperBlockLabelComponent(null);
|
|
85
|
+
setClientBlock(null);
|
|
86
|
+
setSelectedNodes([]);
|
|
87
|
+
setFormData(undefined);
|
|
88
|
+
setSchemaFieldsPath(null);
|
|
89
|
+
}, [isWrapperBlockNode]);
|
|
90
|
+
const $updateBlockPopup = useCallback(() => {
|
|
91
|
+
const selection = $getSelection();
|
|
92
|
+
let selectedNodeDomRect;
|
|
93
|
+
if (!$isRangeSelection(selection) || !selection) {
|
|
94
|
+
void hideBlockPopup();
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
// Handle the data displayed in the popup & drawer when you click on a wrapper block
|
|
98
|
+
const focusNode = getSelectedNode(selection);
|
|
99
|
+
selectedNodeDomRect = editor.getElementByKey(focusNode.getKey())?.getBoundingClientRect();
|
|
100
|
+
const focusWrapperBlockParent = $findMatchingParent(focusNode, $isWrapperBlockNode);
|
|
101
|
+
// Prevent wrapper block modal from showing if selection spans further than the wrapper block: https://github.com/facebook/lexical/issues/4064
|
|
102
|
+
const badNode = selection.getNodes().filter(node => !$isLineBreakNode(node)).find(node_0 => {
|
|
103
|
+
const wrapperBlockNode_0 = $findMatchingParent(node_0, $isWrapperBlockNode);
|
|
104
|
+
return focusWrapperBlockParent && !focusWrapperBlockParent.is(wrapperBlockNode_0) || wrapperBlockNode_0 && !wrapperBlockNode_0.is(focusWrapperBlockParent);
|
|
105
|
+
});
|
|
106
|
+
if (focusWrapperBlockParent == null || badNode) {
|
|
107
|
+
hideBlockPopup();
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const editorElem = editorRef.current;
|
|
111
|
+
const nativeSelection = window.getSelection();
|
|
112
|
+
const {
|
|
113
|
+
activeElement
|
|
114
|
+
} = document;
|
|
115
|
+
if (editorElem === null) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const rootElement = editor.getRootElement();
|
|
119
|
+
if (nativeSelection !== null && rootElement !== null && rootElement.contains(nativeSelection.anchorNode)) {
|
|
120
|
+
if (!selectedNodeDomRect) {
|
|
121
|
+
// Get the DOM rect of the selected node using the native selection. This sometimes produces the wrong
|
|
122
|
+
// result, which is why we use lexical's selection preferably.
|
|
123
|
+
selectedNodeDomRect = nativeSelection.getRangeAt(0).getBoundingClientRect();
|
|
124
|
+
}
|
|
125
|
+
if (selectedNodeDomRect != null) {
|
|
126
|
+
selectedNodeDomRect.y += 40;
|
|
127
|
+
setFloatingElemPositionForLinkEditor(selectedNodeDomRect, editorElem, anchorElem);
|
|
128
|
+
const fields = focusWrapperBlockParent.getFields();
|
|
129
|
+
// Initial state:
|
|
130
|
+
const data = {
|
|
131
|
+
...fields,
|
|
132
|
+
text: focusWrapperBlockParent.getTextContent()
|
|
133
|
+
};
|
|
134
|
+
const schemaFieldsPath_ = `${schemaPath}.lexical_internal_feature.blocks.lexical_wrapper_blocks.${data.blockType}.fields`;
|
|
135
|
+
if (schemaFieldsPath_ === schemaFieldsPath && data.id === formData?.id) {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
setWrapperBlockNode(focusWrapperBlockParent);
|
|
139
|
+
const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_wrapper_blocks.${data.blockType}`;
|
|
140
|
+
setSchemaFieldsPath(schemaFieldsPath_);
|
|
141
|
+
setFormData(data);
|
|
142
|
+
setIsWrapperBlockNode(true);
|
|
143
|
+
setSelectedNodes(selection ? selection?.getNodes() : []);
|
|
144
|
+
const clientSchemaMap = featureClientSchemaMap['blocks'];
|
|
145
|
+
const blocksField = clientSchemaMap[componentMapRenderedBlockPath][0];
|
|
146
|
+
const clientBlock_0 = blocksField.blocks[0];
|
|
147
|
+
setClientBlock(clientBlock_0);
|
|
148
|
+
loadInitialState({
|
|
149
|
+
formData: data,
|
|
150
|
+
schemaFieldsPath: schemaFieldsPath_
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
} else if (activeElement == null || activeElement.className !== 'wraper-block-popup__content') {
|
|
154
|
+
hideBlockPopup();
|
|
155
|
+
}
|
|
156
|
+
return true;
|
|
157
|
+
}, [editor, $isWrapperBlockNode, hideBlockPopup, anchorElem, schemaPath, schemaFieldsPath, formData?.id, featureClientSchemaMap, loadInitialState]);
|
|
158
|
+
useEffect(() => {
|
|
159
|
+
return mergeRegister(editor.registerCommand(TOGGLE_WRAPPER_BLOCK_WITH_MODAL_COMMAND, payload => {
|
|
160
|
+
if (!payload) {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
editor.dispatchCommand(INSERT_WRAPPER_BLOCK_COMMAND, payload.fields);
|
|
164
|
+
// Now, open the modal
|
|
165
|
+
$updateBlockPopup();
|
|
166
|
+
toggleDrawer();
|
|
167
|
+
return true;
|
|
168
|
+
}, COMMAND_PRIORITY_LOW));
|
|
169
|
+
}, [editor, $updateBlockPopup, toggleDrawer, drawerSlug]);
|
|
170
|
+
useEffect(() => {
|
|
171
|
+
const scrollerElem = anchorElem.parentElement;
|
|
172
|
+
const update = () => {
|
|
173
|
+
editor.getEditorState().read(() => {
|
|
174
|
+
void $updateBlockPopup();
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
window.addEventListener('resize', update);
|
|
178
|
+
if (scrollerElem != null) {
|
|
179
|
+
scrollerElem.addEventListener('scroll', update);
|
|
180
|
+
}
|
|
181
|
+
return () => {
|
|
182
|
+
window.removeEventListener('resize', update);
|
|
183
|
+
if (scrollerElem != null) {
|
|
184
|
+
scrollerElem.removeEventListener('scroll', update);
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
}, [anchorElem.parentElement, editor, $updateBlockPopup]);
|
|
188
|
+
useEffect(() => {
|
|
189
|
+
return mergeRegister(editor.registerUpdateListener(({
|
|
190
|
+
editorState
|
|
191
|
+
}) => {
|
|
192
|
+
editorState.read(() => {
|
|
193
|
+
void $updateBlockPopup();
|
|
194
|
+
});
|
|
195
|
+
}), editor.registerCommand(SELECTION_CHANGE_COMMAND, () => {
|
|
196
|
+
void $updateBlockPopup();
|
|
197
|
+
return true;
|
|
198
|
+
}, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_ESCAPE_COMMAND, () => {
|
|
199
|
+
if (isWrapperBlockNode) {
|
|
200
|
+
hideBlockPopup();
|
|
201
|
+
return true;
|
|
202
|
+
}
|
|
203
|
+
return false;
|
|
204
|
+
}, COMMAND_PRIORITY_HIGH));
|
|
205
|
+
}, [editor, $updateBlockPopup, isWrapperBlockNode, hideBlockPopup]);
|
|
206
|
+
/**
|
|
207
|
+
* HANDLE FORM SUBMIT
|
|
208
|
+
*/
|
|
209
|
+
const onFormSubmit = useCallback(formState => {
|
|
210
|
+
const newData = reduceFieldsToValues(formState);
|
|
211
|
+
newData.blockType = formData?.blockType;
|
|
212
|
+
editor.update(() => {
|
|
213
|
+
if (wrapperBlockNode && $isWrapperBlockNode(wrapperBlockNode)) {
|
|
214
|
+
wrapperBlockNode.setFields(newData);
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}, [formData?.blockType, editor, wrapperBlockNode, $isWrapperBlockNode]);
|
|
218
|
+
const blockDisplayName = clientBlock?.labels?.singular ? getTranslation(clientBlock.labels.singular, i18n) : clientBlock?.slug;
|
|
219
|
+
const EditButton = useMemo(() => () => /*#__PURE__*/_jsx("button", {
|
|
220
|
+
"aria-label": "Edit Wrapper Block",
|
|
221
|
+
className: "wrapper-block-popup__edit",
|
|
222
|
+
onClick: () => {
|
|
223
|
+
toggleDrawer();
|
|
224
|
+
},
|
|
225
|
+
onMouseDown: event => {
|
|
226
|
+
event.preventDefault();
|
|
227
|
+
},
|
|
228
|
+
tabIndex: 0,
|
|
229
|
+
type: "button",
|
|
230
|
+
children: /*#__PURE__*/_jsx(EditIcon, {})
|
|
231
|
+
}), [toggleDrawer]);
|
|
232
|
+
const RemoveButton = useMemo(() => () => /*#__PURE__*/_jsx("button", {
|
|
233
|
+
"aria-label": "Remove Wrapper Block",
|
|
234
|
+
className: "wrapper-block-popup__remove",
|
|
235
|
+
onClick: () => {
|
|
236
|
+
editor.dispatchCommand(INSERT_WRAPPER_BLOCK_COMMAND, null);
|
|
237
|
+
},
|
|
238
|
+
onMouseDown: event_0 => {
|
|
239
|
+
event_0.preventDefault();
|
|
240
|
+
},
|
|
241
|
+
tabIndex: 0,
|
|
242
|
+
type: "button",
|
|
243
|
+
children: /*#__PURE__*/_jsx(CloseMenuIcon, {})
|
|
244
|
+
}), [editor]);
|
|
245
|
+
const Label = useMemo(() => {
|
|
246
|
+
if (wrapperBlockLabelComponent) {
|
|
247
|
+
return () => wrapperBlockLabelComponent;
|
|
248
|
+
} else {
|
|
249
|
+
return () => blockDisplayName;
|
|
250
|
+
}
|
|
251
|
+
}, [blockDisplayName, wrapperBlockLabelComponent]);
|
|
252
|
+
const WrapperBlockContainer = useMemo(() => {
|
|
253
|
+
return ({
|
|
254
|
+
children
|
|
255
|
+
}) => {
|
|
256
|
+
return /*#__PURE__*/_jsx("div", {
|
|
257
|
+
className: "wrapper-block-popup__wrapper",
|
|
258
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
259
|
+
className: "wrapper-block-popup__content",
|
|
260
|
+
children: children
|
|
261
|
+
})
|
|
262
|
+
});
|
|
263
|
+
};
|
|
264
|
+
}, []);
|
|
265
|
+
return /*#__PURE__*/_jsxs(Form, {
|
|
266
|
+
beforeSubmit: [async ({
|
|
267
|
+
formState: formState_0
|
|
268
|
+
}) => {
|
|
269
|
+
// This is only called when form is submitted from drawer
|
|
270
|
+
return await onFormChange({
|
|
271
|
+
formState: formState_0,
|
|
272
|
+
submit: true
|
|
273
|
+
});
|
|
274
|
+
}],
|
|
275
|
+
disableValidationOnSubmit: true,
|
|
276
|
+
fields: clientBlock?.fields ?? [],
|
|
277
|
+
initialState: initialState ?? {},
|
|
278
|
+
onChange: [onFormChange],
|
|
279
|
+
onSubmit: formState_1 => {
|
|
280
|
+
onFormSubmit(formState_1);
|
|
281
|
+
toggleDrawer();
|
|
282
|
+
},
|
|
283
|
+
uuid: uuid(),
|
|
284
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
285
|
+
className: "wrapper-block-popup",
|
|
286
|
+
ref: editorRef,
|
|
287
|
+
children: wrapperBlockComponent ? /*#__PURE__*/_jsx(WrapperBlockComponentContext.Provider, {
|
|
288
|
+
value: {
|
|
289
|
+
EditButton,
|
|
290
|
+
formData,
|
|
291
|
+
initialState,
|
|
292
|
+
Label,
|
|
293
|
+
RemoveButton,
|
|
294
|
+
WrapperBlockContainer,
|
|
295
|
+
wrapperBlockNode: wrapperBlockNode
|
|
296
|
+
},
|
|
297
|
+
children: wrapperBlockComponent
|
|
298
|
+
}) : /*#__PURE__*/_jsxs(WrapperBlockContainer, {
|
|
299
|
+
children: [/*#__PURE__*/_jsx(Label, {}), editor.isEditable() && /*#__PURE__*/_jsxs(React.Fragment, {
|
|
300
|
+
children: [/*#__PURE__*/_jsx(EditButton, {}), /*#__PURE__*/_jsx(RemoveButton, {})]
|
|
301
|
+
})]
|
|
302
|
+
})
|
|
303
|
+
}), /*#__PURE__*/_jsx(EditDepthProvider, {
|
|
304
|
+
children: /*#__PURE__*/_jsx(Drawer, {
|
|
305
|
+
className: '',
|
|
306
|
+
slug: drawerSlug,
|
|
307
|
+
title: t(`lexical:blocks:inlineBlocks:${formData?.id ? 'edit' : 'create'}`, {
|
|
308
|
+
label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label')
|
|
309
|
+
}),
|
|
310
|
+
children: initialState && clientBlock && schemaFieldsPath ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
311
|
+
children: [/*#__PURE__*/_jsx(RenderFields, {
|
|
312
|
+
fields: clientBlock.fields,
|
|
313
|
+
forceRender: true,
|
|
314
|
+
parentIndexPath: "",
|
|
315
|
+
parentPath: "" // See Blocks feature path for details as for why this is empty
|
|
316
|
+
,
|
|
317
|
+
|
|
318
|
+
parentSchemaPath: schemaFieldsPath,
|
|
319
|
+
permissions: permissions,
|
|
320
|
+
readOnly: false
|
|
321
|
+
}), /*#__PURE__*/_jsx(FormSubmit, {
|
|
322
|
+
programmaticSubmit: true,
|
|
323
|
+
children: t('fields:saveChanges')
|
|
324
|
+
})]
|
|
325
|
+
}) : null
|
|
326
|
+
})
|
|
327
|
+
})]
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["useLexicalComposerContext","$findMatchingParent","mergeRegister","getTranslation","CloseMenuIcon","Drawer","EditDepthProvider","EditIcon","Form","formatDrawerSlug","FormSubmit","RenderFields","useEditDepth","useTranslation","$getSelection","$isLineBreakNode","$isRangeSelection","COMMAND_PRIORITY_HIGH","COMMAND_PRIORITY_LOW","KEY_ESCAPE_COMMAND","SELECTION_CHANGE_COMMAND","reduceFieldsToValues","React","createContext","useCallback","useEffect","useMemo","useRef","useState","v4","uuid","useEditorConfigContext","getSelectedNode","setFloatingElemPositionForLinkEditor","useLexicalDrawer","INSERT_WRAPPER_BLOCK_COMMAND","TOGGLE_WRAPPER_BLOCK_WITH_MODAL_COMMAND","useLexicalFormState","WrapperBlockComponentContext","formData","undefined","initialState","useWrapperBlockComponentContext","useContext","BlockEditor","$createWrapperBlockNode","$isWrapperBlockNode","anchorElem","editor","wrapperBlockNode","setWrapperBlockNode","editorRef","wrapperBlockComponent","setWrapperBlockComponent","wrapperBlockLabelComponent","setWrapperBlockLabelComponent","clientBlock","setClientBlock","fieldProps","featureClientSchemaMap","permissions","schemaPath","uuidFromContext","setFormData","i18n","t","schemaFieldsPath","setSchemaFieldsPath","loadInitialState","onFormChange","onReceiveRenderedFields","state","customComponents","Block","BlockLabel","editDepth","isWrapperBlockNode","setIsWrapperBlockNode","selectedNodes","setSelectedNodes","drawerSlug","slug","depth","toggleDrawer","hideBlockPopup","current","style","opacity","transform","$updateBlockPopup","selection","selectedNodeDomRect","focusNode","getElementByKey","getKey","getBoundingClientRect","focusWrapperBlockParent","badNode","getNodes","filter","node","find","is","editorElem","nativeSelection","window","getSelection","activeElement","document","rootElement","getRootElement","contains","anchorNode","getRangeAt","y","fields","getFields","data","text","getTextContent","schemaFieldsPath_","blockType","id","componentMapRenderedBlockPath","clientSchemaMap","blocksField","blocks","className","registerCommand","payload","dispatchCommand","scrollerElem","parentElement","update","getEditorState","read","addEventListener","removeEventListener","registerUpdateListener","editorState","onFormSubmit","formState","newData","setFields","blockDisplayName","labels","singular","EditButton","_jsx","onClick","onMouseDown","event","preventDefault","tabIndex","type","RemoveButton","Label","WrapperBlockContainer","children","_jsxs","beforeSubmit","submit","disableValidationOnSubmit","onChange","onSubmit","ref","Provider","value","isEditable","Fragment","title","label","_Fragment","forceRender","parentIndexPath","parentPath","parentSchemaPath","readOnly","programmaticSubmit"],"sources":["../../../../../../../src/features/blocks/client/plugin/wrapperBlocks/BlockEditor/index.tsx"],"sourcesContent":["'use client'\nimport type { LexicalNode } from 'lexical'\nimport type { BlocksFieldClient, ClientBlock, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { $findMatchingParent, mergeRegister } from '@lexical/utils'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n CloseMenuIcon,\n Drawer,\n EditDepthProvider,\n EditIcon,\n Form,\n formatDrawerSlug,\n FormSubmit,\n RenderFields,\n useEditDepth,\n useTranslation,\n} from '@payloadcms/ui'\nimport {\n $getSelection,\n $isLineBreakNode,\n $isRangeSelection,\n COMMAND_PRIORITY_HIGH,\n COMMAND_PRIORITY_LOW,\n KEY_ESCAPE_COMMAND,\n SELECTION_CHANGE_COMMAND,\n} from 'lexical'\nimport { reduceFieldsToValues } from 'payload/shared'\nimport React, { createContext, useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { WrapperBlockFields, WrapperBlockNodeType } from '../../../../WrapperBlockNode.js'\nimport type { AdditionalWrapperBlocksPluginArgs } from '../index.js'\n\nimport { useEditorConfigContext } from '../../../../../../lexical/config/client/EditorConfigProvider.js'\nimport { getSelectedNode } from '../../../../../../lexical/utils/getSelectedNode.js'\nimport { setFloatingElemPositionForLinkEditor } from '../../../../../../lexical/utils/setFloatingElemPositionForLinkEditor.js'\nimport { useLexicalDrawer } from '../../../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport {\n INSERT_WRAPPER_BLOCK_COMMAND,\n TOGGLE_WRAPPER_BLOCK_WITH_MODAL_COMMAND,\n} from '../../commands.js'\nimport { useLexicalFormState } from './useLexicalFormState.js'\n\ntype WrapperBlockComponentContextType = {\n EditButton?: React.FC\n formData: ({ text: string } & WrapperBlockFields) | undefined\n initialState: false | FormState | undefined\n Label?: React.FC\n RemoveButton?: React.FC\n WrapperBlockContainer?: React.FC<{ children: React.ReactNode }>\n wrapperBlockNode?: WrapperBlockNodeType\n}\n\nconst WrapperBlockComponentContext = createContext<WrapperBlockComponentContextType>({\n formData: undefined,\n initialState: false,\n})\n\nexport const useWrapperBlockComponentContext = () => React.useContext(WrapperBlockComponentContext)\n\nexport function BlockEditor({\n $createWrapperBlockNode,\n $isWrapperBlockNode,\n anchorElem,\n}: { anchorElem: HTMLElement } & AdditionalWrapperBlocksPluginArgs): React.ReactNode {\n const [editor] = useLexicalComposerContext()\n const [wrapperBlockNode, setWrapperBlockNode] = useState<null | WrapperBlockNodeType>()\n\n const editorRef = useRef<HTMLDivElement | null>(null)\n const [wrapperBlockComponent, setWrapperBlockComponent] = useState<null | React.ReactNode>(null)\n const [wrapperBlockLabelComponent, setWrapperBlockLabelComponent] =\n useState<null | React.ReactNode>(null)\n const [clientBlock, setClientBlock] = useState<ClientBlock | null>(null)\n\n const {\n fieldProps: { featureClientSchemaMap, permissions, schemaPath },\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n\n const [formData, setFormData] = useState<({ text: string } & WrapperBlockFields) | undefined>()\n const { i18n, t } = useTranslation<object, string>()\n const [schemaFieldsPath, setSchemaFieldsPath] = React.useState<null | string>(null)\n\n const { initialState, loadInitialState, onFormChange } = useLexicalFormState({\n onReceiveRenderedFields: ({ state }) => {\n setWrapperBlockComponent(state['_components']?.customComponents?.Block)\n setWrapperBlockLabelComponent(state['_components']?.customComponents?.BlockLabel)\n },\n schemaFieldsPath,\n })\n\n const editDepth = useEditDepth()\n const [isWrapperBlockNode, setIsWrapperBlockNode] = useState(false)\n const [selectedNodes, setSelectedNodes] = useState<LexicalNode[]>([])\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-rich-text-wrapper-block-` + uuidFromContext,\n depth: editDepth,\n })\n\n const { toggleDrawer } = useLexicalDrawer(drawerSlug)\n\n const hideBlockPopup = useCallback(() => {\n if (!isWrapperBlockNode) {\n return\n }\n setIsWrapperBlockNode(false)\n if (editorRef && editorRef.current) {\n editorRef.current.style.opacity = '0'\n editorRef.current.style.transform = 'translate(-10000px, -10000px)'\n }\n setWrapperBlockNode(null)\n setWrapperBlockComponent(null)\n setWrapperBlockLabelComponent(null)\n setClientBlock(null)\n setSelectedNodes([])\n setFormData(undefined)\n setSchemaFieldsPath(null)\n }, [isWrapperBlockNode])\n\n const $updateBlockPopup = useCallback(() => {\n const selection = $getSelection()\n let selectedNodeDomRect: DOMRect | undefined\n\n if (!$isRangeSelection(selection) || !selection) {\n void hideBlockPopup()\n return\n }\n\n // Handle the data displayed in the popup & drawer when you click on a wrapper block\n const focusNode = getSelectedNode(selection)\n selectedNodeDomRect = editor.getElementByKey(focusNode.getKey())?.getBoundingClientRect()\n const focusWrapperBlockParent = $findMatchingParent(focusNode, $isWrapperBlockNode)\n\n // Prevent wrapper block modal from showing if selection spans further than the wrapper block: https://github.com/facebook/lexical/issues/4064\n const badNode = selection\n .getNodes()\n .filter((node) => !$isLineBreakNode(node))\n .find((node) => {\n const wrapperBlockNode = $findMatchingParent(node, $isWrapperBlockNode)\n return (\n (focusWrapperBlockParent && !focusWrapperBlockParent.is(wrapperBlockNode)) ||\n (wrapperBlockNode && !wrapperBlockNode.is(focusWrapperBlockParent))\n )\n })\n\n if (focusWrapperBlockParent == null || badNode) {\n hideBlockPopup()\n return\n }\n\n const editorElem = editorRef.current\n const nativeSelection = window.getSelection()\n const { activeElement } = document\n\n if (editorElem === null) {\n return\n }\n\n const rootElement = editor.getRootElement()\n\n if (\n nativeSelection !== null &&\n rootElement !== null &&\n rootElement.contains(nativeSelection.anchorNode)\n ) {\n if (!selectedNodeDomRect) {\n // Get the DOM rect of the selected node using the native selection. This sometimes produces the wrong\n // result, which is why we use lexical's selection preferably.\n selectedNodeDomRect = nativeSelection.getRangeAt(0).getBoundingClientRect()\n }\n\n if (selectedNodeDomRect != null) {\n selectedNodeDomRect.y += 40\n setFloatingElemPositionForLinkEditor(selectedNodeDomRect, editorElem, anchorElem)\n\n const fields = focusWrapperBlockParent.getFields()\n\n // Initial state:\n const data: { text: string } & WrapperBlockFields = {\n ...fields,\n text: focusWrapperBlockParent.getTextContent(),\n }\n const schemaFieldsPath_ = `${schemaPath}.lexical_internal_feature.blocks.lexical_wrapper_blocks.${data.blockType}.fields`\n\n if (schemaFieldsPath_ === schemaFieldsPath && data.id === formData?.id) {\n return false\n }\n\n setWrapperBlockNode(focusWrapperBlockParent)\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_wrapper_blocks.${data.blockType}`\n\n setSchemaFieldsPath(schemaFieldsPath_)\n\n setFormData(data)\n setIsWrapperBlockNode(true)\n setSelectedNodes(selection ? selection?.getNodes() : [])\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient = clientSchemaMap[\n componentMapRenderedBlockPath\n ][0] as BlocksFieldClient\n\n const clientBlock = blocksField.blocks[0]\n setClientBlock(clientBlock)\n\n loadInitialState({ formData: data, schemaFieldsPath: schemaFieldsPath_ })\n }\n } else if (activeElement == null || activeElement.className !== 'wraper-block-popup__content') {\n hideBlockPopup()\n }\n\n return true\n }, [\n editor,\n $isWrapperBlockNode,\n hideBlockPopup,\n anchorElem,\n schemaPath,\n schemaFieldsPath,\n formData?.id,\n featureClientSchemaMap,\n loadInitialState,\n ])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n TOGGLE_WRAPPER_BLOCK_WITH_MODAL_COMMAND,\n (payload) => {\n if (!payload) {\n return false\n }\n editor.dispatchCommand(INSERT_WRAPPER_BLOCK_COMMAND, payload.fields)\n\n // Now, open the modal\n $updateBlockPopup()\n toggleDrawer()\n\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor, $updateBlockPopup, toggleDrawer, drawerSlug])\n\n useEffect(() => {\n const scrollerElem = anchorElem.parentElement\n\n const update = (): void => {\n editor.getEditorState().read(() => {\n void $updateBlockPopup()\n })\n }\n\n window.addEventListener('resize', update)\n\n if (scrollerElem != null) {\n scrollerElem.addEventListener('scroll', update)\n }\n\n return () => {\n window.removeEventListener('resize', update)\n\n if (scrollerElem != null) {\n scrollerElem.removeEventListener('scroll', update)\n }\n }\n }, [anchorElem.parentElement, editor, $updateBlockPopup])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerUpdateListener(({ editorState }) => {\n editorState.read(() => {\n void $updateBlockPopup()\n })\n }),\n\n editor.registerCommand(\n SELECTION_CHANGE_COMMAND,\n () => {\n void $updateBlockPopup()\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(\n KEY_ESCAPE_COMMAND,\n () => {\n if (isWrapperBlockNode) {\n hideBlockPopup()\n\n return true\n }\n return false\n },\n COMMAND_PRIORITY_HIGH,\n ),\n )\n }, [editor, $updateBlockPopup, isWrapperBlockNode, hideBlockPopup])\n\n /**\n * HANDLE FORM SUBMIT\n */\n const onFormSubmit = useCallback(\n (formState: FormState) => {\n const newData: any = reduceFieldsToValues(formState)\n newData.blockType = formData?.blockType\n editor.update(() => {\n if (wrapperBlockNode && $isWrapperBlockNode(wrapperBlockNode)) {\n wrapperBlockNode.setFields(newData)\n }\n })\n },\n [formData?.blockType, editor, wrapperBlockNode, $isWrapperBlockNode],\n )\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock.labels.singular, i18n)\n : clientBlock?.slug\n\n const EditButton = useMemo(\n () => () => (\n <button\n aria-label=\"Edit Wrapper Block\"\n className=\"wrapper-block-popup__edit\"\n onClick={() => {\n toggleDrawer()\n }}\n onMouseDown={(event) => {\n event.preventDefault()\n }}\n tabIndex={0}\n type=\"button\"\n >\n <EditIcon />\n </button>\n ),\n [toggleDrawer],\n )\n\n const RemoveButton = useMemo(\n () => () => (\n <button\n aria-label=\"Remove Wrapper Block\"\n className=\"wrapper-block-popup__remove\"\n onClick={() => {\n editor.dispatchCommand(INSERT_WRAPPER_BLOCK_COMMAND, null)\n }}\n onMouseDown={(event) => {\n event.preventDefault()\n }}\n tabIndex={0}\n type=\"button\"\n >\n <CloseMenuIcon />\n </button>\n ),\n [editor],\n )\n\n const Label = useMemo(() => {\n if (wrapperBlockLabelComponent) {\n return () => wrapperBlockLabelComponent\n } else {\n return () => blockDisplayName\n }\n }, [blockDisplayName, wrapperBlockLabelComponent])\n\n const WrapperBlockContainer = useMemo(() => {\n return ({ children }: { children: React.ReactNode }) => {\n return (\n <div className=\"wrapper-block-popup__wrapper\">\n <div className=\"wrapper-block-popup__content\">{children}</div>\n </div>\n )\n }\n }, [])\n\n return (\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer\n return await onFormChange({ formState, submit: true })\n },\n ]}\n disableValidationOnSubmit\n fields={clientBlock?.fields ?? []}\n initialState={initialState ?? {}}\n onChange={[onFormChange]}\n onSubmit={(formState) => {\n onFormSubmit(formState)\n toggleDrawer()\n }}\n uuid={uuid()}\n >\n <div className=\"wrapper-block-popup\" ref={editorRef}>\n {wrapperBlockComponent ? (\n <WrapperBlockComponentContext.Provider\n value={{\n EditButton,\n formData,\n initialState,\n Label,\n RemoveButton,\n WrapperBlockContainer,\n wrapperBlockNode: wrapperBlockNode!,\n }}\n >\n {wrapperBlockComponent}\n </WrapperBlockComponentContext.Provider>\n ) : (\n <WrapperBlockContainer>\n <Label />\n {editor.isEditable() && (\n <React.Fragment>\n <EditButton />\n <RemoveButton />\n </React.Fragment>\n )}\n </WrapperBlockContainer>\n )}\n </div>\n\n <EditDepthProvider>\n <Drawer\n className={''}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${formData?.id ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState && clientBlock && schemaFieldsPath ? (\n <>\n <RenderFields\n fields={clientBlock.fields}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={permissions}\n readOnly={false}\n />\n <FormSubmit programmaticSubmit={true}>{t('fields:saveChanges')}</FormSubmit>\n </>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n </Form>\n )\n}\n"],"mappings":"AAAA;;;AAIA,SAASA,yBAAyB,QAAQ;AAC1C,SAASC,mBAAmB,EAAEC,aAAa,QAAQ;AACnD,SAASC,cAAc,QAAQ;AAC/B,SACEC,aAAa,EACbC,MAAM,EACNC,iBAAiB,EACjBC,QAAQ,EACRC,IAAI,EACJC,gBAAgB,EAChBC,UAAU,EACVC,YAAY,EACZC,YAAY,EACZC,cAAc,QACT;AACP,SACEC,aAAa,EACbC,gBAAgB,EAChBC,iBAAiB,EACjBC,qBAAqB,EACrBC,oBAAoB,EACpBC,kBAAkB,EAClBC,wBAAwB,QACnB;AACP,SAASC,oBAAoB,QAAQ;AACrC,OAAOC,KAAA,IAASC,aAAa,EAAEC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AACxF,SAASC,EAAA,IAAMC,IAAI,QAAQ;AAK3B,SAASC,sBAAsB,QAAQ;AACvC,SAASC,eAAe,QAAQ;AAChC,SAASC,oCAAoC,QAAQ;AACrD,SAASC,gBAAgB,QAAQ;AACjC,SACEC,4BAA4B,EAC5BC,uCAAuC,QAClC;AACP,SAASC,mBAAmB,QAAQ;AAYpC,MAAMC,4BAAA,gBAA+Bf,aAAA,CAAgD;EACnFgB,QAAA,EAAUC,SAAA;EACVC,YAAA,EAAc;AAChB;AAEA,OAAO,MAAMC,+BAAA,GAAkCA,CAAA;EAAA,OAAMpB,KAAA,CAAAqB,UAAA,CAAAL,4BAAiB;AAAA;AAEtE,OAAO,SAASM,YAAY;EAC1BC,uBAAuB;EACv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IAAgBe,WAAA,IAAeU,gBAAA,gBAC9B6F,KAAA,CAAAa,SAAA;kCACExB,IAAA,CAACzI,YAAA;YACCwG,MAAA,EAAQ3D,WAAA,CAAY2D,MAAM;YAC1B0D,WAAW;YACXC,eAAA,EAAgB;YAChBC,UAAA,EAAW,GAAG;YAAA;;YACdC,gBAAA,EAAkB9G,gBAAA;YAClBN,WAAA,EAAaA,WAAA;YACbqH,QAAA,EAAU;2BAEZ7B,IAAA,CAAC1I,UAAA;YAAWwK,kBAAA,EAAoB;sBAAOjH,CAAA,CAAE;;aAEzC;;;;AAKd","ignoreList":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { FormState } from 'payload';
|
|
2
|
+
import type { WrapperBlockFields } from '../../../../WrapperBlockNode.js';
|
|
3
|
+
export type Props = {
|
|
4
|
+
onReceiveRenderedFields: (args: {
|
|
5
|
+
state: FormState;
|
|
6
|
+
}) => void;
|
|
7
|
+
schemaFieldsPath: null | string;
|
|
8
|
+
};
|
|
9
|
+
export declare const useLexicalFormState: (props: Props) => {
|
|
10
|
+
initialState?: FormState;
|
|
11
|
+
loadInitialState: (args: {
|
|
12
|
+
formData: {
|
|
13
|
+
text: string;
|
|
14
|
+
} & WrapperBlockFields;
|
|
15
|
+
schemaFieldsPath: string;
|
|
16
|
+
}) => void;
|
|
17
|
+
onFormChange: (args: {
|
|
18
|
+
formState: FormState;
|
|
19
|
+
submit?: boolean;
|
|
20
|
+
}) => Promise<FormState>;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=useLexicalFormState.d.ts.map
|
package/dist/features/blocks/client/plugin/wrapperBlocks/BlockEditor/useLexicalFormState.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLexicalFormState.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/blocks/client/plugin/wrapperBlocks/BlockEditor/useLexicalFormState.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAMxC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AAEzE,MAAM,MAAM,KAAK,GAAG;IAClB,uBAAuB,EAAE,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,SAAS,CAAA;KAAE,KAAK,IAAI,CAAA;IAC7D,gBAAgB,EAAE,IAAI,GAAG,MAAM,CAAA;CAChC,CAAA;AACD,eAAO,MAAM,mBAAmB,UACvB,KAAK,KACX;IACD,YAAY,CAAC,EAAE,SAAS,CAAA;IACxB,gBAAgB,EAAE,CAAC,IAAI,EAAE;QACvB,QAAQ,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,GAAG,kBAAkB,CAAA;QAC/C,gBAAgB,EAAE,MAAM,CAAA;KACzB,KAAK,IAAI,CAAA;IACV,YAAY,EAAE,CAAC,IAAI,EAAE;QAAE,SAAS,EAAE,SAAS,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC,SAAS,CAAC,CAAA;CAmIvF,CAAA"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
4
|
+
import { useDocumentInfo, useServerFunctions } from '@payloadcms/ui';
|
|
5
|
+
import { abortAndIgnore } from '@payloadcms/ui/shared';
|
|
6
|
+
import React, { useCallback, useEffect, useRef } from 'react';
|
|
7
|
+
export const useLexicalFormState = props => {
|
|
8
|
+
const $ = _c(23);
|
|
9
|
+
const {
|
|
10
|
+
onReceiveRenderedFields,
|
|
11
|
+
schemaFieldsPath
|
|
12
|
+
} = props;
|
|
13
|
+
const {
|
|
14
|
+
id,
|
|
15
|
+
collectionSlug,
|
|
16
|
+
getDocPreferences,
|
|
17
|
+
globalSlug
|
|
18
|
+
} = useDocumentInfo();
|
|
19
|
+
const {
|
|
20
|
+
getFormState
|
|
21
|
+
} = useServerFunctions();
|
|
22
|
+
const [initialState, setInitialState] = React.useState(undefined);
|
|
23
|
+
let t0;
|
|
24
|
+
if ($[0] !== schemaFieldsPath || $[1] !== getFormState || $[2] !== id || $[3] !== collectionSlug || $[4] !== getDocPreferences || $[5] !== globalSlug || $[6] !== onReceiveRenderedFields) {
|
|
25
|
+
t0 = t1 => {
|
|
26
|
+
const {
|
|
27
|
+
formData,
|
|
28
|
+
schemaFieldsPath: schemaFieldsPathFromProps
|
|
29
|
+
} = t1;
|
|
30
|
+
const schemaPath = schemaFieldsPathFromProps ?? schemaFieldsPath;
|
|
31
|
+
if (!schemaPath) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const abortController = new AbortController();
|
|
35
|
+
const awaitInitialState = async () => {
|
|
36
|
+
const {
|
|
37
|
+
state
|
|
38
|
+
} = await getFormState({
|
|
39
|
+
id,
|
|
40
|
+
collectionSlug,
|
|
41
|
+
data: formData,
|
|
42
|
+
docPermissions: {
|
|
43
|
+
fields: true
|
|
44
|
+
},
|
|
45
|
+
docPreferences: await getDocPreferences(),
|
|
46
|
+
globalSlug,
|
|
47
|
+
operation: "update",
|
|
48
|
+
renderAllFields: true,
|
|
49
|
+
schemaPath,
|
|
50
|
+
signal: abortController.signal
|
|
51
|
+
});
|
|
52
|
+
if (state) {
|
|
53
|
+
setInitialState(state);
|
|
54
|
+
if (onReceiveRenderedFields) {
|
|
55
|
+
onReceiveRenderedFields({
|
|
56
|
+
state
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
setInitialState(undefined);
|
|
62
|
+
if (formData) {
|
|
63
|
+
awaitInitialState();
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
$[0] = schemaFieldsPath;
|
|
67
|
+
$[1] = getFormState;
|
|
68
|
+
$[2] = id;
|
|
69
|
+
$[3] = collectionSlug;
|
|
70
|
+
$[4] = getDocPreferences;
|
|
71
|
+
$[5] = globalSlug;
|
|
72
|
+
$[6] = onReceiveRenderedFields;
|
|
73
|
+
$[7] = t0;
|
|
74
|
+
} else {
|
|
75
|
+
t0 = $[7];
|
|
76
|
+
}
|
|
77
|
+
const loadInitialState = t0;
|
|
78
|
+
let t1;
|
|
79
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
80
|
+
t1 = new AbortController();
|
|
81
|
+
$[8] = t1;
|
|
82
|
+
} else {
|
|
83
|
+
t1 = $[8];
|
|
84
|
+
}
|
|
85
|
+
const onChangeAbortControllerRef = useRef(t1);
|
|
86
|
+
let t2;
|
|
87
|
+
if ($[9] !== schemaFieldsPath || $[10] !== getFormState || $[11] !== id || $[12] !== collectionSlug || $[13] !== getDocPreferences || $[14] !== globalSlug || $[15] !== onReceiveRenderedFields) {
|
|
88
|
+
t2 = async t3 => {
|
|
89
|
+
const {
|
|
90
|
+
formState: prevFormState,
|
|
91
|
+
submit
|
|
92
|
+
} = t3;
|
|
93
|
+
if (schemaFieldsPath === null) {
|
|
94
|
+
return prevFormState;
|
|
95
|
+
}
|
|
96
|
+
abortAndIgnore(onChangeAbortControllerRef.current);
|
|
97
|
+
const controller = new AbortController();
|
|
98
|
+
onChangeAbortControllerRef.current = controller;
|
|
99
|
+
const {
|
|
100
|
+
state: state_0
|
|
101
|
+
} = await getFormState({
|
|
102
|
+
id,
|
|
103
|
+
collectionSlug,
|
|
104
|
+
docPermissions: {
|
|
105
|
+
fields: true
|
|
106
|
+
},
|
|
107
|
+
docPreferences: await getDocPreferences(),
|
|
108
|
+
formState: prevFormState,
|
|
109
|
+
globalSlug,
|
|
110
|
+
operation: "update",
|
|
111
|
+
renderAllFields: submit ? true : false,
|
|
112
|
+
schemaPath: schemaFieldsPath,
|
|
113
|
+
signal: controller.signal
|
|
114
|
+
});
|
|
115
|
+
if (!state_0) {
|
|
116
|
+
return prevFormState;
|
|
117
|
+
}
|
|
118
|
+
if (submit) {
|
|
119
|
+
if (onReceiveRenderedFields) {
|
|
120
|
+
onReceiveRenderedFields({
|
|
121
|
+
state: state_0
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return state_0;
|
|
126
|
+
};
|
|
127
|
+
$[9] = schemaFieldsPath;
|
|
128
|
+
$[10] = getFormState;
|
|
129
|
+
$[11] = id;
|
|
130
|
+
$[12] = collectionSlug;
|
|
131
|
+
$[13] = getDocPreferences;
|
|
132
|
+
$[14] = globalSlug;
|
|
133
|
+
$[15] = onReceiveRenderedFields;
|
|
134
|
+
$[16] = t2;
|
|
135
|
+
} else {
|
|
136
|
+
t2 = $[16];
|
|
137
|
+
}
|
|
138
|
+
const onFormChange = t2;
|
|
139
|
+
let t3;
|
|
140
|
+
let t4;
|
|
141
|
+
if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
|
|
142
|
+
t3 = () => () => {
|
|
143
|
+
abortAndIgnore(onChangeAbortControllerRef.current);
|
|
144
|
+
};
|
|
145
|
+
t4 = [];
|
|
146
|
+
$[17] = t3;
|
|
147
|
+
$[18] = t4;
|
|
148
|
+
} else {
|
|
149
|
+
t3 = $[17];
|
|
150
|
+
t4 = $[18];
|
|
151
|
+
}
|
|
152
|
+
useEffect(t3, t4);
|
|
153
|
+
let t5;
|
|
154
|
+
if ($[19] !== initialState || $[20] !== loadInitialState || $[21] !== onFormChange) {
|
|
155
|
+
t5 = {
|
|
156
|
+
initialState,
|
|
157
|
+
loadInitialState,
|
|
158
|
+
onFormChange
|
|
159
|
+
};
|
|
160
|
+
$[19] = initialState;
|
|
161
|
+
$[20] = loadInitialState;
|
|
162
|
+
$[21] = onFormChange;
|
|
163
|
+
$[22] = t5;
|
|
164
|
+
} else {
|
|
165
|
+
t5 = $[22];
|
|
166
|
+
}
|
|
167
|
+
return t5;
|
|
168
|
+
};
|
|
169
|
+
//# sourceMappingURL=useLexicalFormState.js.map
|
package/dist/features/blocks/client/plugin/wrapperBlocks/BlockEditor/useLexicalFormState.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLexicalFormState.js","names":["c","_c","useDocumentInfo","useServerFunctions","abortAndIgnore","React","useCallback","useEffect","useRef","useLexicalFormState","props","$","onReceiveRenderedFields","schemaFieldsPath","id","collectionSlug","getDocPreferences","globalSlug","getFormState","initialState","setInitialState","useState","undefined","t0","t1","formData","schemaFieldsPathFromProps","schemaPath","abortController","AbortController","awaitInitialState","state","data","docPermissions","fields","docPreferences","operation","renderAllFields","signal","loadInitialState","Symbol","for","onChangeAbortControllerRef","t2","t3","formState","prevFormState","submit","current","controller","state_0","onFormChange","t4","t5"],"sources":["../../../../../../../src/features/blocks/client/plugin/wrapperBlocks/BlockEditor/useLexicalFormState.tsx"],"sourcesContent":["'use client'\nimport type { FormState } from 'payload'\n\nimport { useDocumentInfo, useServerFunctions } from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport React, { useCallback, useEffect, useRef } from 'react'\n\nimport type { WrapperBlockFields } from '../../../../WrapperBlockNode.js'\n\nexport type Props = {\n onReceiveRenderedFields: (args: { state: FormState }) => void\n schemaFieldsPath: null | string\n}\nexport const useLexicalFormState = (\n props: Props,\n): {\n initialState?: FormState\n loadInitialState: (args: {\n formData: { text: string } & WrapperBlockFields\n schemaFieldsPath: string\n }) => void\n onFormChange: (args: { formState: FormState; submit?: boolean }) => Promise<FormState>\n} => {\n const { onReceiveRenderedFields, schemaFieldsPath } = props\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n const { getFormState } = useServerFunctions()\n const [initialState, setInitialState] = React.useState<FormState | undefined>(undefined)\n\n const loadInitialState = useCallback(\n ({\n formData,\n schemaFieldsPath: schemaFieldsPathFromProps,\n }: {\n formData: { text: string } & WrapperBlockFields\n schemaFieldsPath?: string\n }) => {\n const schemaPath = schemaFieldsPathFromProps ?? schemaFieldsPath\n if (!schemaPath) {\n return\n }\n const abortController = new AbortController()\n\n const awaitInitialState = async () => {\n /*\n * This will only run if a new block is created. For all existing blocks that are loaded when the document is loaded, or when the form is saved,\n * this is not run, as the lexical field RSC will fetch the state server-side and pass it to the client. That way, we avoid unnecessary client-side\n * requests. Though for newly created blocks, we need to fetch the state client-side, as the server doesn't know about the block yet.\n */\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: formData,\n docPermissions: { fields: true },\n docPreferences: await getDocPreferences(),\n globalSlug,\n operation: 'update',\n renderAllFields: true,\n schemaPath,\n signal: abortController.signal,\n })\n\n if (state) {\n setInitialState(state)\n if (onReceiveRenderedFields) {\n onReceiveRenderedFields({ state })\n }\n }\n }\n\n setInitialState(undefined)\n if (formData) {\n void awaitInitialState()\n }\n },\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n globalSlug,\n schemaFieldsPath,\n onReceiveRenderedFields,\n ],\n )\n\n /**\n * Handle drawer and form state\n */\n const onChangeAbortControllerRef = useRef(new AbortController())\n\n /**\n * HANDLE ONCHANGE\n */\n const onFormChange = useCallback(\n async ({ formState: prevFormState, submit }: { formState: FormState; submit?: boolean }) => {\n if (schemaFieldsPath === null) {\n return prevFormState\n }\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n formState: prevFormState,\n globalSlug,\n operation: 'update',\n renderAllFields: submit ? true : false,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n if (submit) {\n if (onReceiveRenderedFields) {\n onReceiveRenderedFields({ state })\n }\n }\n\n return state\n },\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n globalSlug,\n schemaFieldsPath,\n onReceiveRenderedFields,\n ],\n )\n // cleanup effect\n useEffect(() => {\n return () => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [])\n\n return {\n initialState,\n loadInitialState,\n onFormChange,\n }\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAGA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wC,YAAA;IAAAxC,CAAA,OAAA0C,EAAA;EAAA;IAAAA,EAAA,GAAA1C,CAAA;EAAA;EAAA,OAJO0C,EAIP;AAAA,CACF","ignoreList":[]}
|
package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockContainer.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WrapperBlockContainer.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockContainer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,eAAO,MAAM,qBAAqB,iBAAkB;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,6BAIhF,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { useWrapperBlockComponentContext } from '../BlockEditor/index.js';
|
|
7
|
+
export const WrapperBlockContainer = t0 => {
|
|
8
|
+
const $ = _c(3);
|
|
9
|
+
const {
|
|
10
|
+
children
|
|
11
|
+
} = t0;
|
|
12
|
+
const {
|
|
13
|
+
WrapperBlockContainer
|
|
14
|
+
} = useWrapperBlockComponentContext();
|
|
15
|
+
let t1;
|
|
16
|
+
if ($[0] !== WrapperBlockContainer || $[1] !== children) {
|
|
17
|
+
t1 = WrapperBlockContainer ? _jsx(WrapperBlockContainer, {
|
|
18
|
+
children
|
|
19
|
+
}) : null;
|
|
20
|
+
$[0] = WrapperBlockContainer;
|
|
21
|
+
$[1] = children;
|
|
22
|
+
$[2] = t1;
|
|
23
|
+
} else {
|
|
24
|
+
t1 = $[2];
|
|
25
|
+
}
|
|
26
|
+
return t1;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=WrapperBlockContainer.js.map
|
package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockContainer.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WrapperBlockContainer.js","names":["c","_c","React","useWrapperBlockComponentContext","WrapperBlockContainer","t0","$","children","t1","_jsx"],"sources":["../../../../../../../src/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockContainer.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useWrapperBlockComponentContext } from '../BlockEditor/index.js'\n\nexport const WrapperBlockContainer = ({ children }: { children: React.ReactNode }) => {\n const { WrapperBlockContainer } = useWrapperBlockComponentContext()\n\n return WrapperBlockContainer ? <WrapperBlockContainer>{children}</WrapperBlockContainer> : null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,OAAOC,KAAA,MAAW;AAElB,SAASC,+BAA+B,QAAQ;AAEhD,OAAO,MAAMC,qBAAA,GAAwBC,EAAA;EAAA,MAAAC,CAAA,GAAAL,EAAA;EAAC;IAAAM;EAAA,IAAAF,EAA2C;EAC/E;IAAAD;EAAA,IAAkCD,+BAAA;EAAA,IAAAK,EAAA;EAAA,IAAAF,CAAA,QAAAF,qBAAA,IAAAE,CAAA,QAAAC,QAAA;IAE3BC,EAAA,GAAAJ,qBAAA,GAAwBK,IAAA,CAACL,qBAAA;MAAAG;IAAA,C,QAA2D;IAAAD,CAAA,MAAAF,qBAAA;IAAAE,CAAA,MAAAC,QAAA;IAAAD,CAAA,MAAAE,EAAA;EAAA;IAAAA,EAAA,GAAAF,CAAA;EAAA;EAAA,OAApFE,EAAoF;AAAA,CAC7F","ignoreList":[]}
|
package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockEditButton.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WrapperBlockEditButton.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockEditButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,eAAO,MAAM,sBAAsB,gCAIlC,CAAA"}
|