jodit 4.15.14 → 4.15.16

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 (59) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +4 -4
  4. package/es2015/jodit.js +25 -10
  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 +4 -4
  18. package/es2021/jodit.js +25 -10
  19. package/es2021/jodit.min.js +4 -4
  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 +4 -4
  28. package/es2021.en/jodit.js +25 -10
  29. package/es2021.en/jodit.min.js +4 -4
  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 +25 -10
  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 +4 -2
  51. package/esm/core/constants.js +1 -1
  52. package/esm/plugins/clean-html/clean-html.js +4 -1
  53. package/esm/plugins/clean-html/config.d.ts +4 -2
  54. package/esm/plugins/color/config.js +16 -6
  55. package/esm/plugins/paste/helpers.js +6 -1
  56. package/esm/plugins/placeholder/placeholder.js +2 -1
  57. package/package.json +1 -1
  58. package/types/config.d.ts +4 -2
  59. package/types/plugins/clean-html/config.d.ts +4 -2
@@ -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.14
4
+ * Version: v4.15.16
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.14
4
+ * Version: v4.15.16
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.14
4
+ * Version: v4.15.16
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.14
4
+ * Version: v4.15.16
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.14
4
+ * Version: v4.15.16
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.14
4
+ * Version: v4.15.16
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.14
4
+ * Version: v4.15.16
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.14
4
+ * Version: v4.15.16
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.14
4
+ * Version: v4.15.16
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
package/esm/config.d.ts CHANGED
@@ -1028,8 +1028,10 @@ interface Config {
1028
1028
  removeEmptyElements: boolean;
1029
1029
  /**
1030
1030
  * Return an empty string from `editor.value` (and the synced source
1031
- * element) when the editor holds only a single empty block — e.g.
1032
- * `<p><br></p>` left after the user deletes all the content.
1031
+ * element) when the editor holds only a single empty text block
1032
+ * (`p`, `div`, a heading, `blockquote` or `pre`) — e.g.
1033
+ * `<p><br></p>` left after the user deletes all the content. A lone
1034
+ * video, iframe or other element that is content in itself is kept.
1033
1035
  * `contenteditable` keeps that caret container in the DOM, so by
1034
1036
  * default the value getter returns it as-is; enable this to collapse
1035
1037
  * it to `''` for form submission.
@@ -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.14";
6
+ export const APP_VERSION = "4.15.16";
7
7
  // prettier-ignore
8
8
  export const ES = "es2020";
9
9
  export const IS_ES_MODERN = true;
@@ -112,7 +112,10 @@ export class cleanHtml extends Plugin {
112
112
  if (!this.j.o.cleanHTML.collapseEmptyValueToEmptyString) {
113
113
  return;
114
114
  }
115
- if (/^<([a-z][a-z0-9]*)\b[^>]*>(?:<br\/?>)?<\/\1>$/i.test(data.value.trim())) {
115
+ // Only a text block can be an empty caret container; a lone video,
116
+ // iframe or icon has no children but is content in itself
117
+ const lone = /^<([a-z][a-z0-9]*)\b[^>]*>(?:<br\/?>)?<\/\1>$/i.exec(data.value.trim());
118
+ if (lone && /^(p|div|h[1-6]|blockquote|pre)$/i.test(lone[1])) {
116
119
  data.value = '';
117
120
  }
118
121
  }
@@ -26,8 +26,10 @@ declare module 'jodit/config' {
26
26
  removeEmptyElements: boolean;
27
27
  /**
28
28
  * Return an empty string from `editor.value` (and the synced source
29
- * element) when the editor holds only a single empty block — e.g.
30
- * `<p><br></p>` left after the user deletes all the content.
29
+ * element) when the editor holds only a single empty text block
30
+ * (`p`, `div`, a heading, `blockquote` or `pre`) — e.g.
31
+ * `<p><br></p>` left after the user deletes all the content. A lone
32
+ * video, iframe or other element that is content in itself is kept.
31
33
  * `contenteditable` keeps that caret container in the DOM, so by
32
34
  * default the value getter returns it as-is; enable this to collapse
33
35
  * it to `''` for form submission.
@@ -4,12 +4,22 @@
4
4
  * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
6
  import { Dom } from "../../core/dom/dom.js";
7
- import { css, dataBind, isJoditObject } from "../../core/helpers/index.js";
7
+ import { attr, css, dataBind, isJoditObject } from "../../core/helpers/index.js";
8
8
  import { Icon } from "../../core/ui/icon.js";
9
9
  import { Config } from "../../config.js";
10
10
  import { ColorPickerWidget, TabsWidget } from "../../modules/widget/index.js";
11
11
  import brushIcon from "./brush.svg.js";
12
12
  Icon.set('brush', brushIcon);
13
+ /**
14
+ * Set a color style; an empty value removes it, and with it the `style`
15
+ * attribute once nothing else is left in it
16
+ */
17
+ function setColorStyle(elm, key, value) {
18
+ css(elm, key, value);
19
+ if (!attr(elm, 'style')) {
20
+ attr(elm, 'style', null);
21
+ }
22
+ }
13
23
  Config.prototype.controls.brushCell = {
14
24
  isVisible: (editor) => {
15
25
  return !editor.o.disablePlugins.includes('color');
@@ -25,7 +35,7 @@ Config.prototype.controls.brushCell = {
25
35
  }
26
36
  const makeColorPicker = (key) => ColorPickerWidget(editor, (value) => {
27
37
  selected.forEach(cell => {
28
- css(cell, key, value);
38
+ setColorStyle(cell, key, value);
29
39
  });
30
40
  editor.lock();
31
41
  editor.synchronizeValues();
@@ -105,7 +115,7 @@ Config.prototype.controls.brush = {
105
115
  editor.execCommand('background', false, value);
106
116
  }
107
117
  else {
108
- css(currentElement, 'backgroundColor', value);
118
+ setColorStyle(currentElement, 'backgroundColor', value);
109
119
  }
110
120
  dataBind(button, 'color', value);
111
121
  dataBind(button, 'color-mode', 'background');
@@ -116,7 +126,7 @@ Config.prototype.controls.brush = {
116
126
  editor.execCommand('forecolor', false, value);
117
127
  }
118
128
  else {
119
- css(currentElement, 'color', value);
129
+ setColorStyle(currentElement, 'color', value);
120
130
  }
121
131
  dataBind(button, 'color', value);
122
132
  dataBind(button, 'color-mode', 'color');
@@ -148,10 +158,10 @@ Config.prototype.controls.brush = {
148
158
  Dom.isElement(current)) {
149
159
  switch (mode) {
150
160
  case 'color':
151
- css(current, 'color', color);
161
+ setColorStyle(current, 'color', color);
152
162
  break;
153
163
  case 'background':
154
- css(current, 'backgroundColor', color);
164
+ setColorStyle(current, 'backgroundColor', color);
155
165
  break;
156
166
  }
157
167
  }
@@ -85,10 +85,15 @@ export function askInsertTypeDialog(jodit, msg, title, callback, buttonList) {
85
85
  dialog.close();
86
86
  callback(value);
87
87
  }));
88
- dialog.e.one(dialog, 'afterClose', () => {
88
+ dialog.e
89
+ .on(dialog, 'beforeClose', () => {
90
+ jodit.e.fire('beforeClosePasteDialog', dialog);
91
+ })
92
+ .one(dialog, 'afterClose', () => {
89
93
  if (!jodit.s.isFocused()) {
90
94
  jodit.s.focus();
91
95
  }
96
+ jodit.e.fire('afterClosePasteDialog', dialog);
92
97
  });
93
98
  const cancel = Button(jodit, {
94
99
  text: 'Cancel',
@@ -68,7 +68,8 @@ export class placeholder extends Plugin {
68
68
  .off('.placeholder')
69
69
  .on('changePlace.placeholder', this.addNativeListeners)
70
70
  .on('change.placeholder focus.placeholder keyup.placeholder mouseup.placeholder keydown.placeholder ' +
71
- 'mousedown.placeholder afterSetMode.placeholder changePlace.placeholder', this.toggle)
71
+ 'mousedown.placeholder afterSetMode.placeholder changePlace.placeholder ' +
72
+ 'internalChange.placeholder', this.toggle)
72
73
  .on(window, 'load', this.toggle);
73
74
  this.addNativeListeners();
74
75
  this.toggle();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "4.15.14",
3
+ "version": "4.15.16",
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
@@ -1028,8 +1028,10 @@ interface Config {
1028
1028
  removeEmptyElements: boolean;
1029
1029
  /**
1030
1030
  * Return an empty string from `editor.value` (and the synced source
1031
- * element) when the editor holds only a single empty block — e.g.
1032
- * `<p><br></p>` left after the user deletes all the content.
1031
+ * element) when the editor holds only a single empty text block
1032
+ * (`p`, `div`, a heading, `blockquote` or `pre`) — e.g.
1033
+ * `<p><br></p>` left after the user deletes all the content. A lone
1034
+ * video, iframe or other element that is content in itself is kept.
1033
1035
  * `contenteditable` keeps that caret container in the DOM, so by
1034
1036
  * default the value getter returns it as-is; enable this to collapse
1035
1037
  * it to `''` for form submission.
@@ -26,8 +26,10 @@ declare module 'jodit/config' {
26
26
  removeEmptyElements: boolean;
27
27
  /**
28
28
  * Return an empty string from `editor.value` (and the synced source
29
- * element) when the editor holds only a single empty block — e.g.
30
- * `<p><br></p>` left after the user deletes all the content.
29
+ * element) when the editor holds only a single empty text block
30
+ * (`p`, `div`, a heading, `blockquote` or `pre`) — e.g.
31
+ * `<p><br></p>` left after the user deletes all the content. A lone
32
+ * video, iframe or other element that is content in itself is kept.
31
33
  * `contenteditable` keeps that caret container in the DOM, so by
32
34
  * default the value getter returns it as-is; enable this to collapse
33
35
  * it to `''` for form submission.