@vonaffenfels/slate-editor 1.0.30 → 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/dist/BlockEditor.css +2 -2
- package/dist/BlockEditor.js +1 -1
- package/dist/index.css +2 -2
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/scss/sidebarEditor.scss +1 -1
- package/src/SidebarEditor.js +15 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vonaffenfels/slate-editor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.31",
|
|
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": "007715e3b949cf0368e7b4d70626d2931c7b7829",
|
|
75
75
|
"publishConfig": {
|
|
76
76
|
"access": "public"
|
|
77
77
|
}
|
package/scss/sidebarEditor.scss
CHANGED
package/src/SidebarEditor.js
CHANGED
|
@@ -8,6 +8,8 @@ import "../scss/sidebarEditor.scss";
|
|
|
8
8
|
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
|
|
9
9
|
import {faSpinner} from "@fortawesome/free-solid-svg-icons";
|
|
10
10
|
|
|
11
|
+
const devMode = localStorage.getItem("dev-mode") === "true";
|
|
12
|
+
|
|
11
13
|
const SidebarEditor = ({
|
|
12
14
|
sdk,
|
|
13
15
|
storybookElement,
|
|
@@ -169,7 +171,7 @@ const SidebarEditor = ({
|
|
|
169
171
|
return (
|
|
170
172
|
<div id="sidebar-editor">
|
|
171
173
|
{isLoading ? (
|
|
172
|
-
<div className="
|
|
174
|
+
<div className="flex h-full items-center justify-center">
|
|
173
175
|
<FontAwesomeIcon icon={faSpinner} pulse />
|
|
174
176
|
</div>
|
|
175
177
|
) : (
|
|
@@ -208,7 +210,11 @@ const SidebarEditor = ({
|
|
|
208
210
|
</div>
|
|
209
211
|
<div className="grow overflow-y-auto pr-2 pt-2">
|
|
210
212
|
<div className="mb-2">
|
|
211
|
-
<BlockSelect
|
|
213
|
+
<BlockSelect
|
|
214
|
+
stories={storybookStories}
|
|
215
|
+
active={storybookElement}
|
|
216
|
+
onChange={handleBlockSelectChange}
|
|
217
|
+
storyContext={sdk.parameters.instance.storyContext} />
|
|
212
218
|
</div>
|
|
213
219
|
{storybookElement?.block && (
|
|
214
220
|
<div>
|
|
@@ -362,6 +368,7 @@ const BlockSelect = ({
|
|
|
362
368
|
active,
|
|
363
369
|
onChange,
|
|
364
370
|
className,
|
|
371
|
+
storyContext,
|
|
365
372
|
}) => {
|
|
366
373
|
if (!onChange) {
|
|
367
374
|
return null;
|
|
@@ -388,7 +395,12 @@ const BlockSelect = ({
|
|
|
388
395
|
return;
|
|
389
396
|
}
|
|
390
397
|
|
|
391
|
-
|
|
398
|
+
let splitStoryContext = storyContext.split(",");
|
|
399
|
+
let isItemInContext = splitStoryContext.find(context => {
|
|
400
|
+
return Array.isArray(item.storyContext) ? item.storyContext.includes(context) : context === item.storyContext;
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
if (!devMode && !isItemInContext) {
|
|
392
404
|
return;
|
|
393
405
|
}
|
|
394
406
|
|