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/es2021/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
  */
@@ -1692,7 +1692,7 @@ __webpack_require__.r(__webpack_exports__);
1692
1692
  * Released under MIT see LICENSE.txt in the project root for license information.
1693
1693
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
1694
1694
  */
1695
- const APP_VERSION = "4.0.1";
1695
+ const APP_VERSION = "4.0.3";
1696
1696
  // prettier-ignore
1697
1697
  const ES = "es2021";
1698
1698
  const IS_ES_MODERN = true;
@@ -10966,7 +10966,8 @@ class Selection {
10966
10966
  if (this.isCollapsed()) {
10967
10967
  return this;
10968
10968
  }
10969
- const { range } = this, c = range.cloneRange();
10969
+ const { range } = this;
10970
+ const c = range.cloneRange();
10970
10971
  if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .i.isOrContains(this.j.editor, range.commonAncestorContainer, true)) {
10971
10972
  return this;
10972
10973
  }
@@ -11014,6 +11015,9 @@ class Selection {
11014
11015
  }
11015
11016
  this.selectRange(c);
11016
11017
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .i.safeRemove(leftFake, rightFake);
11018
+ if (this.isCollapsed()) {
11019
+ throw (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.error)('Selection is collapsed');
11020
+ }
11017
11021
  return this;
11018
11022
  }
11019
11023
  }
@@ -15472,10 +15476,11 @@ class Popup extends jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_3__/* .UI
15472
15476
  .off(this.container, 'scroll mousewheel', up)
15473
15477
  .off(ow, 'scroll', up)
15474
15478
  .off(ow, 'resize', up);
15475
- void 0;
15476
- jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .i.up(this.j.container, box => {
15477
- box && this.j.e.off(box, 'scroll mousewheel', up);
15478
- });
15479
+ if (this.j.container.isConnected) {
15480
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .i.up(this.j.container, box => {
15481
+ box && this.j.e.off(box, 'scroll mousewheel', up);
15482
+ });
15483
+ }
15479
15484
  }
15480
15485
  /**
15481
15486
  * Set ZIndex
@@ -16605,18 +16610,12 @@ let Jodit = Jodit_1 = class Jodit extends jodit_modules__WEBPACK_IMPORTED_MODULE
16605
16610
  }
16606
16611
  if (result !== false) {
16607
16612
  this.s.focus();
16608
- if (command === 'selectall') {
16609
- this.s.select(this.editor, true);
16610
- this.s.expandSelection();
16613
+ try {
16614
+ result = this.nativeExecCommand(command, showUI, value);
16611
16615
  }
16612
- else {
16613
- try {
16614
- result = this.nativeExecCommand(command, showUI, value);
16615
- }
16616
- catch (e) {
16617
- if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.IS_PROD) {
16618
- throw e;
16619
- }
16616
+ catch (e) {
16617
+ if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.IS_PROD) {
16618
+ throw e;
16620
16619
  }
16621
16620
  }
16622
16621
  }
@@ -16627,7 +16626,7 @@ let Jodit = Jodit_1 = class Jodit extends jodit_modules__WEBPACK_IMPORTED_MODULE
16627
16626
  * @param third - The third option is for the team
16628
16627
  */
16629
16628
  this.e.fire('afterCommand', command, showUI, value);
16630
- this.setEditorValue(); // synchrony
16629
+ this.__imdSynchronizeValues(); // synchrony
16631
16630
  return result;
16632
16631
  }
16633
16632
  /**
@@ -17474,7 +17473,8 @@ let ContextMenu = class ContextMenu extends jodit_core_ui_popup__WEBPACK_IMPORTE
17474
17473
  * ```
17475
17474
  */
17476
17475
  show(x, y, actions) {
17477
- const self = this, content = this.j.c.div(this.getFullElName('actions'));
17476
+ const self = this;
17477
+ self.clear();
17478
17478
  if (!(0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_2__/* .isArray */ .kJ)(actions)) {
17479
17479
  return;
17480
17480
  }
@@ -17487,12 +17487,13 @@ let ContextMenu = class ContextMenu extends jodit_core_ui_popup__WEBPACK_IMPORTE
17487
17487
  action.setMod('context', 'menu');
17488
17488
  action.onAction((e) => {
17489
17489
  item.exec?.call(self, e);
17490
+ self.clear();
17490
17491
  self.close();
17491
17492
  return false;
17492
17493
  });
17493
- content.appendChild(action.container);
17494
+ this.append(action);
17494
17495
  });
17495
- this.setContent(content).open(() => ({ left: x, top: y, width: 0, height: 0 }), true);
17496
+ this.open(() => ({ left: x, top: y, width: 0, height: 0 }), true);
17496
17497
  }
17497
17498
  };
17498
17499
  ContextMenu = (0,tslib__WEBPACK_IMPORTED_MODULE_3__/* .__decorate */ .gn)([
@@ -18083,10 +18084,12 @@ let Dialog = Dialog_1 = class Dialog extends jodit_core_view_view_with_toolbar__
18083
18084
  this.getMod('static') === true) {
18084
18085
  return this;
18085
18086
  }
18087
+ const { e } = this;
18086
18088
  /**
18087
18089
  * Called up to close the window
18088
18090
  */
18089
- if (this.e.fire('beforeClose', this) === false) {
18091
+ if (e.fire(this, 'beforeClose') === false ||
18092
+ e.fire('beforeClose', this) === false) {
18090
18093
  return this;
18091
18094
  }
18092
18095
  this.setMod('active', false);
@@ -18099,8 +18102,8 @@ let Dialog = Dialog_1 = class Dialog extends jodit_core_view_view_with_toolbar__
18099
18102
  /**
18100
18103
  * It called after the window is closed
18101
18104
  */
18102
- this.e.fire(this, 'afterClose');
18103
- this.e.fire(this.ow, 'joditCloseDialog');
18105
+ e.fire(this, 'afterClose');
18106
+ e.fire(this.ow, 'joditCloseDialog');
18104
18107
  if (this.destroyAfterClose) {
18105
18108
  this.destruct();
18106
18109
  }
@@ -18543,7 +18546,9 @@ const CLASS_PREVIEW = 'jodit-file-browser-preview', preview_tpl_next = (next = '
18543
18546
  ]);
18544
18547
  }, self.defaultTimeout);
18545
18548
  self.e
18546
- .on('beforeClose', () => contextmenu.close())
18549
+ .on('beforeClose', () => {
18550
+ contextmenu.close();
18551
+ })
18547
18552
  .on('beforeDestruct', () => contextmenu.destruct());
18548
18553
  e.stopPropagation();
18549
18554
  e.preventDefault();
@@ -19023,7 +19028,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__/* .Config */ .D.prototype.controls.fil
19023
19028
 
19024
19029
 
19025
19030
  const DEFAULT_SOURCE_NAME = 'default';
19026
- const possibleRules = [
19031
+ const possibleRules = new Set([
19027
19032
  'allowFiles',
19028
19033
  'allowFileMove',
19029
19034
  'allowFileUpload',
@@ -19037,7 +19042,7 @@ const possibleRules = [
19037
19042
  'allowFolderRename',
19038
19043
  'allowImageResize',
19039
19044
  'allowImageCrop'
19040
- ];
19045
+ ]);
19041
19046
  let DataProvider = class DataProvider {
19042
19047
  constructor(parent, options) {
19043
19048
  this.parent = parent;
@@ -19118,13 +19123,13 @@ let DataProvider = class DataProvider {
19118
19123
  canI(action) {
19119
19124
  const rule = 'allow' + action;
19120
19125
  if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_4__.IS_PROD) {
19121
- if (!possibleRules.includes(rule)) {
19126
+ if (!possibleRules.has(rule)) {
19122
19127
  throw (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)('Wrong action ' + action);
19123
19128
  }
19124
19129
  }
19125
- const preset = this.o.permissionsPresets[rule];
19126
- if (preset !== undefined) {
19127
- return preset;
19130
+ const presetValue = this.o.permissionsPresets[rule];
19131
+ if (presetValue !== undefined) {
19132
+ return presetValue;
19128
19133
  }
19129
19134
  return (this.__currentPermissions == null ||
19130
19135
  this.__currentPermissions[rule] === undefined ||
@@ -19634,11 +19639,7 @@ let FileBrowser = class FileBrowser extends jodit_core_view_view_with_toolbar__W
19634
19639
  minHeight: 300,
19635
19640
  buttons: this.o.headerButtons ?? ['fullsize', 'dialog.close']
19636
19641
  });
19637
- ['afterClose', 'beforeOpen'].forEach(proxyEvent => {
19638
- dialog.events.on(dialog, proxyEvent, () => {
19639
- this.e.fire(proxyEvent);
19640
- });
19641
- });
19642
+ ['beforeClose', 'afterClose', 'beforeOpen'].forEach(proxyEvent => dialog.events.on(dialog, proxyEvent, () => this.e.fire(proxyEvent)));
19642
19643
  dialog.setSize(this.o.width, this.o.height);
19643
19644
  return dialog;
19644
19645
  }
@@ -37686,13 +37687,20 @@ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_0__/* .Plugin */
37686
37687
  }
37687
37688
  beforeCommandCut(command) {
37688
37689
  const { s } = this.j;
37689
- if (command === 'cut' && !s.isCollapsed()) {
37690
+ if (!s.isCollapsed()) {
37690
37691
  const current = s.current();
37691
37692
  if (current && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .i.isOrContains(this.j.editor, current)) {
37692
37693
  this.onCopyNormalizeSelectionBound();
37693
37694
  }
37694
37695
  }
37695
37696
  }
37697
+ beforeCommandSelectall(command) {
37698
+ const { s } = this.j;
37699
+ s.focus();
37700
+ s.select(this.j.editor, true);
37701
+ s.expandSelection();
37702
+ return false;
37703
+ }
37696
37704
  onCopyNormalizeSelectionBound(e) {
37697
37705
  const { s, editor, o } = this.j;
37698
37706
  if (!o.select.normalizeSelectionBeforeCutAndCopy || s.isCollapsed()) {
@@ -37714,8 +37722,11 @@ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_0__/* .Plugin */
37714
37722
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)('ow:click')
37715
37723
  ], select.prototype, "onOutsideClick", null);
37716
37724
  (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .gn)([
37717
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)([':beforeCommand'])
37725
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)([':beforeCommandCut'])
37718
37726
  ], select.prototype, "beforeCommandCut", null);
37727
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .gn)([
37728
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)([':beforeCommandSelectall'])
37729
+ ], select.prototype, "beforeCommandSelectall", null);
37719
37730
  (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .gn)([
37720
37731
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)([':copy', ':cut'])
37721
37732
  ], select.prototype, "onCopyNormalizeSelectionBound", null);