@vonaffenfels/slate-editor 1.0.3 → 1.0.4

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.
@@ -4,30 +4,6 @@
4
4
  http://jedwatson.github.io/classnames
5
5
  */
6
6
 
7
- /*!
8
- Copyright (c) 2015 Jed Watson.
9
- Based on code that is Copyright 2013-2015, Facebook, Inc.
10
- All rights reserved.
11
- */
12
-
13
- /*!
14
- Copyright (c) 2018 Jed Watson.
15
- Licensed under the MIT License (MIT), see
16
- http://jedwatson.github.io/classnames
17
- */
18
-
19
- /*!
20
- * Adapted from jQuery UI core
21
- *
22
- * http://jqueryui.com
23
- *
24
- * Copyright 2014 jQuery Foundation and other contributors
25
- * Released under the MIT license.
26
- * http://jquery.org/license
27
- *
28
- * http://api.jqueryui.com/category/ui-core/
29
- */
30
-
31
7
  /*!
32
8
  * Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com
33
9
  * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
@@ -58,12 +34,3 @@
58
34
  /*! https://mths.be/esrever v0.2.0 by @mathias */
59
35
 
60
36
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
61
-
62
- /** @license React v16.13.1
63
- * react-is.production.min.js
64
- *
65
- * Copyright (c) Facebook, Inc. and its affiliates.
66
- *
67
- * This source code is licensed under the MIT license found in the
68
- * LICENSE file in the root directory of this source tree.
69
- */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vonaffenfels/slate-editor",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -71,7 +71,7 @@
71
71
  "cssnano": "^5.0.1",
72
72
  "escape-html": "^1.0.3"
73
73
  },
74
- "gitHead": "5886b3f191d7e644434c7baef0808194aec62802",
74
+ "gitHead": "ba6d3fea2cca04a822de7e3d7dff5949e62a9d46",
75
75
  "publishConfig": {
76
76
  "access": "public"
77
77
  }
package/scss/demo.scss CHANGED
@@ -6,6 +6,7 @@ html, body, #root {
6
6
  @media (prefers-color-scheme: dark) {
7
7
  .slate-editor {
8
8
  color: white;
9
+ background-color: #1c1c27;
9
10
  }
10
11
  }
11
12
 
@@ -17,6 +18,7 @@ html, body, #root {
17
18
  flex-direction: column;
18
19
 
19
20
  .editor-demo-output {
21
+ display: none;
20
22
  width: 100%;
21
23
  }
22
24
 
@@ -76,23 +78,28 @@ html, body, #root {
76
78
 
77
79
  .block-editor-content h1 {
78
80
  font-size: 2em;
81
+ margin-bottom: 2em;
79
82
  }
80
83
 
81
84
  .block-editor-content h2 {
82
85
  font-size: 1.5em;
86
+ margin-bottom: 1em;
83
87
  }
84
88
 
85
89
  .block-editor-content h3 {
86
90
  font-size: 1.3em;
91
+ margin-bottom: 1em;
87
92
  }
88
93
 
89
94
  .block-editor-content h4 {
90
95
  font-size: 1.1em;
96
+ margin-bottom: 1em;
91
97
  }
92
98
 
93
99
  .block-editor-content h5,
94
100
  .block-editor-content h6 {
95
101
  font-size: 1em;
102
+ margin-bottom: 1em;
96
103
  }
97
104
 
98
105
  .block-editor-content ul, .block-editor-content ol {
package/scss/editor.scss CHANGED
@@ -1,3 +1,7 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
4
+
1
5
  .block-editor-wrapper {
2
6
 
3
7
  position: relative;
@@ -39,14 +43,12 @@
39
43
  }
40
44
 
41
45
  .slate-editor {
42
- max-height: 100%;
46
+ width: 100%;
43
47
  height: 100%;
44
48
  z-index: 100;
45
- max-width: 100%;
46
49
  overflow-y: auto;
47
- padding: 40px 60px 0 60px;
50
+ padding: 40px 0 0 0;
48
51
  position: relative;
49
- width: 100%;
50
52
 
51
53
  span[data-slate-node="text"] {
52
54
  /* eslint-disable-next-line */
@@ -59,7 +61,7 @@
59
61
  //outline: #CECECE dashed;
60
62
 
61
63
  &:after {
62
- font-size: 1em;
64
+ font-size: 24px;
63
65
  content: "P";
64
66
  color: #CECECE;
65
67
  position: absolute;
@@ -71,29 +73,29 @@
71
73
  }
72
74
 
73
75
  h1[data-slate-node="element"] {
74
- font-size: 2em;
75
76
  position: relative;
76
77
 
77
78
  &:after {
78
79
  content: "h1";
80
+ font-size: 24px;
79
81
  color: #CECECE;
80
82
  position: absolute;
81
- left: -26px;
83
+ left: -36px;
82
84
  text-transform: uppercase;
83
- top: 1px;
85
+ top: 6px;
84
86
  user-select: none;
85
87
  }
86
88
  }
87
89
 
88
90
  h2[data-slate-node="element"] {
89
- font-size: 1.5em;
90
91
  position: relative;
91
92
 
92
93
  &:after {
93
94
  content: "h2";
95
+ font-size: 24px;
94
96
  color: #CECECE;
95
97
  position: absolute;
96
- left: -26px;
98
+ left: -36px;
97
99
  text-transform: uppercase;
98
100
  top: 1px;
99
101
  user-select: none;
@@ -101,14 +103,14 @@
101
103
  }
102
104
 
103
105
  h3[data-slate-node="element"] {
104
- font-size: 1.3em;
105
106
  position: relative;
106
107
 
107
108
  &:after {
108
109
  content: "h3";
110
+ font-size: 24px;
109
111
  color: #CECECE;
110
112
  position: absolute;
111
- left: -26px;
113
+ left: -36px;
112
114
  text-transform: uppercase;
113
115
  top: 1px;
114
116
  user-select: none;
@@ -116,14 +118,14 @@
116
118
  }
117
119
 
118
120
  h4[data-slate-node="element"] {
119
- font-size: 1.1em;
120
121
  position: relative;
121
122
 
122
123
  &:after {
123
124
  content: "h4";
125
+ font-size: 24px;
124
126
  color: #CECECE;
125
127
  position: absolute;
126
- left: -26px;
128
+ left: -36px;
127
129
  text-transform: uppercase;
128
130
  top: 1px;
129
131
  user-select: none;
@@ -131,14 +133,14 @@
131
133
  }
132
134
 
133
135
  h5[data-slate-node="element"] {
134
- font-size: 1em;
135
136
  position: relative;
136
137
 
137
138
  &:after {
138
139
  content: "h5";
140
+ font-size: 24px;
139
141
  color: #CECECE;
140
142
  position: absolute;
141
- left: -26px;
143
+ left: -36px;
142
144
  text-transform: uppercase;
143
145
  top: 1px;
144
146
  user-select: none;
@@ -146,14 +148,14 @@
146
148
  }
147
149
 
148
150
  h6[data-slate-node="element"] {
149
- font-size: 1em;
150
151
  position: relative;
151
152
 
152
153
  &:after {
153
154
  content: "h6";
155
+ font-size: 24px;
154
156
  color: #CECECE;
155
157
  position: absolute;
156
- left: -26px;
158
+ left: -36px;
157
159
  text-transform: uppercase;
158
160
  top: 1px;
159
161
  user-select: none;
@@ -211,7 +213,9 @@
211
213
  }
212
214
 
213
215
  .options-wrapper {
216
+ font-family: Arial, sans-serif;
214
217
  position: relative;
218
+ color: #161616;
215
219
 
216
220
  &:hover {
217
221
  .options-container {
@@ -219,20 +223,25 @@
219
223
  }
220
224
  }
221
225
 
226
+ .options-toolbar {
227
+ justify-content: space-between;
228
+ display: flex;
229
+ background-color: rgb(235 235 235);
230
+ padding: 0.25em;
231
+ }
232
+
222
233
  .options-container {
223
- display: none;
234
+ display: flex;
224
235
  flex-direction: row;
225
236
  justify-content: center;
226
- left: 0px;
227
- position: absolute;
228
- top: 0px;
237
+ position: relative;
229
238
  z-index: 200;
230
- background-color: grey;
231
- padding: 4px 4px 4px 4px;
239
+ padding: 0.25em;
232
240
 
233
241
  .options-container-option {
234
242
  cursor: pointer;
235
243
  width: 26px;
244
+ margin-right: 0.25em;
236
245
 
237
246
  > svg {
238
247
  width: 100%;
@@ -248,16 +257,15 @@
248
257
  }
249
258
 
250
259
  &.options-container-right {
251
- left: -26px;
260
+ self-align: flex-end;
252
261
  }
253
262
  }
254
263
  }
255
264
 
256
265
  .layout-slot-option-padding {
257
-
258
266
  position: relative;
259
- width: 20px;
260
- height: 20px;
267
+ width: 1.5em;
268
+ height: 1.5em;
261
269
  display: inline-block;
262
270
 
263
271
  .layout-slot-option-padding-item {
@@ -267,40 +275,40 @@
267
275
  cursor: pointer;
268
276
 
269
277
  &:hover {
270
- background-color: white;
278
+ background-color: #61a2e9;
271
279
  z-index: 10
272
280
  }
273
281
 
274
282
  &.active {
275
- background-color: lightgray;
283
+ background-color: #3490f3;
276
284
  z-index: 10
277
285
  }
278
286
  }
279
287
 
280
288
  .layout-slot-option-padding-top {
281
- height: 5px;
282
- width: 20px;
289
+ height: 20%;
290
+ width: 100%;
283
291
  top: 0;
284
292
  left: 0;
285
293
  }
286
294
 
287
295
  .layout-slot-option-padding-right {
288
- height: 20px;
289
- width: 5px;
296
+ height: 100%;
297
+ width: 20%;
290
298
  right: 0;
291
299
  top: 0;
292
300
  }
293
301
 
294
302
  .layout-slot-option-padding-bottom {
295
- height: 5px;
296
- width: 20px;
303
+ height: 20%;
304
+ width: 100%;
297
305
  bottom: 0;
298
306
  left: 0;
299
307
  }
300
308
 
301
309
  .layout-slot-option-padding-left {
302
- height: 20px;
303
- width: 5px;
310
+ height: 100%;
311
+ width: 20%;
304
312
  top: 0;
305
313
  left: 0;
306
314
  }
@@ -391,4 +399,28 @@
391
399
  }
392
400
  }
393
401
  }
402
+
403
+ .selected-storybook-element {
404
+ outline: dashed #036fe3;
405
+ }
406
+ }
407
+
408
+ button {
409
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol" !important;
410
+ width: 100%;
411
+ padding: 8px 0.75rem !important;
412
+ color: #FFFFFF !important;
413
+ border: 1px solid #036fe3 !important;
414
+ transition: all 100ms ease-in-out;
415
+ background-color: #036fe3 !important;
416
+ font-size: 0.875rem !important;
417
+ border-radius: 4px !important;
418
+ }
419
+
420
+ button:hover {
421
+ background-color: #0275F0 !important;
422
+ }
423
+
424
+ button:active {
425
+ background-color: #0262C9 !important;
394
426
  }
@@ -1,25 +1,16 @@
1
1
  #sidebar-editor {
2
+ display: flex;
3
+ flex-direction: column;
2
4
  background-color: rgb(247, 249, 250);
3
- height: 100%;
5
+ max-height: 100%;
4
6
  overflow-y: auto;
5
7
  flex-basis: 400px;
6
8
  flex-shrink: 0;
7
- padding: 61px 16px 16px 16px;
8
- resize: horizontal;
9
+ padding: 60px 16px 16px 16px;
9
10
 
10
11
  * {
11
12
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol" !important;
12
13
  }
13
-
14
- select {
15
- font-size: 0.875rem !important;
16
- color: rgb(90, 101, 124) !important;
17
- background-color: white !important;
18
- border: 1px solid #cfd9e0 !important;
19
- border-radius: 6px !important;
20
- box-shadow: none !important;
21
- filter: none !important;
22
- }
23
14
 
24
15
  p, label {
25
16
  color: rgb(90, 101, 124);
@@ -48,7 +39,7 @@
48
39
  }
49
40
 
50
41
  input[type="color"] {
51
- padding: 0;
42
+ padding: 4px !important;
52
43
  }
53
44
 
54
45
  input[type="range"] {
@@ -82,13 +73,6 @@
82
73
  margin-right: 8px;
83
74
  }
84
75
 
85
- button {
86
- width: 100%;
87
- padding: 8px !important;
88
- color: #036fe3 !important;
89
- border: 1px solid #036fe3 !important;
90
- }
91
-
92
76
  details {
93
77
  display: block;
94
78
  font-size: 0.875rem !important;
@@ -101,4 +85,59 @@
101
85
  width: 100% !important;
102
86
  padding: 16px !important;
103
87
  }
88
+
89
+ summary {
90
+ cursor: pointer;
91
+ }
92
+
93
+ .disabled {
94
+ opacity: 0.4;
95
+ cursor: not-allowed !important;
96
+ }
97
+
98
+ .icon-button {
99
+ display: inline-block;
100
+ color: rgb(90, 101, 124) !important;
101
+ background-color: white !important;
102
+ border: 1px solid #cfd9e0 !important;
103
+ border-radius: 6px;
104
+ filter: none !important;
105
+ width: auto !important;
106
+ text-align: center;
107
+ }
108
+
109
+ .icon-button:not(.disabled):hover {
110
+ background-color: rgb(248, 248, 248) !important;
111
+ }
112
+
113
+ .icon-button:not(.disabled):active {
114
+ background-color: rgb(237, 237, 237) !important;
115
+ }
116
+
117
+ .icon-button-group {
118
+ display: inline-flex;
119
+ border-radius: 6px !important;
120
+ overflow: hidden;
121
+ border: 1px solid #cfd9e0 !important;
122
+
123
+ .icon-button {
124
+ border-radius: 0 !important;
125
+ border: none !important;
126
+ border-right: 1px solid #cfd9e0 !important;
127
+ }
128
+
129
+ .icon-button:last-child {
130
+ border: none !important;
131
+ }
132
+ }
133
+
134
+ .message {
135
+ font-size: 0.875rem;
136
+ padding: 16px;
137
+ border-radius: 4px;
138
+ }
139
+
140
+ .message.message--negative {
141
+ background-color: rgba(238, 26, 26, 0.2);
142
+ }
104
143
  }
@@ -1,6 +1,53 @@
1
1
  .storybook-element {
2
2
  display: inline;
3
3
 
4
+ .storybook-element-component-overlay {
5
+ display: none;
6
+ width: 100%;
7
+ height: 100%;
8
+ position: absolute;
9
+ z-index: 10;
10
+ background-color: rgba(255, 255, 255, 0.7);
11
+ color: black;
12
+ font-size: 2em;
13
+ align-items: center;
14
+ justify-content: center;
15
+ content-visibility: auto;
16
+ }
17
+
18
+ &.storybook-inline {
19
+ display: inline-flex;
20
+ flex-direction: row-reverse;
21
+
22
+ .options-toolbar {
23
+ display: inline-block;
24
+
25
+ .options-container {
26
+ padding: 0.15em;
27
+
28
+ .options-container-option {
29
+ width: 16px;
30
+ }
31
+ }
32
+ }
33
+
34
+ .storybook-element-component {
35
+ display: inline-block;
36
+
37
+ .editor-empty-element {
38
+ min-width: 220px;
39
+ min-height: 10px;
40
+ padding: 0.15em;
41
+ }
42
+ }
43
+
44
+ .storybook-element-component-overlay {
45
+ font-size: 0.75em;
46
+ min-width: 220px;
47
+ text-align: center;
48
+ }
49
+ }
50
+
4
51
  &.storybook-element-float-left {
5
52
  float: left;
6
53
  }
@@ -12,18 +59,39 @@
12
59
  .storybook-element-component {
13
60
  user-select: none;
14
61
  display: block;
62
+ position: relative;
15
63
 
16
- &.storybook-inline {
17
- display: inline-block;
64
+ &:not(.selected-storybook-element):hover {
65
+ .storybook-element-component-overlay {
66
+ user-select: none;
67
+ display: flex;
68
+ cursor: pointer;
69
+ }
18
70
  }
19
71
 
20
72
  .editor-empty-element {
21
- background-color: red;
73
+
74
+ display: block;
75
+ background-color: #42000b;
76
+ color: white;
22
77
  border: 1px solid black;
23
- min-height: 20px;
24
- min-width: 100px;
78
+ min-height: 40px;
79
+ padding: 2em;
80
+ min-width: 100%;
81
+
82
+ &.editor-select-element {
83
+ background-color: #555555;
84
+ }
25
85
  }
26
86
 
87
+ &.storybook-inline {
88
+ .editor-empty-element {
89
+ min-height: 20px;
90
+ min-width: 100px;
91
+ }
92
+ }
93
+
94
+
27
95
  .storybook-element-display {
28
96
  &:empty {
29
97
  display: block;
package/scss/toolbar.scss CHANGED
@@ -4,6 +4,7 @@
4
4
  display: none;
5
5
  flex-direction: row;
6
6
  justify-content: space-between;
7
+ font-family: Arial, sans-serif;
7
8
  padding: 5px;
8
9
  position: absolute;
9
10
  z-index: 500;
@@ -23,6 +24,7 @@
23
24
 
24
25
  .toolbar-btns {
25
26
  display: flex;
27
+ align-items: center;
26
28
  }
27
29
 
28
30
  .toolbar-btn {