jodit 4.2.18 → 4.2.21

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 (70) hide show
  1. package/CHANGELOG.md +18 -7
  2. package/es2015/jodit.css +47 -1
  3. package/es2015/jodit.fat.min.css +1 -1
  4. package/es2015/jodit.fat.min.js +2 -2
  5. package/es2015/jodit.js +76 -64
  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 +47 -1
  14. package/es2018/jodit.fat.min.css +1 -1
  15. package/es2018/jodit.fat.min.js +2 -2
  16. package/es2018/jodit.js +76 -64
  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 +47 -1
  25. package/es2021/jodit.fat.min.css +1 -1
  26. package/es2021/jodit.fat.min.js +2 -2
  27. package/es2021/jodit.js +76 -64
  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 +47 -1
  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 +76 -64
  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 +77 -2
  47. package/es5/jodit.fat.min.css +1 -1
  48. package/es5/jodit.fat.min.js +2 -2
  49. package/es5/jodit.js +79 -63
  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/ui/button/button/button.d.ts +1 -0
  59. package/esm/core/ui/button/button/button.js +7 -0
  60. package/esm/core/ui/button/tooltip/tooltip.d.ts +3 -4
  61. package/esm/core/ui/button/tooltip/tooltip.js +44 -44
  62. package/esm/modules/toolbar/button/button.d.ts +1 -0
  63. package/esm/modules/toolbar/collection/collection.js +1 -1
  64. package/esm/modules/widget/tabs/tabs.js +21 -16
  65. package/esm/types/ui.d.ts +1 -0
  66. package/package.json +1 -1
  67. package/types/core/ui/button/button/button.d.ts +1 -0
  68. package/types/core/ui/button/tooltip/tooltip.d.ts +3 -4
  69. package/types/modules/toolbar/button/button.d.ts +1 -0
  70. package/types/types/ui.d.ts +1 -0
package/es2015/jodit.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.2.18
4
+ * Version: v4.2.21
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1736,7 +1736,7 @@ __webpack_require__.r(__webpack_exports__);
1736
1736
  * Released under MIT see LICENSE.txt in the project root for license information.
1737
1737
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
1738
1738
  */
1739
- const APP_VERSION = "4.2.18";
1739
+ const APP_VERSION = "4.2.21";
1740
1740
  // prettier-ignore
1741
1741
  const ES = "es2015";
1742
1742
  const IS_ES_MODERN = true;
@@ -12972,6 +12972,7 @@ class Mods {
12972
12972
  const UIButtonState = () => ({
12973
12973
  size: 'middle',
12974
12974
  type: 'button',
12975
+ role: 'button',
12975
12976
  name: '',
12976
12977
  value: '',
12977
12978
  variant: 'initial',
@@ -13020,6 +13021,9 @@ let UIButton = class UIButton extends jodit_core_ui_element__WEBPACK_IMPORTED_MO
13020
13021
  onChangeType() {
13021
13022
  (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_3__.attr)(this.container, 'type', this.state.type);
13022
13023
  }
13024
+ onChangeRole() {
13025
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_3__.attr)(this.container, 'role', this.state.role);
13026
+ }
13023
13027
  /**
13024
13028
  * Set size from a parent list
13025
13029
  */
@@ -13149,6 +13153,9 @@ let UIButton = class UIButton extends jodit_core_ui_element__WEBPACK_IMPORTED_MO
13149
13153
  (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
13150
13154
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)('state.type', { immediately: false })
13151
13155
  ], UIButton.prototype, "onChangeType", null);
13156
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
13157
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)('state.role', { immediately: false })
13158
+ ], UIButton.prototype, "onChangeRole", null);
13152
13159
  (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
13153
13160
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)('parentElement')
13154
13161
  ], UIButton.prototype, "updateSize", null);
@@ -13360,6 +13367,19 @@ var UITooltip_1;
13360
13367
 
13361
13368
 
13362
13369
 
13370
+ const WINDOW_EVENTS_ON_HIDE = [
13371
+ 'scroll.tooltip',
13372
+ 'joditCloseDialog',
13373
+ 'mouseleave.tooltip'
13374
+ ];
13375
+ const JODIT_EVENTS_ON_HIDE = [
13376
+ 'escape.tooltip',
13377
+ 'change.tooltip',
13378
+ 'changePlace.tooltip',
13379
+ 'afterOpenPopup.tooltip',
13380
+ 'hidePopup.tooltip',
13381
+ 'closeAllPopups.tooltip'
13382
+ ];
13363
13383
  let UITooltip = UITooltip_1 = class UITooltip extends jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_5__/* .UIElement */ .D {
13364
13384
  className() {
13365
13385
  return 'UITooltip';
@@ -13378,7 +13398,7 @@ let UITooltip = UITooltip_1 = class UITooltip extends jodit_core_ui_element__WEB
13378
13398
  view.o.showTooltip &&
13379
13399
  !view.o.useNativeTooltip) {
13380
13400
  view.hookStatus(jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .STATUSES */ .f.ready, () => {
13381
- // TODO Move it inside __open method. Now it is here because testcase failed with capturing
13401
+ // TODO Move it inside __show method. Now it is here because testcase failed with capturing
13382
13402
  (0,jodit_core_global__WEBPACK_IMPORTED_MODULE_3__/* .getContainer */ .My)(this.j, UITooltip_1).appendChild(this.container);
13383
13403
  view.e.on(view.container, 'mouseenter.tooltip', this.__onMouseEnter, {
13384
13404
  capture: true
@@ -13386,44 +13406,28 @@ let UITooltip = UITooltip_1 = class UITooltip extends jodit_core_ui_element__WEB
13386
13406
  });
13387
13407
  }
13388
13408
  }
13389
- __addListenersOnClose() {
13409
+ __addListenersOnEnter() {
13390
13410
  if (this.__listenClose) {
13391
13411
  return;
13392
13412
  }
13393
13413
  this.__listenClose = true;
13394
13414
  const view = this.j;
13395
13415
  view.e
13396
- .on(view.ow, 'scroll.tooltip', this.__hide)
13397
- .on(view.ow, 'joditCloseDialog', this.__hide)
13398
- .on(view.container, 'mouseleave.tooltip', this.__hide)
13399
- .on([
13400
- 'escape.tooltip',
13401
- 'change.tooltip',
13402
- 'changePlace.tooltip',
13403
- 'afterOpenPopup.tooltip',
13404
- 'hidePopup.tooltip',
13405
- 'closeAllPopups.tooltip'
13406
- ], this.__hide)
13407
- .on(view.container, 'mouseleave', this.__onMouseLeave, {
13416
+ .on(view.ow, WINDOW_EVENTS_ON_HIDE, this.__hide)
13417
+ .on(JODIT_EVENTS_ON_HIDE, this.__hide)
13418
+ .on(view.container, 'mouseleave.tooltip', this.__onMouseLeave, {
13408
13419
  capture: true
13409
13420
  });
13410
13421
  }
13411
- __removeListenersOnClose() {
13422
+ __removeListenersOnLeave() {
13412
13423
  if (!this.__listenClose) {
13413
13424
  return;
13414
13425
  }
13415
13426
  this.__listenClose = false;
13416
13427
  const view = this.j;
13417
13428
  view.e
13418
- .off(view.ow, 'scroll.tooltip', this.__hide)
13419
- .off([
13420
- 'escape.tooltip',
13421
- 'change.tooltip',
13422
- 'changePlace.tooltip',
13423
- 'afterOpenPopup.tooltip',
13424
- 'hidePopup.tooltip',
13425
- 'closeAllPopups.tooltip'
13426
- ], this.__hide)
13429
+ .off(view.ow, WINDOW_EVENTS_ON_HIDE, this.__hide)
13430
+ .off(JODIT_EVENTS_ON_HIDE, this.__hide)
13427
13431
  .off(view.container, 'mouseleave.tooltip', this.__onMouseLeave);
13428
13432
  }
13429
13433
  __onMouseLeave(e) {
@@ -13449,29 +13453,30 @@ let UITooltip = UITooltip_1 = class UITooltip extends jodit_core_ui_element__WEB
13449
13453
  return;
13450
13454
  }
13451
13455
  this.__currentTarget = e.target;
13452
- const pos = (0,jodit_core_helpers_size_position__WEBPACK_IMPORTED_MODULE_6__/* .position */ .G)(e.target);
13453
- this.__addListenersOnClose();
13454
- this.__delayOpen(() => ({
13455
- x: pos.left + pos.width / 2,
13456
- y: pos.top + pos.height
13457
- }), tooltip);
13458
- }
13459
- __delayOpen(getPoint, content) {
13460
- const to = this.j.o.showTooltipDelay || this.j.defaultTimeout;
13456
+ const target = e.target;
13457
+ this.__open(() => {
13458
+ const pos = (0,jodit_core_helpers_size_position__WEBPACK_IMPORTED_MODULE_6__/* .position */ .G)(target);
13459
+ return {
13460
+ x: pos.left + pos.width / 2,
13461
+ y: pos.top + pos.height
13462
+ };
13463
+ }, tooltip);
13464
+ }
13465
+ __open(getPoint, content) {
13466
+ this.__addListenersOnEnter();
13467
+ this.__isOpened = true;
13461
13468
  this.j.async.clearTimeout(this.__hideTimeout);
13462
13469
  this.j.async.clearTimeout(this.__delayShowTimeout);
13463
- this.__delayShowTimeout = this.j.async.setTimeout(() => this.__open(getPoint, content), {
13464
- timeout: to,
13465
- label: 'tooltip'
13466
- });
13470
+ const to = this.j.o.showTooltipDelay || this.j.defaultTimeout;
13471
+ if (!to) {
13472
+ this.__show(getPoint, content);
13473
+ return;
13474
+ }
13475
+ this.__delayShowTimeout = this.j.async.setTimeout(() => this.__show(getPoint, content), to);
13467
13476
  }
13468
- __open(getPoint, content) {
13477
+ __show(getPoint, content) {
13469
13478
  this.setMod('visible', true);
13470
13479
  this.getElm('content').innerHTML = content;
13471
- this.__isOpened = true;
13472
- this.__setPosition(getPoint);
13473
- }
13474
- __setPosition(getPoint) {
13475
13480
  const point = getPoint();
13476
13481
  (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_4__.css)(this.container, {
13477
13482
  left: point.x,
@@ -13481,24 +13486,26 @@ let UITooltip = UITooltip_1 = class UITooltip extends jodit_core_ui_element__WEB
13481
13486
  __hide() {
13482
13487
  this.j.async.clearTimeout(this.__delayShowTimeout);
13483
13488
  this.j.async.clearTimeout(this.__hideTimeout);
13484
- this.__removeListenersOnClose();
13489
+ this.__removeListenersOnLeave();
13485
13490
  if (this.__isOpened) {
13486
13491
  this.__isOpened = false;
13487
13492
  this.setMod('visible', false);
13493
+ this.getElm('content').innerHTML = '';
13488
13494
  (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_4__.css)(this.container, {
13489
13495
  left: -5000
13490
13496
  });
13491
13497
  }
13492
13498
  }
13493
13499
  __hideDelay() {
13500
+ this.j.async.clearTimeout(this.__delayShowTimeout);
13501
+ this.j.async.clearTimeout(this.__hideTimeout);
13494
13502
  if (!this.__isOpened) {
13495
13503
  return;
13496
13504
  }
13497
- this.j.async.clearTimeout(this.__delayShowTimeout);
13498
13505
  this.__hideTimeout = this.async.setTimeout(this.__hide, this.j.defaultTimeout);
13499
13506
  }
13500
13507
  destruct() {
13501
- this.j.e.off(this.j.container, 'mouseenter', this.__onMouseEnter);
13508
+ this.j.e.off(this.j.container, 'mouseenter.tooltip', this.__onMouseEnter);
13502
13509
  this.__hide();
13503
13510
  super.destruct();
13504
13511
  }
@@ -23560,7 +23567,7 @@ let ToolbarCollection = class ToolbarCollection extends jodit_core_ui__WEBPACK_I
23560
23567
  jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.autobind
23561
23568
  ], ToolbarCollection.prototype, "__immediateUpdate", null);
23562
23569
  (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
23563
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.debounce)()
23570
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.debounce)(ctx => ctx.j.defaultTimeout, true)
23564
23571
  ], ToolbarCollection.prototype, "update", null);
23565
23572
  (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
23566
23573
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.hook)('ready')
@@ -24738,8 +24745,8 @@ function val(elm, selector, value) {
24738
24745
  /* harmony export */ });
24739
24746
  /* harmony import */ var jodit_core_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(77753);
24740
24747
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(55186);
24741
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(65147);
24742
24748
  /* harmony import */ var jodit_core_helpers_checker_is_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(69052);
24749
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(26150);
24743
24750
  /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(53048);
24744
24751
  /*!
24745
24752
  * Jodit Editor (https://xdsoft.net/jodit/)
@@ -24781,8 +24788,16 @@ function val(elm, selector, value) {
24781
24788
  * ```
24782
24789
  */
24783
24790
  const TabsWidget = (jodit, tabs, state) => {
24784
- const box = jodit.c.div('jodit-tabs'), tabBox = jodit.c.div('jodit-tabs__wrapper'), buttons = jodit.c.div('jodit-tabs__buttons'), nameToTab = {}, buttonList = [];
24785
- let firstTab = '', tabCount = 0;
24791
+ const box = jodit.c.div('jodit-tabs');
24792
+ const tabBox = jodit.c.div('jodit-tabs__wrapper');
24793
+ const buttons = jodit.c.div('jodit-tabs__buttons');
24794
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__/* .attr */ .C)(buttons, {
24795
+ role: 'tablist',
24796
+ 'aria-orientation': 'horizontal'
24797
+ });
24798
+ const nameToTab = {};
24799
+ const buttonList = [];
24800
+ let firstTab = '';
24786
24801
  box.appendChild(buttons);
24787
24802
  box.appendChild(tabBox);
24788
24803
  const setActive = (tab) => {
@@ -24790,20 +24805,21 @@ const TabsWidget = (jodit, tabs, state) => {
24790
24805
  return;
24791
24806
  }
24792
24807
  buttonList.forEach(b => {
24793
- b.state.variant = 'initial';
24794
24808
  b.state.activated = false;
24795
24809
  });
24796
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.$$)('.jodit-tab', tabBox).forEach(a => {
24797
- a.classList.remove('jodit-tab_active');
24798
- });
24799
- nameToTab[tab].button.state.variant = 'outline';
24810
+ Object.values(nameToTab).forEach(({ tab }) => tab.classList.remove('jodit-tab_active'));
24800
24811
  nameToTab[tab].button.state.activated = true;
24801
24812
  nameToTab[tab].tab.classList.add('jodit-tab_active');
24802
24813
  };
24803
24814
  tabs.forEach(({ icon, name, content }) => {
24804
- const tab = jodit.c.div('jodit-tab'), button = (0,jodit_core_ui__WEBPACK_IMPORTED_MODULE_3__/* .Button */ .$n)(jodit, icon || name, name);
24815
+ const tab = jodit.c.div('jodit-tab');
24816
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__/* .attr */ .C)(tab, {
24817
+ role: 'tabpanel'
24818
+ });
24819
+ const button = (0,jodit_core_ui__WEBPACK_IMPORTED_MODULE_3__/* .Button */ .$n)(jodit, icon || name, name);
24820
+ button.state.role = 'tab';
24805
24821
  // Stop lose the focus
24806
- jodit.e.on(button.container, 'mousedown', (e) => e.preventDefault());
24822
+ jodit.e.on(button.container, 'pointerdown', (e) => e.preventDefault());
24807
24823
  if (!firstTab) {
24808
24824
  firstTab = name;
24809
24825
  }
@@ -24833,13 +24849,9 @@ const TabsWidget = (jodit, tabs, state) => {
24833
24849
  button,
24834
24850
  tab
24835
24851
  };
24836
- tabCount += 1;
24837
24852
  });
24838
- if (!tabCount) {
24839
- return box;
24840
- }
24841
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.$$)('a', buttons).forEach(a => {
24842
- a.style.width = (100 / tabCount).toFixed(10) + '%';
24853
+ Object.values(nameToTab).forEach(({ button }) => {
24854
+ button.container.style.width = (100 / tabs.length).toFixed(10) + '%';
24843
24855
  });
24844
24856
  const tab = !state || !state.activeTab || !nameToTab[state.activeTab]
24845
24857
  ? firstTab