@vonaffenfels/contentful-slate-editor 1.0.15 → 1.0.19
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/package.json +3 -3
- package/src/components/Dialog.js +18 -17
- package/src/index.js +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vonaffenfels/contentful-slate-editor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"prepublish": "yarn run build",
|
|
6
6
|
"dev": "yarn run start",
|
|
@@ -89,10 +89,10 @@
|
|
|
89
89
|
"webpack-dev-server": "^4.0.0-beta.2"
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"@vonaffenfels/slate-editor": "^1.0.
|
|
92
|
+
"@vonaffenfels/slate-editor": "^1.0.19",
|
|
93
93
|
"webpack": "5.73.0"
|
|
94
94
|
},
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "c07e5c97a79341c38e8439ac3e160a02b802db2f",
|
|
96
96
|
"publishConfig": {
|
|
97
97
|
"access": "public"
|
|
98
98
|
}
|
package/src/components/Dialog.js
CHANGED
|
@@ -8,7 +8,10 @@ import BlockEditor from "@vonaffenfels/slate-editor/dist/BlockEditor";
|
|
|
8
8
|
// eslint-disable-next-line import/no-unresolved
|
|
9
9
|
import storybookStories from "storybookStories";
|
|
10
10
|
|
|
11
|
-
const Dialog = ({
|
|
11
|
+
const Dialog = ({
|
|
12
|
+
sdk,
|
|
13
|
+
elementPropsMap,
|
|
14
|
+
}) => {
|
|
12
15
|
const defaultValue = [
|
|
13
16
|
{
|
|
14
17
|
type: "paragraph",
|
|
@@ -37,22 +40,20 @@ const Dialog = ({sdk, elementPropsMap}) => {
|
|
|
37
40
|
return <DialogCloudinary sdk={sdk} config={sdk.parameters.invocation}/>;
|
|
38
41
|
default:
|
|
39
42
|
return <div className="relative flex h-full max-h-full justify-between">
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
/>
|
|
55
|
-
</div>
|
|
43
|
+
<BlockEditor
|
|
44
|
+
storybookStories={loadedStorybookStories}
|
|
45
|
+
onChange={setValue}
|
|
46
|
+
elementPropsMap={elementPropsMap}
|
|
47
|
+
value={value}
|
|
48
|
+
storybookComponentLoader={(block) => {
|
|
49
|
+
return componentLoader(block);
|
|
50
|
+
}}
|
|
51
|
+
storybookComponentDataLoader={async (block, attributes) => {
|
|
52
|
+
return {};
|
|
53
|
+
}}
|
|
54
|
+
contentfulSdk={sdk}
|
|
55
|
+
onSaveClick={saveChanges}
|
|
56
|
+
/>
|
|
56
57
|
</div>;
|
|
57
58
|
}
|
|
58
59
|
};
|
package/src/index.js
CHANGED
|
@@ -18,14 +18,14 @@ import Dialog from "./components/Dialog";
|
|
|
18
18
|
export const BaseContentfulApp = (props) => {
|
|
19
19
|
init((sdk) => {
|
|
20
20
|
const rootContainer = document.getElementById('root');
|
|
21
|
-
const RendererWrapperComponent = props
|
|
21
|
+
const RendererWrapperComponent = props?.RendererWrapperComponent || (({children}) => <div className="h-full">{children}</div>);
|
|
22
22
|
const wrapperProps = {
|
|
23
23
|
sdk,
|
|
24
24
|
value: sdk.parameters?.invocation?.value || sdk?.field?.getValue(),
|
|
25
25
|
portal: sdk.parameters?.invocation?.portal || sdk?.entry?.fields?.portal.getValue(),
|
|
26
26
|
contentType: sdk.parameters?.invocation?.contentType || sdk?.entry?.getSys()?.contentType?.sys?.id,
|
|
27
27
|
};
|
|
28
|
-
const elementPropsMap = props
|
|
28
|
+
const elementPropsMap = props?.getElementPropsMap?.(wrapperProps.contentType) || props?.elementPropsMap;
|
|
29
29
|
|
|
30
30
|
const ComponentLocationSettings = [
|
|
31
31
|
{
|
|
@@ -34,7 +34,7 @@ export const BaseContentfulApp = (props) => {
|
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
location: locations.LOCATION_ENTRY_FIELD,
|
|
37
|
-
component: <RendererWrapperComponent
|
|
37
|
+
component: <RendererWrapperComponent {...wrapperProps}><Field sdk={sdk} elementPropsMap={elementPropsMap}/></RendererWrapperComponent>,
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
40
|
location: locations.LOCATION_ENTRY_EDITOR,
|
|
@@ -49,7 +49,7 @@ export const BaseContentfulApp = (props) => {
|
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
location: locations.LOCATION_DIALOG,
|
|
52
|
-
component: <RendererWrapperComponent
|
|
52
|
+
component: <RendererWrapperComponent {...wrapperProps} ><Dialog sdk={sdk} elementPropsMap={elementPropsMap}/></RendererWrapperComponent>,
|
|
53
53
|
},
|
|
54
54
|
];
|
|
55
55
|
|