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/es2018/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 = "es2018";
1742
1742
  const IS_ES_MODERN = true;
@@ -12997,6 +12997,7 @@ class Mods {
12997
12997
  const UIButtonState = () => ({
12998
12998
  size: 'middle',
12999
12999
  type: 'button',
13000
+ role: 'button',
13000
13001
  name: '',
13001
13002
  value: '',
13002
13003
  variant: 'initial',
@@ -13045,6 +13046,9 @@ let UIButton = class UIButton extends jodit_core_ui_element__WEBPACK_IMPORTED_MO
13045
13046
  onChangeType() {
13046
13047
  (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_3__.attr)(this.container, 'type', this.state.type);
13047
13048
  }
13049
+ onChangeRole() {
13050
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_3__.attr)(this.container, 'role', this.state.role);
13051
+ }
13048
13052
  /**
13049
13053
  * Set size from a parent list
13050
13054
  */
@@ -13174,6 +13178,9 @@ let UIButton = class UIButton extends jodit_core_ui_element__WEBPACK_IMPORTED_MO
13174
13178
  (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
13175
13179
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)('state.type', { immediately: false })
13176
13180
  ], UIButton.prototype, "onChangeType", null);
13181
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
13182
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)('state.role', { immediately: false })
13183
+ ], UIButton.prototype, "onChangeRole", null);
13177
13184
  (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
13178
13185
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)('parentElement')
13179
13186
  ], UIButton.prototype, "updateSize", null);
@@ -13385,6 +13392,19 @@ var UITooltip_1;
13385
13392
 
13386
13393
 
13387
13394
 
13395
+ const WINDOW_EVENTS_ON_HIDE = [
13396
+ 'scroll.tooltip',
13397
+ 'joditCloseDialog',
13398
+ 'mouseleave.tooltip'
13399
+ ];
13400
+ const JODIT_EVENTS_ON_HIDE = [
13401
+ 'escape.tooltip',
13402
+ 'change.tooltip',
13403
+ 'changePlace.tooltip',
13404
+ 'afterOpenPopup.tooltip',
13405
+ 'hidePopup.tooltip',
13406
+ 'closeAllPopups.tooltip'
13407
+ ];
13388
13408
  let UITooltip = UITooltip_1 = class UITooltip extends jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_5__/* .UIElement */ .D {
13389
13409
  className() {
13390
13410
  return 'UITooltip';
@@ -13403,7 +13423,7 @@ let UITooltip = UITooltip_1 = class UITooltip extends jodit_core_ui_element__WEB
13403
13423
  view.o.showTooltip &&
13404
13424
  !view.o.useNativeTooltip) {
13405
13425
  view.hookStatus(jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .STATUSES */ .f.ready, () => {
13406
- // TODO Move it inside __open method. Now it is here because testcase failed with capturing
13426
+ // TODO Move it inside __show method. Now it is here because testcase failed with capturing
13407
13427
  (0,jodit_core_global__WEBPACK_IMPORTED_MODULE_3__/* .getContainer */ .My)(this.j, UITooltip_1).appendChild(this.container);
13408
13428
  view.e.on(view.container, 'mouseenter.tooltip', this.__onMouseEnter, {
13409
13429
  capture: true
@@ -13411,44 +13431,28 @@ let UITooltip = UITooltip_1 = class UITooltip extends jodit_core_ui_element__WEB
13411
13431
  });
13412
13432
  }
13413
13433
  }
13414
- __addListenersOnClose() {
13434
+ __addListenersOnEnter() {
13415
13435
  if (this.__listenClose) {
13416
13436
  return;
13417
13437
  }
13418
13438
  this.__listenClose = true;
13419
13439
  const view = this.j;
13420
13440
  view.e
13421
- .on(view.ow, 'scroll.tooltip', this.__hide)
13422
- .on(view.ow, 'joditCloseDialog', this.__hide)
13423
- .on(view.container, 'mouseleave.tooltip', this.__hide)
13424
- .on([
13425
- 'escape.tooltip',
13426
- 'change.tooltip',
13427
- 'changePlace.tooltip',
13428
- 'afterOpenPopup.tooltip',
13429
- 'hidePopup.tooltip',
13430
- 'closeAllPopups.tooltip'
13431
- ], this.__hide)
13432
- .on(view.container, 'mouseleave', this.__onMouseLeave, {
13441
+ .on(view.ow, WINDOW_EVENTS_ON_HIDE, this.__hide)
13442
+ .on(JODIT_EVENTS_ON_HIDE, this.__hide)
13443
+ .on(view.container, 'mouseleave.tooltip', this.__onMouseLeave, {
13433
13444
  capture: true
13434
13445
  });
13435
13446
  }
13436
- __removeListenersOnClose() {
13447
+ __removeListenersOnLeave() {
13437
13448
  if (!this.__listenClose) {
13438
13449
  return;
13439
13450
  }
13440
13451
  this.__listenClose = false;
13441
13452
  const view = this.j;
13442
13453
  view.e
13443
- .off(view.ow, 'scroll.tooltip', this.__hide)
13444
- .off([
13445
- 'escape.tooltip',
13446
- 'change.tooltip',
13447
- 'changePlace.tooltip',
13448
- 'afterOpenPopup.tooltip',
13449
- 'hidePopup.tooltip',
13450
- 'closeAllPopups.tooltip'
13451
- ], this.__hide)
13454
+ .off(view.ow, WINDOW_EVENTS_ON_HIDE, this.__hide)
13455
+ .off(JODIT_EVENTS_ON_HIDE, this.__hide)
13452
13456
  .off(view.container, 'mouseleave.tooltip', this.__onMouseLeave);
13453
13457
  }
13454
13458
  __onMouseLeave(e) {
@@ -13474,29 +13478,30 @@ let UITooltip = UITooltip_1 = class UITooltip extends jodit_core_ui_element__WEB
13474
13478
  return;
13475
13479
  }
13476
13480
  this.__currentTarget = e.target;
13477
- const pos = (0,jodit_core_helpers_size_position__WEBPACK_IMPORTED_MODULE_6__/* .position */ .G)(e.target);
13478
- this.__addListenersOnClose();
13479
- this.__delayOpen(() => ({
13480
- x: pos.left + pos.width / 2,
13481
- y: pos.top + pos.height
13482
- }), tooltip);
13483
- }
13484
- __delayOpen(getPoint, content) {
13485
- const to = this.j.o.showTooltipDelay || this.j.defaultTimeout;
13481
+ const target = e.target;
13482
+ this.__open(() => {
13483
+ const pos = (0,jodit_core_helpers_size_position__WEBPACK_IMPORTED_MODULE_6__/* .position */ .G)(target);
13484
+ return {
13485
+ x: pos.left + pos.width / 2,
13486
+ y: pos.top + pos.height
13487
+ };
13488
+ }, tooltip);
13489
+ }
13490
+ __open(getPoint, content) {
13491
+ this.__addListenersOnEnter();
13492
+ this.__isOpened = true;
13486
13493
  this.j.async.clearTimeout(this.__hideTimeout);
13487
13494
  this.j.async.clearTimeout(this.__delayShowTimeout);
13488
- this.__delayShowTimeout = this.j.async.setTimeout(() => this.__open(getPoint, content), {
13489
- timeout: to,
13490
- label: 'tooltip'
13491
- });
13495
+ const to = this.j.o.showTooltipDelay || this.j.defaultTimeout;
13496
+ if (!to) {
13497
+ this.__show(getPoint, content);
13498
+ return;
13499
+ }
13500
+ this.__delayShowTimeout = this.j.async.setTimeout(() => this.__show(getPoint, content), to);
13492
13501
  }
13493
- __open(getPoint, content) {
13502
+ __show(getPoint, content) {
13494
13503
  this.setMod('visible', true);
13495
13504
  this.getElm('content').innerHTML = content;
13496
- this.__isOpened = true;
13497
- this.__setPosition(getPoint);
13498
- }
13499
- __setPosition(getPoint) {
13500
13505
  const point = getPoint();
13501
13506
  (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_4__.css)(this.container, {
13502
13507
  left: point.x,
@@ -13506,24 +13511,26 @@ let UITooltip = UITooltip_1 = class UITooltip extends jodit_core_ui_element__WEB
13506
13511
  __hide() {
13507
13512
  this.j.async.clearTimeout(this.__delayShowTimeout);
13508
13513
  this.j.async.clearTimeout(this.__hideTimeout);
13509
- this.__removeListenersOnClose();
13514
+ this.__removeListenersOnLeave();
13510
13515
  if (this.__isOpened) {
13511
13516
  this.__isOpened = false;
13512
13517
  this.setMod('visible', false);
13518
+ this.getElm('content').innerHTML = '';
13513
13519
  (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_4__.css)(this.container, {
13514
13520
  left: -5000
13515
13521
  });
13516
13522
  }
13517
13523
  }
13518
13524
  __hideDelay() {
13525
+ this.j.async.clearTimeout(this.__delayShowTimeout);
13526
+ this.j.async.clearTimeout(this.__hideTimeout);
13519
13527
  if (!this.__isOpened) {
13520
13528
  return;
13521
13529
  }
13522
- this.j.async.clearTimeout(this.__delayShowTimeout);
13523
13530
  this.__hideTimeout = this.async.setTimeout(this.__hide, this.j.defaultTimeout);
13524
13531
  }
13525
13532
  destruct() {
13526
- this.j.e.off(this.j.container, 'mouseenter', this.__onMouseEnter);
13533
+ this.j.e.off(this.j.container, 'mouseenter.tooltip', this.__onMouseEnter);
13527
13534
  this.__hide();
13528
13535
  super.destruct();
13529
13536
  }
@@ -23641,7 +23648,7 @@ let ToolbarCollection = class ToolbarCollection extends jodit_core_ui__WEBPACK_I
23641
23648
  jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.autobind
23642
23649
  ], ToolbarCollection.prototype, "__immediateUpdate", null);
23643
23650
  (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
23644
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.debounce)()
23651
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.debounce)(ctx => ctx.j.defaultTimeout, true)
23645
23652
  ], ToolbarCollection.prototype, "update", null);
23646
23653
  (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
23647
23654
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.hook)('ready')
@@ -24819,8 +24826,8 @@ function val(elm, selector, value) {
24819
24826
  /* harmony export */ });
24820
24827
  /* harmony import */ var jodit_core_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(77753);
24821
24828
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(55186);
24822
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(65147);
24823
24829
  /* harmony import */ var jodit_core_helpers_checker_is_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(69052);
24830
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(26150);
24824
24831
  /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(53048);
24825
24832
  /*!
24826
24833
  * Jodit Editor (https://xdsoft.net/jodit/)
@@ -24862,8 +24869,16 @@ function val(elm, selector, value) {
24862
24869
  * ```
24863
24870
  */
24864
24871
  const TabsWidget = (jodit, tabs, state) => {
24865
- const box = jodit.c.div('jodit-tabs'), tabBox = jodit.c.div('jodit-tabs__wrapper'), buttons = jodit.c.div('jodit-tabs__buttons'), nameToTab = {}, buttonList = [];
24866
- let firstTab = '', tabCount = 0;
24872
+ const box = jodit.c.div('jodit-tabs');
24873
+ const tabBox = jodit.c.div('jodit-tabs__wrapper');
24874
+ const buttons = jodit.c.div('jodit-tabs__buttons');
24875
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__/* .attr */ .C)(buttons, {
24876
+ role: 'tablist',
24877
+ 'aria-orientation': 'horizontal'
24878
+ });
24879
+ const nameToTab = {};
24880
+ const buttonList = [];
24881
+ let firstTab = '';
24867
24882
  box.appendChild(buttons);
24868
24883
  box.appendChild(tabBox);
24869
24884
  const setActive = (tab) => {
@@ -24871,20 +24886,21 @@ const TabsWidget = (jodit, tabs, state) => {
24871
24886
  return;
24872
24887
  }
24873
24888
  buttonList.forEach(b => {
24874
- b.state.variant = 'initial';
24875
24889
  b.state.activated = false;
24876
24890
  });
24877
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.$$)('.jodit-tab', tabBox).forEach(a => {
24878
- a.classList.remove('jodit-tab_active');
24879
- });
24880
- nameToTab[tab].button.state.variant = 'outline';
24891
+ Object.values(nameToTab).forEach(({ tab }) => tab.classList.remove('jodit-tab_active'));
24881
24892
  nameToTab[tab].button.state.activated = true;
24882
24893
  nameToTab[tab].tab.classList.add('jodit-tab_active');
24883
24894
  };
24884
24895
  tabs.forEach(({ icon, name, content }) => {
24885
- const tab = jodit.c.div('jodit-tab'), button = (0,jodit_core_ui__WEBPACK_IMPORTED_MODULE_3__/* .Button */ .$n)(jodit, icon || name, name);
24896
+ const tab = jodit.c.div('jodit-tab');
24897
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__/* .attr */ .C)(tab, {
24898
+ role: 'tabpanel'
24899
+ });
24900
+ const button = (0,jodit_core_ui__WEBPACK_IMPORTED_MODULE_3__/* .Button */ .$n)(jodit, icon || name, name);
24901
+ button.state.role = 'tab';
24886
24902
  // Stop lose the focus
24887
- jodit.e.on(button.container, 'mousedown', (e) => e.preventDefault());
24903
+ jodit.e.on(button.container, 'pointerdown', (e) => e.preventDefault());
24888
24904
  if (!firstTab) {
24889
24905
  firstTab = name;
24890
24906
  }
@@ -24914,13 +24930,9 @@ const TabsWidget = (jodit, tabs, state) => {
24914
24930
  button,
24915
24931
  tab
24916
24932
  };
24917
- tabCount += 1;
24918
24933
  });
24919
- if (!tabCount) {
24920
- return box;
24921
- }
24922
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.$$)('a', buttons).forEach(a => {
24923
- a.style.width = (100 / tabCount).toFixed(10) + '%';
24934
+ Object.values(nameToTab).forEach(({ button }) => {
24935
+ button.container.style.width = (100 / tabs.length).toFixed(10) + '%';
24924
24936
  });
24925
24937
  const tab = !state || !state.activeTab || !nameToTab[state.activeTab]
24926
24938
  ? firstTab