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
package/es5/jodit.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
  */
@@ -2107,7 +2107,7 @@ __webpack_require__.r(__webpack_exports__);
2107
2107
  * @packageDocumentation
2108
2108
  * @module constants
2109
2109
  */
2110
- var APP_VERSION = "4.13.24";
2110
+ var APP_VERSION = "4.13.26";
2111
2111
  // prettier-ignore
2112
2112
  var ES = "es5";
2113
2113
  var IS_ES_MODERN = false;
@@ -2764,24 +2764,45 @@ var Create = /*#__PURE__*/ function() {
2764
2764
  return value;
2765
2765
  };
2766
2766
  }
2767
+ function getOwnerDocument(component) {
2768
+ var od = component.od;
2769
+ return od !== null && od !== void 0 ? od : document;
2770
+ }
2767
2771
  function cacheHTML(target, _, descriptor) {
2768
2772
  var fn = descriptor.value;
2769
2773
  if (!(0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_2__.isFunction)(fn)) {
2770
2774
  throw (0,jodit_core_helpers_utils_error_error__WEBPACK_IMPORTED_MODULE_3__.error)('Handler must be a Function');
2771
2775
  }
2772
2776
  var useCache = true;
2773
- var cached = new WeakMap();
2777
+ /**
2778
+ * The cache is keyed by the owner document first and only then by the
2779
+ * component class. A page can create editors inside different documents
2780
+ * (iframes) and destroy those documents later: a template cached from a
2781
+ * dead document would otherwise be cloned for every subsequent editor,
2782
+ * whose buttons then never react to clicks.
2783
+ */ var cached = new WeakMap();
2774
2784
  descriptor.value = function() {
2775
2785
  for(var _len = arguments.length, attrs = new Array(_len), _key = 0; _key < _len; _key++){
2776
2786
  attrs[_key] = arguments[_key];
2777
2787
  }
2778
- if (useCache && cached.has(this.constructor)) {
2779
- var _cached_get;
2780
- return (_cached_get = cached.get(this.constructor)) === null || _cached_get === void 0 ? void 0 : _cached_get.cloneNode(true);
2788
+ var doc = getOwnerDocument(this);
2789
+ var docCache = cached.get(doc);
2790
+ if (useCache && (docCache === null || docCache === void 0 ? void 0 : docCache.has(this.constructor))) {
2791
+ var _docCache_get;
2792
+ return (_docCache_get = docCache.get(this.constructor)) === null || _docCache_get === void 0 ? void 0 : _docCache_get.cloneNode(true);
2781
2793
  }
2782
2794
  var value = fn.apply(this, attrs);
2783
2795
  if (useCache && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(value)) {
2784
- cached.set(this.constructor, value);
2796
+ if (docCache) {
2797
+ docCache.set(this.constructor, value);
2798
+ } else {
2799
+ cached.set(doc, new WeakMap([
2800
+ [
2801
+ this.constructor,
2802
+ value
2803
+ ]
2804
+ ]));
2805
+ }
2785
2806
  }
2786
2807
  return useCache ? value.cloneNode(true) : value;
2787
2808
  };
@@ -19889,6 +19910,15 @@ var Popup = /*#__PURE__*/ function(UIGroup) {
19889
19910
  this.j.e.fire(this, 'beforeClose');
19890
19911
  this.j.e.fire('beforePopupClose', this);
19891
19912
  this.__removeGlobalListeners();
19913
+ // Blur a focused control (e.g. the color picker hex input) before
19914
+ // the container goes away. Chrome fires `blur`/`change` for a
19915
+ // removed focused element in the middle of `removeChild`, Firefox
19916
+ // does not fire them at all. Blurring first makes both browsers
19917
+ // run those handlers while the popup is still in the DOM. See #1458
19918
+ var activeElement = this.od.activeElement;
19919
+ if (activeElement && activeElement !== this.container && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_13__.Dom.isOrContains(this.container, activeElement) && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_15__.isFunction)(activeElement.blur)) {
19920
+ activeElement.blur();
19921
+ }
19892
19922
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_13__.Dom.safeRemove(this.container);
19893
19923
  return this;
19894
19924
  }
@@ -29194,15 +29224,23 @@ var ToolbarButton = /*#__PURE__*/ function(UIButton) {
29194
29224
  {
29195
29225
  key: "__closePopup",
29196
29226
  value: function __closePopup() {
29197
- if (this.openedPopup) {
29198
- this.j.e.off(this.ow, 'mousedown touchstart', this.onOutsideClick).off('escape closeAllPopups', this.onOutsideClick);
29199
- this.state.activated = false;
29200
- this.openedPopup.close();
29201
- this.openedPopup.destruct();
29202
- this.openedPopup = null;
29203
- if (this.trigger) {
29204
- (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_27__.attr)(this.trigger, 'aria-expanded', false);
29205
- }
29227
+ var popup = this.openedPopup;
29228
+ if (!popup) {
29229
+ return;
29230
+ }
29231
+ // Detach first: removing a popup that holds the focused element
29232
+ // makes Chrome fire `blur`/`change` on it synchronously, and a
29233
+ // handler there may call the popup's `close` callback again.
29234
+ // A re-entrant call must be a no-op, otherwise it destructs the
29235
+ // popup while the outer `removeChild` is still running and Chrome
29236
+ // throws NotFoundError. See #1458
29237
+ this.openedPopup = null;
29238
+ this.j.e.off(this.ow, 'mousedown touchstart', this.onOutsideClick).off('escape closeAllPopups', this.onOutsideClick);
29239
+ this.state.activated = false;
29240
+ popup.close();
29241
+ popup.destruct();
29242
+ if (this.trigger) {
29243
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_27__.attr)(this.trigger, 'aria-expanded', false);
29206
29244
  }
29207
29245
  }
29208
29246
  },
@@ -30799,8 +30837,15 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
30799
30837
  var extra = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.refs)(form).extra;
30800
30838
  extra.appendChild(editor.c.fromHTML('<div class="'.concat(cn, '__hex"><input data-ref="hexInput" type="text" spellcheck="false" aria-label="HEX" placeholder="#FF0000" value="').concat(valueHex || '', '"/></div>')));
30801
30839
  var hexInput = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.refs)(form).hexInput;
30840
+ // Enter applies the value and closes the popup; removing the focused
30841
+ // input then makes Chrome fire `change` on it, which would apply the
30842
+ // same color a second time and toggle it off again. See #1459
30843
+ var appliedHexValue = null;
30802
30844
  var applyHexInput = function applyHexInput() {
30803
30845
  var raw = hexInput.value.trim();
30846
+ if (raw === appliedHexValue) {
30847
+ return;
30848
+ }
30804
30849
  var isHex = /^#?[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(raw);
30805
30850
  var isRgb = /^rgba?\([\d\s.,%]+\)$/i.test(raw);
30806
30851
  if (!isHex && !isRgb) {
@@ -30808,6 +30853,7 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
30808
30853
  }
30809
30854
  var color = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.normalizeColor)(isHex && !raw.startsWith('#') ? '#' + raw : raw);
30810
30855
  if (color && (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.isFunction)(callback)) {
30856
+ appliedHexValue = raw;
30811
30857
  callback(color);
30812
30858
  }
30813
30859
  };
package/es5/jodit.min.css CHANGED
@@ -1,14 +1,14 @@
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
  */
8
8
  /*!
9
9
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
10
10
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
11
- * Version: v4.13.24
11
+ * Version: v4.13.26
12
12
  * Url: https://xdsoft.net/jodit/
13
13
  * License(s): MIT
14
14
  */