@vonaffenfels/contentful-slate-editor 1.0.28 → 1.0.31
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vonaffenfels/contentful-slate-editor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.31",
|
|
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.31",
|
|
93
93
|
"webpack": "5.88.2"
|
|
94
94
|
},
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "007715e3b949cf0368e7b4d70626d2931c7b7829",
|
|
96
96
|
"publishConfig": {
|
|
97
97
|
"access": "public"
|
|
98
98
|
}
|
package/src/components/Dialog.js
CHANGED
|
@@ -21,27 +21,18 @@ const Dialog = ({
|
|
|
21
21
|
},
|
|
22
22
|
];
|
|
23
23
|
const [value, setValue] = useState(sdk.parameters.invocation.value || defaultValue);
|
|
24
|
-
const [loadedStorybookStories, setLoadedStorybookStories] = useState([]);
|
|
25
|
-
|
|
26
|
-
const loadStories = async () => {
|
|
27
|
-
setLoadedStorybookStories(await storybookStories());
|
|
28
|
-
};
|
|
29
24
|
|
|
30
25
|
const saveChanges = () => {
|
|
31
26
|
sdk.close(value);
|
|
32
27
|
};
|
|
33
28
|
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
loadStories();
|
|
36
|
-
}, []);
|
|
37
|
-
|
|
38
29
|
switch (sdk.parameters.invocation.type) {
|
|
39
30
|
case "cloudinary":
|
|
40
31
|
return <DialogCloudinary sdk={sdk} config={sdk.parameters.invocation}/>;
|
|
41
32
|
default:
|
|
42
33
|
return <div className="relative flex h-full max-h-full justify-between">
|
|
43
34
|
<BlockEditor
|
|
44
|
-
storybookStories={
|
|
35
|
+
storybookStories={storybookStories}
|
|
45
36
|
onChange={setValue}
|
|
46
37
|
elementPropsMap={elementPropsMap}
|
|
47
38
|
value={value}
|
|
@@ -12,7 +12,6 @@ import storybookStories from "storybookStories";
|
|
|
12
12
|
import componentLoader from "@vonaffenfels/slate-editor/componentLoader";
|
|
13
13
|
|
|
14
14
|
let isLoadingCountGlobal = 0;
|
|
15
|
-
let controller = new AbortController();
|
|
16
15
|
|
|
17
16
|
const EditorField = ({
|
|
18
17
|
fieldSdk,
|
|
@@ -35,7 +34,6 @@ const EditorField = ({
|
|
|
35
34
|
},
|
|
36
35
|
];
|
|
37
36
|
const [value, setValue] = useState(validateValue(loadedValue));
|
|
38
|
-
const [stories, setStories] = useState([]);
|
|
39
37
|
const [externalValue, setExternalValue] = useState(value);
|
|
40
38
|
const [isLoadingCount, setIsLoadingCount] = useState(isLoadingCount);
|
|
41
39
|
const isVisible = useOnScreen(wrapperRef);
|
|
@@ -66,8 +64,6 @@ const EditorField = ({
|
|
|
66
64
|
if (windowSdk) {
|
|
67
65
|
windowSdk.startAutoResizer();
|
|
68
66
|
}
|
|
69
|
-
|
|
70
|
-
storybookStories().then(s => setStories(s));
|
|
71
67
|
}, []);
|
|
72
68
|
|
|
73
69
|
useEffect(() => {
|
|
@@ -104,16 +100,12 @@ const EditorField = ({
|
|
|
104
100
|
config={JSON.parse("{}")}
|
|
105
101
|
elementPropsMap={elementPropsMap}
|
|
106
102
|
storybookComponentLoader={componentLoader}
|
|
107
|
-
storybookStories={
|
|
103
|
+
storybookStories={storybookStories}
|
|
108
104
|
isLoading={isLoadingCount !== 0}
|
|
109
105
|
storybookComponentDataLoader={async (block, attributes) => {
|
|
110
106
|
let loaderResult = {};
|
|
111
107
|
setIsLoadingCount(++isLoadingCountGlobal);
|
|
112
108
|
|
|
113
|
-
controller.abort();
|
|
114
|
-
|
|
115
|
-
controller = new AbortController();
|
|
116
|
-
|
|
117
109
|
try {
|
|
118
110
|
const fetchUrl = `/api/loader/?${new URLSearchParams({
|
|
119
111
|
portal: portal,
|
|
@@ -124,7 +116,8 @@ const EditorField = ({
|
|
|
124
116
|
items: null,
|
|
125
117
|
}),
|
|
126
118
|
})}`;
|
|
127
|
-
|
|
119
|
+
|
|
120
|
+
loaderResult = await fetch(fetchUrl).then(res => res.json());
|
|
128
121
|
|
|
129
122
|
if (loaderResult) {
|
|
130
123
|
for (let key in loaderResult) {
|