jodit 4.0.1 → 4.0.3

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 (77) hide show
  1. package/CHANGELOG.md +10 -6
  2. package/es2015/jodit.css +5 -7
  3. package/es2015/jodit.fat.min.css +1 -1
  4. package/es2015/jodit.fat.min.js +2 -2
  5. package/es2015/jodit.js +50 -39
  6. package/es2015/jodit.min.css +1 -1
  7. package/es2015/jodit.min.js +2 -2
  8. package/es2015/plugins/debug/debug.js +1 -1
  9. package/es2015/plugins/debug/debug.min.js +1 -1
  10. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  12. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  13. package/es2018/jodit.css +5 -7
  14. package/es2018/jodit.fat.min.css +1 -1
  15. package/es2018/jodit.fat.min.js +2 -2
  16. package/es2018/jodit.js +50 -39
  17. package/es2018/jodit.min.css +1 -1
  18. package/es2018/jodit.min.js +2 -2
  19. package/es2018/plugins/debug/debug.js +1 -1
  20. package/es2018/plugins/debug/debug.min.js +1 -1
  21. package/es2018/plugins/speech-recognize/speech-recognize.css +1 -1
  22. package/es2018/plugins/speech-recognize/speech-recognize.js +1 -1
  23. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  24. package/es2021/jodit.css +5 -7
  25. package/es2021/jodit.fat.min.css +1 -1
  26. package/es2021/jodit.fat.min.js +2 -2
  27. package/es2021/jodit.js +50 -39
  28. package/es2021/jodit.min.css +1 -1
  29. package/es2021/jodit.min.js +2 -2
  30. package/es2021/plugins/debug/debug.js +1 -1
  31. package/es2021/plugins/debug/debug.min.js +1 -1
  32. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  33. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  34. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  35. package/es2021.en/jodit.css +5 -7
  36. package/es2021.en/jodit.fat.min.css +1 -1
  37. package/es2021.en/jodit.fat.min.js +2 -2
  38. package/es2021.en/jodit.js +50 -39
  39. package/es2021.en/jodit.min.css +1 -1
  40. package/es2021.en/jodit.min.js +2 -2
  41. package/es2021.en/plugins/debug/debug.js +1 -1
  42. package/es2021.en/plugins/debug/debug.min.js +1 -1
  43. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  44. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  45. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  46. package/es5/jodit.css +7 -9
  47. package/es5/jodit.fat.min.css +1 -1
  48. package/es5/jodit.fat.min.js +2 -2
  49. package/es5/jodit.js +51 -38
  50. package/es5/jodit.min.css +3 -3
  51. package/es5/jodit.min.js +2 -2
  52. package/es5/plugins/debug/debug.js +1 -1
  53. package/es5/plugins/debug/debug.min.js +1 -1
  54. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  55. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  56. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  57. package/esm/core/constants.js +1 -1
  58. package/esm/core/selection/selection.js +5 -1
  59. package/esm/core/ui/popup/popup.js +5 -4
  60. package/esm/jodit.js +6 -12
  61. package/esm/modules/context-menu/context-menu.js +5 -3
  62. package/esm/modules/dialog/dialog.js +5 -3
  63. package/esm/modules/file-browser/builders/context-menu.js +3 -1
  64. package/esm/modules/file-browser/data-provider.js +6 -6
  65. package/esm/modules/file-browser/file-browser.js +1 -5
  66. package/esm/modules/toolbar/button/button.d.ts +1 -1
  67. package/esm/plugins/inline-popup/config/items/a.d.ts +1 -1
  68. package/esm/plugins/inline-popup/config/items/cells.d.ts +1 -1
  69. package/esm/plugins/inline-popup/config/items/img.d.ts +1 -1
  70. package/esm/plugins/select/select.d.ts +2 -1
  71. package/esm/plugins/select/select.js +12 -2
  72. package/package.json +1 -1
  73. package/types/modules/toolbar/button/button.d.ts +1 -1
  74. package/types/plugins/inline-popup/config/items/a.d.ts +1 -1
  75. package/types/plugins/inline-popup/config/items/cells.d.ts +1 -1
  76. package/types/plugins/inline-popup/config/items/img.d.ts +1 -1
  77. package/types/plugins/select/select.d.ts +2 -1
package/es5/jodit.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is awesome and usefully wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.0.1
4
+ * Version: v4.0.3
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -3084,7 +3084,7 @@ __webpack_require__.r(__webpack_exports__);
3084
3084
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
3085
3085
  */
3086
3086
 
3087
- var APP_VERSION = "4.0.1";
3087
+ var APP_VERSION = "4.0.3";
3088
3088
  // prettier-ignore
3089
3089
  var ES = "es5";
3090
3090
  var IS_ES_MODERN = false;
@@ -12856,7 +12856,8 @@ var Selection = /** @class */ (function () {
12856
12856
  if (this.isCollapsed()) {
12857
12857
  return this;
12858
12858
  }
12859
- var range = this.range, c = range.cloneRange();
12859
+ var range = this.range;
12860
+ var c = range.cloneRange();
12860
12861
  if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .i.isOrContains(this.j.editor, range.commonAncestorContainer, true)) {
12861
12862
  return this;
12862
12863
  }
@@ -12904,6 +12905,9 @@ var Selection = /** @class */ (function () {
12904
12905
  }
12905
12906
  this.selectRange(c);
12906
12907
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .i.safeRemove(leftFake, rightFake);
12908
+ if (this.isCollapsed()) {
12909
+ throw (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.error)('Selection is collapsed');
12910
+ }
12907
12911
  return this;
12908
12912
  };
12909
12913
  (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .gn)([
@@ -17532,10 +17536,11 @@ var Popup = /** @class */ (function (_super) {
17532
17536
  .off(this.container, 'scroll mousewheel', up)
17533
17537
  .off(ow, 'scroll', up)
17534
17538
  .off(ow, 'resize', up);
17535
- void 0;
17536
- jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .i.up(this.j.container, function (box) {
17537
- box && _this.j.e.off(box, 'scroll mousewheel', up);
17538
- });
17539
+ if (this.j.container.isConnected) {
17540
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .i.up(this.j.container, function (box) {
17541
+ box && _this.j.e.off(box, 'scroll mousewheel', up);
17542
+ });
17543
+ }
17539
17544
  };
17540
17545
  /**
17541
17546
  * Set ZIndex
@@ -18914,18 +18919,12 @@ var Jodit = /** @class */ (function (_super) {
18914
18919
  }
18915
18920
  if (result !== false) {
18916
18921
  this.s.focus();
18917
- if (command === 'selectall') {
18918
- this.s.select(this.editor, true);
18919
- this.s.expandSelection();
18922
+ try {
18923
+ result = this.nativeExecCommand(command, showUI, value);
18920
18924
  }
18921
- else {
18922
- try {
18923
- result = this.nativeExecCommand(command, showUI, value);
18924
- }
18925
- catch (e) {
18926
- if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.IS_PROD) {
18927
- throw e;
18928
- }
18925
+ catch (e) {
18926
+ if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.IS_PROD) {
18927
+ throw e;
18929
18928
  }
18930
18929
  }
18931
18930
  }
@@ -18936,7 +18935,7 @@ var Jodit = /** @class */ (function (_super) {
18936
18935
  * @param third - The third option is for the team
18937
18936
  */
18938
18937
  this.e.fire('afterCommand', command, showUI, value);
18939
- this.setEditorValue(); // synchrony
18938
+ this.__imdSynchronizeValues(); // synchrony
18940
18939
  return result;
18941
18940
  };
18942
18941
  /**
@@ -19737,7 +19736,8 @@ var ContextMenu = /** @class */ (function (_super) {
19737
19736
  */
19738
19737
  ContextMenu.prototype.show = function (x, y, actions) {
19739
19738
  var _this = this;
19740
- var self = this, content = this.j.c.div(this.getFullElName('actions'));
19739
+ var self = this;
19740
+ self.clear();
19741
19741
  if (!(0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_2__/* .isArray */ .kJ)(actions)) {
19742
19742
  return;
19743
19743
  }
@@ -19751,12 +19751,13 @@ var ContextMenu = /** @class */ (function (_super) {
19751
19751
  action.onAction(function (e) {
19752
19752
  var _a;
19753
19753
  (_a = item.exec) === null || _a === void 0 ? void 0 : _a.call(self, e);
19754
+ self.clear();
19754
19755
  self.close();
19755
19756
  return false;
19756
19757
  });
19757
- content.appendChild(action.container);
19758
+ _this.append(action);
19758
19759
  });
19759
- this.setContent(content).open(function () { return ({ left: x, top: y, width: 0, height: 0 }); }, true);
19760
+ this.open(function () { return ({ left: x, top: y, width: 0, height: 0 }); }, true);
19760
19761
  };
19761
19762
  ContextMenu = (0,tslib__WEBPACK_IMPORTED_MODULE_3__/* .__decorate */ .gn)([
19762
19763
  jodit_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_4__/* .component */ .w
@@ -20440,10 +20441,12 @@ var Dialog = /** @class */ (function (_super) {
20440
20441
  this.getMod('static') === true) {
20441
20442
  return this;
20442
20443
  }
20444
+ var e = this.e;
20443
20445
  /**
20444
20446
  * Called up to close the window
20445
20447
  */
20446
- if (this.e.fire('beforeClose', this) === false) {
20448
+ if (e.fire(this, 'beforeClose') === false ||
20449
+ e.fire('beforeClose', this) === false) {
20447
20450
  return this;
20448
20451
  }
20449
20452
  this.setMod('active', false);
@@ -20456,8 +20459,8 @@ var Dialog = /** @class */ (function (_super) {
20456
20459
  /**
20457
20460
  * It called after the window is closed
20458
20461
  */
20459
- this.e.fire(this, 'afterClose');
20460
- this.e.fire(this.ow, 'joditCloseDialog');
20462
+ e.fire(this, 'afterClose');
20463
+ e.fire(this.ow, 'joditCloseDialog');
20461
20464
  if (this.destroyAfterClose) {
20462
20465
  this.destruct();
20463
20466
  }
@@ -20823,7 +20826,9 @@ var CLASS_PREVIEW = 'jodit-file-browser-preview', preview_tpl_next = function (n
20823
20826
  ]);
20824
20827
  }, self.defaultTimeout);
20825
20828
  self.e
20826
- .on('beforeClose', function () { return contextmenu.close(); })
20829
+ .on('beforeClose', function () {
20830
+ contextmenu.close();
20831
+ })
20827
20832
  .on('beforeDestruct', function () { return contextmenu.destruct(); });
20828
20833
  e.stopPropagation();
20829
20834
  e.preventDefault();
@@ -21306,7 +21311,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__/* .Config */ .D.prototype.controls.fil
21306
21311
 
21307
21312
 
21308
21313
  var DEFAULT_SOURCE_NAME = 'default';
21309
- var possibleRules = [
21314
+ var possibleRules = new Set([
21310
21315
  'allowFiles',
21311
21316
  'allowFileMove',
21312
21317
  'allowFileUpload',
@@ -21320,7 +21325,7 @@ var possibleRules = [
21320
21325
  'allowFolderRename',
21321
21326
  'allowImageResize',
21322
21327
  'allowImageCrop'
21323
- ];
21328
+ ]);
21324
21329
  var DataProvider = /** @class */ (function () {
21325
21330
  function DataProvider(parent, options) {
21326
21331
  this.parent = parent;
@@ -21411,13 +21416,13 @@ var DataProvider = /** @class */ (function () {
21411
21416
  DataProvider.prototype.canI = function (action) {
21412
21417
  var rule = 'allow' + action;
21413
21418
  if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_4__.IS_PROD) {
21414
- if (!possibleRules.includes(rule)) {
21419
+ if (!possibleRules.has(rule)) {
21415
21420
  throw (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)('Wrong action ' + action);
21416
21421
  }
21417
21422
  }
21418
- var preset = this.o.permissionsPresets[rule];
21419
- if (preset !== undefined) {
21420
- return preset;
21423
+ var presetValue = this.o.permissionsPresets[rule];
21424
+ if (presetValue !== undefined) {
21425
+ return presetValue;
21421
21426
  }
21422
21427
  return (this.__currentPermissions == null ||
21423
21428
  this.__currentPermissions[rule] === undefined ||
@@ -22072,10 +22077,8 @@ var FileBrowser = /** @class */ (function (_super) {
22072
22077
  minHeight: 300,
22073
22078
  buttons: (_a = this.o.headerButtons) !== null && _a !== void 0 ? _a : ['fullsize', 'dialog.close']
22074
22079
  });
22075
- ['afterClose', 'beforeOpen'].forEach(function (proxyEvent) {
22076
- dialog.events.on(dialog, proxyEvent, function () {
22077
- _this.e.fire(proxyEvent);
22078
- });
22080
+ ['beforeClose', 'afterClose', 'beforeOpen'].forEach(function (proxyEvent) {
22081
+ return dialog.events.on(dialog, proxyEvent, function () { return _this.e.fire(proxyEvent); });
22079
22082
  });
22080
22083
  dialog.setSize(this.o.width, this.o.height);
22081
22084
  return dialog;
@@ -40557,13 +40560,20 @@ var select = /** @class */ (function (_super) {
40557
40560
  };
40558
40561
  select.prototype.beforeCommandCut = function (command) {
40559
40562
  var s = this.j.s;
40560
- if (command === 'cut' && !s.isCollapsed()) {
40563
+ if (!s.isCollapsed()) {
40561
40564
  var current = s.current();
40562
40565
  if (current && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .i.isOrContains(this.j.editor, current)) {
40563
40566
  this.onCopyNormalizeSelectionBound();
40564
40567
  }
40565
40568
  }
40566
40569
  };
40570
+ select.prototype.beforeCommandSelectall = function (command) {
40571
+ var s = this.j.s;
40572
+ s.focus();
40573
+ s.select(this.j.editor, true);
40574
+ s.expandSelection();
40575
+ return false;
40576
+ };
40567
40577
  select.prototype.onCopyNormalizeSelectionBound = function (e) {
40568
40578
  var _a = this.j, s = _a.s, editor = _a.editor, o = _a.o;
40569
40579
  if (!o.select.normalizeSelectionBeforeCutAndCopy || s.isCollapsed()) {
@@ -40584,8 +40594,11 @@ var select = /** @class */ (function (_super) {
40584
40594
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)('ow:click')
40585
40595
  ], select.prototype, "onOutsideClick", null);
40586
40596
  (0,tslib__WEBPACK_IMPORTED_MODULE_6__/* .__decorate */ .gn)([
40587
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)([':beforeCommand'])
40597
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)([':beforeCommandCut'])
40588
40598
  ], select.prototype, "beforeCommandCut", null);
40599
+ (0,tslib__WEBPACK_IMPORTED_MODULE_6__/* .__decorate */ .gn)([
40600
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)([':beforeCommandSelectall'])
40601
+ ], select.prototype, "beforeCommandSelectall", null);
40589
40602
  (0,tslib__WEBPACK_IMPORTED_MODULE_6__/* .__decorate */ .gn)([
40590
40603
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)([':copy', ':cut'])
40591
40604
  ], select.prototype, "onCopyNormalizeSelectionBound", null);