jodit 4.13.26 → 4.14.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.
Files changed (167) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +19 -19
  4. package/es2015/jodit.js +1104 -884
  5. package/es2015/jodit.min.js +20 -20
  6. package/es2015/plugins/debug/debug.css +1 -1
  7. package/es2015/plugins/debug/debug.js +10 -10
  8. package/es2015/plugins/debug/debug.min.js +4 -4
  9. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  10. package/es2015/plugins/speech-recognize/speech-recognize.js +2 -2
  11. package/es2015/plugins/speech-recognize/speech-recognize.min.js +2 -2
  12. package/es2018/jodit.fat.min.js +19 -19
  13. package/es2018/jodit.min.js +19 -19
  14. package/es2018/plugins/debug/debug.min.js +4 -4
  15. package/es2018/plugins/speech-recognize/speech-recognize.min.js +2 -2
  16. package/es2021/jodit.css +1 -1
  17. package/es2021/jodit.fat.min.js +29 -29
  18. package/es2021/jodit.js +1097 -875
  19. package/es2021/jodit.min.js +29 -29
  20. package/es2021/plugins/debug/debug.css +1 -1
  21. package/es2021/plugins/debug/debug.js +10 -10
  22. package/es2021/plugins/debug/debug.min.js +4 -4
  23. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  24. package/es2021/plugins/speech-recognize/speech-recognize.js +2 -2
  25. package/es2021/plugins/speech-recognize/speech-recognize.min.js +2 -2
  26. package/es2021.en/jodit.css +1 -1
  27. package/es2021.en/jodit.fat.min.js +29 -29
  28. package/es2021.en/jodit.js +1097 -875
  29. package/es2021.en/jodit.min.js +29 -29
  30. package/es2021.en/plugins/debug/debug.css +1 -1
  31. package/es2021.en/plugins/debug/debug.js +10 -10
  32. package/es2021.en/plugins/debug/debug.min.js +4 -4
  33. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  34. package/es2021.en/plugins/speech-recognize/speech-recognize.js +2 -2
  35. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +2 -2
  36. package/es5/jodit.css +2 -2
  37. package/es5/jodit.fat.min.js +2 -2
  38. package/es5/jodit.js +1221 -925
  39. package/es5/jodit.min.css +2 -2
  40. package/es5/jodit.min.js +2 -2
  41. package/es5/plugins/debug/debug.css +1 -1
  42. package/es5/plugins/debug/debug.js +10 -10
  43. package/es5/plugins/debug/debug.min.js +2 -2
  44. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  45. package/es5/plugins/speech-recognize/speech-recognize.js +2 -2
  46. package/es5/plugins/speech-recognize/speech-recognize.min.js +2 -2
  47. package/es5/polyfills.fat.min.js +1 -1
  48. package/es5/polyfills.js +1 -1
  49. package/es5/polyfills.min.js +1 -1
  50. package/esm/core/constants.js +1 -1
  51. package/esm/core/create/create.js +2 -2
  52. package/esm/core/dom/dom.d.ts +21 -13
  53. package/esm/core/dom/dom.js +58 -87
  54. package/esm/core/global.js +3 -2
  55. package/esm/core/helpers/html/apply-styles.js +14 -10
  56. package/esm/core/helpers/html/clean-from-word.js +8 -4
  57. package/esm/core/helpers/html/safe-html.js +23 -14
  58. package/esm/core/helpers/html/strip-tags.js +9 -4
  59. package/esm/core/helpers/utils/align.d.ts +0 -3
  60. package/esm/core/helpers/utils/align.js +15 -18
  61. package/esm/core/helpers/utils/append-script.js +13 -10
  62. package/esm/core/helpers/utils/attr.d.ts +3 -1
  63. package/esm/core/helpers/utils/attr.js +18 -0
  64. package/esm/core/helpers/utils/css.d.ts +18 -1
  65. package/esm/core/helpers/utils/css.js +15 -0
  66. package/esm/core/helpers/utils/print.js +17 -14
  67. package/esm/core/helpers/utils/reset.js +3 -0
  68. package/esm/core/helpers/utils/selector.js +11 -7
  69. package/esm/core/selection/helpers/move-node-inside-start.js +1 -1
  70. package/esm/core/selection/selection.js +29 -26
  71. package/esm/core/selection/style/api/get-suit-parent.js +10 -0
  72. package/esm/core/selection/style/api/is-same-attributes.js +5 -2
  73. package/esm/core/selection/style/api/toggle-attributes.js +8 -9
  74. package/esm/core/selection/style/api/wrap-unwrapped-text.js +2 -2
  75. package/esm/core/traits/elms.js +11 -3
  76. package/esm/core/ui/button/button/button.js +3 -3
  77. package/esm/core/ui/button/group/group.js +2 -1
  78. package/esm/core/ui/button/tooltip/tooltip.js +2 -2
  79. package/esm/core/ui/element.js +1 -1
  80. package/esm/core/ui/form/inputs/area/area.js +3 -2
  81. package/esm/core/ui/form/inputs/file/file.js +2 -1
  82. package/esm/core/ui/form/inputs/input/input.js +5 -5
  83. package/esm/core/ui/group/group.js +7 -7
  84. package/esm/core/ui/icon.js +2 -2
  85. package/esm/core/ui/popup/popup.js +10 -8
  86. package/esm/core/ui/progress-bar/progress-bar.js +3 -4
  87. package/esm/core/view/view-with-toolbar.js +1 -1
  88. package/esm/core/view/view.js +1 -1
  89. package/esm/jodit.js +30 -28
  90. package/esm/modules/dialog/alert.js +1 -1
  91. package/esm/modules/dialog/confirm.js +3 -2
  92. package/esm/modules/dialog/dialog.d.ts +6 -0
  93. package/esm/modules/dialog/dialog.js +40 -22
  94. package/esm/modules/dialog/prompt.js +4 -3
  95. package/esm/modules/file-browser/builders/context-menu.js +5 -5
  96. package/esm/modules/file-browser/config.js +3 -1
  97. package/esm/modules/file-browser/file-browser.js +7 -4
  98. package/esm/modules/file-browser/listeners/state-listeners.js +6 -6
  99. package/esm/modules/image-editor/image-editor.js +31 -17
  100. package/esm/modules/messages/messages.js +2 -1
  101. package/esm/modules/status-bar/status-bar.js +3 -4
  102. package/esm/modules/table/table.js +22 -18
  103. package/esm/modules/toolbar/button/button.js +4 -4
  104. package/esm/modules/toolbar/button/content.js +12 -4
  105. package/esm/modules/toolbar/collection/collection.js +4 -2
  106. package/esm/modules/uploader/config.js +3 -2
  107. package/esm/modules/uploader/helpers/process-old-browser-drag.js +1 -1
  108. package/esm/modules/uploader/uploader.js +7 -2
  109. package/esm/modules/widget/color-picker/color-picker.js +4 -4
  110. package/esm/modules/widget/file-selector/file-selector.js +6 -6
  111. package/esm/modules/widget/tabs/tabs.js +5 -5
  112. package/esm/plugins/add-new-line/add-new-line.js +8 -7
  113. package/esm/plugins/ai-assistant/ui/ui-ai-assistant.js +4 -4
  114. package/esm/plugins/backspace/cases/check-join-neighbors.js +4 -1
  115. package/esm/plugins/clean-html/helpers/visitor/filters/allow-attributes.js +5 -1
  116. package/esm/plugins/clean-html/helpers/visitor/filters/fill-empty-paragraph.js +1 -1
  117. package/esm/plugins/color/config.js +4 -4
  118. package/esm/plugins/copy-format/copy-format.js +1 -1
  119. package/esm/plugins/delete/delete.js +9 -2
  120. package/esm/plugins/drag-and-drop/drag-and-drop.js +1 -1
  121. package/esm/plugins/drag-and-drop-element/drag-and-drop-element.js +1 -1
  122. package/esm/plugins/enter/helpers/insert-paragraph.js +1 -1
  123. package/esm/plugins/enter/helpers/process-empty-li-leaf.js +2 -2
  124. package/esm/plugins/enter/helpers/wrap-text.js +1 -1
  125. package/esm/plugins/fullsize/fullsize.js +3 -2
  126. package/esm/plugins/iframe/iframe.js +6 -5
  127. package/esm/plugins/image-properties/readers/align.js +6 -5
  128. package/esm/plugins/image-properties/readers/index.js +3 -1
  129. package/esm/plugins/image-properties/ui/ui-image-form.js +2 -1
  130. package/esm/plugins/image-properties/writers/index.js +2 -1
  131. package/esm/plugins/image-properties/writers/link.js +1 -1
  132. package/esm/plugins/indent/config.js +3 -2
  133. package/esm/plugins/indent/indent.js +4 -2
  134. package/esm/plugins/media/media.js +10 -7
  135. package/esm/plugins/mobile/config.js +2 -2
  136. package/esm/plugins/paste-storage/paste-storage.js +5 -5
  137. package/esm/plugins/placeholder/placeholder.js +13 -11
  138. package/esm/plugins/print/print.js +2 -2
  139. package/esm/plugins/resize-cells/resize-cells.js +13 -15
  140. package/esm/plugins/resize-handler/resize-handler.js +3 -4
  141. package/esm/plugins/resizer/resizer.js +11 -10
  142. package/esm/plugins/search/helpers/highlight-text-ranges.js +1 -1
  143. package/esm/plugins/search/ui/search.js +1 -1
  144. package/esm/plugins/select/select.js +2 -2
  145. package/esm/plugins/select-cells/select-cells.js +5 -6
  146. package/esm/plugins/source/editor/engines/ace.js +2 -1
  147. package/esm/plugins/source/editor/engines/area.js +3 -3
  148. package/esm/plugins/source/source.js +2 -2
  149. package/esm/plugins/speech-recognize/speech-recognize.js +1 -1
  150. package/esm/plugins/sticky/sticky.js +1 -1
  151. package/esm/plugins/symbols/config.js +3 -2
  152. package/esm/plugins/symbols/symbols.js +6 -5
  153. package/esm/plugins/tab/cases/on-tab-inside-li.js +2 -2
  154. package/esm/plugins/table/config.js +18 -10
  155. package/esm/plugins/table-keyboard-navigation/table-keyboard-navigation.js +2 -2
  156. package/esm/plugins/wrap-nodes/wrap-nodes.js +2 -2
  157. package/esm/plugins/xpath/xpath.js +2 -3
  158. package/esm/types/index.d.ts +1 -0
  159. package/esm/types/vdom.d.ts +96 -0
  160. package/package.json +1 -1
  161. package/types/core/dom/dom.d.ts +21 -13
  162. package/types/core/helpers/utils/align.d.ts +0 -3
  163. package/types/core/helpers/utils/attr.d.ts +3 -1
  164. package/types/core/helpers/utils/css.d.ts +18 -1
  165. package/types/modules/dialog/dialog.d.ts +6 -0
  166. package/types/types/index.d.ts +1 -0
  167. package/types/types/vdom.d.ts +96 -0
@@ -3,6 +3,7 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
+ import { Dom } from "../../core/dom/dom.js";
6
7
  import { pluginSystem } from "../../core/global.js";
7
8
  import { isJoditObject } from "../../core/helpers/checker/is-jodit-object.js";
8
9
  import { css } from "../../core/helpers/utils/css.js";
@@ -48,7 +49,6 @@ export function fullsize(editor) {
48
49
  * Change editor's state between FullSize and normal
49
50
  */
50
51
  toggle = (enable) => {
51
- var _a;
52
52
  const { container, events } = editor;
53
53
  if (!container) {
54
54
  return;
@@ -62,7 +62,8 @@ export function fullsize(editor) {
62
62
  container.classList.toggle('jodit_fullsize', enable);
63
63
  if (editor.toolbar) {
64
64
  isJoditObject(editor) &&
65
- ((_a = editor.toolbarContainer) === null || _a === void 0 ? void 0 : _a.appendChild(editor.toolbar.container));
65
+ editor.toolbarContainer &&
66
+ Dom.append(editor.toolbarContainer, editor.toolbar.container);
66
67
  css(editor.toolbar.container, 'width', 'auto');
67
68
  }
68
69
  enable
@@ -4,6 +4,7 @@
4
4
  * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
6
  import { MODE_SOURCE } from "../../core/constants.js";
7
+ import { Dom } from "../../core/dom/dom.js";
7
8
  import { pluginSystem } from "../../core/global.js";
8
9
  import { error } from "../../core/helpers/index.js";
9
10
  import { attr, callPromise, css, defaultLanguage } from "../../core/helpers/index.js";
@@ -41,13 +42,13 @@ export function iframe(editor) {
41
42
  const link = doc.createElement('link');
42
43
  attr(link, 'rel', 'stylesheet');
43
44
  attr(link, 'href', href);
44
- doc.head && doc.head.appendChild(link);
45
+ doc.head && Dom.append(doc.head, link);
45
46
  });
46
47
  }
47
48
  if (opt.iframeStyle) {
48
49
  const style = doc.createElement('style');
49
50
  style.innerHTML = opt.iframeStyle;
50
- doc.head && doc.head.appendChild(style);
51
+ doc.head && Dom.append(doc.head, style);
51
52
  }
52
53
  })
53
54
  .on('createEditor', () => {
@@ -55,7 +56,7 @@ export function iframe(editor) {
55
56
  return;
56
57
  }
57
58
  const iframe = editor.c.element('iframe');
58
- iframe.style.display = 'block';
59
+ css(iframe, 'display', 'block');
59
60
  iframe.src = 'about:blank';
60
61
  iframe.className = 'jodit-wysiwyg_iframe';
61
62
  attr(iframe, {
@@ -66,7 +67,7 @@ export function iframe(editor) {
66
67
  if (opt.iframeSandbox != null) {
67
68
  attr(iframe, 'sandbox', opt.iframeSandbox);
68
69
  }
69
- editor.workplace.appendChild(iframe);
70
+ Dom.append(editor.workplace, iframe);
70
71
  editor.iframe = iframe;
71
72
  const result = editor.e.fire('generateDocumentStructure.iframe', null, editor);
72
73
  const init = () => {
@@ -137,7 +138,7 @@ export function iframe(editor) {
137
138
  editor.e.on('afterSetMode afterInit afterAddPlace', toggleEditable);
138
139
  if (opt.height === 'auto') {
139
140
  doc.documentElement &&
140
- (doc.documentElement.style.overflowY = 'hidden');
141
+ css(doc.documentElement, 'overflowY', 'hidden');
141
142
  const resizeIframe = editor.async.throttle((...args) => {
142
143
  editor.async.requestAnimationFrame(() => {
143
144
  if (editor.editor &&
@@ -3,20 +3,21 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- import { css } from "../../../core/helpers/utils/css.js";
6
+ import { css, cssInline } from "../../../core/helpers/utils/css.js";
7
7
  /**
8
8
  * @private
9
9
  */
10
10
  export function readAlign(image, values) {
11
11
  // Align
12
- if (image.style.cssFloat &&
13
- ['left', 'right'].indexOf(image.style.cssFloat.toLowerCase()) !== -1) {
12
+ if (cssInline(image, 'float') &&
13
+ ['left', 'right'].indexOf(cssInline(image, 'float').toLowerCase()) !==
14
+ -1) {
14
15
  values.align = css(image, 'float');
15
16
  }
16
17
  else {
17
18
  if (css(image, 'display') === 'block' &&
18
- image.style.marginLeft === 'auto' &&
19
- image.style.marginRight === 'auto') {
19
+ cssInline(image, 'margin-left') === 'auto' &&
20
+ cssInline(image, 'margin-right') === 'auto') {
20
21
  values.align = 'center';
21
22
  }
22
23
  else {
@@ -4,6 +4,7 @@
4
4
  * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
6
  import { attr } from "../../../core/helpers/utils/attr.js";
7
+ import { cssInline } from "../../../core/helpers/utils/css.js";
7
8
  import { readAlign } from "./align.js";
8
9
  import { readLink } from "./link.js";
9
10
  import { readMargins } from "./margin.js";
@@ -16,7 +17,8 @@ export async function readValuesFromImage(j, state) {
16
17
  const { sourceImage: image, values } = state;
17
18
  readAlign(image, values);
18
19
  // Border radius
19
- values.borderRadius = parseInt(image.style.borderRadius || '0', 10) || 0;
20
+ values.borderRadius =
21
+ parseInt(cssInline(image, 'border-radius') || '0', 10) || 0;
20
22
  // Id
21
23
  values.id = attr(image, 'id') || '';
22
24
  // Title
@@ -15,6 +15,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
15
15
  };
16
16
  import { debounce, hook, watch } from "../../../core/decorators/index.js";
17
17
  import { component } from "../../../core/decorators/component/component.js";
18
+ import { Dom } from "../../../core/dom/dom.js";
18
19
  import { attr, css, isNumeric } from "../../../core/helpers/index.js";
19
20
  import { UIGroup } from "../../../core/ui/group/group.js";
20
21
  import { Icon } from "../../../core/ui/icon.js";
@@ -46,7 +47,7 @@ let UIImagePropertiesForm = class UIImagePropertiesForm extends UIGroup {
46
47
  this.handlers = handlers;
47
48
  this.__mainTab = new UIImageMainTab(this.jodit, this.state, this.handlers);
48
49
  this.__positionTab = new UIImagePositionTab(this.jodit, this.state, this.handlers);
49
- this.getElm('tabsBox').appendChild(TabsWidget(jodit, [
50
+ Dom.append(this.getElm('tabsBox'), TabsWidget(jodit, [
50
51
  { name: 'Image', content: this.__mainTab },
51
52
  { name: 'Advanced', content: this.__positionTab }
52
53
  ], activeTabState));
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import { Dom } from "../../../core/dom/dom.js";
7
7
  import { attr, hAlignElement } from "../../../core/helpers/utils/index.js";
8
+ import { css } from "../../../core/helpers/utils/css.js";
8
9
  import { applyLink } from "./link.js";
9
10
  import { applyMargin } from "./margin.js";
10
11
  import { applySize } from "./size.js";
@@ -28,7 +29,7 @@ export function applyValuesToImage(j, state, image) {
28
29
  return;
29
30
  }
30
31
  // Border radius
31
- image.style.borderRadius = borderRadius ? borderRadius + 'px' : '';
32
+ css(image, 'borderRadius', borderRadius ? borderRadius + 'px' : '');
32
33
  // Title
33
34
  attr(image, 'title', imageTitle || null);
34
35
  // Alt
@@ -24,7 +24,7 @@ export function applyLink(j, image, imageLink, imageLinkOpenInNewTab) {
24
24
  }
25
25
  else {
26
26
  if (link && link.parentNode) {
27
- link.parentNode.replaceChild(image, link);
27
+ Dom.replace(link, image, undefined, false, true);
28
28
  }
29
29
  }
30
30
  }
@@ -4,6 +4,7 @@
4
4
  * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
6
  import { Dom } from "../../core/dom/index.js";
7
+ import { cssInline } from "../../core/helpers/utils/css.js";
7
8
  import { Icon } from "../../core/ui/icon.js";
8
9
  import { Config } from "../../config.js";
9
10
  import indentIcon from "./icons/indent.svg.js";
@@ -35,8 +36,8 @@ Config.prototype.controls.outdent = {
35
36
  const currentBox = Dom.closest(current, Dom.isBlock, editor.editor);
36
37
  if (currentBox) {
37
38
  const arrow = getKey(editor.o.direction, currentBox);
38
- return (!currentBox.style[arrow] ||
39
- parseInt(currentBox.style[arrow], 10) <= 0);
39
+ const value = cssInline(currentBox, arrow);
40
+ return !value || parseInt(value, 10) <= 0;
40
41
  }
41
42
  return true;
42
43
  },
@@ -7,6 +7,7 @@ import { BR } from "../../core/constants.js";
7
7
  import { Dom } from "../../core/dom/index.js";
8
8
  import { pluginSystem } from "../../core/global.js";
9
9
  import { attr, call } from "../../core/helpers/utils/index.js";
10
+ import { css, cssInline } from "../../core/helpers/utils/css.js";
10
11
  import "./config.js";
11
12
  import { getKey } from "./helpers.js";
12
13
  const applyIndentToBox = (processedElements, currentBox, editor, command) => {
@@ -18,9 +19,10 @@ const applyIndentToBox = (processedElements, currentBox, editor, command) => {
18
19
  }
19
20
  const key = getKey(editor.o.direction, currentBox);
20
21
  processedElements.add(currentBox);
21
- let value = currentBox.style[key] ? parseInt(currentBox.style[key], 10) : 0;
22
+ const current = cssInline(currentBox, key);
23
+ let value = current ? parseInt(current, 10) : 0;
22
24
  value += editor.o.indentMargin * (command === 'outdent' ? -1 : 1);
23
- currentBox.style[key] = value > 0 ? value + 'px' : '';
25
+ css(currentBox, key, value > 0 ? value : '');
24
26
  if (!attr(currentBox, 'style')) {
25
27
  attr(currentBox, 'style', null);
26
28
  }
@@ -4,8 +4,10 @@
4
4
  * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
6
  import * as consts from "../../core/constants.js";
7
+ import { Dom } from "../../core/dom/dom.js";
7
8
  import { pluginSystem } from "../../core/global.js";
8
9
  import { $$, attr, dataBind } from "../../core/helpers/utils/index.js";
10
+ import { css, cssInline } from "../../core/helpers/utils/css.js";
9
11
  import "./config.js";
10
12
  /**
11
13
  * Process `video` and `audio`
@@ -26,16 +28,17 @@ export function media(editor) {
26
28
  [`data-${keyFake}`]: 1
27
29
  });
28
30
  attr(wrapper, 'style', attr(element, 'style'));
29
- wrapper.style.display =
30
- element.style.display === 'inline-block'
31
+ css(wrapper, {
32
+ display: cssInline(element, 'display') === 'inline-block'
31
33
  ? 'inline-block'
32
- : 'block';
33
- wrapper.style.width = element.offsetWidth + 'px';
34
- wrapper.style.height = element.offsetHeight + 'px';
34
+ : 'block',
35
+ width: element.offsetWidth,
36
+ height: element.offsetHeight
37
+ });
35
38
  if (element.parentNode) {
36
- element.parentNode.insertBefore(wrapper, element);
39
+ Dom.before(element, wrapper);
37
40
  }
38
- wrapper.appendChild(element);
41
+ Dom.append(wrapper, element);
39
42
  element = wrapper;
40
43
  }
41
44
  editor.e
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import * as consts from "../../core/constants.js";
7
7
  import { splitArray } from "../../core/helpers/index.js";
8
+ import { css } from "../../core/helpers/utils/css.js";
8
9
  import { Config } from "../../config.js";
9
10
  import { ToolbarCollection } from "../../modules/toolbar/collection/collection.js";
10
11
  import { makeCollection } from "../../modules/toolbar/factory.js";
@@ -127,8 +128,7 @@ Config.prototype.controls.dots = {
127
128
  if (buttons && store) {
128
129
  store.toolbar.build(splitArray(buttons));
129
130
  const w = ((_b = (_a = editor.toolbar) === null || _a === void 0 ? void 0 : _a.firstButton) === null || _b === void 0 ? void 0 : _b.container.offsetWidth) || 36;
130
- store.toolbar.container.style.width =
131
- (w + 4) * 3 + 'px';
131
+ css(store.toolbar.container, 'width', (w + 4) * 3);
132
132
  }
133
133
  }
134
134
  }
@@ -83,10 +83,10 @@ export class pasteStorage extends Plugin {
83
83
  }
84
84
  this.dialog || this.createDialog();
85
85
  if (this.listBox) {
86
- this.listBox.innerHTML = '';
86
+ Dom.detach(this.listBox);
87
87
  }
88
88
  if (this.previewBox) {
89
- this.previewBox.innerHTML = '';
89
+ Dom.detach(this.previewBox);
90
90
  }
91
91
  this.list.forEach((html, index) => {
92
92
  const a = this.j.c.element('a');
@@ -96,7 +96,7 @@ export class pasteStorage extends Plugin {
96
96
  attr(a, 'href', '#');
97
97
  attr(a, 'data-index', index.toString());
98
98
  attr(a, 'tab-index', '-1');
99
- this.listBox && this.listBox.appendChild(a);
99
+ this.listBox && Dom.append(this.listBox, a);
100
100
  });
101
101
  this.dialog && this.dialog.open();
102
102
  this.j.async.setTimeout(() => {
@@ -114,8 +114,8 @@ export class pasteStorage extends Plugin {
114
114
  this.container.classList.add('jodit-paste-storage');
115
115
  this.listBox = this.j.c.div();
116
116
  this.previewBox = this.j.c.div();
117
- this.container.appendChild(this.listBox);
118
- this.container.appendChild(this.previewBox);
117
+ Dom.append(this.container, this.listBox);
118
+ Dom.append(this.container, this.previewBox);
119
119
  this.dialog.setHeader(this.j.i18n('Choose Content to Paste'));
120
120
  this.dialog.setContent(this.container);
121
121
  this.dialog.setFooter([pasteButton, cancelButton]);
@@ -80,8 +80,10 @@ export class placeholder extends Plugin {
80
80
  }
81
81
  this.placeholderElm = editor.c.fromHTML(`<span data-ref="placeholder" style="display: none;" class="jodit-placeholder">${editor.i18n(editor.o.placeholder)}</span>`);
82
82
  if (editor.o.direction === 'rtl') {
83
- this.placeholderElm.style.right = '0px';
84
- this.placeholderElm.style.direction = 'rtl';
83
+ css(this.placeholderElm, {
84
+ right: 0,
85
+ direction: 'rtl'
86
+ });
85
87
  }
86
88
  editor.e
87
89
  .on('readonly', (isReadOnly) => {
@@ -105,22 +107,22 @@ export class placeholder extends Plugin {
105
107
  editor.editor;
106
108
  const style = editor.ew.getComputedStyle(wrapper);
107
109
  const styleEditor = editor.ew.getComputedStyle(editor.editor);
108
- editor.workplace.appendChild(this.placeholderElm);
110
+ Dom.append(editor.workplace, this.placeholderElm);
109
111
  const { firstChild } = editor.editor;
110
112
  if (Dom.isElement(firstChild) && !isMarker(firstChild)) {
111
113
  const style2 = editor.ew.getComputedStyle(firstChild);
112
114
  marginTop = parseInt(style2.getPropertyValue('margin-top'), 10);
113
115
  marginLeft = parseInt(style2.getPropertyValue('margin-left'), 10);
114
- this.placeholderElm.style.fontSize =
115
- parseInt(style2.getPropertyValue('font-size'), 10) + 'px';
116
- this.placeholderElm.style.lineHeight =
117
- style2.getPropertyValue('line-height');
116
+ css(this.placeholderElm, {
117
+ fontSize: parseInt(style2.getPropertyValue('font-size'), 10),
118
+ lineHeight: style2.getPropertyValue('line-height')
119
+ });
118
120
  }
119
121
  else {
120
- this.placeholderElm.style.fontSize =
121
- parseInt(style.getPropertyValue('font-size'), 10) + 'px';
122
- this.placeholderElm.style.lineHeight =
123
- style.getPropertyValue('line-height');
122
+ css(this.placeholderElm, {
123
+ fontSize: parseInt(style.getPropertyValue('font-size'), 10),
124
+ lineHeight: style.getPropertyValue('line-height')
125
+ });
124
126
  }
125
127
  css(this.placeholderElm, {
126
128
  display: 'block',
@@ -24,7 +24,7 @@ Config.prototype.controls.print = {
24
24
  height: 0,
25
25
  border: 0
26
26
  });
27
- getContainer(editor, Config).appendChild(iframe);
27
+ Dom.append(getContainer(editor, Config), iframe);
28
28
  const afterFinishPrint = () => {
29
29
  editor.e.off(editor.ow, 'mousemove', afterFinishPrint);
30
30
  Dom.safeRemove(iframe);
@@ -53,7 +53,7 @@ Config.prototype.controls.print = {
53
53
  -webkit-print-color-adjust: exact;
54
54
  }
55
55
  }`;
56
- myWindow.document.head.appendChild(style);
56
+ Dom.append(myWindow.document.head, style);
57
57
  myWindow.focus();
58
58
  myWindow.print();
59
59
  }
@@ -18,6 +18,7 @@ import { autobind } from "../../core/decorators/index.js";
18
18
  import { Dom } from "../../core/dom/dom.js";
19
19
  import { pluginSystem } from "../../core/global.js";
20
20
  import { $$, call, dataBind, getContentWidth, offset } from "../../core/helpers/index.js";
21
+ import { css } from "../../core/helpers/utils/css.js";
21
22
  import { Plugin, Table } from "../../modules/index.js";
22
23
  import "./config.js";
23
24
  const key = 'table_processor_observer-resize';
@@ -59,7 +60,7 @@ export class resizeCells extends Plugin {
59
60
  }
60
61
  showResizeHandle() {
61
62
  this.j.async.clearTimeout(this.hideTimeout);
62
- this.j.workplace.appendChild(this.resizeHandler);
63
+ Dom.append(this.j.workplace, this.resizeHandler);
63
64
  }
64
65
  hideResizeHandle() {
65
66
  this.hideTimeout = this.j.async.setTimeout(() => {
@@ -126,8 +127,7 @@ export class resizeCells extends Plugin {
126
127
  }
127
128
  this.resizeDelta =
128
129
  x - this.startX + (!this.j.o.iframe ? 0 : workplacePosition.left);
129
- this.resizeHandler.style.left =
130
- x - (this.j.o.iframe ? 0 : workplacePosition.left) + 'px';
130
+ css(this.resizeHandler, 'left', x - (this.j.o.iframe ? 0 : workplacePosition.left) + 'px');
131
131
  const sel = this.j.s.sel;
132
132
  sel && sel.removeAllRanges();
133
133
  }
@@ -179,16 +179,15 @@ export class resizeCells extends Plugin {
179
179
  const needChangeWidth = this.isRTL ? !rightSide : rightSide;
180
180
  // right side
181
181
  if (needChangeWidth) {
182
- this.workTable.style.width =
183
- ((width + delta) / parentWidth) * 100 + '%';
182
+ css(this.workTable, 'width', ((width + delta) / parentWidth) * 100 + '%');
184
183
  }
185
184
  else {
186
185
  const side = this.isRTL ? 'marginRight' : 'marginLeft';
187
186
  const margin = parseInt(this.j.ew.getComputedStyle(this.workTable)[side] || '0', 10);
188
- this.workTable.style.width =
189
- ((width - delta) / parentWidth) * 100 + '%';
190
- this.workTable.style[side] =
191
- ((margin + delta) / parentWidth) * 100 + '%';
187
+ css(this.workTable, {
188
+ width: ((width - delta) / parentWidth) * 100 + '%',
189
+ [side]: ((margin + delta) / parentWidth) * 100 + '%'
190
+ });
192
191
  }
193
192
  }
194
193
  /**
@@ -212,11 +211,10 @@ export class resizeCells extends Plugin {
212
211
  return;
213
212
  }
214
213
  const workplacePosition = offset(this.j.workplace, this.j, this.j.od, true), parentBox = offset(table, this.j, this.j.ed);
215
- this.resizeHandler.style.left =
216
- (offsetX <= consts.NEARBY ? box.left : box.left + box.width) -
217
- workplacePosition.left +
218
- delta +
219
- 'px';
214
+ css(this.resizeHandler, 'left', (offsetX <= consts.NEARBY ? box.left : box.left + box.width) -
215
+ workplacePosition.left +
216
+ delta +
217
+ 'px');
220
218
  Object.assign(this.resizeHandler.style, {
221
219
  height: parentBox.height + 'px',
222
220
  top: parentBox.top - workplacePosition.top + 'px'
@@ -249,7 +247,7 @@ export class resizeCells extends Plugin {
249
247
  const parent = Dom.up(this.workCell, (elm) => Dom.isTag(elm, 'table'), editor.editor);
250
248
  if (parent) {
251
249
  const parentBox = parent.getBoundingClientRect();
252
- this.resizeHandler.style.top = parentBox.top + 'px';
250
+ css(this.resizeHandler, 'top', parentBox.top + 'px');
253
251
  }
254
252
  })
255
253
  .on('beforeSetMode.resize-cells', () => {
@@ -17,6 +17,7 @@ import { autobind } from "../../core/decorators/index.js";
17
17
  import { Dom } from "../../core/dom/index.js";
18
18
  import { pluginSystem } from "../../core/global.js";
19
19
  import { offset } from "../../core/helpers/index.js";
20
+ import { css } from "../../core/helpers/utils/css.js";
20
21
  import { Plugin } from "../../core/plugin/index.js";
21
22
  import { Icon } from "../../core/ui/index.js";
22
23
  import "./config.js";
@@ -54,13 +55,11 @@ export class resizeHandler extends Plugin {
54
55
  editor.statusbar.show();
55
56
  editor.e
56
57
  .on('toggleFullSize.resizeHandler', () => {
57
- this.handle.style.display = editor.isFullSize
58
- ? 'none'
59
- : 'block';
58
+ css(this.handle, 'display', editor.isFullSize ? 'none' : 'block');
60
59
  })
61
60
  .on(this.handle, 'mousedown touchstart', this.onHandleResizeStart)
62
61
  .on(editor.ow, 'mouseup touchend', this.onHandleResizeEnd);
63
- editor.container.appendChild(this.handle);
62
+ Dom.append(editor.container, this.handle);
64
63
  }
65
64
  }
66
65
  /**
@@ -19,6 +19,7 @@ import { autobind, watch } from "../../core/decorators/index.js";
19
19
  import { Dom } from "../../core/dom/dom.js";
20
20
  import { eventEmitter, pluginSystem } from "../../core/global.js";
21
21
  import { $$, attr, css, dataBind, innerWidth, markOwner, offset } from "../../core/helpers/index.js";
22
+ import { cssInline } from "../../core/helpers/utils/css.js";
22
23
  import { Plugin } from "../../core/plugin/plugin.js";
23
24
  import "./config.js";
24
25
  const keyBInd = '__jodit-resizer_binded';
@@ -66,7 +67,7 @@ export class resizer extends Plugin {
66
67
  }
67
68
  if (this.element && this.rect) {
68
69
  const workplacePosition = this.getWorkplacePosition();
69
- const pos = offset(this.element, this.j, this.j.ed), left = parseInt(this.rect.style.left || '0', 10), top = parseInt(this.rect.style.top || '0', 10), w = this.rect.offsetWidth, h = this.rect.offsetHeight;
70
+ const pos = offset(this.element, this.j, this.j.ed), left = parseInt(cssInline(this.rect, 'left') || '0', 10), top = parseInt(cssInline(this.rect, 'top') || '0', 10), w = this.rect.offsetWidth, h = this.rect.offsetHeight;
70
71
  const newTop = pos.top - workplacePosition.top, newLeft = pos.left - workplacePosition.left;
71
72
  if (top !== newTop ||
72
73
  left !== newLeft ||
@@ -89,7 +90,7 @@ export class resizer extends Plugin {
89
90
  }
90
91
  };
91
92
  this.hideSizeViewer = () => {
92
- this.sizeViewer.style.opacity = '0';
93
+ css(this.sizeViewer, 'opacity', '0');
93
94
  };
94
95
  }
95
96
  /** @override */
@@ -134,7 +135,7 @@ export class resizer extends Plugin {
134
135
  return;
135
136
  }
136
137
  const width = attr(image, 'width');
137
- if (width && !css(image, 'width', true)) {
138
+ if (width && !cssInline(image, 'width')) {
138
139
  css(image, 'width', width);
139
140
  attr(image, 'width', null);
140
141
  }
@@ -293,7 +294,7 @@ export class resizer extends Plugin {
293
294
  if (changeAttrs) {
294
295
  attr(element, key, value);
295
296
  }
296
- if (!changeAttrs || element.style[key]) {
297
+ if (!changeAttrs || cssInline(element, key)) {
297
298
  css(element, key, value);
298
299
  }
299
300
  }
@@ -348,16 +349,16 @@ export class resizer extends Plugin {
348
349
  });
349
350
  attr(wrapper, 'style', attr(element, 'style'));
350
351
  css(wrapper, {
351
- display: element.style.display === 'inline-block'
352
+ display: cssInline(element, 'display') === 'inline-block'
352
353
  ? 'inline-block'
353
354
  : 'block',
354
355
  width: element.offsetWidth,
355
356
  height: element.offsetHeight
356
357
  });
357
358
  if (element.parentNode) {
358
- element.parentNode.insertBefore(wrapper, element);
359
+ Dom.before(element, wrapper);
359
360
  }
360
- wrapper.appendChild(element);
361
+ Dom.append(wrapper, element);
361
362
  this.j.e.on(wrapper, 'click', () => {
362
363
  attr(wrapper, 'data-jodit-wrapper_active', true);
363
364
  });
@@ -393,7 +394,7 @@ export class resizer extends Plugin {
393
394
  this.hideSizeViewer();
394
395
  return;
395
396
  }
396
- this.sizeViewer.style.opacity = '1';
397
+ css(this.sizeViewer, 'opacity', '1');
397
398
  this.sizeViewer.textContent = `${w} x ${h}`;
398
399
  this.j.async.setTimeout(this.hideSizeViewer, {
399
400
  timeout: this.j.o.resizer.hideSizeTimeout,
@@ -410,10 +411,10 @@ export class resizer extends Plugin {
410
411
  this.isShown = true;
411
412
  if (!this.rect.parentNode) {
412
413
  markOwner(this.j, this.rect);
413
- this.j.workplace.appendChild(this.rect);
414
+ Dom.append(this.j.workplace, this.rect);
414
415
  }
415
416
  if (this.j.isFullSize) {
416
- this.rect.style.zIndex = css(this.j.container, 'zIndex').toString();
417
+ css(this.rect, 'zIndex', css(this.j.container, 'zIndex').toString());
417
418
  }
418
419
  this.updateSize();
419
420
  }
@@ -28,7 +28,7 @@ function ensureHighlightStyle(doc, useHighlightAPI) {
28
28
  catch (_a) {
29
29
  const style = doc.createElement('style');
30
30
  style.textContent = rule;
31
- doc.head.appendChild(style);
31
+ Dom.append(doc.head, style);
32
32
  }
33
33
  }
34
34
  /**
@@ -168,7 +168,7 @@ let UISearch = class UISearch extends UIElement {
168
168
  }
169
169
  open(query, replace, searchAndReplace = false) {
170
170
  if (!this.isOpened) {
171
- this.j.workplace.appendChild(this.container);
171
+ Dom.append(this.j.workplace, this.container);
172
172
  this.isOpened = true;
173
173
  }
174
174
  this.calcSticky(this.j.e.fire('getStickyState.sticky') || false);
@@ -13,7 +13,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
13
13
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
14
14
  return c > 3 && r && Object.defineProperty(target, key, r), r;
15
15
  };
16
- import { IS_INLINE } from "../../core/constants.js";
16
+ import { IS_INLINE, LIST_TAGS } from "../../core/constants.js";
17
17
  import { autobind, watch } from "../../core/decorators/index.js";
18
18
  import { Dom } from "../../core/dom/dom.js";
19
19
  import { pluginSystem } from "../../core/global.js";
@@ -111,7 +111,7 @@ export class select extends Plugin {
111
111
  // The text must be the direct content of a list item that has a nested
112
112
  // list (the last level has no nested list and behaves correctly).
113
113
  if (!Dom.isTag(li, 'li') ||
114
- !(li.querySelector('ul') || li.querySelector('ol'))) {
114
+ !Dom.first(li, node => Dom.isTag(node, LIST_TAGS))) {
115
115
  return;
116
116
  }
117
117
  const measure = this.j.ed.createRange();
@@ -97,7 +97,7 @@ export class selectCells extends Plugin {
97
97
  }
98
98
  else {
99
99
  if (!cell.firstChild) {
100
- cell.appendChild(this.j.createInside.element('br'));
100
+ Dom.append(cell, this.j.createInside.element('br'));
101
101
  }
102
102
  this.__tableModule.addSelection(cell);
103
103
  }
@@ -119,7 +119,7 @@ export class selectCells extends Plugin {
119
119
  return;
120
120
  }
121
121
  if (!cell.firstChild) {
122
- cell.appendChild(this.j.createInside.element('br'));
122
+ Dom.append(cell, this.j.createInside.element('br'));
123
123
  }
124
124
  this.__isSelectionMode = true;
125
125
  this.__selectedCell = cell;
@@ -186,10 +186,9 @@ export class selectCells extends Plugin {
186
186
  // Hack for FireFox for force redraw selection
187
187
  (() => {
188
188
  const n = this.j.createInside.fromHTML('<div style="color:rgba(0,0,0,0.01);width:0;height:0">&nbsp;</div>');
189
- cell.appendChild(n);
189
+ Dom.append(cell, n);
190
190
  this.j.async.setTimeout(() => {
191
- var _a;
192
- (_a = n.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(n);
191
+ Dom.safeRemove(n);
193
192
  }, this.j.defaultTimeout / 5);
194
193
  })();
195
194
  }
@@ -287,7 +286,7 @@ export class selectCells extends Plugin {
287
286
  const cells = this.__tableModule.getAllSelectedCells();
288
287
  cells.forEach(td => {
289
288
  Dom.detach(td);
290
- td.appendChild(this.j.createInside.element('br'));
289
+ Dom.append(td, this.j.createInside.element('br'));
291
290
  });
292
291
  this.unselectCells();
293
292
  this.j.s.setCursorIn(cells[0]);