jodit 4.13.25 → 4.13.26

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 (54) 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 +36 -11
  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 +36 -11
  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 +36 -11
  29. package/es2021.en/jodit.min.js +25 -25
  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 +36 -11
  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/core/constants.js +1 -1
  51. package/esm/core/ui/popup/popup.js +13 -1
  52. package/esm/modules/toolbar/button/button.js +19 -11
  53. package/esm/modules/widget/color-picker/color-picker.js +8 -0
  54. package/package.json +1 -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.13.25
4
+ * Version: v4.13.26
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.13.25
4
+ * Version: v4.13.26
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.13.25
4
+ * Version: v4.13.26
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.13.25
4
+ * Version: v4.13.26
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.13.25
4
+ * Version: v4.13.26
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.13.25
4
+ * Version: v4.13.26
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.13.25
4
+ * Version: v4.13.26
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.13.25
4
+ * Version: v4.13.26
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.13.25
4
+ * Version: v4.13.26
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -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.13.25";
6
+ export const APP_VERSION = "4.13.26";
7
7
  // prettier-ignore
8
8
  export const ES = "es2020";
9
9
  export const IS_ES_MODERN = true;
@@ -17,7 +17,7 @@ import { Component } from "../../component/component.js";
17
17
  import { autobind, throttle } from "../../decorators/index.js";
18
18
  import { Dom } from "../../dom/dom.js";
19
19
  import { eventEmitter, getContainer } from "../../global.js";
20
- import { attr, css, getFixedPositionOffset, isString, kebabCase, markOwner, position, ucfirst } from "../../helpers/index.js";
20
+ import { attr, css, getFixedPositionOffset, isFunction, isString, kebabCase, markOwner, position, ucfirst } from "../../helpers/index.js";
21
21
  import { assert } from "../../helpers/utils/assert.js";
22
22
  import { UIElement } from "../element.js";
23
23
  import { UIGroup } from "../group/group.js";
@@ -250,6 +250,18 @@ export class Popup extends UIGroup {
250
250
  this.j.e.fire(this, 'beforeClose');
251
251
  this.j.e.fire('beforePopupClose', this);
252
252
  this.__removeGlobalListeners();
253
+ // Blur a focused control (e.g. the color picker hex input) before
254
+ // the container goes away. Chrome fires `blur`/`change` for a
255
+ // removed focused element in the middle of `removeChild`, Firefox
256
+ // does not fire them at all. Blurring first makes both browsers
257
+ // run those handlers while the popup is still in the DOM. See #1458
258
+ const { activeElement } = this.od;
259
+ if (activeElement &&
260
+ activeElement !== this.container &&
261
+ Dom.isOrContains(this.container, activeElement) &&
262
+ isFunction(activeElement.blur)) {
263
+ activeElement.blur();
264
+ }
253
265
  Dom.safeRemove(this.container);
254
266
  return this;
255
267
  }
@@ -381,17 +381,25 @@ let ToolbarButton = class ToolbarButton extends UIButton {
381
381
  return this.openedPopup;
382
382
  }
383
383
  __closePopup() {
384
- if (this.openedPopup) {
385
- this.j.e
386
- .off(this.ow, 'mousedown touchstart', this.onOutsideClick)
387
- .off('escape closeAllPopups', this.onOutsideClick);
388
- this.state.activated = false;
389
- this.openedPopup.close();
390
- this.openedPopup.destruct();
391
- this.openedPopup = null;
392
- if (this.trigger) {
393
- attr(this.trigger, 'aria-expanded', false);
394
- }
384
+ const popup = this.openedPopup;
385
+ if (!popup) {
386
+ return;
387
+ }
388
+ // Detach first: removing a popup that holds the focused element
389
+ // makes Chrome fire `blur`/`change` on it synchronously, and a
390
+ // handler there may call the popup's `close` callback again.
391
+ // A re-entrant call must be a no-op, otherwise it destructs the
392
+ // popup while the outer `removeChild` is still running and Chrome
393
+ // throws NotFoundError. See #1458
394
+ this.openedPopup = null;
395
+ this.j.e
396
+ .off(this.ow, 'mousedown touchstart', this.onOutsideClick)
397
+ .off('escape closeAllPopups', this.onOutsideClick);
398
+ this.state.activated = false;
399
+ popup.close();
400
+ popup.destruct();
401
+ if (this.trigger) {
402
+ attr(this.trigger, 'aria-expanded', false);
395
403
  }
396
404
  }
397
405
  /**
@@ -51,8 +51,15 @@ export const ColorPickerWidget = (editor, callback, coldColor) => {
51
51
  const { extra } = refs(form);
52
52
  extra.appendChild(editor.c.fromHTML(`<div class="${cn}__hex"><input data-ref="hexInput" type="text" spellcheck="false" aria-label="HEX" placeholder="#FF0000" value="${valueHex || ''}"/></div>`));
53
53
  const { hexInput } = refs(form);
54
+ // Enter applies the value and closes the popup; removing the focused
55
+ // input then makes Chrome fire `change` on it, which would apply the
56
+ // same color a second time and toggle it off again. See #1459
57
+ let appliedHexValue = null;
54
58
  const applyHexInput = () => {
55
59
  const raw = hexInput.value.trim();
60
+ if (raw === appliedHexValue) {
61
+ return;
62
+ }
56
63
  const isHex = /^#?[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(raw);
57
64
  const isRgb = /^rgba?\([\d\s.,%]+\)$/i.test(raw);
58
65
  if (!isHex && !isRgb) {
@@ -60,6 +67,7 @@ export const ColorPickerWidget = (editor, callback, coldColor) => {
60
67
  }
61
68
  const color = normalizeColor(isHex && !raw.startsWith('#') ? '#' + raw : raw);
62
69
  if (color && isFunction(callback)) {
70
+ appliedHexValue = raw;
63
71
  callback(color);
64
72
  }
65
73
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "4.13.25",
3
+ "version": "4.13.26",
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",