@vonaffenfels/slate-editor 1.0.1 → 1.0.2
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/dist/BlockEditor.css +3 -1
- package/dist/BlockEditor.js +1 -1
- package/dist/index.css +3 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/src/SidebarEditor.css +3 -1
- package/src/SidebarEditor.js +13 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vonaffenfels/slate-editor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"cssnano": "^5.0.1",
|
|
73
73
|
"escape-html": "^1.0.3"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "ae1bfe8cfaf2732b1bc53b28cec08ea1c5d5a842",
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"access": "public"
|
|
78
78
|
}
|
package/src/SidebarEditor.css
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
flex-basis: 400px;
|
|
10
10
|
flex-shrink: 0;
|
|
11
11
|
padding: 61px 16px 16px 16px;
|
|
12
|
+
resize: horizontal;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
select {
|
|
@@ -34,6 +35,7 @@ input[type="text"],
|
|
|
34
35
|
input[type="number"],
|
|
35
36
|
input[type="color"],
|
|
36
37
|
input[type="date"],
|
|
38
|
+
select,
|
|
37
39
|
textarea {
|
|
38
40
|
display: block;
|
|
39
41
|
font-size: 0.875rem !important;
|
|
@@ -44,7 +46,7 @@ textarea {
|
|
|
44
46
|
box-shadow: none !important;
|
|
45
47
|
filter: none !important;
|
|
46
48
|
width: 100% !important;
|
|
47
|
-
padding: 8px 0.75rem;
|
|
49
|
+
padding: 8px 0.75rem !important;
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
input[type="color"] {
|
package/src/SidebarEditor.js
CHANGED
|
@@ -83,18 +83,17 @@ const SidebarEditor = ({
|
|
|
83
83
|
|
|
84
84
|
return (
|
|
85
85
|
<div id="sidebar-editor">
|
|
86
|
-
<
|
|
86
|
+
<div className="mb-2">
|
|
87
|
+
<div className="flex items-center">
|
|
88
|
+
<div className="grow pr-2">
|
|
89
|
+
<BlockSelect stories={storybookStories} active={storybookElement} onChange={onChange} className="font-bold"/>
|
|
90
|
+
</div>
|
|
91
|
+
{!!onClose && <div className="cursor-pointer p-1" onClick={onClose} title="Schließen"><Icon icon="Close" /></div>}
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
87
94
|
{storybookElement?.block && (
|
|
88
95
|
<div>
|
|
89
|
-
<
|
|
90
|
-
<div className="flex">
|
|
91
|
-
<div className="grow">
|
|
92
|
-
<Heading>{storybookElement.block}</Heading>
|
|
93
|
-
</div>
|
|
94
|
-
{!!onClose && <div className="cursor-pointer p-1" onClick={onClose}><Icon icon="Close" /></div>}
|
|
95
|
-
</div>
|
|
96
|
-
<VariantSelect story={story} onChange={onChange}/>
|
|
97
|
-
</div>
|
|
96
|
+
<VariantSelect story={story} onChange={onChange} className="mb-2" />
|
|
98
97
|
<div className="flex items-center">
|
|
99
98
|
<select
|
|
100
99
|
value={storybookElement.attributes.blockWidth}
|
|
@@ -173,6 +172,7 @@ const SidebarEditor = ({
|
|
|
173
172
|
const VariantSelect = ({
|
|
174
173
|
story,
|
|
175
174
|
onChange,
|
|
175
|
+
className,
|
|
176
176
|
}) => {
|
|
177
177
|
const stories = story?.stories?.filter(s => s.title !== story.title) || [];
|
|
178
178
|
|
|
@@ -181,7 +181,7 @@ const VariantSelect = ({
|
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
return <select
|
|
184
|
-
className=
|
|
184
|
+
className={className}
|
|
185
185
|
onChange={e => onChange && onChange({
|
|
186
186
|
block: story.id,
|
|
187
187
|
attributes: {...stories.find(s => s.title === e.target.value)?.args || {}},
|
|
@@ -197,6 +197,7 @@ const BlockSelect = ({
|
|
|
197
197
|
stories,
|
|
198
198
|
active,
|
|
199
199
|
onChange,
|
|
200
|
+
className,
|
|
200
201
|
}) => {
|
|
201
202
|
if (!onChange) {
|
|
202
203
|
return null;
|
|
@@ -216,8 +217,8 @@ const BlockSelect = ({
|
|
|
216
217
|
|
|
217
218
|
return (
|
|
218
219
|
<select
|
|
219
|
-
className="mt-2"
|
|
220
220
|
onChange={e => onSelectChange(stories.find(s => s.id === e.target.value))}
|
|
221
|
+
className={className}
|
|
221
222
|
>
|
|
222
223
|
<option>Element wählen</option>
|
|
223
224
|
{stories.map(s => (
|