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
@@ -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
  /**
@@ -17457,7 +17456,8 @@ let ContextMenu = class ContextMenu extends jodit_core_ui_popup__WEBPACK_IMPORTE
17457
17456
  * ```
17458
17457
  */
17459
17458
  show(x, y, actions) {
17460
- const self = this, content = this.j.c.div(this.getFullElName('actions'));
17459
+ const self = this;
17460
+ self.clear();
17461
17461
  if (!(0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_2__/* .isArray */ .kJ)(actions)) {
17462
17462
  return;
17463
17463
  }
@@ -17470,12 +17470,13 @@ let ContextMenu = class ContextMenu extends jodit_core_ui_popup__WEBPACK_IMPORTE
17470
17470
  action.setMod('context', 'menu');
17471
17471
  action.onAction((e) => {
17472
17472
  item.exec?.call(self, e);
17473
+ self.clear();
17473
17474
  self.close();
17474
17475
  return false;
17475
17476
  });
17476
- content.appendChild(action.container);
17477
+ this.append(action);
17477
17478
  });
17478
- this.setContent(content).open(() => ({ left: x, top: y, width: 0, height: 0 }), true);
17479
+ this.open(() => ({ left: x, top: y, width: 0, height: 0 }), true);
17479
17480
  }
17480
17481
  };
17481
17482
  ContextMenu = (0,tslib__WEBPACK_IMPORTED_MODULE_3__/* .__decorate */ .gn)([
@@ -18066,10 +18067,12 @@ let Dialog = Dialog_1 = class Dialog extends jodit_core_view_view_with_toolbar__
18066
18067
  this.getMod('static') === true) {
18067
18068
  return this;
18068
18069
  }
18070
+ const { e } = this;
18069
18071
  /**
18070
18072
  * Called up to close the window
18071
18073
  */
18072
- if (this.e.fire('beforeClose', this) === false) {
18074
+ if (e.fire(this, 'beforeClose') === false ||
18075
+ e.fire('beforeClose', this) === false) {
18073
18076
  return this;
18074
18077
  }
18075
18078
  this.setMod('active', false);
@@ -18082,8 +18085,8 @@ let Dialog = Dialog_1 = class Dialog extends jodit_core_view_view_with_toolbar__
18082
18085
  /**
18083
18086
  * It called after the window is closed
18084
18087
  */
18085
- this.e.fire(this, 'afterClose');
18086
- this.e.fire(this.ow, 'joditCloseDialog');
18088
+ e.fire(this, 'afterClose');
18089
+ e.fire(this.ow, 'joditCloseDialog');
18087
18090
  if (this.destroyAfterClose) {
18088
18091
  this.destruct();
18089
18092
  }
@@ -18526,7 +18529,9 @@ const CLASS_PREVIEW = 'jodit-file-browser-preview', preview_tpl_next = (next = '
18526
18529
  ]);
18527
18530
  }, self.defaultTimeout);
18528
18531
  self.e
18529
- .on('beforeClose', () => contextmenu.close())
18532
+ .on('beforeClose', () => {
18533
+ contextmenu.close();
18534
+ })
18530
18535
  .on('beforeDestruct', () => contextmenu.destruct());
18531
18536
  e.stopPropagation();
18532
18537
  e.preventDefault();
@@ -19006,7 +19011,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__/* .Config */ .D.prototype.controls.fil
19006
19011
 
19007
19012
 
19008
19013
  const DEFAULT_SOURCE_NAME = 'default';
19009
- const possibleRules = [
19014
+ const possibleRules = new Set([
19010
19015
  'allowFiles',
19011
19016
  'allowFileMove',
19012
19017
  'allowFileUpload',
@@ -19020,7 +19025,7 @@ const possibleRules = [
19020
19025
  'allowFolderRename',
19021
19026
  'allowImageResize',
19022
19027
  'allowImageCrop'
19023
- ];
19028
+ ]);
19024
19029
  let DataProvider = class DataProvider {
19025
19030
  constructor(parent, options) {
19026
19031
  this.parent = parent;
@@ -19101,13 +19106,13 @@ let DataProvider = class DataProvider {
19101
19106
  canI(action) {
19102
19107
  const rule = 'allow' + action;
19103
19108
  if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_4__.IS_PROD) {
19104
- if (!possibleRules.includes(rule)) {
19109
+ if (!possibleRules.has(rule)) {
19105
19110
  throw (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)('Wrong action ' + action);
19106
19111
  }
19107
19112
  }
19108
- const preset = this.o.permissionsPresets[rule];
19109
- if (preset !== undefined) {
19110
- return preset;
19113
+ const presetValue = this.o.permissionsPresets[rule];
19114
+ if (presetValue !== undefined) {
19115
+ return presetValue;
19111
19116
  }
19112
19117
  return (this.__currentPermissions == null ||
19113
19118
  this.__currentPermissions[rule] === undefined ||
@@ -19617,11 +19622,7 @@ let FileBrowser = class FileBrowser extends jodit_core_view_view_with_toolbar__W
19617
19622
  minHeight: 300,
19618
19623
  buttons: this.o.headerButtons ?? ['fullsize', 'dialog.close']
19619
19624
  });
19620
- ['afterClose', 'beforeOpen'].forEach(proxyEvent => {
19621
- dialog.events.on(dialog, proxyEvent, () => {
19622
- this.e.fire(proxyEvent);
19623
- });
19624
- });
19625
+ ['beforeClose', 'afterClose', 'beforeOpen'].forEach(proxyEvent => dialog.events.on(dialog, proxyEvent, () => this.e.fire(proxyEvent)));
19625
19626
  dialog.setSize(this.o.width, this.o.height);
19626
19627
  return dialog;
19627
19628
  }
@@ -36913,13 +36914,20 @@ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_0__/* .Plugin */
36913
36914
  }
36914
36915
  beforeCommandCut(command) {
36915
36916
  const { s } = this.j;
36916
- if (command === 'cut' && !s.isCollapsed()) {
36917
+ if (!s.isCollapsed()) {
36917
36918
  const current = s.current();
36918
36919
  if (current && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .i.isOrContains(this.j.editor, current)) {
36919
36920
  this.onCopyNormalizeSelectionBound();
36920
36921
  }
36921
36922
  }
36922
36923
  }
36924
+ beforeCommandSelectall(command) {
36925
+ const { s } = this.j;
36926
+ s.focus();
36927
+ s.select(this.j.editor, true);
36928
+ s.expandSelection();
36929
+ return false;
36930
+ }
36923
36931
  onCopyNormalizeSelectionBound(e) {
36924
36932
  const { s, editor, o } = this.j;
36925
36933
  if (!o.select.normalizeSelectionBeforeCutAndCopy || s.isCollapsed()) {
@@ -36941,8 +36949,11 @@ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_0__/* .Plugin */
36941
36949
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)('ow:click')
36942
36950
  ], select.prototype, "onOutsideClick", null);
36943
36951
  (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .gn)([
36944
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)([':beforeCommand'])
36952
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)([':beforeCommandCut'])
36945
36953
  ], select.prototype, "beforeCommandCut", null);
36954
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .gn)([
36955
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)([':beforeCommandSelectall'])
36956
+ ], select.prototype, "beforeCommandSelectall", null);
36946
36957
  (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .gn)([
36947
36958
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)([':copy', ':cut'])
36948
36959
  ], select.prototype, "onCopyNormalizeSelectionBound", null);