@zipify/wysiwyg 4.0.3 → 4.0.4-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.
package/dist/wysiwyg.css CHANGED
@@ -23,7 +23,7 @@
23
23
  padding: var(--zw-offset-xxs) var(--zw-offset-xs);
24
24
  }
25
25
 
26
- .zw-button[data-v-45d91005] {
26
+ .zw-button[data-v-b2d5d74a] {
27
27
  display: inline-flex;
28
28
  align-items: center;
29
29
  vertical-align: middle;
@@ -43,21 +43,21 @@
43
43
  transition: 0.1s opacity ease-out;
44
44
  will-change: opacity;
45
45
  }
46
- .zw-button[data-v-45d91005]::-moz-focus-inner {
46
+ .zw-button[data-v-b2d5d74a]::-moz-focus-inner {
47
47
  border: 0 !important;
48
48
  }
49
- .zw-button[data-v-45d91005]:hover,
50
- .zw-button[data-v-45d91005]:focus {
49
+ .zw-button[data-v-b2d5d74a]:hover,
50
+ .zw-button[data-v-b2d5d74a]:focus {
51
51
  text-decoration: none;
52
52
  outline: none;
53
53
  }
54
- .zw-button[data-v-45d91005]:disabled {
54
+ .zw-button[data-v-b2d5d74a]:disabled {
55
55
  user-select: none;
56
56
  box-shadow: none;
57
57
  cursor: not-allowed;
58
58
  opacity: 0.35;
59
59
  }
60
- .zw-button--toolbar[data-v-45d91005] {
60
+ .zw-button--toolbar[data-v-b2d5d74a] {
61
61
  border-radius: 1px;
62
62
  min-height: 28px;
63
63
  font-weight: var(--zw-font-weight-semibold);
@@ -67,33 +67,33 @@
67
67
  transition-property: background-color, color, opacity;
68
68
  will-change: background-color, color, opacity;
69
69
  }
70
- .zw-button--primary[data-v-45d91005] {
70
+ .zw-button--primary[data-v-b2d5d74a] {
71
71
  background-color: rgb(var(--zw-color-green));
72
72
  color: rgb(var(--zw-color-white));
73
73
  padding: var(--zw-offset-xxs) var(--zw-offset-sm);
74
74
  line-height: var(--zw-line-height-md);
75
75
  }
76
- .zw-button--primary[data-v-45d91005],
77
- .zw-button--secondary[data-v-45d91005] {
76
+ .zw-button--primary[data-v-b2d5d74a],
77
+ .zw-button--secondary[data-v-b2d5d74a] {
78
78
  color: rgb(var(--zw-color-white));
79
79
  padding: var(--zw-offset-xxs) var(--zw-offset-sm);
80
80
  font-weight: 600;
81
81
  font-size: var(--zw-font-size-xs);
82
82
  }
83
- .zw-button--primary[data-v-45d91005]:not(:disabled):hover,
84
- .zw-button--secondary[data-v-45d91005]:not(:disabled):hover {
83
+ .zw-button--primary[data-v-b2d5d74a]:not(:disabled):hover,
84
+ .zw-button--secondary[data-v-b2d5d74a]:not(:disabled):hover {
85
85
  opacity: 0.9;
86
86
  }
87
- .zw-button--toolbar[data-v-45d91005]:not(.zw-button--icon) {
87
+ .zw-button--toolbar[data-v-b2d5d74a]:not(.zw-button--icon) {
88
88
  padding: var(--zw-offset-xxs) var(--zw-offset-xs);
89
89
  }
90
- .zw-button--toolbar[data-v-45d91005]:not(:disabled):hover,
91
- .zw-button--toolbar[data-v-45d91005]:not(:disabled):focus,
92
- .zw-button--toolbar.zw-button--active[data-v-45d91005]:not(:disabled) {
90
+ .zw-button--toolbar[data-v-b2d5d74a]:not(:disabled):hover,
91
+ .zw-button--toolbar[data-v-b2d5d74a]:not(:disabled):focus,
92
+ .zw-button--toolbar.zw-button--active[data-v-b2d5d74a]:not(:disabled) {
93
93
  color: rgb(var(--zw-color-white));
94
94
  background-color: rgb(var(--zw-color-n5));
95
95
  }
96
- .zw-button__customized-indicator[data-v-45d91005] {
96
+ [data-v-b2d5d74a] .zw-button__customized-indicator {
97
97
  width: 4px;
98
98
  height: 4px;
99
99
  background-color: rgb(var(--zw-color-y300));
package/dist/wysiwyg.mjs CHANGED
@@ -23049,6 +23049,11 @@ const _HtmlNormalizer = class extends BaseNormalizer {
23049
23049
  }
23050
23050
  itemEl.append(fragment);
23051
23051
  this._removeStyleProperties(itemEl, _HtmlNormalizer.BLOCK_STYLES);
23052
+ this._removeStyleProperties(itemEl.parentElement, _HtmlNormalizer.BLOCK_STYLES);
23053
+ this._assignElementProperties(itemEl, itemEl.parentElement);
23054
+ if (itemEl.parentElement.lastElementChild === itemEl) {
23055
+ this._removeStyleProperties(itemEl.parentElement);
23056
+ }
23052
23057
  }
23053
23058
  _isBlockNode(node) {
23054
23059
  return _HtmlNormalizer.BLOCK_NODE_NAMES.includes(node.tagName);
@@ -23056,7 +23061,7 @@ const _HtmlNormalizer = class extends BaseNormalizer {
23056
23061
  _isRootNode(node) {
23057
23062
  return _HtmlNormalizer.ROOT_NODE_NAMES.includes(node.tagName);
23058
23063
  }
23059
- _assignElementProperties(target, source, properties) {
23064
+ _assignElementProperties(target, source, properties = Array.from(source.style)) {
23060
23065
  for (const property of properties) {
23061
23066
  const value = source.style.getPropertyValue(property);
23062
23067
  if (value && !target.style.getPropertyValue(property)) {
@@ -23064,7 +23069,7 @@ const _HtmlNormalizer = class extends BaseNormalizer {
23064
23069
  }
23065
23070
  }
23066
23071
  }
23067
- _removeStyleProperties(element, properties) {
23072
+ _removeStyleProperties(element, properties = Array.from(element.style)) {
23068
23073
  for (const property of properties) {
23069
23074
  element.style.removeProperty(property);
23070
23075
  }
@@ -23890,7 +23895,7 @@ function tooltip(el, { value, modifiers: modifiers2 }) {
23890
23895
  if (modifiers2.lg)
23891
23896
  el.dataset.tooltipSize = "lg";
23892
23897
  }
23893
- const Button_vue_vue_type_style_index_0_scoped_45d91005_lang = "";
23898
+ const Button_vue_vue_type_style_index_0_scoped_b2d5d74a_lang = "";
23894
23899
  const _hoisted_1$n = ["disabled"];
23895
23900
  const _sfc_main$G = {
23896
23901
  __name: "Button",
@@ -23937,7 +23942,7 @@ const _sfc_main$G = {
23937
23942
  };
23938
23943
  }
23939
23944
  };
23940
- const Button = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-45d91005"]]);
23945
+ const Button = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-b2d5d74a"]]);
23941
23946
  const ButtonToggle_vue_vue_type_style_index_0_scoped_bbdc7b20_lang = "";
23942
23947
  const _hoisted_1$m = { class: "zw-button-toggle" };
23943
23948
  const _sfc_main$F = {
@@ -130,7 +130,7 @@ const classes = computed(() => ({
130
130
  background-color: rgb(var(--zw-color-n5));
131
131
  }
132
132
 
133
- .zw-button__customized-indicator {
133
+ :deep(.zw-button__customized-indicator) {
134
134
  width: 4px;
135
135
  height: 4px;
136
136
  background-color: rgb(var(--zw-color-y300));
@@ -155,6 +155,13 @@ export class HtmlNormalizer extends BaseNormalizer {
155
155
 
156
156
  itemEl.append(fragment);
157
157
  this._removeStyleProperties(itemEl, HtmlNormalizer.BLOCK_STYLES);
158
+ this._removeStyleProperties(itemEl.parentElement, HtmlNormalizer.BLOCK_STYLES);
159
+
160
+ this._assignElementProperties(itemEl, itemEl.parentElement);
161
+
162
+ if (itemEl.parentElement.lastElementChild === itemEl) {
163
+ this._removeStyleProperties(itemEl.parentElement);
164
+ }
158
165
  }
159
166
 
160
167
  _isBlockNode(node) {
@@ -165,7 +172,7 @@ export class HtmlNormalizer extends BaseNormalizer {
165
172
  return HtmlNormalizer.ROOT_NODE_NAMES.includes(node.tagName);
166
173
  }
167
174
 
168
- _assignElementProperties(target, source, properties) {
175
+ _assignElementProperties(target, source, properties = Array.from(source.style)) {
169
176
  for (const property of properties) {
170
177
  const value = source.style.getPropertyValue(property);
171
178
 
@@ -175,7 +182,7 @@ export class HtmlNormalizer extends BaseNormalizer {
175
182
  }
176
183
  }
177
184
 
178
- _removeStyleProperties(element, properties) {
185
+ _removeStyleProperties(element, properties = Array.from(element.style)) {
179
186
  for (const property of properties) {
180
187
  element.style.removeProperty(property);
181
188
  }
@@ -79,7 +79,14 @@ describe('normalize text content', () => {
79
79
 
80
80
  test('should assign block styles from list to paragraph', () => {
81
81
  const input = '<ul style="line-height: 2;"><li>lorem ipsum</li></ul>';
82
- const output = '<ul style="line-height: 2;"><li><p style="line-height: 2;">lorem ipsum</p></li></ul>';
82
+ const output = '<ul><li><p style="line-height: 2;">lorem ipsum</p></li></ul>';
83
+
84
+ expect(ContentNormalizer.normalize(input)).toBe(output);
85
+ });
86
+
87
+ test('should assign styles from list to item', () => {
88
+ const input = '<ul style="color: red;"><li>lorem ipsum</li></ul>';
89
+ const output = '<ul><li style="color: red;"><p>lorem ipsum</p></li></ul>';
83
90
 
84
91
  expect(ContentNormalizer.normalize(input)).toBe(output);
85
92
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zipify/wysiwyg",
3
- "version": "4.0.3",
3
+ "version": "4.0.4-0",
4
4
  "description": "Zipify modification of TipTap text editor",
5
5
  "main": "dist/wysiwyg.mjs",
6
6
  "bin": {