@zipify/wysiwyg 1.0.0-dev.91 → 1.0.0-dev.94
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.
- package/dist/wysiwyg.css +32 -27
- package/dist/wysiwyg.mjs +7 -5
- package/lib/components/base/Checkbox.vue +3 -1
- package/lib/components/base/TextField.vue +2 -0
- package/lib/components/toolbar/controls/link/LinkControlHeader.vue +4 -2
- package/lib/services/ContentNormalizer.js +5 -2
- package/lib/services/__tests__/ContentNormalizer.test.js +7 -0
- package/lib/styles/content.css +2 -4
- package/package.json +1 -1
package/dist/wysiwyg.css
CHANGED
|
@@ -369,11 +369,11 @@
|
|
|
369
369
|
overscroll-behavior: contain;
|
|
370
370
|
}
|
|
371
371
|
|
|
372
|
-
.zw-field[data-v-
|
|
372
|
+
.zw-field[data-v-20ee36c3] {
|
|
373
373
|
display: flex;
|
|
374
374
|
flex-direction: column;
|
|
375
375
|
}
|
|
376
|
-
.zw-field__input[data-v-
|
|
376
|
+
.zw-field__input[data-v-20ee36c3] {
|
|
377
377
|
--border-color: rgb(var(--zw-color-n60));
|
|
378
378
|
--text-color: rgb(var(--zw-color-n85));
|
|
379
379
|
|
|
@@ -384,49 +384,53 @@
|
|
|
384
384
|
outline: none;
|
|
385
385
|
padding: 6px;
|
|
386
386
|
line-height: var(--zw-line-height-xxs);
|
|
387
|
+
transition: 0.1s border ease-out, 0.1s color ease-out;
|
|
388
|
+
will-change: border, color;
|
|
387
389
|
}
|
|
388
|
-
.zw-field__input[data-v-
|
|
390
|
+
.zw-field__input[data-v-20ee36c3]:hover {
|
|
389
391
|
--border-color: rgb(var(--zw-color-n80));
|
|
390
392
|
--text-color: rgb(var(--zw-color-n85));
|
|
391
393
|
}
|
|
392
|
-
.zw-field__input[data-v-
|
|
393
|
-
.zw-field__input[data-v-
|
|
394
|
+
.zw-field__input[data-v-20ee36c3]:focus,
|
|
395
|
+
.zw-field__input[data-v-20ee36c3]:focus-within {
|
|
394
396
|
--border-color: rgb(var(--zw-color-white));
|
|
395
397
|
--text-color: rgb(var(--zw-color-white));
|
|
396
398
|
}
|
|
397
|
-
.zw-field__label[data-v-
|
|
399
|
+
.zw-field__label[data-v-20ee36c3] {
|
|
398
400
|
display: inline-block;
|
|
399
401
|
font-size: var(--zw-font-size-xxs);
|
|
400
402
|
padding-bottom: var(--zw-offset-xxs);
|
|
401
403
|
line-height: var(--zw-line-height-xxs);
|
|
402
404
|
}
|
|
403
|
-
.zw-field__label--error[data-v-
|
|
405
|
+
.zw-field__label--error[data-v-20ee36c3] {
|
|
404
406
|
font-size: var(--zw-font-size-xxs);
|
|
405
407
|
margin: var(--zw-offset-xxs) 0 0;
|
|
406
408
|
color: rgb(var(--zw-color-red));
|
|
407
409
|
}
|
|
408
410
|
|
|
409
|
-
.zw-checkbox[data-v-
|
|
411
|
+
.zw-checkbox[data-v-c9d1da12] {
|
|
410
412
|
display: inline-flex;
|
|
411
413
|
align-items: center;
|
|
412
414
|
position: relative;
|
|
413
415
|
cursor: pointer;
|
|
414
416
|
padding: var(--zw-offset-xxs) var(--zw-offset-xxs) var(--zw-offset-xxs) 0;
|
|
415
417
|
}
|
|
416
|
-
.zw-checkbox__field + .zw-checkbox__indicator[data-v-
|
|
418
|
+
.zw-checkbox__field + .zw-checkbox__indicator[data-v-c9d1da12] {
|
|
417
419
|
color: var(--zw-color-n200);
|
|
418
420
|
box-shadow: inset 0 0 0 2px currentColor;
|
|
419
421
|
}
|
|
420
|
-
.zw-checkbox:hover .zw-checkbox__indicator[data-v-
|
|
422
|
+
.zw-checkbox:hover .zw-checkbox__indicator[data-v-c9d1da12],
|
|
423
|
+
.zw-checkbox:focus .zw-checkbox__indicator[data-v-c9d1da12],
|
|
424
|
+
.zw-checkbox:focus-within .zw-checkbox__indicator[data-v-c9d1da12] {
|
|
421
425
|
box-shadow: inset 0 0 0 2px rgb(var(--zw-color-green));
|
|
422
426
|
}
|
|
423
|
-
.zw-checkbox__field:checked + .zw-checkbox__indicator[data-v-
|
|
427
|
+
.zw-checkbox__field:checked + .zw-checkbox__indicator[data-v-c9d1da12] {
|
|
424
428
|
color: rgb(var(--zw-color-green))
|
|
425
429
|
}
|
|
426
|
-
.zw-checkbox .zw-checkbox__field:checked + .zw-checkbox__indicator[data-v-
|
|
430
|
+
.zw-checkbox .zw-checkbox__field:checked + .zw-checkbox__indicator[data-v-c9d1da12] {
|
|
427
431
|
background-color: rgb(var(--zw-color-green));
|
|
428
432
|
}
|
|
429
|
-
.zw-checkbox .zw-checkbox__indicator[data-v-
|
|
433
|
+
.zw-checkbox .zw-checkbox__indicator[data-v-c9d1da12]::after {
|
|
430
434
|
content: "";
|
|
431
435
|
display: block;
|
|
432
436
|
height: 16px;
|
|
@@ -438,16 +442,16 @@
|
|
|
438
442
|
background-size: 16px;
|
|
439
443
|
background-position: center center;
|
|
440
444
|
}
|
|
441
|
-
.zw-checkbox__field:not(:checked) + .zw-checkbox__indicator[data-v-
|
|
445
|
+
.zw-checkbox__field:not(:checked) + .zw-checkbox__indicator[data-v-c9d1da12]::after {
|
|
442
446
|
transform: scale(0);
|
|
443
447
|
}
|
|
444
|
-
.zw-checkbox__field[data-v-
|
|
448
|
+
.zw-checkbox__field[data-v-c9d1da12] {
|
|
445
449
|
position: absolute;
|
|
446
450
|
opacity: 0;
|
|
447
451
|
height: 0;
|
|
448
452
|
width: 0;
|
|
449
453
|
}
|
|
450
|
-
.zw-checkbox__label[data-v-
|
|
454
|
+
.zw-checkbox__label[data-v-c9d1da12] {
|
|
451
455
|
font-size: var(--zw-font-size-xs);
|
|
452
456
|
}
|
|
453
457
|
|
|
@@ -587,32 +591,34 @@
|
|
|
587
591
|
display: flex;
|
|
588
592
|
}
|
|
589
593
|
|
|
590
|
-
.zw-link-modal-header[data-v-
|
|
594
|
+
.zw-link-modal-header[data-v-0a202ba4] {
|
|
591
595
|
display: flex;
|
|
592
596
|
align-items: center;
|
|
593
597
|
justify-content: space-between;
|
|
594
598
|
padding: var(--zw-offset-sm);
|
|
595
599
|
border-bottom: 2px solid rgb(var(--zw-color-n5));
|
|
596
600
|
}
|
|
597
|
-
.zw-link-modal-header__title[data-v-
|
|
601
|
+
.zw-link-modal-header__title[data-v-0a202ba4] {
|
|
598
602
|
text-transform: uppercase;
|
|
599
603
|
font-weight: var(--zw-font-weight-semibold);
|
|
600
604
|
font-size: var(--zw-font-size-xxs);
|
|
601
605
|
color: rgb(var(--zw-color-white));
|
|
602
606
|
}
|
|
603
|
-
.zw-link-modal-header__unlink-icon[data-v-
|
|
607
|
+
.zw-link-modal-header__unlink-icon[data-v-0a202ba4] {
|
|
604
608
|
margin-right: var(--zw-offset-xxs);
|
|
605
609
|
}
|
|
606
|
-
.zw-link-modal-header__unlink-button[data-v-
|
|
610
|
+
.zw-link-modal-header__unlink-button[data-v-0a202ba4] {
|
|
607
611
|
color: rgb(var(--zw-color-n80));
|
|
608
612
|
font-size: var(--zw-font-size-xxs);
|
|
609
|
-
transition: 0.1s opacity ease-out;
|
|
610
|
-
will-change: opacity;
|
|
613
|
+
transition: 0.1s opacity ease-out, 0.1s color ease-out;
|
|
614
|
+
will-change: opacity, color;
|
|
611
615
|
}
|
|
612
|
-
.zw-link-modal-header__unlink-button[data-v-
|
|
616
|
+
.zw-link-modal-header__unlink-button[data-v-0a202ba4]:disabled {
|
|
613
617
|
opacity: 0.35;
|
|
614
618
|
}
|
|
615
|
-
.zw-link-modal-header__unlink-button[data-v-
|
|
619
|
+
.zw-link-modal-header__unlink-button[data-v-0a202ba4]:focus,
|
|
620
|
+
.zw-link-modal-header__unlink-button[data-v-0a202ba4]:focus-within,
|
|
621
|
+
.zw-link-modal-header__unlink-button[data-v-0a202ba4]:hover {
|
|
616
622
|
color: rgb(var(--zw-color-white));
|
|
617
623
|
}
|
|
618
624
|
|
|
@@ -728,9 +734,6 @@ $font-height--xs: 1.33;
|
|
|
728
734
|
$font-height--sm: 1.43;
|
|
729
735
|
$font-height--md: 1.72;
|
|
730
736
|
*/
|
|
731
|
-
.zw-wysiwyg [contenteditable] {
|
|
732
|
-
outline: none;
|
|
733
|
-
}
|
|
734
737
|
.zw-wysiwyg__placeholder:first-child:last-child::before {
|
|
735
738
|
content: attr(data-placeholder);
|
|
736
739
|
color: rgb(var(--zw-color-n70));
|
|
@@ -777,6 +780,8 @@ $font-height--md: 1.72;
|
|
|
777
780
|
/* ProseMirror styles */
|
|
778
781
|
.ProseMirror {
|
|
779
782
|
position: relative;
|
|
783
|
+
outline: none;
|
|
784
|
+
overflow: auto;
|
|
780
785
|
}
|
|
781
786
|
.ProseMirror {
|
|
782
787
|
word-wrap: break-word;
|
package/dist/wysiwyg.mjs
CHANGED
|
@@ -19588,7 +19588,9 @@ const _ContentNormalizer = class {
|
|
|
19588
19588
|
return;
|
|
19589
19589
|
const fragment = new DocumentFragment();
|
|
19590
19590
|
const children = Array.from(parentElement.childNodes);
|
|
19591
|
-
|
|
19591
|
+
const parentTemplate = parentElement.cloneNode(true);
|
|
19592
|
+
parentTemplate.innerHTML = "";
|
|
19593
|
+
let capturingParagraph = parentTemplate.cloneNode();
|
|
19592
19594
|
const append2 = (node) => {
|
|
19593
19595
|
this._assignElementProperties(node, parentElement, _ContentNormalizer.BLOCK_STYLES);
|
|
19594
19596
|
fragment.append(node);
|
|
@@ -19596,7 +19598,7 @@ const _ContentNormalizer = class {
|
|
|
19596
19598
|
for (const child of children) {
|
|
19597
19599
|
if (child.tagName === "BR") {
|
|
19598
19600
|
append2(capturingParagraph);
|
|
19599
|
-
capturingParagraph =
|
|
19601
|
+
capturingParagraph = parentTemplate.cloneNode();
|
|
19600
19602
|
continue;
|
|
19601
19603
|
}
|
|
19602
19604
|
capturingParagraph.append(child);
|
|
@@ -19903,7 +19905,7 @@ var __component__$y = /* @__PURE__ */ normalizeComponent(
|
|
|
19903
19905
|
staticRenderFns$y,
|
|
19904
19906
|
false,
|
|
19905
19907
|
__vue2_injectStyles$y,
|
|
19906
|
-
"
|
|
19908
|
+
"20ee36c3",
|
|
19907
19909
|
null,
|
|
19908
19910
|
null
|
|
19909
19911
|
);
|
|
@@ -19965,7 +19967,7 @@ var __component__$x = /* @__PURE__ */ normalizeComponent(
|
|
|
19965
19967
|
staticRenderFns$x,
|
|
19966
19968
|
false,
|
|
19967
19969
|
__vue2_injectStyles$x,
|
|
19968
|
-
"
|
|
19970
|
+
"c9d1da12",
|
|
19969
19971
|
null,
|
|
19970
19972
|
null
|
|
19971
19973
|
);
|
|
@@ -22045,7 +22047,7 @@ var __component__$9 = /* @__PURE__ */ normalizeComponent(
|
|
|
22045
22047
|
staticRenderFns$9,
|
|
22046
22048
|
false,
|
|
22047
22049
|
__vue2_injectStyles$9,
|
|
22048
|
-
"
|
|
22050
|
+
"0a202ba4",
|
|
22049
22051
|
null,
|
|
22050
22052
|
null
|
|
22051
22053
|
);
|
|
@@ -45,7 +45,9 @@ export default {
|
|
|
45
45
|
box-shadow: inset 0 0 0 2px currentColor;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
.zw-checkbox:hover .zw-checkbox__indicator
|
|
48
|
+
.zw-checkbox:hover .zw-checkbox__indicator,
|
|
49
|
+
.zw-checkbox:focus .zw-checkbox__indicator,
|
|
50
|
+
.zw-checkbox:focus-within .zw-checkbox__indicator {
|
|
49
51
|
box-shadow: inset 0 0 0 2px rgb(var(--zw-color-green));
|
|
50
52
|
}
|
|
51
53
|
|
|
@@ -53,14 +53,16 @@ export default {
|
|
|
53
53
|
.zw-link-modal-header__unlink-button {
|
|
54
54
|
color: rgb(var(--zw-color-n80));
|
|
55
55
|
font-size: var(--zw-font-size-xxs);
|
|
56
|
-
transition: 0.1s opacity ease-out;
|
|
57
|
-
will-change: opacity;
|
|
56
|
+
transition: 0.1s opacity ease-out, 0.1s color ease-out;
|
|
57
|
+
will-change: opacity, color;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
.zw-link-modal-header__unlink-button:disabled {
|
|
61
61
|
opacity: 0.35;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
.zw-link-modal-header__unlink-button:focus,
|
|
65
|
+
.zw-link-modal-header__unlink-button:focus-within,
|
|
64
66
|
.zw-link-modal-header__unlink-button:hover {
|
|
65
67
|
color: rgb(var(--zw-color-white));
|
|
66
68
|
}
|
|
@@ -206,7 +206,10 @@ export class ContentNormalizer {
|
|
|
206
206
|
|
|
207
207
|
const fragment = new DocumentFragment();
|
|
208
208
|
const children = Array.from(parentElement.childNodes);
|
|
209
|
-
|
|
209
|
+
const parentTemplate = parentElement.cloneNode(true);
|
|
210
|
+
|
|
211
|
+
parentTemplate.innerHTML = '';
|
|
212
|
+
let capturingParagraph = parentTemplate.cloneNode();
|
|
210
213
|
|
|
211
214
|
const append = (node) => {
|
|
212
215
|
this._assignElementProperties(node, parentElement, ContentNormalizer.BLOCK_STYLES);
|
|
@@ -216,7 +219,7 @@ export class ContentNormalizer {
|
|
|
216
219
|
for (const child of children) {
|
|
217
220
|
if (child.tagName === 'BR') {
|
|
218
221
|
append(capturingParagraph);
|
|
219
|
-
capturingParagraph =
|
|
222
|
+
capturingParagraph = parentTemplate.cloneNode();
|
|
220
223
|
continue;
|
|
221
224
|
}
|
|
222
225
|
|
|
@@ -154,4 +154,11 @@ describe('normalize text content', () => {
|
|
|
154
154
|
|
|
155
155
|
expect(ContentNormalizer.normalize(input)).toBe(output);
|
|
156
156
|
});
|
|
157
|
+
|
|
158
|
+
test('should duplicate parent tag on normalize br', () => {
|
|
159
|
+
const input = '<h1><br></h1>';
|
|
160
|
+
const output = '<h1><br></h1>';
|
|
161
|
+
|
|
162
|
+
expect(ContentNormalizer.normalize(input)).toBe(output);
|
|
163
|
+
});
|
|
157
164
|
});
|
package/lib/styles/content.css
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
.zw-wysiwyg [contenteditable] {
|
|
2
|
-
outline: none;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
1
|
.zw-wysiwyg__placeholder:first-child:last-child::before {
|
|
6
2
|
content: attr(data-placeholder);
|
|
7
3
|
color: rgb(var(--zw-color-n70));
|
|
@@ -59,6 +55,8 @@
|
|
|
59
55
|
|
|
60
56
|
.ProseMirror {
|
|
61
57
|
position: relative;
|
|
58
|
+
outline: none;
|
|
59
|
+
overflow: auto;
|
|
62
60
|
}
|
|
63
61
|
|
|
64
62
|
.ProseMirror {
|