@vonaffenfels/slate-editor 1.0.49 → 1.0.53

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.
@@ -90,7 +90,7 @@ export const Toolbar = ({
90
90
  el.removeAttribute('style');
91
91
  el.classList.remove("active");
92
92
  }
93
- });
93
+ }, [hover, ref, editor]);
94
94
 
95
95
  function renderMenu() {
96
96
  return <Menu
@@ -147,7 +147,9 @@ export const Toolbar = ({
147
147
  />
148
148
  </div>
149
149
  </div>
150
- {!!onSaveClick && <button className="!w-auto !border-0 !bg-green-600 !text-xs font-bold text-white hover:!bg-green-700" onClick={onSaveClick}>Änderungen speichern</button>}
150
+ {!!onSaveClick && <button
151
+ className="!w-auto !border-0 !bg-green-600 !text-xs font-bold text-white hover:!bg-green-700"
152
+ onClick={onSaveClick}>Änderungen speichern</button>}
151
153
  </div>
152
154
  </Menu>;
153
155
  }
@@ -167,18 +169,16 @@ const ElementAutocomplete = ({
167
169
  storybookStories,
168
170
  isLoading,
169
171
  editor,
170
- storyContext,
172
+ storyContext = "",
171
173
  }) => {
172
- const [filteredItems, setFilteredItems] = React.useState(items);
173
-
174
174
  const items = (storybookStories || []).map(story => {
175
- let storyTitleSplit = story.title.split("/");
175
+ let storyTitleSplit = String(story.title || "").split("/");
176
176
 
177
177
  if (!story.id) {
178
178
  return;
179
179
  }
180
180
 
181
- let splitStoryContext = storyContext.split(",");
181
+ let splitStoryContext = String(storyContext || "").split(",");
182
182
  let isItemInContext = splitStoryContext.find(context => {
183
183
  return Array.isArray(story.storyContext) ? story.storyContext.includes(context) : context === story.storyContext;
184
184
  });
@@ -194,6 +194,8 @@ const ElementAutocomplete = ({
194
194
  };
195
195
  }).filter(Boolean);
196
196
 
197
+ const [filteredItems, setFilteredItems] = useState(items);
198
+
197
199
  useEffect(() => {
198
200
  setFilteredItems(items);
199
201
  }, [storybookStories]);
@@ -226,7 +228,7 @@ const ElementAutocomplete = ({
226
228
  items={filteredItems}
227
229
  onQueryChange={handleQueryChange}
228
230
  isLoading={isLoading}
229
- placeholder={'Suchen...'}
231
+ placeholder={'Element hinzufügen'}
230
232
  emptyListMessage={'Keine Komponenten gefunden'}
231
233
  noMatchesMessage={'Keine Ergebnisse gefunden'}
232
234
  dropdownProps={{isFullWidth: true}}
package/src/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ import "../scss/editor.scss";
2
+
1
3
  import BlockEditor from "./BlockEditor";
2
4
  import Renderer from "./Renderer";
3
5
  import {HtmlSerializer} from "./Serializer";
package/storyLoader.js CHANGED
@@ -8,6 +8,7 @@ module.exports = async function storiesLoader() {
8
8
  globs: ["**/*.stories.js", "**/*.stories.jsx", "**/*.stories.ts"],
9
9
  });
10
10
 
11
+ this.addContextDependency(options.storiesRoot);
11
12
  console.log(`Found ${files.length} stories in ${options.storiesRoot}`);
12
13
 
13
14
  return `
@@ -4,6 +4,7 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
4
4
 
5
5
  config.externals = {
6
6
  react: "react",
7
+ next: "next",
7
8
  "react-dom": "react-dom",
8
9
  "prop-types": "prop-types",
9
10
  };
@@ -0,0 +1,5 @@
1
+ const config = require("./webpack.config.build");
2
+
3
+ config.mode = "development";
4
+
5
+ module.exports = config;