@vonaffenfels/contentful-slate-editor 1.0.35 → 1.0.43
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.43",
|
|
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.43",
|
|
93
93
|
"webpack": "5.88.2"
|
|
94
94
|
},
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "2dc1a5a219755f4b1036840f4c1bc9356749eb28",
|
|
96
96
|
"publishConfig": {
|
|
97
97
|
"access": "public"
|
|
98
98
|
}
|
|
@@ -37,7 +37,7 @@ const EditorField = ({
|
|
|
37
37
|
];
|
|
38
38
|
const [value, setValue] = useState(validateValue(loadedValue));
|
|
39
39
|
const [externalValue, setExternalValue] = useState(value);
|
|
40
|
-
const [isLoadingCount, setIsLoadingCount] = useState(
|
|
40
|
+
const [isLoadingCount, setIsLoadingCount] = useState(0);
|
|
41
41
|
const isVisible = useOnScreen(wrapperRef);
|
|
42
42
|
|
|
43
43
|
function validateValue(value) {
|
|
@@ -114,19 +114,25 @@ const EditorField = ({
|
|
|
114
114
|
}),
|
|
115
115
|
})}`;
|
|
116
116
|
|
|
117
|
-
loaderResult = await fetch(fetchUrl)
|
|
117
|
+
loaderResult = await fetch(fetchUrl)
|
|
118
|
+
.then(res => res.json())
|
|
119
|
+
.catch(err => {
|
|
120
|
+
console.error(err);
|
|
121
|
+
});
|
|
118
122
|
|
|
119
123
|
if (loaderResult) {
|
|
120
124
|
for (let key in loaderResult) {
|
|
121
125
|
attributes[key] = loaderResult[key];
|
|
122
126
|
}
|
|
123
127
|
}
|
|
128
|
+
|
|
129
|
+
setIsLoadingCount(--isLoadingCountGlobal);
|
|
124
130
|
} catch (e) {
|
|
125
131
|
console.error(`Error in loader for ${block}`);
|
|
126
132
|
console.error(e);
|
|
127
|
-
}
|
|
128
133
|
|
|
129
|
-
|
|
134
|
+
setIsLoadingCount(--isLoadingCountGlobal);
|
|
135
|
+
}
|
|
130
136
|
|
|
131
137
|
return loaderResult;
|
|
132
138
|
};
|
package/src/components/Field.js
CHANGED
|
@@ -6,7 +6,10 @@ import componentLoader from "@vonaffenfels/slate-editor/componentLoader.js";
|
|
|
6
6
|
|
|
7
7
|
const FIELD_HEIGHT = 300;
|
|
8
8
|
|
|
9
|
-
const Field = ({
|
|
9
|
+
const Field = ({
|
|
10
|
+
sdk,
|
|
11
|
+
elementPropsMap,
|
|
12
|
+
}) => {
|
|
10
13
|
const [value, setValue] = useState(sdk.field.getValue());
|
|
11
14
|
const wrapperRef = useRef();
|
|
12
15
|
|
|
@@ -49,7 +52,7 @@ const Field = ({sdk, elementPropsMap}) => {
|
|
|
49
52
|
return <div
|
|
50
53
|
ref={wrapperRef}
|
|
51
54
|
>
|
|
52
|
-
<button onClick={openDialog} className="mb-2 w-full">Inhalt bearbeiten</button>
|
|
55
|
+
<button onClick={openDialog} className="button mb-2 w-full">Inhalt bearbeiten</button>
|
|
53
56
|
<div style={{
|
|
54
57
|
overflowY: "auto",
|
|
55
58
|
maxHeight: "500px",
|