@vonaffenfels/slate-editor 1.1.34 → 1.1.36
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.js +1 -1
- package/dist/index.js +4 -4
- package/package.json +2 -2
- package/src/SidebarEditor.js +51 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vonaffenfels/slate-editor",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.36",
|
|
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": "c55640e4184996f5503928a6e1f990c3b4420a52",
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"access": "public"
|
|
78
78
|
}
|
package/src/SidebarEditor.js
CHANGED
|
@@ -270,6 +270,56 @@ const SidebarEditor = ({
|
|
|
270
270
|
);
|
|
271
271
|
};
|
|
272
272
|
|
|
273
|
+
const handleInfoClick = () => {
|
|
274
|
+
let message = "";
|
|
275
|
+
|
|
276
|
+
if (!story?.argTypes || !storybookElement) {
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
Object.keys(story.argTypes).forEach((key, index) => {
|
|
281
|
+
const argType = story.argTypes[key];
|
|
282
|
+
const attribute = storybookElement.attributes?.[key];
|
|
283
|
+
|
|
284
|
+
if (!argType || attribute === undefined || attribute === "") {
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
if (index !== 0) {
|
|
289
|
+
message += " | ";
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
if (Array.isArray(attribute)) {
|
|
293
|
+
message += `${argType.name}: ${attribute.length} Elemente`;
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
switch (typeof attribute) {
|
|
298
|
+
case "boolean":
|
|
299
|
+
message += `${argType.name}: ${attribute ? "Ja" : "Nein"}`;
|
|
300
|
+
break;
|
|
301
|
+
case "number":
|
|
302
|
+
message += `${argType.name}: ${attribute}`;
|
|
303
|
+
break;
|
|
304
|
+
case "object":
|
|
305
|
+
message += `${argType.name}: ${JSON.stringify(attribute, null, 2)}`;
|
|
306
|
+
break;
|
|
307
|
+
default:
|
|
308
|
+
message += `${argType.name}: "${attribute}"`;
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
sdk.dialogs
|
|
313
|
+
.openAlert({
|
|
314
|
+
title: 'Info',
|
|
315
|
+
message: message || 'Keine Informationen verfügbar',
|
|
316
|
+
confirmLabel: "Schließen",
|
|
317
|
+
})
|
|
318
|
+
.then((result) => {
|
|
319
|
+
// `result` is always `true`, can be skipped
|
|
320
|
+
});
|
|
321
|
+
};
|
|
322
|
+
|
|
273
323
|
return (
|
|
274
324
|
<div id="sidebar-editor-wrapper">
|
|
275
325
|
<div id="sidebar-editor">
|
|
@@ -327,6 +377,7 @@ const SidebarEditor = ({
|
|
|
327
377
|
hinzufügen</CollapsableMenuItem>
|
|
328
378
|
<CollapsableMenuItem onClick={() => onInsert("below")}>Danach
|
|
329
379
|
hinzufügen</CollapsableMenuItem>
|
|
380
|
+
<CollapsableMenuItem onClick={handleInfoClick}>Info</CollapsableMenuItem>
|
|
330
381
|
<div className="px-4 pb-2 pt-1">
|
|
331
382
|
<b className="mb-1 block text-sm">Sichtbar auf:</b>
|
|
332
383
|
<Switch
|