jodit 4.15.9 → 4.15.13

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 +16 -0
  2. package/README.md +7 -0
  3. package/es2015/jodit.css +21 -1
  4. package/es2015/jodit.fat.min.css +1 -1
  5. package/es2015/jodit.fat.min.js +7 -7
  6. package/es2015/jodit.js +250 -9
  7. package/es2015/jodit.min.css +1 -1
  8. package/es2015/jodit.min.js +5 -5
  9. package/es2015/plugins/debug/debug.css +1 -1
  10. package/es2015/plugins/debug/debug.js +1 -1
  11. package/es2015/plugins/debug/debug.min.js +1 -1
  12. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  13. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  14. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  15. package/es2018/jodit.fat.min.css +1 -1
  16. package/es2018/jodit.fat.min.js +5 -5
  17. package/es2018/jodit.min.css +1 -1
  18. package/es2018/jodit.min.js +5 -5
  19. package/es2018/plugins/debug/debug.min.js +1 -1
  20. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  21. package/es2021/jodit.css +21 -1
  22. package/es2021/jodit.fat.min.css +1 -1
  23. package/es2021/jodit.fat.min.js +6 -6
  24. package/es2021/jodit.js +249 -9
  25. package/es2021/jodit.min.css +1 -1
  26. package/es2021/jodit.min.js +6 -6
  27. package/es2021/plugins/debug/debug.css +1 -1
  28. package/es2021/plugins/debug/debug.js +1 -1
  29. package/es2021/plugins/debug/debug.min.js +1 -1
  30. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  31. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  32. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  33. package/es2021.en/jodit.css +21 -1
  34. package/es2021.en/jodit.fat.min.css +1 -1
  35. package/es2021.en/jodit.fat.min.js +11 -11
  36. package/es2021.en/jodit.js +249 -9
  37. package/es2021.en/jodit.min.css +1 -1
  38. package/es2021.en/jodit.min.js +10 -10
  39. package/es2021.en/plugins/debug/debug.css +1 -1
  40. package/es2021.en/plugins/debug/debug.js +1 -1
  41. package/es2021.en/plugins/debug/debug.min.js +1 -1
  42. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  43. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  44. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  45. package/es5/jodit.css +22 -2
  46. package/es5/jodit.fat.min.css +1 -1
  47. package/es5/jodit.fat.min.js +2 -2
  48. package/es5/jodit.js +307 -9
  49. package/es5/jodit.min.css +3 -3
  50. package/es5/jodit.min.js +2 -2
  51. package/es5/plugins/debug/debug.css +1 -1
  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/es5/polyfills.fat.min.js +1 -1
  58. package/es5/polyfills.js +1 -1
  59. package/es5/polyfills.min.js +1 -1
  60. package/esm/core/constants.d.ts +2 -0
  61. package/esm/core/constants.js +3 -1
  62. package/esm/core/selection/selection.d.ts +11 -0
  63. package/esm/core/selection/selection.js +24 -1
  64. package/esm/modules/toolbar/button/button.d.ts +14 -0
  65. package/esm/modules/toolbar/button/button.js +102 -4
  66. package/esm/plugins/all.d.ts +1 -0
  67. package/esm/plugins/all.js +1 -0
  68. package/esm/plugins/index.d.ts +1 -0
  69. package/esm/plugins/index.js +1 -0
  70. package/esm/plugins/toolbar-navigation/toolbar-navigation.d.ts +42 -0
  71. package/esm/plugins/toolbar-navigation/toolbar-navigation.js +113 -0
  72. package/package.json +1 -1
  73. package/types/core/constants.d.ts +2 -0
  74. package/types/core/selection/selection.d.ts +11 -0
  75. package/types/modules/toolbar/button/button.d.ts +14 -0
  76. package/types/plugins/index.d.ts +1 -0
  77. package/types/plugins/toolbar-navigation/toolbar-navigation.d.ts +42 -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.15.9
4
+ * Version: v4.15.13
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1785,7 +1785,7 @@ __webpack_require__.r(__webpack_exports__);
1785
1785
  * ```
1786
1786
  * @packageDocumentation
1787
1787
  * @module constants
1788
- */ const APP_VERSION = "4.15.9";
1788
+ */ const APP_VERSION = "4.15.13";
1789
1789
  // prettier-ignore
1790
1790
  const ES = "es2015";
1791
1791
  const IS_ES_MODERN = true;
@@ -1836,6 +1836,8 @@ const KEY_TAB = 'Tab';
1836
1836
  const KEY_ENTER = 'Enter';
1837
1837
  const KEY_ESC = 'Escape';
1838
1838
  const KEY_ALT = 'Alt';
1839
+ const KEY_HOME = 'Home';
1840
+ const KEY_END = 'End';
1839
1841
  const KEY_LEFT = 'ArrowLeft';
1840
1842
  const KEY_UP = 'ArrowUp';
1841
1843
  const KEY_RIGHT = 'ArrowRight';
@@ -2029,9 +2031,11 @@ const PASSIVE_EVENTS = new Set([
2029
2031
  /* harmony export */ "KEY_BACKSPACE", 0, /* binding */ KEY_BACKSPACE,
2030
2032
  /* harmony export */ "KEY_DELETE", 0, /* binding */ KEY_DELETE,
2031
2033
  /* harmony export */ "KEY_DOWN", 0, /* binding */ KEY_DOWN,
2034
+ /* harmony export */ "KEY_END", 0, /* binding */ KEY_END,
2032
2035
  /* harmony export */ "KEY_ENTER", 0, /* binding */ KEY_ENTER,
2033
2036
  /* harmony export */ "KEY_ESC", 0, /* binding */ KEY_ESC,
2034
2037
  /* harmony export */ "KEY_F3", 0, /* binding */ KEY_F3,
2038
+ /* harmony export */ "KEY_HOME", 0, /* binding */ KEY_HOME,
2035
2039
  /* harmony export */ "KEY_LEFT", 0, /* binding */ KEY_LEFT,
2036
2040
  /* harmony export */ "KEY_META", 0, /* binding */ KEY_META,
2037
2041
  /* harmony export */ "KEY_RIGHT", 0, /* binding */ KEY_RIGHT,
@@ -11598,10 +11602,31 @@ class Selection {
11598
11602
  if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.up(node, (elm)=>elm === this.area || elm && elm.parentNode === this.area, this.area)) {
11599
11603
  throw (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.error)('Node element must be in editor');
11600
11604
  }
11605
+ const target = !inward && this.__closestNotEditable(node) || node;
11601
11606
  const range = this.createRange();
11602
- range[inward || node === this.area ? 'selectNodeContents' : 'selectNode'](node);
11607
+ range[inward || target === this.area ? 'selectNodeContents' : 'selectNode'](target);
11603
11608
  return this.selectRange(range);
11604
11609
  }
11610
+ /**
11611
+ * The outermost `contenteditable="false"` ancestor of the node inside the
11612
+ * editable area, if there is one.
11613
+ *
11614
+ * A range can be put inside such an island (e.g. on an `<img>` wrapped in a
11615
+ * `<picture contenteditable="false">`), but the browser cannot place a caret
11616
+ * there: the arrow keys then have nothing to move from and the selection
11617
+ * cannot be escaped. Selecting the island itself keeps the range in editable
11618
+ * content, so the caret can step over it. See #1184
11619
+ */ __closestNotEditable(node) {
11620
+ const { area } = this;
11621
+ let result = null, elm = node.parentNode;
11622
+ while(elm && elm !== area && area.contains(elm)){
11623
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(elm) && elm.getAttribute('contenteditable') === 'false') {
11624
+ result = elm;
11625
+ }
11626
+ elm = elm.parentNode;
11627
+ }
11628
+ return result;
11629
+ }
11605
11630
  /**
11606
11631
  * Return current selected HTML
11607
11632
  * @example
@@ -24409,6 +24434,19 @@ const instance = (j)=>j.getInstance('Table', j.o);
24409
24434
 
24410
24435
 
24411
24436
 
24437
+ const INPUT_TAGS = new Set([
24438
+ 'input',
24439
+ 'textarea',
24440
+ 'select'
24441
+ ]);
24442
+ const FOCUSABLE_SELECTOR = [
24443
+ 'button:not([disabled])',
24444
+ 'a[href]',
24445
+ 'input:not([disabled]):not([type="hidden"])',
24446
+ 'select:not([disabled])',
24447
+ 'textarea:not([disabled])',
24448
+ '[tabindex]:not([tabindex="-1"])'
24449
+ ].join(',');
24412
24450
  class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_21__.UIButton {
24413
24451
  className() {
24414
24452
  return 'ToolbarButton';
@@ -24603,7 +24641,14 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_21__.U
24603
24641
  }
24604
24642
  }
24605
24643
  onTriggerKeyDown(e) {
24606
- if (this.state.disabled || ![
24644
+ if (this.state.disabled) {
24645
+ return;
24646
+ }
24647
+ if (e.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_5__.KEY_DOWN) {
24648
+ this.onButtonKeyDown(e);
24649
+ return;
24650
+ }
24651
+ if (![
24607
24652
  jodit_core_constants__WEBPACK_IMPORTED_MODULE_5__.KEY_ENTER,
24608
24653
  jodit_core_constants__WEBPACK_IMPORTED_MODULE_5__.KEY_SPACE,
24609
24654
  ' '
@@ -24613,6 +24658,66 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_21__.U
24613
24658
  e.preventDefault();
24614
24659
  this.trigger.click();
24615
24660
  }
24661
+ /**
24662
+ * `ArrowDown` on a button with a trigger opens its dropdown and moves the
24663
+ * focus into it, like the WAI-ARIA menu button pattern
24664
+ */ onButtonKeyDown(e) {
24665
+ var _this___popupFocusables_;
24666
+ if (e.key !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_5__.KEY_DOWN || this.state.disabled || !this.state.hasTrigger || e.altKey || e.ctrlKey || e.metaKey) {
24667
+ return;
24668
+ }
24669
+ e.preventDefault();
24670
+ e.stopPropagation();
24671
+ if (!this.openedPopup) {
24672
+ this.trigger.click();
24673
+ }
24674
+ (_this___popupFocusables_ = this.__popupFocusables()[0]) === null || _this___popupFocusables_ === void 0 ? void 0 : _this___popupFocusables_.focus();
24675
+ }
24676
+ /**
24677
+ * Inside the dropdown: `ArrowDown`/`ArrowUp` walk the items, `Escape` and
24678
+ * `ArrowUp` on the first item close it and give the focus back to the button
24679
+ */ __onPopupKeyDown(e) {
24680
+ if (!this.openedPopup || e.altKey || e.ctrlKey || e.metaKey) {
24681
+ return;
24682
+ }
24683
+ const target = e.target;
24684
+ // A text field keeps the arrow keys for itself
24685
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.isTag(target, INPUT_TAGS) && e.key !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_5__.KEY_ESC) {
24686
+ return;
24687
+ }
24688
+ const items = this.__popupFocusables(), index = items.indexOf(target);
24689
+ switch(e.key){
24690
+ case jodit_core_constants__WEBPACK_IMPORTED_MODULE_5__.KEY_ESC:
24691
+ this.__closePopup();
24692
+ break;
24693
+ case jodit_core_constants__WEBPACK_IMPORTED_MODULE_5__.KEY_UP:
24694
+ if (index <= 0) {
24695
+ this.__closePopup();
24696
+ } else {
24697
+ items[index - 1].focus();
24698
+ }
24699
+ break;
24700
+ case jodit_core_constants__WEBPACK_IMPORTED_MODULE_5__.KEY_DOWN:
24701
+ if (!items.length) {
24702
+ return;
24703
+ }
24704
+ items[(index + 1) % items.length].focus();
24705
+ break;
24706
+ default:
24707
+ return;
24708
+ }
24709
+ e.preventDefault();
24710
+ e.stopPropagation();
24711
+ }
24712
+ /**
24713
+ * Visible controls of the opened dropdown that can take the focus
24714
+ */ __popupFocusables() {
24715
+ const popup = this.openedPopup;
24716
+ if (!popup) {
24717
+ return [];
24718
+ }
24719
+ return Array.from(popup.container.querySelectorAll(FOCUSABLE_SELECTOR)).filter((elm)=>Boolean(elm.offsetParent));
24720
+ }
24616
24721
  /**
24617
24722
  * Create an open popup list
24618
24723
  */ __openControlList(control) {
@@ -24682,7 +24787,7 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_21__.U
24682
24787
  openPopup() {
24683
24788
  this.__closePopup();
24684
24789
  this.openedPopup = new jodit_core_ui_popup_popup__WEBPACK_IMPORTED_MODULE_24__.Popup(this.j, false);
24685
- this.j.e.on(this.ow, 'mousedown touchstart', this.onOutsideClick).on('escape closeAllPopups', this.onOutsideClick);
24790
+ this.j.e.on(this.ow, 'mousedown touchstart', this.onOutsideClick).on('escape closeAllPopups', this.onOutsideClick).on(this.openedPopup.container, 'keydown', this.__onPopupKeyDown);
24686
24791
  return this.openedPopup;
24687
24792
  }
24688
24793
  __closePopup() {
@@ -24698,12 +24803,18 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_21__.U
24698
24803
  // throws NotFoundError. See #1458
24699
24804
  this.openedPopup = null;
24700
24805
  this.j.e.off(this.ow, 'mousedown touchstart', this.onOutsideClick).off('escape closeAllPopups', this.onOutsideClick);
24806
+ // The keyboard brought the focus into the dropdown: give it back to
24807
+ // the button, otherwise it would fall out to the document
24808
+ const { activeElement } = this.od, hadFocus = activeElement && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.isOrContains(popup.container, activeElement);
24701
24809
  this.state.activated = false;
24702
24810
  popup.close();
24703
24811
  popup.destruct();
24704
24812
  if (this.trigger) {
24705
24813
  (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_19__.attr)(this.trigger, 'aria-expanded', false);
24706
24814
  }
24815
+ if (hadFocus) {
24816
+ this.focus();
24817
+ }
24707
24818
  }
24708
24819
  /**
24709
24820
  * Click handler
@@ -24796,6 +24907,12 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_21__.U
24796
24907
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
24797
24908
  (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_9__.watch)('trigger:keydown')
24798
24909
  ], ToolbarButton.prototype, "onTriggerKeyDown", null);
24910
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
24911
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_9__.watch)('button:keydown')
24912
+ ], ToolbarButton.prototype, "onButtonKeyDown", null);
24913
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
24914
+ jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_6__.autobind
24915
+ ], ToolbarButton.prototype, "__onPopupKeyDown", null);
24799
24916
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
24800
24917
  jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_6__.autobind
24801
24918
  ], ToolbarButton.prototype, "onOutsideClick", null);
@@ -35140,10 +35257,11 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_2__.pluginSystem.add('indent', indent
35140
35257
  /* harmony import */ var jodit_plugins_tab_tab__WEBPACK_IMPORTED_MODULE_55__ = __webpack_require__(81582);
35141
35258
  /* harmony import */ var jodit_plugins_table_table__WEBPACK_IMPORTED_MODULE_56__ = __webpack_require__(7994);
35142
35259
  /* harmony import */ var jodit_plugins_table_keyboard_navigation_table_keyboard_navigation__WEBPACK_IMPORTED_MODULE_57__ = __webpack_require__(30110);
35143
- /* harmony import */ var jodit_plugins_video_video__WEBPACK_IMPORTED_MODULE_58__ = __webpack_require__(34142);
35144
- /* harmony import */ var jodit_plugins_wrap_nodes_wrap_nodes__WEBPACK_IMPORTED_MODULE_59__ = __webpack_require__(22980);
35145
- /* harmony import */ var jodit_plugins_dtd_dtd__WEBPACK_IMPORTED_MODULE_60__ = __webpack_require__(56894);
35146
- /* harmony import */ var jodit_plugins_xpath_xpath__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(52014);
35260
+ /* harmony import */ var jodit_plugins_toolbar_navigation_toolbar_navigation__WEBPACK_IMPORTED_MODULE_58__ = __webpack_require__(74192);
35261
+ /* harmony import */ var jodit_plugins_video_video__WEBPACK_IMPORTED_MODULE_59__ = __webpack_require__(34142);
35262
+ /* harmony import */ var jodit_plugins_wrap_nodes_wrap_nodes__WEBPACK_IMPORTED_MODULE_60__ = __webpack_require__(22980);
35263
+ /* harmony import */ var jodit_plugins_dtd_dtd__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(56894);
35264
+ /* harmony import */ var jodit_plugins_xpath_xpath__WEBPACK_IMPORTED_MODULE_62__ = __webpack_require__(52014);
35147
35265
  /*!
35148
35266
  * Jodit Editor (https://xdsoft.net/jodit/)
35149
35267
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -35215,6 +35333,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_2__.pluginSystem.add('indent', indent
35215
35333
 
35216
35334
 
35217
35335
 
35336
+
35218
35337
 
35219
35338
 
35220
35339
  /***/ }),
@@ -44931,6 +45050,128 @@ function table(editor) {
44931
45050
  jodit_core_global__WEBPACK_IMPORTED_MODULE_0__.pluginSystem.add('table', table);
44932
45051
 
44933
45052
 
45053
+ /***/ }),
45054
+
45055
+ /***/ 74192:
45056
+ /***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
45057
+
45058
+ "use strict";
45059
+ /* unused harmony export toolbarNavigation */
45060
+ /* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31635);
45061
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(81937);
45062
+ /* harmony import */ var jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(49574);
45063
+ /* harmony import */ var jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(68616);
45064
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
45065
+ /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
45066
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(7909);
45067
+ /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
45068
+ /*!
45069
+ * Jodit Editor (https://xdsoft.net/jodit/)
45070
+ * Released under MIT see LICENSE.txt in the project root for license information.
45071
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
45072
+ */ /**
45073
+ * [[include:plugins/toolbar-navigation/README.md]]
45074
+ * @packageDocumentation
45075
+ * @module plugins/toolbar-navigation
45076
+ */
45077
+
45078
+
45079
+
45080
+
45081
+
45082
+
45083
+
45084
+ const INPUT_TAGS = new Set([
45085
+ 'input',
45086
+ 'textarea',
45087
+ 'select'
45088
+ ]);
45089
+ /**
45090
+ * Makes the toolbar reachable from the keyboard, as described by the WAI-ARIA
45091
+ * authoring practices for a `role="toolbar"` widget.
45092
+ *
45093
+ * The focus is moved programmatically, so this works whatever
45094
+ * {@link Config.allowTabNavigation} does with the tab order — including the
45095
+ * default, where the buttons take no part in the page tab order.
45096
+ */ class toolbarNavigation extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
45097
+ /** @override */ afterInit(jodit) {
45098
+ jodit.registerCommand('focusToolbar', {
45099
+ hotkeys: 'alt+f10',
45100
+ exec: this.focusToolbar
45101
+ });
45102
+ }
45103
+ /** @override */ beforeDestruct() {}
45104
+ /**
45105
+ * Moves the focus to the first button of the toolbar.
45106
+ *
45107
+ * Bound to `Alt+F10` by default; remap it like any other command:
45108
+ * `commandToHotkeys: { focusToolbar: 'alt+0' }`
45109
+ */ focusToolbar() {
45110
+ const [first] = this.__buttons();
45111
+ first === null || first === void 0 ? void 0 : first.focus();
45112
+ return false;
45113
+ }
45114
+ /**
45115
+ * Arrow keys / `Home` / `End` walk the buttons, `Escape` leaves the toolbar
45116
+ */ onKeyDown(e) {
45117
+ if (e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey) {
45118
+ return;
45119
+ }
45120
+ const target = e.target;
45121
+ // A control that needs the arrow keys for itself
45122
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(target, INPUT_TAGS) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isHTMLElement(target) && target.isContentEditable) {
45123
+ return;
45124
+ }
45125
+ const buttons = this.__buttons();
45126
+ if (!buttons.length) {
45127
+ return;
45128
+ }
45129
+ switch(e.key){
45130
+ case jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.KEY_ESC:
45131
+ this.j.s.focus();
45132
+ break;
45133
+ case jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.KEY_HOME:
45134
+ buttons[0].focus();
45135
+ break;
45136
+ case jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.KEY_END:
45137
+ buttons[buttons.length - 1].focus();
45138
+ break;
45139
+ case jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.KEY_LEFT:
45140
+ case jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.KEY_RIGHT:
45141
+ {
45142
+ const index = buttons.findIndex((button)=>button.container.contains(target));
45143
+ if (index === -1) {
45144
+ return;
45145
+ }
45146
+ const forward = e.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.KEY_RIGHT !== this.__isRtl(), next = index + (forward ? 1 : -1);
45147
+ buttons[(next + buttons.length) % buttons.length].focus();
45148
+ break;
45149
+ }
45150
+ default:
45151
+ return;
45152
+ }
45153
+ e.preventDefault();
45154
+ e.stopPropagation();
45155
+ return false;
45156
+ }
45157
+ /**
45158
+ * Toolbar buttons that can take the focus right now
45159
+ */ __buttons() {
45160
+ return this.j.toolbar.buttons.filter((button)=>!button.state.disabled && button.container.isConnected);
45161
+ }
45162
+ __isRtl() {
45163
+ return (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_6__.attr)(this.j.toolbar.container, 'dir') === 'rtl';
45164
+ }
45165
+ }
45166
+ ;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
45167
+ jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_2__.autobind
45168
+ ], toolbarNavigation.prototype, "focusToolbar", null);
45169
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
45170
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_3__.watch)('j.toolbar.container:keydown.toolbar-navigation')
45171
+ ], toolbarNavigation.prototype, "onKeyDown", null);
45172
+ jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('toolbarNavigation', toolbarNavigation);
45173
+
45174
+
44934
45175
  /***/ }),
44935
45176
 
44936
45177
  /***/ 48899: