@zipify/wysiwyg 1.0.0-dev.95 → 1.0.0-dev.98

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 CHANGED
@@ -561,18 +561,18 @@
561
561
  flex-direction: column;
562
562
  }
563
563
 
564
- .zw-line-height-control__modal[data-v-532367c1] {
564
+ .zw-line-height-control__modal[data-v-9ea28b80] {
565
565
  padding: var(--zw-offset-sm);
566
566
  }
567
- .zw-line-height-control__row[data-v-532367c1] {
567
+ .zw-line-height-control__row[data-v-9ea28b80] {
568
568
  display: flex;
569
569
  align-items: center;
570
570
  }
571
- .zw-line-height-control__range[data-v-532367c1] {
571
+ .zw-line-height-control__range[data-v-9ea28b80] {
572
572
  width: 156px;
573
573
  }
574
- .zw-line-height-control__field[data-v-532367c1] {
575
- width: 52px;
574
+ .zw-line-height-control__field[data-v-9ea28b80] {
575
+ width: 64px;
576
576
  margin-left: var(--zw-offset-sm);
577
577
  }
578
578
 
@@ -851,17 +851,17 @@ to {
851
851
  position: relative;
852
852
  }
853
853
  .zw-margin-bottom--xxs {
854
- margin-bottom: var(--zw-offset-xxs);
854
+ margin-bottom: var(--zw-offset-xxs) !important;
855
855
  }
856
856
  .zw-margin-bottom--xs {
857
- margin-bottom: var(--zw-offset-xs);
857
+ margin-bottom: var(--zw-offset-xs) !important;
858
858
  }
859
859
  .zw-margin-bottom--sm {
860
- margin-bottom: var(--zw-offset-sm);
860
+ margin-bottom: var(--zw-offset-sm) !important;
861
861
  }
862
862
  .zw-margin-bottom--md {
863
- margin-bottom: var(--zw-offset-md);
863
+ margin-bottom: var(--zw-offset-md) !important;
864
864
  }
865
865
  .zw-margin-right--xs {
866
- margin-right: var(--zw-offset-xs);
866
+ margin-right: var(--zw-offset-xs) !important;
867
867
  }
package/dist/wysiwyg.mjs CHANGED
@@ -19455,6 +19455,7 @@ const _ContentNormalizer = class {
19455
19455
  }
19456
19456
  _normalizeTextContent() {
19457
19457
  this._dom = this._parser.parseFromString(this._content.replace(/(\r)?\n/g, ""), "text/html");
19458
+ this._removeComments();
19458
19459
  this._iterateNodes(this._normalizeBreakLines, (node) => node.tagName === "BR");
19459
19460
  this._iterateNodes(this._removeEmptyNodes, this._isBlockNode);
19460
19461
  this._iterateNodes(this._normalizeListItems, (node) => node.tagName === "LI");
@@ -19462,10 +19463,17 @@ const _ContentNormalizer = class {
19462
19463
  this._iterateNodes(this._normalizeStyles, (node) => node.tagName !== "SPAN");
19463
19464
  return this._dom.body.innerHTML;
19464
19465
  }
19466
+ _removeComments() {
19467
+ const iterator = this._dom.createNodeIterator(this._dom.body, NodeFilter.SHOW_COMMENT);
19468
+ this._runIterator(iterator, (node) => node.remove());
19469
+ }
19465
19470
  _iterateNodes(handler, condition = () => true) {
19466
19471
  const iterator = this._dom.createNodeIterator(this._dom.body, NodeFilter.SHOW_ELEMENT, {
19467
19472
  acceptNode: (node) => condition.call(this, node) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT
19468
19473
  });
19474
+ this._runIterator(iterator, handler);
19475
+ }
19476
+ _runIterator(iterator, handler) {
19469
19477
  let currentNode = iterator.nextNode();
19470
19478
  while (currentNode) {
19471
19479
  handler.call(this, currentNode);
@@ -19473,8 +19481,7 @@ const _ContentNormalizer = class {
19473
19481
  }
19474
19482
  }
19475
19483
  _removeEmptyNodes(node) {
19476
- const html2 = node.innerHTML.replace(/ /g, "").trim();
19477
- if (!html2)
19484
+ if (!node.innerHTML.trim())
19478
19485
  node.remove();
19479
19486
  }
19480
19487
  _normalizeListItems(itemEl) {
@@ -21788,7 +21795,7 @@ var __component__$c = /* @__PURE__ */ normalizeComponent(
21788
21795
  staticRenderFns$c,
21789
21796
  false,
21790
21797
  __vue2_injectStyles$c,
21791
- "532367c1",
21798
+ "9ea28b80",
21792
21799
  null,
21793
21800
  null
21794
21801
  );
@@ -179,4 +179,6 @@ p, h1, h2, h3, h4 {
179
179
  margin-top: 0.3em;
180
180
  margin-bottom: 0.3em;
181
181
  }
182
+
183
+ *, *::before, *::after { box-sizing: border-box }
182
184
  </style>
@@ -96,7 +96,7 @@ export default {
96
96
  }
97
97
 
98
98
  .zw-line-height-control__field {
99
- width: 52px;
99
+ width: 64px;
100
100
  margin-left: var(--zw-offset-sm);
101
101
  }
102
102
  </style>
@@ -40,6 +40,7 @@ export class ContentNormalizer {
40
40
  _normalizeTextContent() {
41
41
  this._dom = this._parser.parseFromString(this._content.replace(/(\r)?\n/g, ''), 'text/html');
42
42
 
43
+ this._removeComments();
43
44
  this._iterateNodes(this._normalizeBreakLines, (node) => node.tagName === 'BR');
44
45
  this._iterateNodes(this._removeEmptyNodes, this._isBlockNode);
45
46
  this._iterateNodes(this._normalizeListItems, (node) => node.tagName === 'LI');
@@ -49,10 +50,21 @@ export class ContentNormalizer {
49
50
  return this._dom.body.innerHTML;
50
51
  }
51
52
 
53
+ _removeComments() {
54
+ const iterator = this._dom.createNodeIterator(this._dom.body, NodeFilter.SHOW_COMMENT);
55
+
56
+ this._runIterator(iterator, (node) => node.remove());
57
+ }
58
+
52
59
  _iterateNodes(handler, condition = () => true) {
53
60
  const iterator = this._dom.createNodeIterator(this._dom.body, NodeFilter.SHOW_ELEMENT, {
54
61
  acceptNode: (node) => condition.call(this, node) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT
55
62
  });
63
+
64
+ this._runIterator(iterator, handler);
65
+ }
66
+
67
+ _runIterator(iterator, handler) {
56
68
  let currentNode = iterator.nextNode();
57
69
 
58
70
  while (currentNode) {
@@ -62,9 +74,7 @@ export class ContentNormalizer {
62
74
  }
63
75
 
64
76
  _removeEmptyNodes(node) {
65
- const html = node.innerHTML.replace(/&nbsp;/g, '').trim();
66
-
67
- if (!html) node.remove();
77
+ if (!node.innerHTML.trim()) node.remove();
68
78
  }
69
79
 
70
80
  _normalizeListItems(itemEl) {
@@ -92,13 +92,6 @@ describe('normalize text content', () => {
92
92
  expect(ContentNormalizer.normalize(input)).toBe(output);
93
93
  });
94
94
 
95
- test('should ignore non-breaking space only nodes', () => {
96
- const input = '<p>lorem ipsum 1</p><p>&nbsp;</p><p>lorem ipsum 2</p>';
97
- const output = '<p>lorem ipsum 1</p><p>lorem ipsum 2</p>';
98
-
99
- expect(ContentNormalizer.normalize(input)).toBe(output);
100
- });
101
-
102
95
  test('should ignore newline chapters only nodes', () => {
103
96
  const input = '<p>lorem ipsum 1</p><p>\n</p><p>lorem ipsum 2</p>';
104
97
  const output = '<p>lorem ipsum 1</p><p>lorem ipsum 2</p>';
@@ -161,4 +154,11 @@ describe('normalize text content', () => {
161
154
 
162
155
  expect(ContentNormalizer.normalize(input)).toBe(output);
163
156
  });
157
+
158
+ test('should remove comments', () => {
159
+ const input = '<p>lorem ipsum</p><p style="color: red;">Hello <!-- world --></p>';
160
+ const output = '<p>lorem ipsum</p><p><span style="color: red;">Hello </span></p>';
161
+
162
+ expect(ContentNormalizer.normalize(input)).toBe(output);
163
+ });
164
164
  });
@@ -1,19 +1,19 @@
1
1
  .zw-margin-bottom--xxs {
2
- margin-bottom: var(--zw-offset-xxs);
2
+ margin-bottom: var(--zw-offset-xxs) !important;
3
3
  }
4
4
 
5
5
  .zw-margin-bottom--xs {
6
- margin-bottom: var(--zw-offset-xs);
6
+ margin-bottom: var(--zw-offset-xs) !important;
7
7
  }
8
8
 
9
9
  .zw-margin-bottom--sm {
10
- margin-bottom: var(--zw-offset-sm);
10
+ margin-bottom: var(--zw-offset-sm) !important;
11
11
  }
12
12
 
13
13
  .zw-margin-bottom--md {
14
- margin-bottom: var(--zw-offset-md);
14
+ margin-bottom: var(--zw-offset-md) !important;
15
15
  }
16
16
 
17
17
  .zw-margin-right--xs {
18
- margin-right: var(--zw-offset-xs);
18
+ margin-right: var(--zw-offset-xs) !important;
19
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zipify/wysiwyg",
3
- "version": "1.0.0-dev.95",
3
+ "version": "1.0.0-dev.98",
4
4
  "description": "Zipify modification of TipTap text editor",
5
5
  "main": "dist/wysiwyg.mjs",
6
6
  "repository": {