@zipify/wysiwyg 3.1.0-2 → 3.1.1

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 (66) hide show
  1. package/.eslintrc.js +17 -235
  2. package/.github/actions/setup/action.yaml +1 -1
  3. package/README.md +2 -0
  4. package/config/build/cli.config.js +6 -6
  5. package/config/build/lib.config.js +5 -3
  6. package/config/svgo.js +6 -3
  7. package/dist/cli.js +5 -4
  8. package/dist/wysiwyg.css +18 -18
  9. package/dist/wysiwyg.mjs +12502 -11732
  10. package/example/tooltip/Tooltip.js +92 -69
  11. package/example/tooltip/modifiers/TooltipCloseOnScrollModifier.js +2 -5
  12. package/example/tooltip/tooltip.css +8 -31
  13. package/lib/Wysiwyg.vue +3 -0
  14. package/lib/cli/commands/ToJsonCommand.js +6 -6
  15. package/lib/components/base/__tests__/Button.test.js +1 -1
  16. package/lib/components/base/composables/__tests__/useDeselectionLock.test.js +2 -2
  17. package/lib/components/base/composables/__tests__/useElementRef.test.js +1 -1
  18. package/lib/components/base/composables/__tests__/useModalToggler.test.js +0 -2
  19. package/lib/components/base/composables/__tests__/useValidator.test.js +2 -2
  20. package/lib/components/base/composables/useModalToggler.js +30 -24
  21. package/lib/components/toolbar/Toolbar.vue +1 -1
  22. package/lib/components/toolbar/base/__tests__/ToolbarDivider.test.js +1 -1
  23. package/lib/components/toolbar/controls/StylePresetControl.vue +1 -1
  24. package/lib/components/toolbar/controls/__tests__/LineHeightControl.test.js +0 -2
  25. package/lib/components/toolbar/controls/composables/__tests__/useRecentFonts.test.js +1 -1
  26. package/lib/components/toolbar/controls/link/composables/__tests__/useLink.test.js +2 -2
  27. package/lib/composables/useToolbar.js +24 -19
  28. package/lib/extensions/FontSize.js +1 -2
  29. package/lib/extensions/Link.js +2 -0
  30. package/lib/extensions/__tests__/BackgroundColor.test.js +2 -2
  31. package/lib/extensions/__tests__/FontColor.test.js +3 -3
  32. package/lib/extensions/__tests__/FontFamily.test.js +3 -3
  33. package/lib/extensions/__tests__/FontSize.test.js +3 -3
  34. package/lib/extensions/__tests__/FontWeight.test.js +4 -4
  35. package/lib/extensions/__tests__/LineHeight.test.js +2 -2
  36. package/lib/extensions/__tests__/Link.test.js +33 -5
  37. package/lib/extensions/__tests__/__snapshots__/Link.test.js.snap +27 -0
  38. package/lib/extensions/core/Document.js +8 -1
  39. package/lib/extensions/core/NodeProcessor.js +3 -4
  40. package/lib/extensions/core/__tests__/NodeProcessor.test.js +6 -8
  41. package/lib/extensions/core/__tests__/TextProcessor.test.js +1 -1
  42. package/lib/extensions/core/index.js +0 -2
  43. package/lib/extensions/core/plugins/PlaceholderPlugin.js +2 -2
  44. package/lib/extensions/list/List.js +4 -5
  45. package/lib/extensions/list/ListItem.js +1 -2
  46. package/lib/extensions/list/__tests__/List.test.js +1 -1
  47. package/lib/models/Font.js +2 -2
  48. package/lib/models/__tests__/Font.test.js +3 -9
  49. package/lib/services/ContentSerializer.js +8 -8
  50. package/lib/services/HtmlToJsonParser.js +3 -3
  51. package/lib/services/NodeFactory.js +6 -6
  52. package/lib/services/StylePresetRenderer.js +11 -11
  53. package/lib/services/__tests__/JsonSerializer.test.js +1 -1
  54. package/lib/services/__tests__/Storage.test.js +1 -1
  55. package/lib/services/__tests__/StylePresetRenderer.test.js +1 -1
  56. package/lib/services/normalizer/BrowserDomParser.js +2 -2
  57. package/lib/services/normalizer/ContentNormalizer.js +3 -3
  58. package/lib/services/normalizer/HtmlNormalizer.js +52 -52
  59. package/lib/services/normalizer/JsonNormalizer.js +21 -21
  60. package/lib/utils/__tests__/convertAlignment.test.js +1 -1
  61. package/lib/utils/__tests__/renderInlineSetting.test.js +2 -2
  62. package/package.json +50 -48
  63. package/lib/extensions/core/steps/AddNodeMarkStep.js +0 -66
  64. package/lib/extensions/core/steps/AttrStep.js +0 -60
  65. package/lib/extensions/core/steps/RemoveNodeMarkStep.js +0 -56
  66. package/lib/extensions/core/steps/index.js +0 -3
@@ -46,7 +46,7 @@ export class NodeFactory {
46
46
  * }}
47
47
  */
48
48
  static listItem(...args) {
49
- const { attrs, content: children, marks } = this.#normalizeTextBlockArgs(args);
49
+ const { attrs, content: children, marks } = this._normalizeTextBlockArgs(args);
50
50
 
51
51
  return {
52
52
  type: NodeTypes.LIST_ITEM,
@@ -66,7 +66,7 @@ export class NodeFactory {
66
66
  * }}
67
67
  */
68
68
  static heading(level, ...args) {
69
- const config = this.#textBlock(args, this.text);
69
+ const config = this._textBlock(args, this.text);
70
70
 
71
71
  config.attrs ??= {};
72
72
  config.attrs.level = level;
@@ -84,12 +84,12 @@ export class NodeFactory {
84
84
  static paragraph(...args) {
85
85
  return {
86
86
  type: NodeTypes.PARAGRAPH,
87
- ...this.#textBlock(args, this.text)
87
+ ...this._textBlock(args, this.text)
88
88
  };
89
89
  }
90
90
 
91
- static #textBlock(args) {
92
- const { attrs, content, marks } = this.#normalizeTextBlockArgs(args);
91
+ static _textBlock(args) {
92
+ const { attrs, content, marks } = this._normalizeTextBlockArgs(args);
93
93
  const children = typeof content === 'string' ? [this.text(content)] : content;
94
94
 
95
95
  return {
@@ -99,7 +99,7 @@ export class NodeFactory {
99
99
  };
100
100
  }
101
101
 
102
- static #normalizeTextBlockArgs(args) {
102
+ static _normalizeTextBlockArgs(args) {
103
103
  if (args.length === 1) {
104
104
  return { attrs: null, marks: null, content: args[0] };
105
105
  }
@@ -2,14 +2,14 @@ import { Devices } from '../enums';
2
2
  import { ContextWindow } from './ContextWindow';
3
3
 
4
4
  export class StylePresetRenderer {
5
- #baseClass;
6
- #makeVariable;
7
- #linkPresetId;
5
+ _baseClass;
6
+ _makeVariable;
7
+ _linkPresetId;
8
8
 
9
9
  constructor({ baseClass, makeVariable, linkPresetId }) {
10
- this.#baseClass = baseClass;
11
- this.#makeVariable = makeVariable;
12
- this.#linkPresetId = linkPresetId;
10
+ this._baseClass = baseClass;
11
+ this._makeVariable = makeVariable;
12
+ this._linkPresetId = linkPresetId;
13
13
  }
14
14
 
15
15
  inject(hostEl, presets) {
@@ -28,15 +28,15 @@ export class StylePresetRenderer {
28
28
  let css = '';
29
29
 
30
30
  for (const preset of presets) {
31
- const isLink = preset.id === this.#linkPresetId;
31
+ const isLink = preset.id === this._linkPresetId;
32
32
  const className = this.makePresetCssClass(preset);
33
33
 
34
34
  css += ` ${className} {`;
35
35
 
36
36
  for (const device of Devices.values) {
37
37
  for (const setting of Object.keys(preset[device])) {
38
- const variable = this.#makeVariable({ device, preset, property: setting });
39
- const internalVariable = this.#makeInternalVariableName(setting, device);
38
+ const variable = this._makeVariable({ device, preset, property: setting });
39
+ const internalVariable = this._makeInternalVariableName(setting, device);
40
40
 
41
41
  css += `${internalVariable}: var(${variable}, inherit);`;
42
42
 
@@ -56,7 +56,7 @@ export class StylePresetRenderer {
56
56
  return css;
57
57
  }
58
58
 
59
- #makeInternalVariableName(setting, device) {
59
+ _makeInternalVariableName(setting, device) {
60
60
  const property = setting === 'color' ? 'font-color' : setting.replace(/_/i, '-');
61
61
  const prefix = device === Devices.COMMON ? '' : `-${device}`;
62
62
 
@@ -64,7 +64,7 @@ export class StylePresetRenderer {
64
64
  }
65
65
 
66
66
  makePresetHtmlClass(preset) {
67
- return this.#baseClass + preset.id;
67
+ return this._baseClass + preset.id;
68
68
  }
69
69
 
70
70
  makePresetCssClass(preset) {
@@ -10,7 +10,7 @@ describe('decode', () => {
10
10
  test('should return null on error', () => {
11
11
  const json = JsonSerializer.decode('{ "tes');
12
12
 
13
- expect(json).toBe(null);
13
+ expect(json).toBeNull();
14
14
  });
15
15
  });
16
16
 
@@ -20,7 +20,7 @@ describe('get item', () => {
20
20
  storage: createNativeStorage({})
21
21
  });
22
22
 
23
- expect(storage.getItem('test')).toBe(null);
23
+ expect(storage.getItem('test')).toBeNull();
24
24
  });
25
25
 
26
26
  test('should parse json', () => {
@@ -51,7 +51,7 @@ describe('inject styles', () => {
51
51
  renderer.inject(host, presets);
52
52
  renderer.inject(host, presets);
53
53
 
54
- expect(host.querySelectorAll('[data-zw-styles]').length).toBe(1);
54
+ expect(host.querySelectorAll('[data-zw-styles]')).toHaveLength(1);
55
55
  });
56
56
  });
57
57
 
@@ -1,8 +1,8 @@
1
1
  export class BrowserDomParser {
2
- #domParser = new DOMParser();
2
+ _domParser = new DOMParser();
3
3
  types = window;
4
4
 
5
5
  parse(html) {
6
- return this.#domParser.parseFromString(html, 'text/html');
6
+ return this._domParser.parseFromString(html, 'text/html');
7
7
  }
8
8
  }
@@ -4,17 +4,17 @@ import { JsonNormalizer } from './JsonNormalizer';
4
4
 
5
5
  export class ContentNormalizer {
6
6
  static build(content, options = {}) {
7
- return typeof content === 'string' ? this.#buildHtml(content, options) : this.#buildJson(content);
7
+ return typeof content === 'string' ? this._buildHtml(content, options) : this._buildJson(content);
8
8
  }
9
9
 
10
- static #buildHtml(content, options) {
10
+ static _buildHtml(content, options) {
11
11
  return new HtmlNormalizer({
12
12
  content,
13
13
  parser: options.parser || new BrowserDomParser()
14
14
  });
15
15
  }
16
16
 
17
- static #buildJson(content) {
17
+ static _buildJson(content) {
18
18
  return new JsonNormalizer({ content });
19
19
  }
20
20
 
@@ -14,11 +14,11 @@ export class HtmlNormalizer extends BaseNormalizer {
14
14
  'margin-right'
15
15
  ];
16
16
 
17
- #parser;
17
+ _parser;
18
18
 
19
19
  constructor({ content, parser }) {
20
20
  super({ content });
21
- this.#parser = parser;
21
+ this._parser = parser;
22
22
  this.dom = null;
23
23
  }
24
24
 
@@ -28,42 +28,42 @@ export class HtmlNormalizer extends BaseNormalizer {
28
28
  }
29
29
 
30
30
  normalizeHTML() {
31
- this.dom = this.#parser.parse(this.content.replace(/(\r)?\n/g, ''));
32
-
33
- this.#removeComments();
34
- this.#normalizeRootTags();
35
- this.#iterateNodes(this.#normalizeBreakLines, (node) => node.tagName === 'BR');
36
- this.#iterateNodes(this.#removeEmptyNodes, this.#isBlockNode);
37
- this.#iterateNodes(this.#normalizeListItems, (node) => node.tagName === 'LI');
38
- this.#normalizeBlockTextDecoration();
39
- this.#normalizeBlockBackgroundColor();
31
+ this.dom = this._parser.parse(this.content.replace(/(\r)?\n/g, ''));
32
+
33
+ this._removeComments();
34
+ this._normalizeRootTags();
35
+ this._iterateNodes(this._normalizeBreakLines, (node) => node.tagName === 'BR');
36
+ this._iterateNodes(this._removeEmptyNodes, this._isBlockNode);
37
+ this._iterateNodes(this._normalizeListItems, (node) => node.tagName === 'LI');
38
+ this._normalizeBlockTextDecoration();
39
+ this._normalizeBlockBackgroundColor();
40
40
  }
41
41
 
42
42
  get normalizedHTML() {
43
43
  return this.dom.body.innerHTML;
44
44
  }
45
45
 
46
- get #NodeFilter() {
47
- return this.#parser.types.NodeFilter;
46
+ get _NodeFilter() {
47
+ return this._parser.types.NodeFilter;
48
48
  }
49
49
 
50
- get #Node() {
51
- return this.#parser.types.Node;
50
+ get _Node() {
51
+ return this._parser.types.Node;
52
52
  }
53
53
 
54
- #removeComments() {
55
- const iterator = this.#createNodeIterator(this.#NodeFilter.SHOW_COMMENT);
54
+ _removeComments() {
55
+ const iterator = this._createNodeIterator(this._NodeFilter.SHOW_COMMENT);
56
56
 
57
- this.#runIterator(iterator, (node) => node.remove());
57
+ this._runIterator(iterator, (node) => node.remove());
58
58
  }
59
59
 
60
- #normalizeRootTags() {
60
+ _normalizeRootTags() {
61
61
  const children = Array.from(this.dom.body.childNodes);
62
62
  const fragment = this.dom.createDocumentFragment();
63
63
  let capturingParagraph;
64
64
 
65
65
  for (const node of children) {
66
- if (this.#isRootNode(node)) {
66
+ if (this._isRootNode(node)) {
67
67
  fragment.append(node);
68
68
  capturingParagraph = null;
69
69
  continue;
@@ -81,21 +81,21 @@ export class HtmlNormalizer extends BaseNormalizer {
81
81
  this.dom.body.append(fragment);
82
82
  }
83
83
 
84
- #createNodeIterator(whatToShow, filter) {
84
+ _createNodeIterator(whatToShow, filter) {
85
85
  return this.dom.createNodeIterator(this.dom.body, whatToShow, filter);
86
86
  }
87
87
 
88
- #iterateNodes(handler, condition = () => true) {
88
+ _iterateNodes(handler, condition = () => true) {
89
89
  const checkCondition = (node) => node.tagName !== 'BODY' && condition.call(this, node);
90
90
 
91
- const iterator = this.#createNodeIterator(this.#NodeFilter.SHOW_ELEMENT, {
92
- acceptNode: (node) => checkCondition(node) ? this.#NodeFilter.FILTER_ACCEPT : this.#NodeFilter.FILTER_REJECT
91
+ const iterator = this._createNodeIterator(this._NodeFilter.SHOW_ELEMENT, {
92
+ acceptNode: (node) => checkCondition(node) ? this._NodeFilter.FILTER_ACCEPT : this._NodeFilter.FILTER_REJECT
93
93
  });
94
94
 
95
- this.#runIterator(iterator, handler);
95
+ this._runIterator(iterator, handler);
96
96
  }
97
97
 
98
- #runIterator(iterator, handler) {
98
+ _runIterator(iterator, handler) {
99
99
  let currentNode = iterator.nextNode();
100
100
 
101
101
  while (currentNode) {
@@ -104,24 +104,24 @@ export class HtmlNormalizer extends BaseNormalizer {
104
104
  }
105
105
  }
106
106
 
107
- #removeEmptyNodes(node) {
107
+ _removeEmptyNodes(node) {
108
108
  if (!node.innerHTML.trim()) node.remove();
109
109
  }
110
110
 
111
- #normalizeListItems(itemEl) {
111
+ _normalizeListItems(itemEl) {
112
112
  const fragment = this.dom.createDocumentFragment();
113
113
  const children = Array.from(itemEl.childNodes);
114
114
  let capturingParagraph, previousNode;
115
115
 
116
116
  const append = (node) => {
117
- this.#assignElementProperties(node, itemEl, HtmlNormalizer.BLOCK_STYLES);
117
+ this._assignElementProperties(node, itemEl, HtmlNormalizer.BLOCK_STYLES);
118
118
  fragment.append(node);
119
119
  };
120
120
 
121
- this.#assignElementProperties(itemEl, itemEl.parentElement, HtmlNormalizer.BLOCK_STYLES);
121
+ this._assignElementProperties(itemEl, itemEl.parentElement, HtmlNormalizer.BLOCK_STYLES);
122
122
 
123
123
  for (const node of children) {
124
- if (this.#isBlockNode(node)) {
124
+ if (this._isBlockNode(node)) {
125
125
  append(node);
126
126
  capturingParagraph = null;
127
127
  previousNode = node;
@@ -154,18 +154,18 @@ export class HtmlNormalizer extends BaseNormalizer {
154
154
  }
155
155
 
156
156
  itemEl.append(fragment);
157
- this.#removeStyleProperties(itemEl, HtmlNormalizer.BLOCK_STYLES);
157
+ this._removeStyleProperties(itemEl, HtmlNormalizer.BLOCK_STYLES);
158
158
  }
159
159
 
160
- #isBlockNode(node) {
160
+ _isBlockNode(node) {
161
161
  return HtmlNormalizer.BLOCK_NODE_NAMES.includes(node.tagName);
162
162
  }
163
163
 
164
- #isRootNode(node) {
164
+ _isRootNode(node) {
165
165
  return HtmlNormalizer.ROOT_NODE_NAMES.includes(node.tagName);
166
166
  }
167
167
 
168
- #assignElementProperties(target, source, properties) {
168
+ _assignElementProperties(target, source, properties) {
169
169
  for (const property of properties) {
170
170
  const value = source.style.getPropertyValue(property);
171
171
 
@@ -175,7 +175,7 @@ export class HtmlNormalizer extends BaseNormalizer {
175
175
  }
176
176
  }
177
177
 
178
- #removeStyleProperties(element, properties) {
178
+ _removeStyleProperties(element, properties) {
179
179
  for (const property of properties) {
180
180
  element.style.removeProperty(property);
181
181
  }
@@ -185,8 +185,8 @@ export class HtmlNormalizer extends BaseNormalizer {
185
185
  }
186
186
  }
187
187
 
188
- #normalizeBreakLines({ parentElement }) {
189
- if (!this.#isBlockNode(parentElement)) return;
188
+ _normalizeBreakLines({ parentElement }) {
189
+ if (!this._isBlockNode(parentElement)) return;
190
190
  if (!parentElement.textContent) return;
191
191
 
192
192
  const fragment = this.dom.createDocumentFragment();
@@ -197,7 +197,7 @@ export class HtmlNormalizer extends BaseNormalizer {
197
197
  let capturingParagraph = parentTemplate.cloneNode();
198
198
 
199
199
  const append = (node) => {
200
- this.#assignElementProperties(node, parentElement, HtmlNormalizer.BLOCK_STYLES);
200
+ this._assignElementProperties(node, parentElement, HtmlNormalizer.BLOCK_STYLES);
201
201
  fragment.append(node);
202
202
  };
203
203
 
@@ -215,16 +215,16 @@ export class HtmlNormalizer extends BaseNormalizer {
215
215
  parentElement.replaceWith(fragment);
216
216
  }
217
217
 
218
- #normalizeBlockTextDecoration() {
218
+ _normalizeBlockTextDecoration() {
219
219
  const blockEls = this.dom.querySelectorAll('[style*="text-decoration"]:where(p, h1, h2, h3, h4, li)');
220
220
 
221
221
  for (const blockEl of blockEls) {
222
- this.#moveTextDecorationToChildren(blockEl);
222
+ this._moveTextDecorationToChildren(blockEl);
223
223
  }
224
224
  }
225
225
 
226
- #moveTextDecorationToChildren(blockEl) {
227
- const blockDecoration = this.#parseTextDecoration(blockEl);
226
+ _moveTextDecorationToChildren(blockEl) {
227
+ const blockDecoration = this._parseTextDecoration(blockEl);
228
228
 
229
229
  blockEl.style.removeProperty('text-decoration-line');
230
230
  blockEl.style.removeProperty('text-decoration');
@@ -233,8 +233,8 @@ export class HtmlNormalizer extends BaseNormalizer {
233
233
  if (blockDecoration.none) return;
234
234
 
235
235
  for (const childNode of blockEl.childNodes) {
236
- const textEl = this.#wrapTextNode(blockEl, childNode);
237
- const textDecoration = this.#parseTextDecoration(textEl);
236
+ const textEl = this._wrapTextNode(blockEl, childNode);
237
+ const textDecoration = this._parseTextDecoration(textEl);
238
238
 
239
239
  const mergedDecoration = {
240
240
  underline: textDecoration.underline || blockDecoration.underline,
@@ -251,7 +251,7 @@ export class HtmlNormalizer extends BaseNormalizer {
251
251
  }
252
252
  }
253
253
 
254
- #parseTextDecoration(element) {
254
+ _parseTextDecoration(element) {
255
255
  const { textDecoration, textDecorationLine } = element.style;
256
256
  const decoration = textDecoration || textDecorationLine || '';
257
257
 
@@ -262,30 +262,30 @@ export class HtmlNormalizer extends BaseNormalizer {
262
262
  };
263
263
  }
264
264
 
265
- #normalizeBlockBackgroundColor() {
265
+ _normalizeBlockBackgroundColor() {
266
266
  const blockEls = this.dom.querySelectorAll('[style*="background-color"]:where(p, h1, h2, h3, h4, li)');
267
267
 
268
268
  for (const blockEl of blockEls) {
269
- this.#moveBackgroundColorToChildren(blockEl);
269
+ this._moveBackgroundColorToChildren(blockEl);
270
270
  }
271
271
  }
272
272
 
273
- #moveBackgroundColorToChildren(blockEl) {
273
+ _moveBackgroundColorToChildren(blockEl) {
274
274
  const blockColor = blockEl.style.backgroundColor;
275
275
 
276
276
  blockEl.style.removeProperty('background-color');
277
277
  if (!blockEl.style.cssText) blockEl.removeAttribute('style');
278
278
 
279
279
  for (const childNode of blockEl.childNodes) {
280
- const textEl = this.#wrapTextNode(blockEl, childNode);
280
+ const textEl = this._wrapTextNode(blockEl, childNode);
281
281
  const color = textEl.style.backgroundColor || blockColor;
282
282
 
283
283
  textEl.style.backgroundColor = color;
284
284
  }
285
285
  }
286
286
 
287
- #wrapTextNode(parent, node) {
288
- if (node.nodeType !== this.#Node.TEXT_NODE) return node;
287
+ _wrapTextNode(parent, node) {
288
+ if (node.nodeType !== this._Node.TEXT_NODE) return node;
289
289
 
290
290
  const span = this.dom.createElement('span');
291
291
 
@@ -4,22 +4,22 @@ import { BaseNormalizer } from './BaseNormalizer';
4
4
 
5
5
  export class JsonNormalizer extends BaseNormalizer {
6
6
  normalize() {
7
- this.#iterateNodes(this.#bubbleMarks);
7
+ this._iterateNodes(this._bubbleMarks);
8
8
  return this.content;
9
9
  }
10
10
 
11
- #iterateNodes(handler) {
12
- this.#iterateChildNodes(this.content, handler);
11
+ _iterateNodes(handler) {
12
+ this._iterateChildNodes(this.content, handler);
13
13
  }
14
14
 
15
- #iterateChildNodes(node, handler) {
15
+ _iterateChildNodes(node, handler) {
16
16
  for (const child of node.content) {
17
- child.content && this.#iterateChildNodes(child, handler);
17
+ child.content && this._iterateChildNodes(child, handler);
18
18
  handler.call(this, child);
19
19
  }
20
20
  }
21
21
 
22
- #bubbleMarks(node) {
22
+ _bubbleMarks(node) {
23
23
  if (!node.content) return;
24
24
  if (node.type === NodeTypes.LIST) return;
25
25
 
@@ -27,56 +27,56 @@ export class JsonNormalizer extends BaseNormalizer {
27
27
  if (!child.marks) continue;
28
28
 
29
29
  for (const childMark of child.marks.slice()) {
30
- if (this.#includesMark(node, childMark)) {
31
- this.#removeMark(child, childMark);
30
+ if (this._includesMark(node, childMark)) {
31
+ this._removeMark(child, childMark);
32
32
  continue;
33
33
  }
34
34
 
35
- if (this.#canBubbleMark(node, childMark)) {
36
- this.#removeMark(child, childMark);
37
- this.#addMark(node, childMark);
35
+ if (this._canBubbleMark(node, childMark)) {
36
+ this._removeMark(child, childMark);
37
+ this._addMark(node, childMark);
38
38
  }
39
39
  }
40
40
  }
41
41
  }
42
42
 
43
- #canBubbleMark(node, childMark) {
43
+ _canBubbleMark(node, childMark) {
44
44
  if (TextSettings.inlineMarks.includes(childMark.type)) return false;
45
- if (this.#includesMarkType(node, childMark.type)) return false;
45
+ if (this._includesMarkType(node, childMark.type)) return false;
46
46
 
47
47
  for (const child of node.content) {
48
48
  if (!child.content && node.type === NodeTypes.LIST_ITEM) continue;
49
49
  if (!child.marks) return false;
50
- if (!this.#includesMark(child, childMark)) return false;
50
+ if (!this._includesMark(child, childMark)) return false;
51
51
  }
52
52
 
53
53
  return true;
54
54
  }
55
55
 
56
- #includesMark(node, checkingMark) {
56
+ _includesMark(node, checkingMark) {
57
57
  return node.marks?.some((mark) => isEqual(mark, checkingMark)) ?? false;
58
58
  }
59
59
 
60
- #includesMarkType(node, type) {
60
+ _includesMarkType(node, type) {
61
61
  return node.marks?.some((mark) => mark.type === type) ?? false;
62
62
  }
63
63
 
64
- #removeMark(node, mark) {
64
+ _removeMark(node, mark) {
65
65
  if (!node.marks) return;
66
66
 
67
- const index = this.#findMarkIndexByType(node, mark.type);
67
+ const index = this._findMarkIndexByType(node, mark.type);
68
68
 
69
69
  if (index >= 0) node.marks.splice(index, 1);
70
70
  if (!node.marks.length) delete node.marks;
71
71
  }
72
72
 
73
- #addMark(node, mark) {
74
- this.#removeMark(node, mark);
73
+ _addMark(node, mark) {
74
+ this._removeMark(node, mark);
75
75
  node.marks ??= [];
76
76
  node.marks.push(mark);
77
77
  }
78
78
 
79
- #findMarkIndexByType(node, type) {
79
+ _findMarkIndexByType(node, type) {
80
80
  return node.marks?.findIndex((mark) => mark.type === type) ?? null;
81
81
  }
82
82
  }
@@ -11,6 +11,6 @@ describe('convert alignment', () => {
11
11
  });
12
12
 
13
13
  test('should return null if cannot convert', () => {
14
- expect(convertAlignment('test-test')).toBe(null);
14
+ expect(convertAlignment('test-test')).toBeNull();
15
15
  });
16
16
  });
@@ -50,7 +50,7 @@ describe('render settings', () => {
50
50
  test('should return null if no styles', () => {
51
51
  const result = renderInlineSetting({});
52
52
 
53
- expect(result).toBe(null);
53
+ expect(result).toBeNull();
54
54
  });
55
55
 
56
56
  test('should return null if all styles empty', () => {
@@ -60,6 +60,6 @@ describe('render settings', () => {
60
60
  desktop_font_size: null
61
61
  });
62
62
 
63
- expect(result).toBe(null);
63
+ expect(result).toBeNull();
64
64
  });
65
65
  });