jodit 4.15.7 → 4.15.8

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 (57) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +4 -4
  4. package/es2015/jodit.js +50 -22
  5. package/es2015/jodit.min.js +4 -4
  6. package/es2015/plugins/debug/debug.css +1 -1
  7. package/es2015/plugins/debug/debug.js +1 -1
  8. package/es2015/plugins/debug/debug.min.js +1 -1
  9. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  10. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  12. package/es2018/jodit.fat.min.js +4 -4
  13. package/es2018/jodit.min.js +4 -4
  14. package/es2018/plugins/debug/debug.min.js +1 -1
  15. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  16. package/es2021/jodit.css +1 -1
  17. package/es2021/jodit.fat.min.js +5 -5
  18. package/es2021/jodit.js +49 -21
  19. package/es2021/jodit.min.js +5 -5
  20. package/es2021/plugins/debug/debug.css +1 -1
  21. package/es2021/plugins/debug/debug.js +1 -1
  22. package/es2021/plugins/debug/debug.min.js +1 -1
  23. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  24. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  25. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  26. package/es2021.en/jodit.css +1 -1
  27. package/es2021.en/jodit.fat.min.js +5 -5
  28. package/es2021.en/jodit.js +49 -21
  29. package/es2021.en/jodit.min.js +5 -5
  30. package/es2021.en/plugins/debug/debug.css +1 -1
  31. package/es2021.en/plugins/debug/debug.js +1 -1
  32. package/es2021.en/plugins/debug/debug.min.js +1 -1
  33. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  34. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  35. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  36. package/es5/jodit.css +2 -2
  37. package/es5/jodit.fat.min.js +2 -2
  38. package/es5/jodit.js +50 -22
  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 +1 -1
  43. package/es5/plugins/debug/debug.min.js +1 -1
  44. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  45. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  46. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  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/config.d.ts +2 -1
  51. package/esm/core/constants.js +1 -1
  52. package/esm/plugins/clean-html/config.d.ts +2 -1
  53. package/esm/plugins/clean-html/helpers/visitor/filters/try-remove-node.js +10 -0
  54. package/esm/plugins/mobile/mobile.js +25 -4
  55. package/package.json +1 -1
  56. package/types/config.d.ts +2 -1
  57. package/types/plugins/clean-html/config.d.ts +2 -1
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.15.7
4
+ * Version: v4.15.8
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.15.7
4
+ * Version: v4.15.8
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.15.7
4
+ * Version: v4.15.8
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.15.7
4
+ * Version: v4.15.8
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.15.7
4
+ * Version: v4.15.8
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.15.7
4
+ * Version: v4.15.8
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.15.7
4
+ * Version: v4.15.8
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
package/es5/polyfills.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.15.7
4
+ * Version: v4.15.8
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.15.7
4
+ * Version: v4.15.8
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
package/esm/config.d.ts CHANGED
@@ -1021,7 +1021,8 @@ interface Config {
1021
1021
  */
1022
1022
  fillEmptyParagraph: boolean;
1023
1023
  /**
1024
- * Remove empty elements
1024
+ * Remove empty inline elements. Elements that in-page links can point
1025
+ * at (anything with an `id`, and `<a>` with a `name`) are kept.
1025
1026
  */
1026
1027
  removeEmptyElements: boolean;
1027
1028
  /**
@@ -3,7 +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
- export const APP_VERSION = "4.15.7";
6
+ export const APP_VERSION = "4.15.8";
7
7
  // prettier-ignore
8
8
  export const ES = "es2020";
9
9
  export const IS_ES_MODERN = true;
@@ -20,7 +20,8 @@ declare module 'jodit/config' {
20
20
  */
21
21
  fillEmptyParagraph: boolean;
22
22
  /**
23
- * Remove empty elements
23
+ * Remove empty inline elements. Elements that in-page links can point
24
+ * at (anything with an `id`, and `<a>` with a `name`) are kept.
24
25
  */
25
26
  removeEmptyElements: boolean;
26
27
  /**
@@ -55,7 +55,17 @@ function isRemovableNode(jodit, node, current, allow, deny) {
55
55
  return (Dom.isElement(node) &&
56
56
  node.nodeName.match(IS_INLINE) != null &&
57
57
  !Dom.isTemporary(node) &&
58
+ !isFragmentTarget(node) &&
58
59
  trimInv(node.innerHTML).length === 0 &&
59
60
  (current == null || !Dom.isOrContains(node, current)) &&
60
61
  (liveCaret == null || !Dom.isOrContains(node, liveCaret)));
61
62
  }
63
+ /**
64
+ * An element with an `id`, or an `<a>` with a `name`, is where an in-page link
65
+ * (`#fragment`) lands. It is usually empty (`<a name="top"></a>`), and removing
66
+ * it silently breaks every link that points at it.
67
+ */
68
+ function isFragmentTarget(element) {
69
+ return (element.hasAttribute('id') ||
70
+ (element.nodeName === 'A' && element.hasAttribute('name')));
71
+ }
@@ -3,8 +3,10 @@
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 { splitArray, toArray } from "../../core/helpers/index.js";
9
+ import { isString } from "../../core/helpers/checker/is-string.js";
8
10
  import { flatButtonsSet, isButtonGroup } from "../../core/ui/helpers/buttons.js";
9
11
  import "./config.js";
10
12
  const isButtonSeparator = (item) => item === '|' || item === '---' || item === '\n';
@@ -75,6 +77,22 @@ function fitToButtons(list, editor) {
75
77
  }
76
78
  return cleaned;
77
79
  }
80
+ /**
81
+ * The width that decides which breakpoint set the toolbar uses. A toolbar
82
+ * rendered into an external container (`toolbar` set to an element or a
83
+ * selector) lays out in that container, so its width is what matters there.
84
+ */
85
+ function adaptiveWidth(editor) {
86
+ var _a;
87
+ const { toolbar } = editor.o;
88
+ if (isString(toolbar) || Dom.isHTMLElement(toolbar)) {
89
+ const width = editor.toolbarContainer.offsetWidth;
90
+ if (width) {
91
+ return width;
92
+ }
93
+ }
94
+ return ((_a = editor.container.parentElement) !== null && _a !== void 0 ? _a : editor.container).offsetWidth;
95
+ }
78
96
  /**
79
97
  * Rebuild toolbar in depends on editor's width
80
98
  */
@@ -108,13 +126,16 @@ export function mobile(editor) {
108
126
  if (editor.o.toolbarAdaptive) {
109
127
  editor.e
110
128
  .on('resize afterInit recalcAdaptive changePlace afterAddPlace', () => {
111
- var _a, _b;
129
+ var _a;
112
130
  if (!editor.o.toolbar) {
113
131
  return;
114
132
  }
115
- const width = ((_a = editor.container.parentElement) !== null && _a !== void 0 ? _a : editor.container).offsetWidth;
116
133
  const newStore = (() => {
117
- if (editor.isFullSize || width >= editor.o.sizeLG) {
134
+ if (editor.isFullSize) {
135
+ return splitArray(editor.o.buttons);
136
+ }
137
+ const width = adaptiveWidth(editor);
138
+ if (width >= editor.o.sizeLG) {
118
139
  return splitArray(editor.o.buttons);
119
140
  }
120
141
  if (width >= editor.o.sizeMD) {
@@ -128,7 +149,7 @@ export function mobile(editor) {
128
149
  if (newStore.toString() !== store.toString()) {
129
150
  store = newStore;
130
151
  editor.e.fire('closeAllPopups');
131
- (_b = editor.toolbar) === null || _b === void 0 ? void 0 : _b.setRemoveButtons(editor.o.removeButtons).build(store.concat(editor.o.extraButtons));
152
+ (_a = editor.toolbar) === null || _a === void 0 ? void 0 : _a.setRemoveButtons(editor.o.removeButtons).build(store.concat(editor.o.extraButtons));
132
153
  }
133
154
  })
134
155
  .on(editor.ow, 'load resize', () => editor.e.fire('recalcAdaptive'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "4.15.7",
3
+ "version": "4.15.8",
4
4
  "description": "Jodit is an awesome and useful wysiwyg editor with filebrowser",
5
5
  "main": "esm/index.js",
6
6
  "types": "types/index.d.ts",
package/types/config.d.ts CHANGED
@@ -1021,7 +1021,8 @@ interface Config {
1021
1021
  */
1022
1022
  fillEmptyParagraph: boolean;
1023
1023
  /**
1024
- * Remove empty elements
1024
+ * Remove empty inline elements. Elements that in-page links can point
1025
+ * at (anything with an `id`, and `<a>` with a `name`) are kept.
1025
1026
  */
1026
1027
  removeEmptyElements: boolean;
1027
1028
  /**
@@ -20,7 +20,8 @@ declare module 'jodit/config' {
20
20
  */
21
21
  fillEmptyParagraph: boolean;
22
22
  /**
23
- * Remove empty elements
23
+ * Remove empty inline elements. Elements that in-page links can point
24
+ * at (anything with an `id`, and `<a>` with a `name`) are kept.
24
25
  */
25
26
  removeEmptyElements: boolean;
26
27
  /**