@vonaffenfels/slate-editor 1.0.18 → 1.0.20
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.20",
|
|
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": "a846930c8b8e27a6ecf7bab999e1b6a77b22c6a2",
|
|
75
75
|
"publishConfig": {
|
|
76
76
|
"access": "public"
|
|
77
77
|
}
|
|
@@ -62,6 +62,17 @@ export const SidebarEditorField = ({
|
|
|
62
62
|
))}
|
|
63
63
|
</select>
|
|
64
64
|
);
|
|
65
|
+
case "data-stream":
|
|
66
|
+
return (
|
|
67
|
+
<select
|
|
68
|
+
value={value || ""}
|
|
69
|
+
onChange={e => onChange(fieldKey, e.target.value)}>
|
|
70
|
+
<option value="">Auswählen</option>
|
|
71
|
+
{field.control.streams.map(stream => (
|
|
72
|
+
<option key={`select-option-${stream.value}`} value={stream.value}>{stream.label}</option>
|
|
73
|
+
))}
|
|
74
|
+
</select>
|
|
75
|
+
);
|
|
65
76
|
case "number":
|
|
66
77
|
return (
|
|
67
78
|
<input
|
package/src/SidebarEditor.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
useState, useEffect,
|
|
2
|
+
Fragment, useState, useEffect,
|
|
3
3
|
} from "react";
|
|
4
4
|
import {SidebarEditorField} from "./SidebarEditor/SidebarEditorField";
|
|
5
5
|
import {ToolMargin} from "./Tools/Margin";
|
|
@@ -371,6 +371,10 @@ const BlockSelect = ({
|
|
|
371
371
|
const result = {};
|
|
372
372
|
|
|
373
373
|
array.forEach(item => {
|
|
374
|
+
if (!item.id) {
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
|
|
374
378
|
const parts = item.title.split('/');
|
|
375
379
|
let currentLevel = result;
|
|
376
380
|
|
|
@@ -391,8 +395,13 @@ const BlockSelect = ({
|
|
|
391
395
|
|
|
392
396
|
let storyGroups = groupArrayToObject(stories);
|
|
393
397
|
|
|
394
|
-
const renderOptions = (obj) => Object.keys(obj).map(key => {
|
|
398
|
+
const renderOptions = (obj) => Object.keys(obj).map((key, index) => {
|
|
395
399
|
const option = obj[key];
|
|
400
|
+
|
|
401
|
+
if (!option) {
|
|
402
|
+
return null;
|
|
403
|
+
}
|
|
404
|
+
|
|
396
405
|
if (option.title && option.id) {
|
|
397
406
|
return (
|
|
398
407
|
<option key={option.id} value={option.id}>
|
|
@@ -401,7 +410,7 @@ const BlockSelect = ({
|
|
|
401
410
|
);
|
|
402
411
|
} else if (typeof option === "object") {
|
|
403
412
|
return (
|
|
404
|
-
|
|
413
|
+
<Fragment key={`${key}-${index}`}>
|
|
405
414
|
<option
|
|
406
415
|
disabled
|
|
407
416
|
style={{
|
|
@@ -409,7 +418,7 @@ const BlockSelect = ({
|
|
|
409
418
|
fontWeight: option.level === 0 ? "bold" : "normal",
|
|
410
419
|
}}>{key}</option>
|
|
411
420
|
{renderOptions(option)}
|
|
412
|
-
|
|
421
|
+
</Fragment>
|
|
413
422
|
);
|
|
414
423
|
}
|
|
415
424
|
});
|
|
@@ -14,6 +14,18 @@ export default {
|
|
|
14
14
|
name: "Text",
|
|
15
15
|
control: {type: "text"},
|
|
16
16
|
},
|
|
17
|
+
stream: {
|
|
18
|
+
name: "Logik",
|
|
19
|
+
control: {
|
|
20
|
+
type: 'data-stream',
|
|
21
|
+
streams: [
|
|
22
|
+
{
|
|
23
|
+
value: "contentById",
|
|
24
|
+
label: "Ausgewählten Inhalt laden",
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
17
29
|
boolean: {
|
|
18
30
|
name: "Boolean",
|
|
19
31
|
control: {type: "boolean"},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import TestStory3 from "./TestStory3";
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
|
-
title: "
|
|
5
|
-
id: "TestStory3",
|
|
4
|
+
title: "Design-System/Atoms/Ad Tags/Test Story 3",
|
|
5
|
+
// id: "TestStory3",
|
|
6
6
|
component: TestStory3,
|
|
7
7
|
storyContext: ["layout"],
|
|
8
8
|
argTypes: {
|