@vonaffenfels/slate-editor 1.1.69 → 1.1.71

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 (94) hide show
  1. package/.babelrc +43 -43
  2. package/README.md +5 -5
  3. package/componentLoader.js +93 -93
  4. package/dist/BlockEditor.css +1871 -4
  5. package/dist/BlockEditor.js +3960 -336
  6. package/dist/Renderer.js +2081 -2
  7. package/dist/fromHTML.js +78 -1
  8. package/dist/index.css +1871 -4
  9. package/dist/index.js +4037 -336
  10. package/dist/toHTML.js +1689 -2
  11. package/dist/toText.js +1689 -2
  12. package/package.json +2 -2
  13. package/postcss.config.js +6 -6
  14. package/scss/demo.scss +148 -148
  15. package/scss/sidebarEditor.scss +181 -181
  16. package/scss/toolbar.scss +161 -161
  17. package/src/Blocks/EmptyBlock.js +11 -11
  18. package/src/Blocks/EmptyWrapper.js +4 -4
  19. package/src/Blocks/ErrorBoundary.js +40 -40
  20. package/src/Blocks/LayoutBlock.js +274 -274
  21. package/src/Blocks/LayoutSlot.js +90 -90
  22. package/src/CollapsableMenu/CollapsableMenu.js +48 -48
  23. package/src/Context/StorybookContext.js +6 -6
  24. package/src/ElementAutocomplete.js +133 -133
  25. package/src/Loader.js +137 -137
  26. package/src/Nodes/Default.js +158 -158
  27. package/src/Nodes/Leaf.js +54 -54
  28. package/src/Nodes/Text.js +97 -97
  29. package/src/ObjectId.js +3 -3
  30. package/src/Renderer.js +73 -73
  31. package/src/Serializer/Html.js +42 -42
  32. package/src/Serializer/Serializer.js +371 -371
  33. package/src/Serializer/Text.js +17 -17
  34. package/src/Serializer/ads.js +174 -174
  35. package/src/Serializer/index.js +3 -3
  36. package/src/SidebarEditor/AssetList.js +181 -181
  37. package/src/SidebarEditor/Fields/CloudinaryContentSelect.js +89 -89
  38. package/src/SidebarEditor/Fields/ColorPicker.js +89 -89
  39. package/src/SidebarEditor/Fields/ContentfulContentSelect.js +62 -62
  40. package/src/SidebarEditor/Fields/DateTime.js +55 -55
  41. package/src/SidebarEditor/Fields/MVP.js +66 -66
  42. package/src/SidebarEditor/Fields/MultiSelect.js +13 -13
  43. package/src/SidebarEditor/Fields/RemoteMultiSelect.js +40 -40
  44. package/src/SidebarEditor/Fields/RemoteSelect.js +39 -39
  45. package/src/SidebarEditor/Fields/Select.js +47 -47
  46. package/src/SidebarEditor/Fields/StreamSelect.js +15 -15
  47. package/src/SidebarEditor/Fields/Switch.js +34 -34
  48. package/src/SidebarEditor/Fields/Textarea.js +21 -21
  49. package/src/SidebarEditor/Resizable.js +85 -85
  50. package/src/Storybook.js +151 -151
  51. package/src/Toolbar/Align.js +64 -64
  52. package/src/Toolbar/Anchor.js +94 -94
  53. package/src/Toolbar/Block.js +135 -135
  54. package/src/Toolbar/Element.js +44 -44
  55. package/src/Toolbar/Formats.js +71 -71
  56. package/src/Toolbar/Insert.js +28 -28
  57. package/src/Toolbar/Layout.js +399 -399
  58. package/src/Toolbar/Link.js +164 -164
  59. package/src/Toolbar/Toolbar.js +235 -235
  60. package/src/Tools/Margin.js +51 -51
  61. package/src/Translation/TranslationToolbarButton.js +115 -115
  62. package/src/dev/draftToSlate.json +3147 -3147
  63. package/src/dev/index.css +2 -2
  64. package/src/dev/index.html +10 -10
  65. package/src/dev/index.js +4 -4
  66. package/src/dev/sampleValue1.json +4294 -4294
  67. package/src/dev/sampleValueValid.json +410 -410
  68. package/src/dev/testComponents/TestStory.js +74 -74
  69. package/src/dev/testComponents/TestStory.stories.js +216 -216
  70. package/src/dev/testComponents/TestStory2.js +74 -74
  71. package/src/dev/testComponents/TestStory2.stories.js +197 -197
  72. package/src/dev/testComponents/TestStory3.js +74 -74
  73. package/src/dev/testComponents/TestStory3.stories.js +197 -197
  74. package/src/dev/testSampleValue.json +746 -746
  75. package/src/fromHTML.js +4 -4
  76. package/src/helper/array.js +8 -8
  77. package/src/index.js +10 -10
  78. package/src/plugins/ListItem.js +48 -48
  79. package/src/plugins/SoftBreak.js +23 -23
  80. package/src/toHTML.js +6 -6
  81. package/src/toText.js +6 -6
  82. package/src/util/reduceContentfulResponse.js +64 -64
  83. package/src/util.js +19 -19
  84. package/storyLoader.js +47 -47
  85. package/tailwind.config.js +4 -4
  86. package/webpack.config.build.js +55 -55
  87. package/webpack.config.dev.js +60 -60
  88. package/webpack.config.js +130 -130
  89. package/webpack.config.watch.js +4 -4
  90. package/dist/BlockEditor.js.LICENSE.txt +0 -61
  91. package/dist/Renderer.js.LICENSE.txt +0 -15
  92. package/dist/index.js.LICENSE.txt +0 -69
  93. package/dist/toHTML.js.LICENSE.txt +0 -23
  94. package/dist/toText.js.LICENSE.txt +0 -23
package/scss/toolbar.scss CHANGED
@@ -1,162 +1,162 @@
1
- .toolbar {
2
- background-color: rgba(255, 255, 255, 0.95);
3
- border-bottom: 1px solid rgba(0, 0, 0, 0.3);
4
- display: none;
5
- flex-direction: row;
6
- justify-content: space-between;
7
- font-family: Arial, sans-serif;
8
- padding: 5px;
9
- position: absolute;
10
- z-index: 500;
11
-
12
- &.toolbar-static {
13
- display: block;
14
- position: fixed;
15
- width: 100%;
16
- max-width: 100%;
17
- top: 0px;
18
- left: 0px;
19
- }
20
-
21
- &.active {
22
- display: block;
23
- }
24
-
25
- .toolbar-btns {
26
- display: flex;
27
- align-items: center;
28
- }
29
-
30
- .toolbar-btn {
31
- border-radius: 3px;
32
- color: black;
33
- cursor: pointer;
34
- font-weight: bold;
35
- margin-right: 5px;
36
- padding: 5px 7px;
37
- z-index: 500;
38
- position: relative;
39
- display: block;
40
-
41
- &.active {
42
- background-color: rgba(0, 0, 0, 0.3);
43
- }
44
-
45
- &:last-child {
46
- margin-right: 0px;
47
- }
48
-
49
- &:hover, &:active {
50
- background-color: rgba(0, 0, 0, 0.2);
51
-
52
- .toolbar-btn-config {
53
- display: block;
54
- }
55
- }
56
-
57
- .toolbar-btn-config {
58
- position: absolute;
59
- top: 28px;
60
- left: 0px;
61
- display: none;
62
- background-color: rgba(255, 255, 255, 0.95);
63
- border-bottom: 1px solid rgba(0, 0, 0, 0.3);
64
- padding: 5px 7px;
65
-
66
- .toolbar-btn-config-inner {
67
- display: flex;
68
- flex-direction: column;
69
-
70
- .toolbar-btn-config-row {
71
- min-width: 250px;
72
- padding: 5px 7px;
73
- display: flex;
74
- flex-direction: row;
75
-
76
- .toolbar-form-label {
77
- flex-grow: 0;
78
- padding: 0 7px 0 0;
79
- }
80
-
81
- .toolbar-form-input {
82
- flex-grow: 1;
83
-
84
- input {
85
- padding: 5px;
86
- border: 1px solid grey;
87
- background-color: white;
88
- color: black;
89
-
90
- &[type="checkbox"] {
91
- &:checked {
92
- color: white;
93
- background-color: black;
94
- }
95
- }
96
- }
97
- }
98
-
99
- .toolbar-btn {
100
- display: flex;
101
- flex-grow: 1;
102
- border: 1px solid black;
103
- }
104
- }
105
- }
106
- }
107
- }
108
-
109
- .toolbar-btn-expand {
110
- z-index: 500;
111
- display: block;
112
- max-height: 28px;
113
- overflow: hidden;
114
-
115
- .toolbar-btn-expand-inner {
116
- display: flex;
117
- flex-direction: column;
118
-
119
- .toolbar-btn.active {
120
- order: -1;
121
- }
122
- }
123
-
124
- &:hover {
125
- .toolbar-btn-expand-inner {
126
- background-color: rgba(255, 255, 255, 0.95);
127
- border-bottom: 1px solid rgba(0, 0, 0, 0.3);
128
- }
129
-
130
- overflow: visible;
131
- }
132
-
133
- }
134
-
135
-
136
- .toolbar-btn-expand-right {
137
- z-index: 500;
138
- display: block;
139
- max-height: 28px;
140
- overflow: hidden;
141
-
142
- .toolbar-btn-expand-inner {
143
- left: 100%;
144
- display: flex;
145
- flex-direction: column;
146
-
147
- .toolbar-btn.active {
148
- order: -1;
149
- }
150
- }
151
-
152
- &:hover {
153
- .toolbar-btn-expand-inner {
154
- background-color: rgba(255, 255, 255, 0.95);
155
- border-bottom: 1px solid rgba(0, 0, 0, 0.3);
156
- }
157
-
158
- overflow: visible;
159
- }
160
-
161
- }
1
+ .toolbar {
2
+ background-color: rgba(255, 255, 255, 0.95);
3
+ border-bottom: 1px solid rgba(0, 0, 0, 0.3);
4
+ display: none;
5
+ flex-direction: row;
6
+ justify-content: space-between;
7
+ font-family: Arial, sans-serif;
8
+ padding: 5px;
9
+ position: absolute;
10
+ z-index: 500;
11
+
12
+ &.toolbar-static {
13
+ display: block;
14
+ position: fixed;
15
+ width: 100%;
16
+ max-width: 100%;
17
+ top: 0px;
18
+ left: 0px;
19
+ }
20
+
21
+ &.active {
22
+ display: block;
23
+ }
24
+
25
+ .toolbar-btns {
26
+ display: flex;
27
+ align-items: center;
28
+ }
29
+
30
+ .toolbar-btn {
31
+ border-radius: 3px;
32
+ color: black;
33
+ cursor: pointer;
34
+ font-weight: bold;
35
+ margin-right: 5px;
36
+ padding: 5px 7px;
37
+ z-index: 500;
38
+ position: relative;
39
+ display: block;
40
+
41
+ &.active {
42
+ background-color: rgba(0, 0, 0, 0.3);
43
+ }
44
+
45
+ &:last-child {
46
+ margin-right: 0px;
47
+ }
48
+
49
+ &:hover, &:active {
50
+ background-color: rgba(0, 0, 0, 0.2);
51
+
52
+ .toolbar-btn-config {
53
+ display: block;
54
+ }
55
+ }
56
+
57
+ .toolbar-btn-config {
58
+ position: absolute;
59
+ top: 28px;
60
+ left: 0px;
61
+ display: none;
62
+ background-color: rgba(255, 255, 255, 0.95);
63
+ border-bottom: 1px solid rgba(0, 0, 0, 0.3);
64
+ padding: 5px 7px;
65
+
66
+ .toolbar-btn-config-inner {
67
+ display: flex;
68
+ flex-direction: column;
69
+
70
+ .toolbar-btn-config-row {
71
+ min-width: 250px;
72
+ padding: 5px 7px;
73
+ display: flex;
74
+ flex-direction: row;
75
+
76
+ .toolbar-form-label {
77
+ flex-grow: 0;
78
+ padding: 0 7px 0 0;
79
+ }
80
+
81
+ .toolbar-form-input {
82
+ flex-grow: 1;
83
+
84
+ input {
85
+ padding: 5px;
86
+ border: 1px solid grey;
87
+ background-color: white;
88
+ color: black;
89
+
90
+ &[type="checkbox"] {
91
+ &:checked {
92
+ color: white;
93
+ background-color: black;
94
+ }
95
+ }
96
+ }
97
+ }
98
+
99
+ .toolbar-btn {
100
+ display: flex;
101
+ flex-grow: 1;
102
+ border: 1px solid black;
103
+ }
104
+ }
105
+ }
106
+ }
107
+ }
108
+
109
+ .toolbar-btn-expand {
110
+ z-index: 500;
111
+ display: block;
112
+ max-height: 28px;
113
+ overflow: hidden;
114
+
115
+ .toolbar-btn-expand-inner {
116
+ display: flex;
117
+ flex-direction: column;
118
+
119
+ .toolbar-btn.active {
120
+ order: -1;
121
+ }
122
+ }
123
+
124
+ &:hover {
125
+ .toolbar-btn-expand-inner {
126
+ background-color: rgba(255, 255, 255, 0.95);
127
+ border-bottom: 1px solid rgba(0, 0, 0, 0.3);
128
+ }
129
+
130
+ overflow: visible;
131
+ }
132
+
133
+ }
134
+
135
+
136
+ .toolbar-btn-expand-right {
137
+ z-index: 500;
138
+ display: block;
139
+ max-height: 28px;
140
+ overflow: hidden;
141
+
142
+ .toolbar-btn-expand-inner {
143
+ left: 100%;
144
+ display: flex;
145
+ flex-direction: column;
146
+
147
+ .toolbar-btn.active {
148
+ order: -1;
149
+ }
150
+ }
151
+
152
+ &:hover {
153
+ .toolbar-btn-expand-inner {
154
+ background-color: rgba(255, 255, 255, 0.95);
155
+ border-bottom: 1px solid rgba(0, 0, 0, 0.3);
156
+ }
157
+
158
+ overflow: visible;
159
+ }
160
+
161
+ }
162
162
  }
@@ -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
  }