@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vonaffenfels/slate-editor",
3
- "version": "1.0.30",
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": "fe88a0b3ce82331fa3d7193a4cd62b8e2c8ecfb9",
74
+ "gitHead": "007715e3b949cf0368e7b4d70626d2931c7b7829",
75
75
  "publishConfig": {
76
76
  "access": "public"
77
77
  }
@@ -17,7 +17,7 @@
17
17
  }
18
18
 
19
19
  label {
20
- margin: 0 0 6px 0 !important;
20
+ margin: 0 0 2px 0 !important;
21
21
  }
22
22
 
23
23
  input[type="text"],
@@ -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="text-center">
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 stories={storybookStories} active={storybookElement} onChange={handleBlockSelectChange} />
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
- if (item.storyContext === "development" || (Array.isArray(item.storyContext) && item.storyContext.includes("development"))) {
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