@vonaffenfels/slate-editor 1.0.31 → 1.0.33
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/slate-editor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.33",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"cssnano": "^5.0.1",
|
|
72
72
|
"escape-html": "^1.0.3"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "a5d858b33c49e6a1a53f90951749159b06452db5",
|
|
75
75
|
"publishConfig": {
|
|
76
76
|
"access": "public"
|
|
77
77
|
}
|
package/scss/sidebarEditor.scss
CHANGED
|
@@ -59,12 +59,6 @@ export const AssetList = ({
|
|
|
59
59
|
return asset;
|
|
60
60
|
});
|
|
61
61
|
|
|
62
|
-
console.log({
|
|
63
|
-
newAssets,
|
|
64
|
-
newAsset,
|
|
65
|
-
assets,
|
|
66
|
-
});
|
|
67
|
-
|
|
68
62
|
onChange(newAssets);
|
|
69
63
|
};
|
|
70
64
|
|
|
@@ -90,12 +84,12 @@ export const Asset = ({
|
|
|
90
84
|
let mediaAssetId = asset?.fields?.media?.["en-US"]?.sys?.id || asset?.fields?.media?.["de"]?.sys?.id || asset?.fields?.media?.sys?.id;
|
|
91
85
|
|
|
92
86
|
if (cloudinary) {
|
|
93
|
-
title = asset.public_id;
|
|
87
|
+
title = asset.public_id || asset.title;
|
|
94
88
|
}
|
|
95
89
|
|
|
96
90
|
useEffect(() => {
|
|
97
91
|
if (cloudinary) {
|
|
98
|
-
setMediaUrl(asset.url);
|
|
92
|
+
setMediaUrl(asset.url || asset?.media?.url);
|
|
99
93
|
|
|
100
94
|
return;
|
|
101
95
|
}
|
|
@@ -161,16 +155,18 @@ export const Asset = ({
|
|
|
161
155
|
<IconButton size="small" onClick={() => onMoveClick("down")} disabled={index === assetsLength - 1}>↓</IconButton>
|
|
162
156
|
</div>
|
|
163
157
|
)}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
onChange
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
158
|
+
{!cloudinary && (
|
|
159
|
+
<IconButton
|
|
160
|
+
size="small"
|
|
161
|
+
className="mr-1"
|
|
162
|
+
onClick={() => {
|
|
163
|
+
sdk.navigator.openEntry(id, {slideIn: {waitForClose: true}}).then(({entity}) => {
|
|
164
|
+
if (onChange) {
|
|
165
|
+
onChange(entity);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}}>✎</IconButton>
|
|
169
|
+
)}
|
|
174
170
|
<IconButton size="small" onClick={onDeleteClick}>⨯</IconButton>
|
|
175
171
|
</div>
|
|
176
172
|
</div>
|
|
@@ -69,10 +69,21 @@ export const SidebarEditorField = ({
|
|
|
69
69
|
|
|
70
70
|
switch (field?.control?.type) {
|
|
71
71
|
case "text":
|
|
72
|
-
return <
|
|
72
|
+
return <textarea
|
|
73
73
|
type="text"
|
|
74
74
|
value={value || ""}
|
|
75
|
-
onChange={e =>
|
|
75
|
+
onChange={e => {
|
|
76
|
+
onChange(fieldKey, e.target.value);
|
|
77
|
+
e.target.style.height = "5px";
|
|
78
|
+
e.target.style.height = e.target.scrollHeight + 2 + "px";
|
|
79
|
+
}}
|
|
80
|
+
onBlur={(e) => {
|
|
81
|
+
e.target.style.height = "42px";
|
|
82
|
+
}}
|
|
83
|
+
onFocus={e => {
|
|
84
|
+
e.target.style.height = "5px";
|
|
85
|
+
e.target.style.height = e.target.scrollHeight + 2 + "px";
|
|
86
|
+
}} />;
|
|
76
87
|
case "boolean":
|
|
77
88
|
return (
|
|
78
89
|
<div>
|
|
@@ -362,7 +373,7 @@ export const SidebarEditorField = ({
|
|
|
362
373
|
</div>
|
|
363
374
|
);
|
|
364
375
|
})}
|
|
365
|
-
<button onClick={() => onChange(fieldKey, [...(storybookElement.attributes[fieldKey] || []), {}])}>Neue Zeile</button>
|
|
376
|
+
<button className="button--secondary" onClick={() => onChange(fieldKey, [...(storybookElement.attributes[fieldKey] || []), {}])}>Neue Zeile</button>
|
|
366
377
|
</div>
|
|
367
378
|
</details>
|
|
368
379
|
);
|