jodit 4.13.24 → 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 (55) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +4 -4
  4. package/es2015/jodit.js +62 -16
  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 +61 -15
  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 +61 -15
  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 +62 -16
  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/decorators/cache/cache.js +21 -3
  52. package/esm/core/ui/popup/popup.js +13 -1
  53. package/esm/modules/toolbar/button/button.js +19 -11
  54. package/esm/modules/widget/color-picker/color-picker.js +8 -0
  55. 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.24
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.24
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.24
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.24
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.24
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.24
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.24
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.24
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.24
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.24";
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;
@@ -133,21 +133,39 @@ export function cache(_, name, descriptor) {
133
133
  return value;
134
134
  };
135
135
  }
136
+ function getOwnerDocument(component) {
137
+ const od = component.od;
138
+ return od !== null && od !== void 0 ? od : document;
139
+ }
136
140
  export function cacheHTML(target, _, descriptor) {
137
141
  const fn = descriptor.value;
138
142
  if (!isFunction(fn)) {
139
143
  throw error('Handler must be a Function');
140
144
  }
141
145
  let useCache = true;
146
+ /**
147
+ * The cache is keyed by the owner document first and only then by the
148
+ * component class. A page can create editors inside different documents
149
+ * (iframes) and destroy those documents later: a template cached from a
150
+ * dead document would otherwise be cloned for every subsequent editor,
151
+ * whose buttons then never react to clicks.
152
+ */
142
153
  const cached = new WeakMap();
143
154
  descriptor.value = function (...attrs) {
144
155
  var _a;
145
- if (useCache && cached.has(this.constructor)) {
146
- return (_a = cached.get(this.constructor)) === null || _a === void 0 ? void 0 : _a.cloneNode(true);
156
+ const doc = getOwnerDocument(this);
157
+ const docCache = cached.get(doc);
158
+ if (useCache && (docCache === null || docCache === void 0 ? void 0 : docCache.has(this.constructor))) {
159
+ return (_a = docCache.get(this.constructor)) === null || _a === void 0 ? void 0 : _a.cloneNode(true);
147
160
  }
148
161
  const value = fn.apply(this, attrs);
149
162
  if (useCache && Dom.isElement(value)) {
150
- cached.set(this.constructor, value);
163
+ if (docCache) {
164
+ docCache.set(this.constructor, value);
165
+ }
166
+ else {
167
+ cached.set(doc, new WeakMap([[this.constructor, value]]));
168
+ }
151
169
  }
152
170
  return useCache ? value.cloneNode(true) : value;
153
171
  };
@@ -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.24",
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",