@vonaffenfels/slate-editor 1.2.39 → 1.2.41

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 (79) hide show
  1. package/.babelrc +43 -43
  2. package/README.md +5 -5
  3. package/componentLoader.js +93 -93
  4. package/package.json +2 -2
  5. package/postcss.config.js +6 -6
  6. package/scss/demo.scss +148 -148
  7. package/scss/sidebarEditor.scss +185 -185
  8. package/scss/toolbar.scss +162 -162
  9. package/src/Blocks/EmptyBlock.js +11 -11
  10. package/src/Blocks/EmptyWrapper.js +4 -4
  11. package/src/Blocks/ErrorBoundary.js +40 -40
  12. package/src/Blocks/LayoutBlock.js +274 -274
  13. package/src/Blocks/LayoutSlot.js +90 -90
  14. package/src/CollapsableMenu/CollapsableMenu.js +48 -48
  15. package/src/Context/StorybookContext.js +6 -6
  16. package/src/ElementAutocomplete.js +134 -134
  17. package/src/Loader.js +137 -137
  18. package/src/Nodes/Default.js +162 -162
  19. package/src/Nodes/Leaf.js +54 -54
  20. package/src/Nodes/Text.js +97 -97
  21. package/src/ObjectId.js +3 -3
  22. package/src/Renderer.js +73 -73
  23. package/src/Serializer/Html.js +42 -42
  24. package/src/Serializer/Serializer.js +374 -374
  25. package/src/Serializer/Text.js +17 -17
  26. package/src/Serializer/ads.js +187 -187
  27. package/src/Serializer/index.js +3 -3
  28. package/src/SidebarEditor/Fields/CloudinaryContentSelect.js +89 -89
  29. package/src/SidebarEditor/Fields/ColorPicker.js +89 -89
  30. package/src/SidebarEditor/Fields/DateTime.js +55 -55
  31. package/src/SidebarEditor/Fields/MVP.js +66 -66
  32. package/src/SidebarEditor/Fields/MultiSelect.js +13 -13
  33. package/src/SidebarEditor/Fields/RemoteMultiSelect.js +40 -40
  34. package/src/SidebarEditor/Fields/RemoteSelect.js +39 -39
  35. package/src/SidebarEditor/Fields/Select.js +47 -47
  36. package/src/SidebarEditor/Fields/StreamSelect.js +15 -15
  37. package/src/SidebarEditor/Fields/Switch.js +34 -34
  38. package/src/SidebarEditor/Fields/Textarea.js +21 -21
  39. package/src/SidebarEditor/Resizable.js +85 -85
  40. package/src/Storybook.js +151 -151
  41. package/src/Toolbar/Align.js +64 -64
  42. package/src/Toolbar/Anchor.js +94 -94
  43. package/src/Toolbar/Block.js +135 -135
  44. package/src/Toolbar/Element.js +44 -44
  45. package/src/Toolbar/Formats.js +71 -71
  46. package/src/Toolbar/Insert.js +28 -28
  47. package/src/Toolbar/Layout.js +399 -399
  48. package/src/Toolbar/Link.js +164 -164
  49. package/src/Toolbar/Toolbar.js +235 -235
  50. package/src/Tools/Margin.js +51 -51
  51. package/src/Translation/TranslationToolbarButton.js +119 -119
  52. package/src/dev/draftToSlate.json +3147 -3147
  53. package/src/dev/index.css +2 -2
  54. package/src/dev/index.html +10 -10
  55. package/src/dev/index.js +4 -4
  56. package/src/dev/sampleValue1.json +4294 -4294
  57. package/src/dev/sampleValueValid.json +410 -410
  58. package/src/dev/testComponents/TestStory.js +74 -74
  59. package/src/dev/testComponents/TestStory.stories.js +216 -216
  60. package/src/dev/testComponents/TestStory2.js +74 -74
  61. package/src/dev/testComponents/TestStory2.stories.js +197 -197
  62. package/src/dev/testComponents/TestStory3.js +74 -74
  63. package/src/dev/testComponents/TestStory3.stories.js +197 -197
  64. package/src/dev/testSampleValue.json +746 -746
  65. package/src/fromHTML.js +4 -4
  66. package/src/helper/array.js +8 -8
  67. package/src/index.js +10 -10
  68. package/src/plugins/ListItem.js +48 -48
  69. package/src/plugins/SoftBreak.js +23 -23
  70. package/src/toHTML.js +6 -6
  71. package/src/toText.js +6 -6
  72. package/src/util/reduceContentfulResponse.js +64 -64
  73. package/src/util.js +19 -19
  74. package/storyLoader.js +47 -47
  75. package/tailwind.config.js +4 -4
  76. package/webpack.config.build.js +55 -55
  77. package/webpack.config.dev.js +60 -60
  78. package/webpack.config.js +130 -130
  79. package/webpack.config.watch.js +4 -4
@@ -1,186 +1,186 @@
1
- #sidebar-editor-wrapper {
2
- @media (max-width: 768px) {
3
- padding-top: 66px;
4
- }
5
-
6
- padding-top: 51px;
7
- height: 100%;
8
- flex-basis: 400px;
9
- flex-shrink: 0;
10
- }
11
-
12
- #sidebar-editor {
13
- display: flex;
14
- flex-direction: column;
15
- background-color: rgb(247, 249, 250);
16
- max-height: 100%;
17
- height: 100%;
18
- overflow-y: auto;
19
- padding: 16px;
20
-
21
- * {
22
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol" !important;
23
- }
24
-
25
- p, label, b, span {
26
- color: rgb(90, 101, 124);
27
- }
28
-
29
- label {
30
- margin: 0 0 2px 0 !important;
31
- }
32
-
33
- input[type="text"],
34
- input[type="time"],
35
- input[type="date"],
36
- input[type="number"],
37
- input[type="color"],
38
- input[type="datetime-local"],
39
- input[type="search"],
40
- select,
41
- textarea {
42
- display: block;
43
- font-size: 0.875rem !important;
44
- color: rgb(90, 101, 124) !important;
45
- background-color: white !important;
46
- border: 1px solid #cfd9e0 !important;
47
- border-radius: 6px !important;
48
- box-shadow: none !important;
49
- filter: none !important;
50
- width: 100% !important;
51
- padding: 8px 0.75rem !important;
52
- }
53
-
54
- textarea {
55
- height: 42px;
56
- max-height: 200px;
57
- }
58
-
59
- input[type="color"] {
60
- padding: 4px !important;
61
- }
62
-
63
- input[type="range"] {
64
- display: block;
65
- width: 100%;
66
- }
67
-
68
- input[type="radio"],
69
- input[type="checkbox"] {
70
- margin-right: 8px;
71
- margin-left: 4px;
72
- }
73
-
74
- option[disabled] {
75
- color: rgba(0, 0, 0, 0.3)
76
- }
77
-
78
- /* button[data-test-id="cf-ui-button"] span {
79
- color: #036fe3 !important;
80
- }
81
-
82
- button[data-test-id="cf-ui-button"] svg {
83
- fill: #036fe3 !important;
84
- }
85
-
86
- button[data-test-id="cf-ui-button"]:hover span {
87
- color: #FFFFFF !important;
88
- }
89
-
90
- button[data-test-id="cf-ui-button"]:hover svg {
91
- fill: #FFFFFF !important;
92
- } */
93
-
94
- .inline-check-wrapper {
95
- display: inline-block;
96
- margin-right: 8px;
97
- }
98
-
99
- details {
100
- display: block;
101
- font-size: 0.875rem !important;
102
- color: rgb(90, 101, 124) !important;
103
- background-color: white !important;
104
- border: 1px solid #cfd9e0 !important;
105
- border-radius: 6px !important;
106
- box-shadow: none !important;
107
- filter: none !important;
108
- width: 100% !important;
109
- padding: 16px !important;
110
- }
111
-
112
- summary {
113
- cursor: pointer;
114
- }
115
-
116
- .disabled {
117
- opacity: 0.4;
118
- cursor: not-allowed !important;
119
- }
120
-
121
- .icon-button {
122
- display: inline-block;
123
- color: rgb(90, 101, 124) !important;
124
- background-color: white !important;
125
- border: 1px solid #cfd9e0 !important;
126
- border-radius: 6px;
127
- filter: none !important;
128
- width: auto !important;
129
- text-align: center;
130
- }
131
-
132
- .icon-button:not(.disabled):hover {
133
- background-color: rgb(248, 248, 248) !important;
134
- }
135
-
136
- .icon-button:not(.disabled):active {
137
- background-color: rgb(237, 237, 237) !important;
138
- }
139
-
140
- .icon-button-group {
141
- display: inline-flex;
142
- border-radius: 6px !important;
143
- overflow: hidden;
144
- border: 1px solid #cfd9e0 !important;
145
-
146
- .icon-button {
147
- border-radius: 0 !important;
148
- border: none !important;
149
- border-right: 1px solid #cfd9e0 !important;
150
- }
151
-
152
- .icon-button:last-child {
153
- border: none !important;
154
- }
155
- }
156
-
157
- .message {
158
- font-size: 0.875rem;
159
- padding: 16px;
160
- border-radius: 4px;
161
- }
162
-
163
- .message.message--negative {
164
- background-color: rgba(238, 26, 26, 0.2);
165
- }
166
-
167
- .collapsable-menu {
168
- background-color: white !important;
169
- border: 1px solid #cfd9e0 !important;
170
- border-radius: 6px;
171
- z-index: 2;
172
- overflow: hidden;
173
- }
174
-
175
- .collapsable-menu-item {
176
- color: rgb(90, 101, 124) !important;
177
- }
178
-
179
- .collapsable-menu-item:not(.disabled):hover {
180
- background-color: rgb(248, 248, 248) !important;
181
- }
182
-
183
- .collapsable-menu-item:not(.disabled):active {
184
- background-color: rgb(237, 237, 237) !important;
185
- }
1
+ #sidebar-editor-wrapper {
2
+ @media (max-width: 768px) {
3
+ padding-top: 66px;
4
+ }
5
+
6
+ padding-top: 51px;
7
+ height: 100%;
8
+ flex-basis: 400px;
9
+ flex-shrink: 0;
10
+ }
11
+
12
+ #sidebar-editor {
13
+ display: flex;
14
+ flex-direction: column;
15
+ background-color: rgb(247, 249, 250);
16
+ max-height: 100%;
17
+ height: 100%;
18
+ overflow-y: auto;
19
+ padding: 16px;
20
+
21
+ * {
22
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol" !important;
23
+ }
24
+
25
+ p, label, b, span {
26
+ color: rgb(90, 101, 124);
27
+ }
28
+
29
+ label {
30
+ margin: 0 0 2px 0 !important;
31
+ }
32
+
33
+ input[type="text"],
34
+ input[type="time"],
35
+ input[type="date"],
36
+ input[type="number"],
37
+ input[type="color"],
38
+ input[type="datetime-local"],
39
+ input[type="search"],
40
+ select,
41
+ textarea {
42
+ display: block;
43
+ font-size: 0.875rem !important;
44
+ color: rgb(90, 101, 124) !important;
45
+ background-color: white !important;
46
+ border: 1px solid #cfd9e0 !important;
47
+ border-radius: 6px !important;
48
+ box-shadow: none !important;
49
+ filter: none !important;
50
+ width: 100% !important;
51
+ padding: 8px 0.75rem !important;
52
+ }
53
+
54
+ textarea {
55
+ height: 42px;
56
+ max-height: 200px;
57
+ }
58
+
59
+ input[type="color"] {
60
+ padding: 4px !important;
61
+ }
62
+
63
+ input[type="range"] {
64
+ display: block;
65
+ width: 100%;
66
+ }
67
+
68
+ input[type="radio"],
69
+ input[type="checkbox"] {
70
+ margin-right: 8px;
71
+ margin-left: 4px;
72
+ }
73
+
74
+ option[disabled] {
75
+ color: rgba(0, 0, 0, 0.3)
76
+ }
77
+
78
+ /* button[data-test-id="cf-ui-button"] span {
79
+ color: #036fe3 !important;
80
+ }
81
+
82
+ button[data-test-id="cf-ui-button"] svg {
83
+ fill: #036fe3 !important;
84
+ }
85
+
86
+ button[data-test-id="cf-ui-button"]:hover span {
87
+ color: #FFFFFF !important;
88
+ }
89
+
90
+ button[data-test-id="cf-ui-button"]:hover svg {
91
+ fill: #FFFFFF !important;
92
+ } */
93
+
94
+ .inline-check-wrapper {
95
+ display: inline-block;
96
+ margin-right: 8px;
97
+ }
98
+
99
+ details {
100
+ display: block;
101
+ font-size: 0.875rem !important;
102
+ color: rgb(90, 101, 124) !important;
103
+ background-color: white !important;
104
+ border: 1px solid #cfd9e0 !important;
105
+ border-radius: 6px !important;
106
+ box-shadow: none !important;
107
+ filter: none !important;
108
+ width: 100% !important;
109
+ padding: 16px !important;
110
+ }
111
+
112
+ summary {
113
+ cursor: pointer;
114
+ }
115
+
116
+ .disabled {
117
+ opacity: 0.4;
118
+ cursor: not-allowed !important;
119
+ }
120
+
121
+ .icon-button {
122
+ display: inline-block;
123
+ color: rgb(90, 101, 124) !important;
124
+ background-color: white !important;
125
+ border: 1px solid #cfd9e0 !important;
126
+ border-radius: 6px;
127
+ filter: none !important;
128
+ width: auto !important;
129
+ text-align: center;
130
+ }
131
+
132
+ .icon-button:not(.disabled):hover {
133
+ background-color: rgb(248, 248, 248) !important;
134
+ }
135
+
136
+ .icon-button:not(.disabled):active {
137
+ background-color: rgb(237, 237, 237) !important;
138
+ }
139
+
140
+ .icon-button-group {
141
+ display: inline-flex;
142
+ border-radius: 6px !important;
143
+ overflow: hidden;
144
+ border: 1px solid #cfd9e0 !important;
145
+
146
+ .icon-button {
147
+ border-radius: 0 !important;
148
+ border: none !important;
149
+ border-right: 1px solid #cfd9e0 !important;
150
+ }
151
+
152
+ .icon-button:last-child {
153
+ border: none !important;
154
+ }
155
+ }
156
+
157
+ .message {
158
+ font-size: 0.875rem;
159
+ padding: 16px;
160
+ border-radius: 4px;
161
+ }
162
+
163
+ .message.message--negative {
164
+ background-color: rgba(238, 26, 26, 0.2);
165
+ }
166
+
167
+ .collapsable-menu {
168
+ background-color: white !important;
169
+ border: 1px solid #cfd9e0 !important;
170
+ border-radius: 6px;
171
+ z-index: 2;
172
+ overflow: hidden;
173
+ }
174
+
175
+ .collapsable-menu-item {
176
+ color: rgb(90, 101, 124) !important;
177
+ }
178
+
179
+ .collapsable-menu-item:not(.disabled):hover {
180
+ background-color: rgb(248, 248, 248) !important;
181
+ }
182
+
183
+ .collapsable-menu-item:not(.disabled):active {
184
+ background-color: rgb(237, 237, 237) !important;
185
+ }
186
186
  }
package/scss/toolbar.scss CHANGED
@@ -1,163 +1,163 @@
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
- position: relative;
29
- }
30
-
31
- .toolbar-btn {
32
- border-radius: 3px;
33
- color: black;
34
- cursor: pointer;
35
- font-weight: bold;
36
- margin-right: 5px;
37
- padding: 5px 7px;
38
- z-index: 500;
39
- position: relative;
40
- display: block;
41
-
42
- &.active {
43
- background-color: rgba(0, 0, 0, 0.3);
44
- }
45
-
46
- &:last-child {
47
- margin-right: 0px;
48
- }
49
-
50
- &:hover, &:active {
51
- background-color: rgba(0, 0, 0, 0.2);
52
-
53
- .toolbar-btn-config {
54
- display: block;
55
- }
56
- }
57
-
58
- .toolbar-btn-config {
59
- position: absolute;
60
- top: 28px;
61
- left: 0px;
62
- display: none;
63
- background-color: rgba(255, 255, 255, 0.95);
64
- border-bottom: 1px solid rgba(0, 0, 0, 0.3);
65
- padding: 5px 7px;
66
-
67
- .toolbar-btn-config-inner {
68
- display: flex;
69
- flex-direction: column;
70
-
71
- .toolbar-btn-config-row {
72
- min-width: 250px;
73
- padding: 5px 7px;
74
- display: flex;
75
- flex-direction: row;
76
-
77
- .toolbar-form-label {
78
- flex-grow: 0;
79
- padding: 0 7px 0 0;
80
- }
81
-
82
- .toolbar-form-input {
83
- flex-grow: 1;
84
-
85
- input {
86
- padding: 5px;
87
- border: 1px solid grey;
88
- background-color: white;
89
- color: black;
90
-
91
- &[type="checkbox"] {
92
- &:checked {
93
- color: white;
94
- background-color: black;
95
- }
96
- }
97
- }
98
- }
99
-
100
- .toolbar-btn {
101
- display: flex;
102
- flex-grow: 1;
103
- border: 1px solid black;
104
- }
105
- }
106
- }
107
- }
108
- }
109
-
110
- .toolbar-btn-expand {
111
- z-index: 500;
112
- display: block;
113
- max-height: 28px;
114
- overflow: hidden;
115
-
116
- .toolbar-btn-expand-inner {
117
- display: flex;
118
- flex-direction: column;
119
-
120
- .toolbar-btn.active {
121
- order: -1;
122
- }
123
- }
124
-
125
- &:hover {
126
- .toolbar-btn-expand-inner {
127
- background-color: rgba(255, 255, 255, 0.95);
128
- border-bottom: 1px solid rgba(0, 0, 0, 0.3);
129
- }
130
-
131
- overflow: visible;
132
- }
133
-
134
- }
135
-
136
-
137
- .toolbar-btn-expand-right {
138
- z-index: 500;
139
- display: block;
140
- max-height: 28px;
141
- overflow: hidden;
142
-
143
- .toolbar-btn-expand-inner {
144
- left: 100%;
145
- display: flex;
146
- flex-direction: column;
147
-
148
- .toolbar-btn.active {
149
- order: -1;
150
- }
151
- }
152
-
153
- &:hover {
154
- .toolbar-btn-expand-inner {
155
- background-color: rgba(255, 255, 255, 0.95);
156
- border-bottom: 1px solid rgba(0, 0, 0, 0.3);
157
- }
158
-
159
- overflow: visible;
160
- }
161
-
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
+ position: relative;
29
+ }
30
+
31
+ .toolbar-btn {
32
+ border-radius: 3px;
33
+ color: black;
34
+ cursor: pointer;
35
+ font-weight: bold;
36
+ margin-right: 5px;
37
+ padding: 5px 7px;
38
+ z-index: 500;
39
+ position: relative;
40
+ display: block;
41
+
42
+ &.active {
43
+ background-color: rgba(0, 0, 0, 0.3);
44
+ }
45
+
46
+ &:last-child {
47
+ margin-right: 0px;
48
+ }
49
+
50
+ &:hover, &:active {
51
+ background-color: rgba(0, 0, 0, 0.2);
52
+
53
+ .toolbar-btn-config {
54
+ display: block;
55
+ }
56
+ }
57
+
58
+ .toolbar-btn-config {
59
+ position: absolute;
60
+ top: 28px;
61
+ left: 0px;
62
+ display: none;
63
+ background-color: rgba(255, 255, 255, 0.95);
64
+ border-bottom: 1px solid rgba(0, 0, 0, 0.3);
65
+ padding: 5px 7px;
66
+
67
+ .toolbar-btn-config-inner {
68
+ display: flex;
69
+ flex-direction: column;
70
+
71
+ .toolbar-btn-config-row {
72
+ min-width: 250px;
73
+ padding: 5px 7px;
74
+ display: flex;
75
+ flex-direction: row;
76
+
77
+ .toolbar-form-label {
78
+ flex-grow: 0;
79
+ padding: 0 7px 0 0;
80
+ }
81
+
82
+ .toolbar-form-input {
83
+ flex-grow: 1;
84
+
85
+ input {
86
+ padding: 5px;
87
+ border: 1px solid grey;
88
+ background-color: white;
89
+ color: black;
90
+
91
+ &[type="checkbox"] {
92
+ &:checked {
93
+ color: white;
94
+ background-color: black;
95
+ }
96
+ }
97
+ }
98
+ }
99
+
100
+ .toolbar-btn {
101
+ display: flex;
102
+ flex-grow: 1;
103
+ border: 1px solid black;
104
+ }
105
+ }
106
+ }
107
+ }
108
+ }
109
+
110
+ .toolbar-btn-expand {
111
+ z-index: 500;
112
+ display: block;
113
+ max-height: 28px;
114
+ overflow: hidden;
115
+
116
+ .toolbar-btn-expand-inner {
117
+ display: flex;
118
+ flex-direction: column;
119
+
120
+ .toolbar-btn.active {
121
+ order: -1;
122
+ }
123
+ }
124
+
125
+ &:hover {
126
+ .toolbar-btn-expand-inner {
127
+ background-color: rgba(255, 255, 255, 0.95);
128
+ border-bottom: 1px solid rgba(0, 0, 0, 0.3);
129
+ }
130
+
131
+ overflow: visible;
132
+ }
133
+
134
+ }
135
+
136
+
137
+ .toolbar-btn-expand-right {
138
+ z-index: 500;
139
+ display: block;
140
+ max-height: 28px;
141
+ overflow: hidden;
142
+
143
+ .toolbar-btn-expand-inner {
144
+ left: 100%;
145
+ display: flex;
146
+ flex-direction: column;
147
+
148
+ .toolbar-btn.active {
149
+ order: -1;
150
+ }
151
+ }
152
+
153
+ &:hover {
154
+ .toolbar-btn-expand-inner {
155
+ background-color: rgba(255, 255, 255, 0.95);
156
+ border-bottom: 1px solid rgba(0, 0, 0, 0.3);
157
+ }
158
+
159
+ overflow: visible;
160
+ }
161
+
162
+ }
163
163
  }