@vonaffenfels/slate-editor 1.2.19 → 1.2.29

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.
Files changed (87) hide show
  1. package/.babelrc +43 -43
  2. package/README.md +5 -5
  3. package/componentLoader.js +93 -93
  4. package/dist/BlockEditor.css +1 -1
  5. package/dist/BlockEditor.js +1 -1
  6. package/dist/Renderer.js +1 -1
  7. package/dist/index.css +1 -1
  8. package/dist/index.js +1 -1
  9. package/package.json +2 -2
  10. package/postcss.config.js +6 -6
  11. package/scss/demo.scss +148 -148
  12. package/scss/sidebarEditor.scss +185 -185
  13. package/scss/toolbar.scss +162 -162
  14. package/src/Blocks/EmptyBlock.js +11 -11
  15. package/src/Blocks/EmptyWrapper.js +4 -4
  16. package/src/Blocks/ErrorBoundary.js +40 -40
  17. package/src/Blocks/LayoutBlock.js +274 -274
  18. package/src/Blocks/LayoutSlot.js +90 -90
  19. package/src/CollapsableMenu/CollapsableMenu.js +48 -48
  20. package/src/Context/StorybookContext.js +6 -6
  21. package/src/ElementAutocomplete.js +134 -134
  22. package/src/Loader.js +137 -137
  23. package/src/Nodes/Default.js +162 -162
  24. package/src/Nodes/Leaf.js +54 -54
  25. package/src/Nodes/Text.js +97 -97
  26. package/src/ObjectId.js +3 -3
  27. package/src/Renderer.js +73 -73
  28. package/src/Serializer/Html.js +42 -42
  29. package/src/Serializer/Serializer.js +374 -371
  30. package/src/Serializer/Text.js +17 -17
  31. package/src/Serializer/ads.js +187 -187
  32. package/src/Serializer/index.js +3 -3
  33. package/src/SidebarEditor/AssetList.js +181 -181
  34. package/src/SidebarEditor/Fields/CloudinaryContentSelect.js +89 -89
  35. package/src/SidebarEditor/Fields/ColorPicker.js +89 -89
  36. package/src/SidebarEditor/Fields/ContentfulContentSelect.js +62 -62
  37. package/src/SidebarEditor/Fields/DateTime.js +55 -55
  38. package/src/SidebarEditor/Fields/MVP.js +66 -66
  39. package/src/SidebarEditor/Fields/MultiSelect.js +13 -13
  40. package/src/SidebarEditor/Fields/RemoteMultiSelect.js +40 -40
  41. package/src/SidebarEditor/Fields/RemoteSelect.js +39 -39
  42. package/src/SidebarEditor/Fields/Select.js +47 -47
  43. package/src/SidebarEditor/Fields/StreamSelect.js +15 -15
  44. package/src/SidebarEditor/Fields/Switch.js +34 -34
  45. package/src/SidebarEditor/Fields/Textarea.js +21 -21
  46. package/src/SidebarEditor/Resizable.js +85 -85
  47. package/src/SidebarEditor/SidebarEditorField.js +4 -1
  48. package/src/Storybook.js +151 -151
  49. package/src/Toolbar/Align.js +64 -64
  50. package/src/Toolbar/Anchor.js +94 -94
  51. package/src/Toolbar/Block.js +135 -135
  52. package/src/Toolbar/Element.js +44 -44
  53. package/src/Toolbar/Formats.js +71 -71
  54. package/src/Toolbar/Insert.js +28 -28
  55. package/src/Toolbar/Layout.js +399 -399
  56. package/src/Toolbar/Link.js +164 -164
  57. package/src/Toolbar/Toolbar.js +235 -235
  58. package/src/Tools/Margin.js +51 -51
  59. package/src/Translation/TranslationToolbarButton.js +119 -119
  60. package/src/dev/draftToSlate.json +3147 -3147
  61. package/src/dev/index.css +2 -2
  62. package/src/dev/index.html +10 -10
  63. package/src/dev/index.js +4 -4
  64. package/src/dev/sampleValue1.json +4294 -4294
  65. package/src/dev/sampleValueValid.json +410 -410
  66. package/src/dev/testComponents/TestStory.js +74 -74
  67. package/src/dev/testComponents/TestStory.stories.js +216 -216
  68. package/src/dev/testComponents/TestStory2.js +74 -74
  69. package/src/dev/testComponents/TestStory2.stories.js +197 -197
  70. package/src/dev/testComponents/TestStory3.js +74 -74
  71. package/src/dev/testComponents/TestStory3.stories.js +197 -197
  72. package/src/dev/testSampleValue.json +746 -746
  73. package/src/fromHTML.js +4 -4
  74. package/src/helper/array.js +8 -8
  75. package/src/index.js +10 -10
  76. package/src/plugins/ListItem.js +48 -48
  77. package/src/plugins/SoftBreak.js +23 -23
  78. package/src/toHTML.js +6 -6
  79. package/src/toText.js +6 -6
  80. package/src/util/reduceContentfulResponse.js +64 -64
  81. package/src/util.js +19 -19
  82. package/storyLoader.js +47 -47
  83. package/tailwind.config.js +4 -4
  84. package/webpack.config.build.js +55 -55
  85. package/webpack.config.dev.js +60 -60
  86. package/webpack.config.js +130 -130
  87. package/webpack.config.watch.js +4 -4
@@ -1,12 +1,12 @@
1
- import React from "react";
2
-
3
- export const EmptyBlock = () => {
4
- if (process.env.NEXT_PUBLIC_VERCEL_ENV === "production") {
5
- // hide this in production
6
- return null;
7
- }
8
-
9
- return <span className="editor-empty-element" style={{minHeight: 200, display: "inline-block"}}>
10
- Unbekanntes Element
11
- </span>;
1
+ import React from "react";
2
+
3
+ export const EmptyBlock = () => {
4
+ if (process.env.NEXT_PUBLIC_VERCEL_ENV === "production") {
5
+ // hide this in production
6
+ return null;
7
+ }
8
+
9
+ return <span className="editor-empty-element" style={{minHeight: 200, display: "inline-block"}}>
10
+ Unbekanntes Element
11
+ </span>;
12
12
  };
@@ -1,5 +1,5 @@
1
- import React from "react";
2
-
3
- export const EmptyWrapper = ({children}) => {
4
- return <>{children}</>;
1
+ import React from "react";
2
+
3
+ export const EmptyWrapper = ({children}) => {
4
+ return <>{children}</>;
5
5
  };
@@ -1,41 +1,41 @@
1
- import React from "react";
2
-
3
- export default class ErrorBoundary extends React.Component {
4
- constructor(props) {
5
- super(props);
6
- this.state = {
7
- hasError: false,
8
- };
9
- }
10
-
11
- static getDerivedStateFromError(error) {
12
- return {hasError: true};
13
- }
14
-
15
- componentDidCatch(error, errorInfo) {
16
- const groupName = `Error in ${this.props.name}`;
17
- console.groupCollapsed(groupName);
18
- console.error("Error", error);
19
- console.error("Info", errorInfo);
20
- console.groupEnd(groupName);
21
- }
22
-
23
- render() {
24
- if (this.state.hasError) {
25
-
26
- if (this.props.fallback) {
27
- return this.props.fallback;
28
- }
29
-
30
- if (this.props.isEditor) {
31
- return <div className="storybook-element-error">
32
- <p>Error in Element {this.props.name}</p>
33
- </div>;
34
- }
35
-
36
- return null;
37
- }
38
-
39
- return this.props.children;
40
- }
1
+ import React from "react";
2
+
3
+ export default class ErrorBoundary extends React.Component {
4
+ constructor(props) {
5
+ super(props);
6
+ this.state = {
7
+ hasError: false,
8
+ };
9
+ }
10
+
11
+ static getDerivedStateFromError(error) {
12
+ return {hasError: true};
13
+ }
14
+
15
+ componentDidCatch(error, errorInfo) {
16
+ const groupName = `Error in ${this.props.name}`;
17
+ console.groupCollapsed(groupName);
18
+ console.error("Error", error);
19
+ console.error("Info", errorInfo);
20
+ console.groupEnd(groupName);
21
+ }
22
+
23
+ render() {
24
+ if (this.state.hasError) {
25
+
26
+ if (this.props.fallback) {
27
+ return this.props.fallback;
28
+ }
29
+
30
+ if (this.props.isEditor) {
31
+ return <div className="storybook-element-error">
32
+ <p>Error in Element {this.props.name}</p>
33
+ </div>;
34
+ }
35
+
36
+ return null;
37
+ }
38
+
39
+ return this.props.children;
40
+ }
41
41
  }
@@ -1,275 +1,275 @@
1
- import React from "react";
2
- import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
3
- import {
4
- faAlignCenter,
5
- faArrowDown, faArrowUp, faBorderAll, faBorderNone, faCompress, faTimes,
6
- } from "@fortawesome/free-solid-svg-icons";
7
- import {Transforms} from "slate";
8
- import {faExpand} from "@fortawesome/free-solid-svg-icons/faExpand";
9
- import {ReactEditor} from "slate-react";
10
- import classNames from "classnames";
11
- import {ToolMargin} from "../Tools/Margin";
12
-
13
- export const LayoutBlock = ({
14
- children,
15
- element,
16
- editor,
17
- attributes,
18
- classNameArticle = "article-width",
19
- classNameSite = "site-width",
20
- onElementClick = () => {},
21
- ...props
22
- }) => {
23
- function onRemoveClick(e) {
24
- let node = ReactEditor.toSlateNode(editor, attributes.ref.current);
25
- let fromPath = ReactEditor.findPath(editor, node);
26
-
27
- if (!fromPath) {
28
- return;
29
- }
30
-
31
- try {
32
- Transforms.removeNodes(editor, {at: fromPath});
33
- } catch (e) {
34
- console.error(e);
35
- }
36
- }
37
-
38
- const moveUp = () => {
39
- let node = ReactEditor.toSlateNode(editor, attributes.ref.current);
40
- let path = ReactEditor.findPath(editor, node);
41
-
42
- if (!path[0]) {
43
- return;
44
- }
45
-
46
- try {
47
- Transforms.moveNodes(editor, {
48
- from: [path[0]],
49
- match: node => {
50
- return node.type === "layout";
51
- },
52
- to: [path[0] - 1],
53
- mode: "highest",
54
- voids: false,
55
- });
56
- } catch (e) {
57
- console.error(e);
58
- }
59
- };
60
-
61
- const moveDown = () => {
62
- let node = ReactEditor.toSlateNode(editor, attributes.ref.current);
63
- let path = ReactEditor.findPath(editor, node);
64
-
65
- try {
66
- Transforms.moveNodes(editor, {
67
- from: [path[0]],
68
- match: node => {
69
- return node.type === "layout";
70
- },
71
- to: [path[0] + 1],
72
- mode: "highest",
73
- });
74
- } catch (e) {
75
- console.error(e);
76
- }
77
- };
78
-
79
- const switchSpacing = (e) => {
80
- let node = ReactEditor.toSlateNode(editor, attributes.ref.current);
81
- let fromPath = ReactEditor.findPath(editor, node);
82
-
83
- if (!fromPath) {
84
- return;
85
- }
86
-
87
- let spacing = !(element?.attributes?.spacing);
88
-
89
- Transforms.setNodes(editor, {
90
- type: "layout",
91
- attributes: {
92
- ...(element.attributes || {}),
93
- spacing: spacing,
94
- },
95
- }, {at: fromPath});
96
- };
97
-
98
- const switchSize = (e) => {
99
- let node = ReactEditor.toSlateNode(editor, attributes.ref.current);
100
- let fromPath = ReactEditor.findPath(editor, node);
101
-
102
- if (!fromPath) {
103
- return;
104
- }
105
-
106
- let width = element?.attributes?.width || "article";
107
-
108
- if (width === "article") {
109
- width = "full";
110
- } else {
111
- width = "article";
112
- }
113
-
114
- Transforms.setNodes(editor, {
115
- type: "layout",
116
- attributes: {
117
- ...(element.attributes || {}),
118
- width: width,
119
- },
120
- }, {at: fromPath});
121
- };
122
-
123
- const switchCenter = (e) => {
124
- let node = ReactEditor.toSlateNode(editor, attributes.ref.current);
125
- let fromPath = ReactEditor.findPath(editor, node);
126
-
127
- if (!fromPath) {
128
- return;
129
- }
130
-
131
- let justifyCenter = !(element?.attributes?.justifyCenter);
132
-
133
- Transforms.setNodes(editor, {
134
- type: "layout",
135
- attributes: {
136
- ...(element.attributes || {}),
137
- justifyCenter,
138
- },
139
- }, {at: fromPath});
140
- };
141
-
142
- const switchBorder = (e) => {
143
- let node = ReactEditor.toSlateNode(editor, attributes.ref.current);
144
- let fromPath = ReactEditor.findPath(editor, node);
145
-
146
- if (!fromPath) {
147
- return;
148
- }
149
-
150
- let tableBorder = !(element?.attributes?.tableBorder);
151
-
152
- Transforms.setNodes(editor, {
153
- type: "layout",
154
- attributes: {
155
- ...(element.attributes || {}),
156
- tableBorder,
157
- },
158
- }, {at: fromPath});
159
- };
160
-
161
- const onMarginChange = (value) => {
162
- let node = ReactEditor.toSlateNode(editor, attributes.ref.current);
163
- let path = ReactEditor.findPath(editor, node);
164
-
165
- Transforms.setNodes(editor, {
166
- type: "layout",
167
- attributes: {
168
- ...(element.attributes || {}),
169
- margin: value,
170
- },
171
- }, {at: path});
172
- };
173
-
174
- const switchMobileColumnSpan = () => {
175
- let node = ReactEditor.toSlateNode(editor, attributes.ref.current);
176
- let fromPath = ReactEditor.findPath(editor, node);
177
-
178
- if (!fromPath) {
179
- return;
180
- }
181
-
182
- let mobileColumnSpan = element?.attributes?.mobileColumnSpan === 1 ? 2 : 1;
183
-
184
- Transforms.setNodes(editor, {
185
- type: "layout",
186
- attributes: {
187
- ...(element.attributes || {}),
188
- mobileColumnSpan,
189
- },
190
- }, {at: fromPath});
191
- };
192
-
193
- let isGrid = true;
194
-
195
- if (Array.isArray(element?.children)) {
196
- element.children.forEach(child => {
197
- if (child.type === "layout-slot" && ["grid-auto", "grid-fill"].includes(child.attributes.name)) {
198
- isGrid = false;
199
- }
200
- });
201
- }
202
-
203
- return <div className="options-wrapper" onClick={() => onElementClick(element)}>
204
- <div className="options-container">
205
- <span className="options-container-option options-container-option-remove" onClick={onRemoveClick}>
206
- <FontAwesomeIcon icon={faTimes} size="lg"/>
207
- </span>
208
- {/*
209
- <span className="options-container-option options-container-option-move-up" onClick={moveUp}>
210
- <FontAwesomeIcon icon={faArrowUp} size="lg"/>
211
- </span>
212
- <span className="options-container-option options-container-option-move-down" onClick={moveDown}>
213
- <FontAwesomeIcon icon={faArrowDown} size="lg"/>
214
- </span>
215
- */}
216
- <span className="options-container-option options-container-option-expand" onClick={switchSize}>
217
- {element?.attributes?.width === "full" ? (
218
- <FontAwesomeIcon icon={faCompress} size="lg"/>
219
- ) : (
220
- <FontAwesomeIcon icon={faExpand} size="lg"/>
221
- )}
222
- </span>
223
- <span className="options-container-option options-container-option-expand" onClick={switchSpacing}>
224
- {element?.attributes?.spacing === false ? (
225
- <FontAwesomeIcon icon={faBorderNone} size="lg"/>
226
- ) : (
227
- <FontAwesomeIcon icon={faBorderAll} size="lg"/>
228
- )}
229
- </span>
230
- <span className="options-container-option options-container-option-expand" onClick={switchCenter}>
231
- {!element?.attributes?.justifyCenter ? (
232
- <FontAwesomeIcon icon={faAlignCenter} size="lg"/>
233
- ) : (
234
- <FontAwesomeIcon icon={faAlignCenter} color="#3490f3" size="lg"/>
235
- )}
236
- </span>
237
- <span className="options-container-option options-container-option-expand-text mx-2" onClick={switchBorder}>
238
- {!element?.attributes?.tableBorder ? (
239
- <span>Kein Rahmen</span>
240
- ) : (
241
- <span>Rahmen</span>
242
- )}
243
- </span>
244
- <span className="mx-2 cursor-pointer" onClick={switchMobileColumnSpan}>
245
- <span>Mobile Spalten: {element?.attributes?.mobileColumnSpan || 1}</span>
246
- </span>
247
- <ToolMargin margin={element?.attributes?.margin} onChange={onMarginChange}/>
248
- </div>
249
- <div
250
- className={`layout-block layout-grid layout-grid-cols-${children.length} ` + classNames({
251
- "layout-block-flex": !isGrid,
252
- "layout-block-grid": isGrid,
253
- [classNameArticle + " article-width"]: element?.attributes?.width === "article" || !element?.attributes?.width,
254
- [classNameSite + " site-width"]: element?.attributes?.width === "full",
255
- "block-editor-table-border-wrapper": element?.attributes?.tableBorder,
256
- "mx-auto": element?.attributes?.justifyCenter,
257
- "gap-4": element?.attributes?.spacing,
258
- "editor-mt-large": element?.attributes?.margin?.top,
259
- "editor-mr-large": element?.attributes?.margin?.right,
260
- "editor-mb-large": element?.attributes?.margin?.bottom,
261
- "editor-ml-large": element?.attributes?.margin?.left,
262
- "md:grid-cols-1": element?.children?.length === 1,
263
- "md:grid-cols-2": element?.children?.length === 2,
264
- "md:grid-cols-3": element?.children?.length === 3,
265
- "md:grid-cols-4": element?.children?.length === 4,
266
- "md:grid-cols-5": element?.children?.length === 5,
267
- "grid-cols-1": element?.attributes?.mobileColumnSpan === 1,
268
- "grid-cols-2": element?.attributes?.mobileColumnSpan === 2,
269
- })}
270
- {...attributes}
271
- >
272
- {children}
273
- </div>
274
- </div>;
1
+ import React from "react";
2
+ import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
3
+ import {
4
+ faAlignCenter,
5
+ faArrowDown, faArrowUp, faBorderAll, faBorderNone, faCompress, faTimes,
6
+ } from "@fortawesome/free-solid-svg-icons";
7
+ import {Transforms} from "slate";
8
+ import {faExpand} from "@fortawesome/free-solid-svg-icons/faExpand";
9
+ import {ReactEditor} from "slate-react";
10
+ import classNames from "classnames";
11
+ import {ToolMargin} from "../Tools/Margin";
12
+
13
+ export const LayoutBlock = ({
14
+ children,
15
+ element,
16
+ editor,
17
+ attributes,
18
+ classNameArticle = "article-width",
19
+ classNameSite = "site-width",
20
+ onElementClick = () => {},
21
+ ...props
22
+ }) => {
23
+ function onRemoveClick(e) {
24
+ let node = ReactEditor.toSlateNode(editor, attributes.ref.current);
25
+ let fromPath = ReactEditor.findPath(editor, node);
26
+
27
+ if (!fromPath) {
28
+ return;
29
+ }
30
+
31
+ try {
32
+ Transforms.removeNodes(editor, {at: fromPath});
33
+ } catch (e) {
34
+ console.error(e);
35
+ }
36
+ }
37
+
38
+ const moveUp = () => {
39
+ let node = ReactEditor.toSlateNode(editor, attributes.ref.current);
40
+ let path = ReactEditor.findPath(editor, node);
41
+
42
+ if (!path[0]) {
43
+ return;
44
+ }
45
+
46
+ try {
47
+ Transforms.moveNodes(editor, {
48
+ from: [path[0]],
49
+ match: node => {
50
+ return node.type === "layout";
51
+ },
52
+ to: [path[0] - 1],
53
+ mode: "highest",
54
+ voids: false,
55
+ });
56
+ } catch (e) {
57
+ console.error(e);
58
+ }
59
+ };
60
+
61
+ const moveDown = () => {
62
+ let node = ReactEditor.toSlateNode(editor, attributes.ref.current);
63
+ let path = ReactEditor.findPath(editor, node);
64
+
65
+ try {
66
+ Transforms.moveNodes(editor, {
67
+ from: [path[0]],
68
+ match: node => {
69
+ return node.type === "layout";
70
+ },
71
+ to: [path[0] + 1],
72
+ mode: "highest",
73
+ });
74
+ } catch (e) {
75
+ console.error(e);
76
+ }
77
+ };
78
+
79
+ const switchSpacing = (e) => {
80
+ let node = ReactEditor.toSlateNode(editor, attributes.ref.current);
81
+ let fromPath = ReactEditor.findPath(editor, node);
82
+
83
+ if (!fromPath) {
84
+ return;
85
+ }
86
+
87
+ let spacing = !(element?.attributes?.spacing);
88
+
89
+ Transforms.setNodes(editor, {
90
+ type: "layout",
91
+ attributes: {
92
+ ...(element.attributes || {}),
93
+ spacing: spacing,
94
+ },
95
+ }, {at: fromPath});
96
+ };
97
+
98
+ const switchSize = (e) => {
99
+ let node = ReactEditor.toSlateNode(editor, attributes.ref.current);
100
+ let fromPath = ReactEditor.findPath(editor, node);
101
+
102
+ if (!fromPath) {
103
+ return;
104
+ }
105
+
106
+ let width = element?.attributes?.width || "article";
107
+
108
+ if (width === "article") {
109
+ width = "full";
110
+ } else {
111
+ width = "article";
112
+ }
113
+
114
+ Transforms.setNodes(editor, {
115
+ type: "layout",
116
+ attributes: {
117
+ ...(element.attributes || {}),
118
+ width: width,
119
+ },
120
+ }, {at: fromPath});
121
+ };
122
+
123
+ const switchCenter = (e) => {
124
+ let node = ReactEditor.toSlateNode(editor, attributes.ref.current);
125
+ let fromPath = ReactEditor.findPath(editor, node);
126
+
127
+ if (!fromPath) {
128
+ return;
129
+ }
130
+
131
+ let justifyCenter = !(element?.attributes?.justifyCenter);
132
+
133
+ Transforms.setNodes(editor, {
134
+ type: "layout",
135
+ attributes: {
136
+ ...(element.attributes || {}),
137
+ justifyCenter,
138
+ },
139
+ }, {at: fromPath});
140
+ };
141
+
142
+ const switchBorder = (e) => {
143
+ let node = ReactEditor.toSlateNode(editor, attributes.ref.current);
144
+ let fromPath = ReactEditor.findPath(editor, node);
145
+
146
+ if (!fromPath) {
147
+ return;
148
+ }
149
+
150
+ let tableBorder = !(element?.attributes?.tableBorder);
151
+
152
+ Transforms.setNodes(editor, {
153
+ type: "layout",
154
+ attributes: {
155
+ ...(element.attributes || {}),
156
+ tableBorder,
157
+ },
158
+ }, {at: fromPath});
159
+ };
160
+
161
+ const onMarginChange = (value) => {
162
+ let node = ReactEditor.toSlateNode(editor, attributes.ref.current);
163
+ let path = ReactEditor.findPath(editor, node);
164
+
165
+ Transforms.setNodes(editor, {
166
+ type: "layout",
167
+ attributes: {
168
+ ...(element.attributes || {}),
169
+ margin: value,
170
+ },
171
+ }, {at: path});
172
+ };
173
+
174
+ const switchMobileColumnSpan = () => {
175
+ let node = ReactEditor.toSlateNode(editor, attributes.ref.current);
176
+ let fromPath = ReactEditor.findPath(editor, node);
177
+
178
+ if (!fromPath) {
179
+ return;
180
+ }
181
+
182
+ let mobileColumnSpan = element?.attributes?.mobileColumnSpan === 1 ? 2 : 1;
183
+
184
+ Transforms.setNodes(editor, {
185
+ type: "layout",
186
+ attributes: {
187
+ ...(element.attributes || {}),
188
+ mobileColumnSpan,
189
+ },
190
+ }, {at: fromPath});
191
+ };
192
+
193
+ let isGrid = true;
194
+
195
+ if (Array.isArray(element?.children)) {
196
+ element.children.forEach(child => {
197
+ if (child.type === "layout-slot" && ["grid-auto", "grid-fill"].includes(child.attributes.name)) {
198
+ isGrid = false;
199
+ }
200
+ });
201
+ }
202
+
203
+ return <div className="options-wrapper" onClick={() => onElementClick(element)}>
204
+ <div className="options-container">
205
+ <span className="options-container-option options-container-option-remove" onClick={onRemoveClick}>
206
+ <FontAwesomeIcon icon={faTimes} size="lg"/>
207
+ </span>
208
+ {/*
209
+ <span className="options-container-option options-container-option-move-up" onClick={moveUp}>
210
+ <FontAwesomeIcon icon={faArrowUp} size="lg"/>
211
+ </span>
212
+ <span className="options-container-option options-container-option-move-down" onClick={moveDown}>
213
+ <FontAwesomeIcon icon={faArrowDown} size="lg"/>
214
+ </span>
215
+ */}
216
+ <span className="options-container-option options-container-option-expand" onClick={switchSize}>
217
+ {element?.attributes?.width === "full" ? (
218
+ <FontAwesomeIcon icon={faCompress} size="lg"/>
219
+ ) : (
220
+ <FontAwesomeIcon icon={faExpand} size="lg"/>
221
+ )}
222
+ </span>
223
+ <span className="options-container-option options-container-option-expand" onClick={switchSpacing}>
224
+ {element?.attributes?.spacing === false ? (
225
+ <FontAwesomeIcon icon={faBorderNone} size="lg"/>
226
+ ) : (
227
+ <FontAwesomeIcon icon={faBorderAll} size="lg"/>
228
+ )}
229
+ </span>
230
+ <span className="options-container-option options-container-option-expand" onClick={switchCenter}>
231
+ {!element?.attributes?.justifyCenter ? (
232
+ <FontAwesomeIcon icon={faAlignCenter} size="lg"/>
233
+ ) : (
234
+ <FontAwesomeIcon icon={faAlignCenter} color="#3490f3" size="lg"/>
235
+ )}
236
+ </span>
237
+ <span className="options-container-option options-container-option-expand-text mx-2" onClick={switchBorder}>
238
+ {!element?.attributes?.tableBorder ? (
239
+ <span>Kein Rahmen</span>
240
+ ) : (
241
+ <span>Rahmen</span>
242
+ )}
243
+ </span>
244
+ <span className="mx-2 cursor-pointer" onClick={switchMobileColumnSpan}>
245
+ <span>Mobile Spalten: {element?.attributes?.mobileColumnSpan || 1}</span>
246
+ </span>
247
+ <ToolMargin margin={element?.attributes?.margin} onChange={onMarginChange}/>
248
+ </div>
249
+ <div
250
+ className={`layout-block layout-grid layout-grid-cols-${children.length} ` + classNames({
251
+ "layout-block-flex": !isGrid,
252
+ "layout-block-grid": isGrid,
253
+ [classNameArticle + " article-width"]: element?.attributes?.width === "article" || !element?.attributes?.width,
254
+ [classNameSite + " site-width"]: element?.attributes?.width === "full",
255
+ "block-editor-table-border-wrapper": element?.attributes?.tableBorder,
256
+ "mx-auto": element?.attributes?.justifyCenter,
257
+ "gap-4": element?.attributes?.spacing,
258
+ "editor-mt-large": element?.attributes?.margin?.top,
259
+ "editor-mr-large": element?.attributes?.margin?.right,
260
+ "editor-mb-large": element?.attributes?.margin?.bottom,
261
+ "editor-ml-large": element?.attributes?.margin?.left,
262
+ "md:grid-cols-1": element?.children?.length === 1,
263
+ "md:grid-cols-2": element?.children?.length === 2,
264
+ "md:grid-cols-3": element?.children?.length === 3,
265
+ "md:grid-cols-4": element?.children?.length === 4,
266
+ "md:grid-cols-5": element?.children?.length === 5,
267
+ "grid-cols-1": element?.attributes?.mobileColumnSpan === 1,
268
+ "grid-cols-2": element?.attributes?.mobileColumnSpan === 2,
269
+ })}
270
+ {...attributes}
271
+ >
272
+ {children}
273
+ </div>
274
+ </div>;
275
275
  };