@vonaffenfels/slate-editor 1.0.80 → 1.0.81

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.80",
3
+ "version": "1.0.81",
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": "4fb98b27f14958fc2d5c99f8d95c5010da0c266e",
74
+ "gitHead": "a8759bb4528cbe15162eea2db425d570110eaaf7",
75
75
  "publishConfig": {
76
76
  "access": "public"
77
77
  }
@@ -31,6 +31,7 @@ export default function BlockEditor({
31
31
  storybookStories,
32
32
  onSaveClick,
33
33
  isLoading,
34
+ activeConfig,
34
35
  }) {
35
36
  const scrollContainer = useRef(null);
36
37
  const [selectedStorybookElement, setSelectedStorybookElement] = useState(null);
@@ -319,6 +320,8 @@ export default function BlockEditor({
319
320
  setSelectedStorybookElement(null);
320
321
  };
321
322
 
323
+ const slug = contentfulSdk?.entry?.fields?.slug?.getValue();
324
+
322
325
  return (
323
326
  <div className={classNames({"block-editor-wrapper h-full": true})}>
324
327
  <Resizable
@@ -336,7 +339,12 @@ export default function BlockEditor({
336
339
  isLoadingStories={isLoadingStories}
337
340
  editor={editor}
338
341
  sdk={contentfulSdk}
339
- lastSelection={lastSelection}/>
342
+ lastSelection={lastSelection}
343
+ buttons={activeConfig?.domain && slug && (
344
+ <a href={`${activeConfig.domain}/${slug}`} target="_blank" rel="noreferrer">
345
+ <button className='button button--secondary'>Live-Seite öffnen</button>
346
+ </a>
347
+ )}/>
340
348
  </div>
341
349
  <div className="relative h-full max-h-full overflow-scroll px-8 py-4" ref={scrollContainer}>
342
350
  {isLoading && (
@@ -39,6 +39,7 @@ export const Toolbar = ({
39
39
  editor,
40
40
  sdk,
41
41
  lastSelection,
42
+ buttons,
42
43
  }) => {
43
44
  const ref = useRef();
44
45
 
@@ -166,6 +167,9 @@ export const Toolbar = ({
166
167
  {!!onSaveClick && <button
167
168
  className="!w-auto !border-0 !bg-green-600 !text-xs font-bold text-white hover:!bg-green-700"
168
169
  onClick={onSaveClick}>Änderungen speichern</button>}
170
+ {buttons && (
171
+ <div>{buttons}</div>
172
+ )}
169
173
  </div>
170
174
  </Menu>;
171
175
  }