@vonaffenfels/slate-editor 1.1.71 → 1.2.0

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