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/es2015/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 = "es2015";
1697
1697
  const IS_ES_MODERN = true;
@@ -11009,7 +11009,8 @@ class Selection {
11009
11009
  if (this.isCollapsed()) {
11010
11010
  return this;
11011
11011
  }
11012
- const { range } = this, c = range.cloneRange();
11012
+ const { range } = this;
11013
+ const c = range.cloneRange();
11013
11014
  if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .i.isOrContains(this.j.editor, range.commonAncestorContainer, true)) {
11014
11015
  return this;
11015
11016
  }
@@ -11057,6 +11058,9 @@ class Selection {
11057
11058
  }
11058
11059
  this.selectRange(c);
11059
11060
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .i.safeRemove(leftFake, rightFake);
11061
+ if (this.isCollapsed()) {
11062
+ throw (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.error)('Selection is collapsed');
11063
+ }
11060
11064
  return this;
11061
11065
  }
11062
11066
  }
@@ -15463,10 +15467,11 @@ class Popup extends jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_3__/* .UI
15463
15467
  .off(this.container, 'scroll mousewheel', up)
15464
15468
  .off(ow, 'scroll', up)
15465
15469
  .off(ow, 'resize', up);
15466
- void 0;
15467
- jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .i.up(this.j.container, box => {
15468
- box && this.j.e.off(box, 'scroll mousewheel', up);
15469
- });
15470
+ if (this.j.container.isConnected) {
15471
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .i.up(this.j.container, box => {
15472
+ box && this.j.e.off(box, 'scroll mousewheel', up);
15473
+ });
15474
+ }
15470
15475
  }
15471
15476
  /**
15472
15477
  * Set ZIndex
@@ -16597,18 +16602,12 @@ let Jodit = Jodit_1 = class Jodit extends jodit_modules__WEBPACK_IMPORTED_MODULE
16597
16602
  }
16598
16603
  if (result !== false) {
16599
16604
  this.s.focus();
16600
- if (command === 'selectall') {
16601
- this.s.select(this.editor, true);
16602
- this.s.expandSelection();
16605
+ try {
16606
+ result = this.nativeExecCommand(command, showUI, value);
16603
16607
  }
16604
- else {
16605
- try {
16606
- result = this.nativeExecCommand(command, showUI, value);
16607
- }
16608
- catch (e) {
16609
- if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.IS_PROD) {
16610
- throw e;
16611
- }
16608
+ catch (e) {
16609
+ if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.IS_PROD) {
16610
+ throw e;
16612
16611
  }
16613
16612
  }
16614
16613
  }
@@ -16619,7 +16618,7 @@ let Jodit = Jodit_1 = class Jodit extends jodit_modules__WEBPACK_IMPORTED_MODULE
16619
16618
  * @param third - The third option is for the team
16620
16619
  */
16621
16620
  this.e.fire('afterCommand', command, showUI, value);
16622
- this.setEditorValue(); // synchrony
16621
+ this.__imdSynchronizeValues(); // synchrony
16623
16622
  return result;
16624
16623
  }
16625
16624
  /**
@@ -17463,7 +17462,8 @@ let ContextMenu = class ContextMenu extends jodit_core_ui_popup__WEBPACK_IMPORTE
17463
17462
  * ```
17464
17463
  */
17465
17464
  show(x, y, actions) {
17466
- const self = this, content = this.j.c.div(this.getFullElName('actions'));
17465
+ const self = this;
17466
+ self.clear();
17467
17467
  if (!(0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_2__/* .isArray */ .kJ)(actions)) {
17468
17468
  return;
17469
17469
  }
@@ -17477,12 +17477,13 @@ let ContextMenu = class ContextMenu extends jodit_core_ui_popup__WEBPACK_IMPORTE
17477
17477
  action.onAction((e) => {
17478
17478
  var _a;
17479
17479
  (_a = item.exec) === null || _a === void 0 ? void 0 : _a.call(self, e);
17480
+ self.clear();
17480
17481
  self.close();
17481
17482
  return false;
17482
17483
  });
17483
- content.appendChild(action.container);
17484
+ this.append(action);
17484
17485
  });
17485
- this.setContent(content).open(() => ({ left: x, top: y, width: 0, height: 0 }), true);
17486
+ this.open(() => ({ left: x, top: y, width: 0, height: 0 }), true);
17486
17487
  }
17487
17488
  };
17488
17489
  ContextMenu = (0,tslib__WEBPACK_IMPORTED_MODULE_3__/* .__decorate */ .gn)([
@@ -18074,10 +18075,12 @@ let Dialog = Dialog_1 = class Dialog extends jodit_core_view_view_with_toolbar__
18074
18075
  this.getMod('static') === true) {
18075
18076
  return this;
18076
18077
  }
18078
+ const { e } = this;
18077
18079
  /**
18078
18080
  * Called up to close the window
18079
18081
  */
18080
- if (this.e.fire('beforeClose', this) === false) {
18082
+ if (e.fire(this, 'beforeClose') === false ||
18083
+ e.fire('beforeClose', this) === false) {
18081
18084
  return this;
18082
18085
  }
18083
18086
  this.setMod('active', false);
@@ -18090,8 +18093,8 @@ let Dialog = Dialog_1 = class Dialog extends jodit_core_view_view_with_toolbar__
18090
18093
  /**
18091
18094
  * It called after the window is closed
18092
18095
  */
18093
- this.e.fire(this, 'afterClose');
18094
- this.e.fire(this.ow, 'joditCloseDialog');
18096
+ e.fire(this, 'afterClose');
18097
+ e.fire(this.ow, 'joditCloseDialog');
18095
18098
  if (this.destroyAfterClose) {
18096
18099
  this.destruct();
18097
18100
  }
@@ -18533,7 +18536,9 @@ const CLASS_PREVIEW = 'jodit-file-browser-preview', preview_tpl_next = (next = '
18533
18536
  ]);
18534
18537
  }, self.defaultTimeout);
18535
18538
  self.e
18536
- .on('beforeClose', () => contextmenu.close())
18539
+ .on('beforeClose', () => {
18540
+ contextmenu.close();
18541
+ })
18537
18542
  .on('beforeDestruct', () => contextmenu.destruct());
18538
18543
  e.stopPropagation();
18539
18544
  e.preventDefault();
@@ -19003,7 +19008,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__/* .Config */ .D.prototype.controls.fil
19003
19008
 
19004
19009
 
19005
19010
  const DEFAULT_SOURCE_NAME = 'default';
19006
- const possibleRules = [
19011
+ const possibleRules = new Set([
19007
19012
  'allowFiles',
19008
19013
  'allowFileMove',
19009
19014
  'allowFileUpload',
@@ -19017,7 +19022,7 @@ const possibleRules = [
19017
19022
  'allowFolderRename',
19018
19023
  'allowImageResize',
19019
19024
  'allowImageCrop'
19020
- ];
19025
+ ]);
19021
19026
  let DataProvider = class DataProvider {
19022
19027
  constructor(parent, options) {
19023
19028
  this.parent = parent;
@@ -19100,13 +19105,13 @@ let DataProvider = class DataProvider {
19100
19105
  canI(action) {
19101
19106
  const rule = 'allow' + action;
19102
19107
  if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_4__.IS_PROD) {
19103
- if (!possibleRules.includes(rule)) {
19108
+ if (!possibleRules.has(rule)) {
19104
19109
  throw (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)('Wrong action ' + action);
19105
19110
  }
19106
19111
  }
19107
- const preset = this.o.permissionsPresets[rule];
19108
- if (preset !== undefined) {
19109
- return preset;
19112
+ const presetValue = this.o.permissionsPresets[rule];
19113
+ if (presetValue !== undefined) {
19114
+ return presetValue;
19110
19115
  }
19111
19116
  return (this.__currentPermissions == null ||
19112
19117
  this.__currentPermissions[rule] === undefined ||
@@ -19622,11 +19627,7 @@ let FileBrowser = class FileBrowser extends jodit_core_view_view_with_toolbar__W
19622
19627
  minHeight: 300,
19623
19628
  buttons: (_a = this.o.headerButtons) !== null && _a !== void 0 ? _a : ['fullsize', 'dialog.close']
19624
19629
  });
19625
- ['afterClose', 'beforeOpen'].forEach(proxyEvent => {
19626
- dialog.events.on(dialog, proxyEvent, () => {
19627
- this.e.fire(proxyEvent);
19628
- });
19629
- });
19630
+ ['beforeClose', 'afterClose', 'beforeOpen'].forEach(proxyEvent => dialog.events.on(dialog, proxyEvent, () => this.e.fire(proxyEvent)));
19630
19631
  dialog.setSize(this.o.width, this.o.height);
19631
19632
  return dialog;
19632
19633
  }
@@ -37724,13 +37725,20 @@ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_0__/* .Plugin */
37724
37725
  }
37725
37726
  beforeCommandCut(command) {
37726
37727
  const { s } = this.j;
37727
- if (command === 'cut' && !s.isCollapsed()) {
37728
+ if (!s.isCollapsed()) {
37728
37729
  const current = s.current();
37729
37730
  if (current && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .i.isOrContains(this.j.editor, current)) {
37730
37731
  this.onCopyNormalizeSelectionBound();
37731
37732
  }
37732
37733
  }
37733
37734
  }
37735
+ beforeCommandSelectall(command) {
37736
+ const { s } = this.j;
37737
+ s.focus();
37738
+ s.select(this.j.editor, true);
37739
+ s.expandSelection();
37740
+ return false;
37741
+ }
37734
37742
  onCopyNormalizeSelectionBound(e) {
37735
37743
  const { s, editor, o } = this.j;
37736
37744
  if (!o.select.normalizeSelectionBeforeCutAndCopy || s.isCollapsed()) {
@@ -37752,8 +37760,11 @@ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_0__/* .Plugin */
37752
37760
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)('ow:click')
37753
37761
  ], select.prototype, "onOutsideClick", null);
37754
37762
  (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .gn)([
37755
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)([':beforeCommand'])
37763
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)([':beforeCommandCut'])
37756
37764
  ], select.prototype, "beforeCommandCut", null);
37765
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .gn)([
37766
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)([':beforeCommandSelectall'])
37767
+ ], select.prototype, "beforeCommandSelectall", null);
37757
37768
  (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .gn)([
37758
37769
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)([':copy', ':cut'])
37759
37770
  ], select.prototype, "onCopyNormalizeSelectionBound", null);