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/es2018/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
  */
@@ -1691,7 +1691,7 @@ __webpack_require__.r(__webpack_exports__);
1691
1691
  * Released under MIT see LICENSE.txt in the project root for license information.
1692
1692
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
1693
1693
  */
1694
- const APP_VERSION = "4.0.1";
1694
+ const APP_VERSION = "4.0.3";
1695
1695
  // prettier-ignore
1696
1696
  const ES = "es2018";
1697
1697
  const IS_ES_MODERN = true;
@@ -10997,7 +10997,8 @@ class Selection {
10997
10997
  if (this.isCollapsed()) {
10998
10998
  return this;
10999
10999
  }
11000
- const { range } = this, c = range.cloneRange();
11000
+ const { range } = this;
11001
+ const c = range.cloneRange();
11001
11002
  if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .i.isOrContains(this.j.editor, range.commonAncestorContainer, true)) {
11002
11003
  return this;
11003
11004
  }
@@ -11045,6 +11046,9 @@ class Selection {
11045
11046
  }
11046
11047
  this.selectRange(c);
11047
11048
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .i.safeRemove(leftFake, rightFake);
11049
+ if (this.isCollapsed()) {
11050
+ throw (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.error)('Selection is collapsed');
11051
+ }
11048
11052
  return this;
11049
11053
  }
11050
11054
  }
@@ -15520,10 +15524,11 @@ class Popup extends jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_3__/* .UI
15520
15524
  .off(this.container, 'scroll mousewheel', up)
15521
15525
  .off(ow, 'scroll', up)
15522
15526
  .off(ow, 'resize', up);
15523
- void 0;
15524
- jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .i.up(this.j.container, box => {
15525
- box && this.j.e.off(box, 'scroll mousewheel', up);
15526
- });
15527
+ if (this.j.container.isConnected) {
15528
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .i.up(this.j.container, box => {
15529
+ box && this.j.e.off(box, 'scroll mousewheel', up);
15530
+ });
15531
+ }
15527
15532
  }
15528
15533
  /**
15529
15534
  * Set ZIndex
@@ -16654,18 +16659,12 @@ let Jodit = Jodit_1 = class Jodit extends jodit_modules__WEBPACK_IMPORTED_MODULE
16654
16659
  }
16655
16660
  if (result !== false) {
16656
16661
  this.s.focus();
16657
- if (command === 'selectall') {
16658
- this.s.select(this.editor, true);
16659
- this.s.expandSelection();
16662
+ try {
16663
+ result = this.nativeExecCommand(command, showUI, value);
16660
16664
  }
16661
- else {
16662
- try {
16663
- result = this.nativeExecCommand(command, showUI, value);
16664
- }
16665
- catch (e) {
16666
- if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.IS_PROD) {
16667
- throw e;
16668
- }
16665
+ catch (e) {
16666
+ if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.IS_PROD) {
16667
+ throw e;
16669
16668
  }
16670
16669
  }
16671
16670
  }
@@ -16676,7 +16675,7 @@ let Jodit = Jodit_1 = class Jodit extends jodit_modules__WEBPACK_IMPORTED_MODULE
16676
16675
  * @param third - The third option is for the team
16677
16676
  */
16678
16677
  this.e.fire('afterCommand', command, showUI, value);
16679
- this.setEditorValue(); // synchrony
16678
+ this.__imdSynchronizeValues(); // synchrony
16680
16679
  return result;
16681
16680
  }
16682
16681
  /**
@@ -17523,7 +17522,8 @@ let ContextMenu = class ContextMenu extends jodit_core_ui_popup__WEBPACK_IMPORTE
17523
17522
  * ```
17524
17523
  */
17525
17524
  show(x, y, actions) {
17526
- const self = this, content = this.j.c.div(this.getFullElName('actions'));
17525
+ const self = this;
17526
+ self.clear();
17527
17527
  if (!(0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_2__/* .isArray */ .kJ)(actions)) {
17528
17528
  return;
17529
17529
  }
@@ -17537,12 +17537,13 @@ let ContextMenu = class ContextMenu extends jodit_core_ui_popup__WEBPACK_IMPORTE
17537
17537
  action.onAction((e) => {
17538
17538
  var _a;
17539
17539
  (_a = item.exec) === null || _a === void 0 ? void 0 : _a.call(self, e);
17540
+ self.clear();
17540
17541
  self.close();
17541
17542
  return false;
17542
17543
  });
17543
- content.appendChild(action.container);
17544
+ this.append(action);
17544
17545
  });
17545
- this.setContent(content).open(() => ({ left: x, top: y, width: 0, height: 0 }), true);
17546
+ this.open(() => ({ left: x, top: y, width: 0, height: 0 }), true);
17546
17547
  }
17547
17548
  };
17548
17549
  ContextMenu = (0,tslib__WEBPACK_IMPORTED_MODULE_3__/* .__decorate */ .gn)([
@@ -18134,10 +18135,12 @@ let Dialog = Dialog_1 = class Dialog extends jodit_core_view_view_with_toolbar__
18134
18135
  this.getMod('static') === true) {
18135
18136
  return this;
18136
18137
  }
18138
+ const { e } = this;
18137
18139
  /**
18138
18140
  * Called up to close the window
18139
18141
  */
18140
- if (this.e.fire('beforeClose', this) === false) {
18142
+ if (e.fire(this, 'beforeClose') === false ||
18143
+ e.fire('beforeClose', this) === false) {
18141
18144
  return this;
18142
18145
  }
18143
18146
  this.setMod('active', false);
@@ -18150,8 +18153,8 @@ let Dialog = Dialog_1 = class Dialog extends jodit_core_view_view_with_toolbar__
18150
18153
  /**
18151
18154
  * It called after the window is closed
18152
18155
  */
18153
- this.e.fire(this, 'afterClose');
18154
- this.e.fire(this.ow, 'joditCloseDialog');
18156
+ e.fire(this, 'afterClose');
18157
+ e.fire(this.ow, 'joditCloseDialog');
18155
18158
  if (this.destroyAfterClose) {
18156
18159
  this.destruct();
18157
18160
  }
@@ -18595,7 +18598,9 @@ const CLASS_PREVIEW = 'jodit-file-browser-preview', preview_tpl_next = (next = '
18595
18598
  ]);
18596
18599
  }, self.defaultTimeout);
18597
18600
  self.e
18598
- .on('beforeClose', () => contextmenu.close())
18601
+ .on('beforeClose', () => {
18602
+ contextmenu.close();
18603
+ })
18599
18604
  .on('beforeDestruct', () => contextmenu.destruct());
18600
18605
  e.stopPropagation();
18601
18606
  e.preventDefault();
@@ -19075,7 +19080,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__/* .Config */ .D.prototype.controls.fil
19075
19080
 
19076
19081
 
19077
19082
  const DEFAULT_SOURCE_NAME = 'default';
19078
- const possibleRules = [
19083
+ const possibleRules = new Set([
19079
19084
  'allowFiles',
19080
19085
  'allowFileMove',
19081
19086
  'allowFileUpload',
@@ -19089,7 +19094,7 @@ const possibleRules = [
19089
19094
  'allowFolderRename',
19090
19095
  'allowImageResize',
19091
19096
  'allowImageCrop'
19092
- ];
19097
+ ]);
19093
19098
  let DataProvider = class DataProvider {
19094
19099
  constructor(parent, options) {
19095
19100
  this.parent = parent;
@@ -19170,13 +19175,13 @@ let DataProvider = class DataProvider {
19170
19175
  canI(action) {
19171
19176
  const rule = 'allow' + action;
19172
19177
  if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_4__.IS_PROD) {
19173
- if (!possibleRules.includes(rule)) {
19178
+ if (!possibleRules.has(rule)) {
19174
19179
  throw (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)('Wrong action ' + action);
19175
19180
  }
19176
19181
  }
19177
- const preset = this.o.permissionsPresets[rule];
19178
- if (preset !== undefined) {
19179
- return preset;
19182
+ const presetValue = this.o.permissionsPresets[rule];
19183
+ if (presetValue !== undefined) {
19184
+ return presetValue;
19180
19185
  }
19181
19186
  return (this.__currentPermissions == null ||
19182
19187
  this.__currentPermissions[rule] === undefined ||
@@ -19690,11 +19695,7 @@ let FileBrowser = class FileBrowser extends jodit_core_view_view_with_toolbar__W
19690
19695
  minHeight: 300,
19691
19696
  buttons: (_a = this.o.headerButtons) !== null && _a !== void 0 ? _a : ['fullsize', 'dialog.close']
19692
19697
  });
19693
- ['afterClose', 'beforeOpen'].forEach(proxyEvent => {
19694
- dialog.events.on(dialog, proxyEvent, () => {
19695
- this.e.fire(proxyEvent);
19696
- });
19697
- });
19698
+ ['beforeClose', 'afterClose', 'beforeOpen'].forEach(proxyEvent => dialog.events.on(dialog, proxyEvent, () => this.e.fire(proxyEvent)));
19698
19699
  dialog.setSize(this.o.width, this.o.height);
19699
19700
  return dialog;
19700
19701
  }
@@ -37795,13 +37796,20 @@ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_0__/* .Plugin */
37795
37796
  }
37796
37797
  beforeCommandCut(command) {
37797
37798
  const { s } = this.j;
37798
- if (command === 'cut' && !s.isCollapsed()) {
37799
+ if (!s.isCollapsed()) {
37799
37800
  const current = s.current();
37800
37801
  if (current && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .i.isOrContains(this.j.editor, current)) {
37801
37802
  this.onCopyNormalizeSelectionBound();
37802
37803
  }
37803
37804
  }
37804
37805
  }
37806
+ beforeCommandSelectall(command) {
37807
+ const { s } = this.j;
37808
+ s.focus();
37809
+ s.select(this.j.editor, true);
37810
+ s.expandSelection();
37811
+ return false;
37812
+ }
37805
37813
  onCopyNormalizeSelectionBound(e) {
37806
37814
  const { s, editor, o } = this.j;
37807
37815
  if (!o.select.normalizeSelectionBeforeCutAndCopy || s.isCollapsed()) {
@@ -37823,8 +37831,11 @@ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_0__/* .Plugin */
37823
37831
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)('ow:click')
37824
37832
  ], select.prototype, "onOutsideClick", null);
37825
37833
  (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .gn)([
37826
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)([':beforeCommand'])
37834
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)([':beforeCommandCut'])
37827
37835
  ], select.prototype, "beforeCommandCut", null);
37836
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .gn)([
37837
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)([':beforeCommandSelectall'])
37838
+ ], select.prototype, "beforeCommandSelectall", null);
37828
37839
  (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .gn)([
37829
37840
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)([':copy', ':cut'])
37830
37841
  ], select.prototype, "onCopyNormalizeSelectionBound", null);