jodit 4.15.10 → 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 (74) hide show
  1. package/CHANGELOG.md +10 -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 +228 -8
  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 +5 -5
  24. package/es2021/jodit.js +227 -8
  25. package/es2021/jodit.min.css +1 -1
  26. package/es2021/jodit.min.js +5 -5
  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 +10 -10
  36. package/es2021.en/jodit.js +227 -8
  37. package/es2021.en/jodit.min.css +1 -1
  38. package/es2021.en/jodit.min.js +9 -9
  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 +282 -8
  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/modules/toolbar/button/button.d.ts +14 -0
  63. package/esm/modules/toolbar/button/button.js +102 -4
  64. package/esm/plugins/all.d.ts +1 -0
  65. package/esm/plugins/all.js +1 -0
  66. package/esm/plugins/index.d.ts +1 -0
  67. package/esm/plugins/index.js +1 -0
  68. package/esm/plugins/toolbar-navigation/toolbar-navigation.d.ts +42 -0
  69. package/esm/plugins/toolbar-navigation/toolbar-navigation.js +113 -0
  70. package/package.json +1 -1
  71. package/types/core/constants.d.ts +2 -0
  72. package/types/modules/toolbar/button/button.d.ts +14 -0
  73. package/types/plugins/index.d.ts +1 -0
  74. package/types/plugins/toolbar-navigation/toolbar-navigation.d.ts +42 -0
package/es5/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.10
4
+ * Version: v4.15.13
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -2058,9 +2058,11 @@ __webpack_require__.r(__webpack_exports__);
2058
2058
  /* harmony export */ KEY_BACKSPACE: function() { return /* binding */ KEY_BACKSPACE; },
2059
2059
  /* harmony export */ KEY_DELETE: function() { return /* binding */ KEY_DELETE; },
2060
2060
  /* harmony export */ KEY_DOWN: function() { return /* binding */ KEY_DOWN; },
2061
+ /* harmony export */ KEY_END: function() { return /* binding */ KEY_END; },
2061
2062
  /* harmony export */ KEY_ENTER: function() { return /* binding */ KEY_ENTER; },
2062
2063
  /* harmony export */ KEY_ESC: function() { return /* binding */ KEY_ESC; },
2063
2064
  /* harmony export */ KEY_F3: function() { return /* binding */ KEY_F3; },
2065
+ /* harmony export */ KEY_HOME: function() { return /* binding */ KEY_HOME; },
2064
2066
  /* harmony export */ KEY_LEFT: function() { return /* binding */ KEY_LEFT; },
2065
2067
  /* harmony export */ KEY_META: function() { return /* binding */ KEY_META; },
2066
2068
  /* harmony export */ KEY_RIGHT: function() { return /* binding */ KEY_RIGHT; },
@@ -2107,7 +2109,7 @@ __webpack_require__.r(__webpack_exports__);
2107
2109
  * @packageDocumentation
2108
2110
  * @module constants
2109
2111
  */
2110
- var APP_VERSION = "4.15.10";
2112
+ var APP_VERSION = "4.15.13";
2111
2113
  // prettier-ignore
2112
2114
  var ES = "es5";
2113
2115
  var IS_ES_MODERN = false;
@@ -2171,6 +2173,8 @@ var KEY_TAB = 'Tab';
2171
2173
  var KEY_ENTER = 'Enter';
2172
2174
  var KEY_ESC = 'Escape';
2173
2175
  var KEY_ALT = 'Alt';
2176
+ var KEY_HOME = 'Home';
2177
+ var KEY_END = 'End';
2174
2178
  var KEY_LEFT = 'ArrowLeft';
2175
2179
  var KEY_UP = 'ArrowUp';
2176
2180
  var KEY_RIGHT = 'ArrowRight';
@@ -29383,6 +29387,19 @@ var instance = function instance(j) {
29383
29387
 
29384
29388
 
29385
29389
 
29390
+ var INPUT_TAGS = new Set([
29391
+ 'input',
29392
+ 'textarea',
29393
+ 'select'
29394
+ ]);
29395
+ var FOCUSABLE_SELECTOR = [
29396
+ 'button:not([disabled])',
29397
+ 'a[href]',
29398
+ 'input:not([disabled]):not([type="hidden"])',
29399
+ 'select:not([disabled])',
29400
+ 'textarea:not([disabled])',
29401
+ '[tabindex]:not([tabindex="-1"])'
29402
+ ].join(',');
29386
29403
  var ToolbarButton = /*#__PURE__*/ function(UIButton) {
29387
29404
  "use strict";
29388
29405
  (0,_swc_helpers_inherits__WEBPACK_IMPORTED_MODULE_6__._)(ToolbarButton, UIButton);
@@ -29679,7 +29696,14 @@ var ToolbarButton = /*#__PURE__*/ function(UIButton) {
29679
29696
  {
29680
29697
  key: "onTriggerKeyDown",
29681
29698
  value: function onTriggerKeyDown(e) {
29682
- if (this.state.disabled || ![
29699
+ if (this.state.disabled) {
29700
+ return;
29701
+ }
29702
+ if (e.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_13__.KEY_DOWN) {
29703
+ this.onButtonKeyDown(e);
29704
+ return;
29705
+ }
29706
+ if (![
29683
29707
  jodit_core_constants__WEBPACK_IMPORTED_MODULE_13__.KEY_ENTER,
29684
29708
  jodit_core_constants__WEBPACK_IMPORTED_MODULE_13__.KEY_SPACE,
29685
29709
  ' '
@@ -29690,6 +29714,77 @@ var ToolbarButton = /*#__PURE__*/ function(UIButton) {
29690
29714
  this.trigger.click();
29691
29715
  }
29692
29716
  },
29717
+ {
29718
+ key: "onButtonKeyDown",
29719
+ value: /**
29720
+ * `ArrowDown` on a button with a trigger opens its dropdown and moves the
29721
+ * focus into it, like the WAI-ARIA menu button pattern
29722
+ */ function onButtonKeyDown(e) {
29723
+ var _this___popupFocusables_;
29724
+ if (e.key !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_13__.KEY_DOWN || this.state.disabled || !this.state.hasTrigger || e.altKey || e.ctrlKey || e.metaKey) {
29725
+ return;
29726
+ }
29727
+ e.preventDefault();
29728
+ e.stopPropagation();
29729
+ if (!this.openedPopup) {
29730
+ this.trigger.click();
29731
+ }
29732
+ (_this___popupFocusables_ = this.__popupFocusables()[0]) === null || _this___popupFocusables_ === void 0 ? void 0 : _this___popupFocusables_.focus();
29733
+ }
29734
+ },
29735
+ {
29736
+ key: "__onPopupKeyDown",
29737
+ value: /**
29738
+ * Inside the dropdown: `ArrowDown`/`ArrowUp` walk the items, `Escape` and
29739
+ * `ArrowUp` on the first item close it and give the focus back to the button
29740
+ */ function __onPopupKeyDown(e) {
29741
+ if (!this.openedPopup || e.altKey || e.ctrlKey || e.metaKey) {
29742
+ return;
29743
+ }
29744
+ var target = e.target;
29745
+ // A text field keeps the arrow keys for itself
29746
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_18__.Dom.isTag(target, INPUT_TAGS) && e.key !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_13__.KEY_ESC) {
29747
+ return;
29748
+ }
29749
+ var items = this.__popupFocusables(), index = items.indexOf(target);
29750
+ switch(e.key){
29751
+ case jodit_core_constants__WEBPACK_IMPORTED_MODULE_13__.KEY_ESC:
29752
+ this.__closePopup();
29753
+ break;
29754
+ case jodit_core_constants__WEBPACK_IMPORTED_MODULE_13__.KEY_UP:
29755
+ if (index <= 0) {
29756
+ this.__closePopup();
29757
+ } else {
29758
+ items[index - 1].focus();
29759
+ }
29760
+ break;
29761
+ case jodit_core_constants__WEBPACK_IMPORTED_MODULE_13__.KEY_DOWN:
29762
+ if (!items.length) {
29763
+ return;
29764
+ }
29765
+ items[(index + 1) % items.length].focus();
29766
+ break;
29767
+ default:
29768
+ return;
29769
+ }
29770
+ e.preventDefault();
29771
+ e.stopPropagation();
29772
+ }
29773
+ },
29774
+ {
29775
+ key: "__popupFocusables",
29776
+ value: /**
29777
+ * Visible controls of the opened dropdown that can take the focus
29778
+ */ function __popupFocusables() {
29779
+ var popup = this.openedPopup;
29780
+ if (!popup) {
29781
+ return [];
29782
+ }
29783
+ return Array.from(popup.container.querySelectorAll(FOCUSABLE_SELECTOR)).filter(function(elm) {
29784
+ return Boolean(elm.offsetParent);
29785
+ });
29786
+ }
29787
+ },
29693
29788
  {
29694
29789
  key: "__openControlList",
29695
29790
  value: /**
@@ -29777,7 +29872,7 @@ var ToolbarButton = /*#__PURE__*/ function(UIButton) {
29777
29872
  value: function openPopup() {
29778
29873
  this.__closePopup();
29779
29874
  this.openedPopup = new jodit_core_ui_popup_popup__WEBPACK_IMPORTED_MODULE_32__.Popup(this.j, false);
29780
- this.j.e.on(this.ow, 'mousedown touchstart', this.onOutsideClick).on('escape closeAllPopups', this.onOutsideClick);
29875
+ this.j.e.on(this.ow, 'mousedown touchstart', this.onOutsideClick).on('escape closeAllPopups', this.onOutsideClick).on(this.openedPopup.container, 'keydown', this.__onPopupKeyDown);
29781
29876
  return this.openedPopup;
29782
29877
  }
29783
29878
  },
@@ -29796,12 +29891,18 @@ var ToolbarButton = /*#__PURE__*/ function(UIButton) {
29796
29891
  // throws NotFoundError. See #1458
29797
29892
  this.openedPopup = null;
29798
29893
  this.j.e.off(this.ow, 'mousedown touchstart', this.onOutsideClick).off('escape closeAllPopups', this.onOutsideClick);
29894
+ // The keyboard brought the focus into the dropdown: give it back to
29895
+ // the button, otherwise it would fall out to the document
29896
+ var activeElement = this.od.activeElement, hadFocus = activeElement && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_18__.Dom.isOrContains(popup.container, activeElement);
29799
29897
  this.state.activated = false;
29800
29898
  popup.close();
29801
29899
  popup.destruct();
29802
29900
  if (this.trigger) {
29803
29901
  (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_27__.attr)(this.trigger, 'aria-expanded', false);
29804
29902
  }
29903
+ if (hadFocus) {
29904
+ this.focus();
29905
+ }
29805
29906
  }
29806
29907
  },
29807
29908
  {
@@ -29870,6 +29971,12 @@ var ToolbarButton = /*#__PURE__*/ function(UIButton) {
29870
29971
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_10__.__decorate)([
29871
29972
  (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_17__.watch)('trigger:keydown')
29872
29973
  ], ToolbarButton.prototype, "onTriggerKeyDown", null);
29974
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_10__.__decorate)([
29975
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_17__.watch)('button:keydown')
29976
+ ], ToolbarButton.prototype, "onButtonKeyDown", null);
29977
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_10__.__decorate)([
29978
+ jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_14__.autobind
29979
+ ], ToolbarButton.prototype, "__onPopupKeyDown", null);
29873
29980
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_10__.__decorate)([
29874
29981
  jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_14__.autobind
29875
29982
  ], ToolbarButton.prototype, "onOutsideClick", null);
@@ -41557,10 +41664,11 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_2__.pluginSystem.add('indent', indent
41557
41664
  /* harmony import */ var jodit_plugins_tab_tab__WEBPACK_IMPORTED_MODULE_55__ = __webpack_require__(81582);
41558
41665
  /* harmony import */ var jodit_plugins_table_table__WEBPACK_IMPORTED_MODULE_56__ = __webpack_require__(7994);
41559
41666
  /* harmony import */ var jodit_plugins_table_keyboard_navigation_table_keyboard_navigation__WEBPACK_IMPORTED_MODULE_57__ = __webpack_require__(30110);
41560
- /* harmony import */ var jodit_plugins_video_video__WEBPACK_IMPORTED_MODULE_58__ = __webpack_require__(34142);
41561
- /* harmony import */ var jodit_plugins_wrap_nodes_wrap_nodes__WEBPACK_IMPORTED_MODULE_59__ = __webpack_require__(22980);
41562
- /* harmony import */ var jodit_plugins_dtd_dtd__WEBPACK_IMPORTED_MODULE_60__ = __webpack_require__(56894);
41563
- /* harmony import */ var jodit_plugins_xpath_xpath__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(52014);
41667
+ /* harmony import */ var jodit_plugins_toolbar_navigation_toolbar_navigation__WEBPACK_IMPORTED_MODULE_58__ = __webpack_require__(74192);
41668
+ /* harmony import */ var jodit_plugins_video_video__WEBPACK_IMPORTED_MODULE_59__ = __webpack_require__(34142);
41669
+ /* harmony import */ var jodit_plugins_wrap_nodes_wrap_nodes__WEBPACK_IMPORTED_MODULE_60__ = __webpack_require__(22980);
41670
+ /* harmony import */ var jodit_plugins_dtd_dtd__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(56894);
41671
+ /* harmony import */ var jodit_plugins_xpath_xpath__WEBPACK_IMPORTED_MODULE_62__ = __webpack_require__(52014);
41564
41672
  /*!
41565
41673
  * Jodit Editor (https://xdsoft.net/jodit/)
41566
41674
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -41632,6 +41740,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_2__.pluginSystem.add('indent', indent
41632
41740
 
41633
41741
 
41634
41742
 
41743
+
41635
41744
 
41636
41745
 
41637
41746
  /***/ }),
@@ -53075,6 +53184,171 @@ function table(editor) {
53075
53184
  jodit_core_global__WEBPACK_IMPORTED_MODULE_0__.pluginSystem.add('table', table);
53076
53185
 
53077
53186
 
53187
+ /***/ }),
53188
+
53189
+ /***/ 74192:
53190
+ /***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
53191
+
53192
+ "use strict";
53193
+ /* unused harmony export toolbarNavigation */
53194
+ /* harmony import */ var _swc_helpers_call_super__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(69262);
53195
+ /* harmony import */ var _swc_helpers_class_call_check__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(73104);
53196
+ /* harmony import */ var _swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(53429);
53197
+ /* harmony import */ var _swc_helpers_inherits__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(34918);
53198
+ /* harmony import */ var _swc_helpers_sliced_to_array__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(50684);
53199
+ /* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(31635);
53200
+ /* harmony import */ var _swc_helpers_wrap_native_super__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(38574);
53201
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(81937);
53202
+ /* harmony import */ var jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(49574);
53203
+ /* harmony import */ var jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(68616);
53204
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(23211);
53205
+ /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(28077);
53206
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(7909);
53207
+ /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(91206);
53208
+ /*!
53209
+ * Jodit Editor (https://xdsoft.net/jodit/)
53210
+ * Released under MIT see LICENSE.txt in the project root for license information.
53211
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
53212
+ */ /**
53213
+ * [[include:plugins/toolbar-navigation/README.md]]
53214
+ * @packageDocumentation
53215
+ * @module plugins/toolbar-navigation
53216
+ */
53217
+
53218
+
53219
+
53220
+
53221
+
53222
+
53223
+
53224
+
53225
+
53226
+
53227
+
53228
+
53229
+
53230
+ var INPUT_TAGS = new Set([
53231
+ 'input',
53232
+ 'textarea',
53233
+ 'select'
53234
+ ]);
53235
+ /**
53236
+ * Makes the toolbar reachable from the keyboard, as described by the WAI-ARIA
53237
+ * authoring practices for a `role="toolbar"` widget.
53238
+ *
53239
+ * The focus is moved programmatically, so this works whatever
53240
+ * {@link Config.allowTabNavigation} does with the tab order — including the
53241
+ * default, where the buttons take no part in the page tab order.
53242
+ */ var toolbarNavigation = /*#__PURE__*/ function(Plugin) {
53243
+ "use strict";
53244
+ (0,_swc_helpers_inherits__WEBPACK_IMPORTED_MODULE_3__._)(toolbarNavigation, Plugin);
53245
+ function toolbarNavigation() {
53246
+ (0,_swc_helpers_class_call_check__WEBPACK_IMPORTED_MODULE_1__._)(this, toolbarNavigation);
53247
+ return (0,_swc_helpers_call_super__WEBPACK_IMPORTED_MODULE_0__._)(this, toolbarNavigation, arguments);
53248
+ }
53249
+ ;(0,_swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_2__._)(toolbarNavigation, [
53250
+ {
53251
+ key: "afterInit",
53252
+ value: /** @override */ function afterInit(jodit) {
53253
+ jodit.registerCommand('focusToolbar', {
53254
+ hotkeys: 'alt+f10',
53255
+ exec: this.focusToolbar
53256
+ });
53257
+ }
53258
+ },
53259
+ {
53260
+ key: "beforeDestruct",
53261
+ value: /** @override */ function beforeDestruct() {}
53262
+ },
53263
+ {
53264
+ key: "focusToolbar",
53265
+ value: /**
53266
+ * Moves the focus to the first button of the toolbar.
53267
+ *
53268
+ * Bound to `Alt+F10` by default; remap it like any other command:
53269
+ * `commandToHotkeys: { focusToolbar: 'alt+0' }`
53270
+ */ function focusToolbar() {
53271
+ var _this___buttons = (0,_swc_helpers_sliced_to_array__WEBPACK_IMPORTED_MODULE_4__._)(this.__buttons(), 1), first = _this___buttons[0];
53272
+ first === null || first === void 0 ? void 0 : first.focus();
53273
+ return false;
53274
+ }
53275
+ },
53276
+ {
53277
+ key: "onKeyDown",
53278
+ value: /**
53279
+ * Arrow keys / `Home` / `End` walk the buttons, `Escape` leaves the toolbar
53280
+ */ function onKeyDown(e) {
53281
+ if (e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey) {
53282
+ return;
53283
+ }
53284
+ var target = e.target;
53285
+ // A control that needs the arrow keys for itself
53286
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.isTag(target, INPUT_TAGS) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.isHTMLElement(target) && target.isContentEditable) {
53287
+ return;
53288
+ }
53289
+ var buttons = this.__buttons();
53290
+ if (!buttons.length) {
53291
+ return;
53292
+ }
53293
+ switch(e.key){
53294
+ case jodit_core_constants__WEBPACK_IMPORTED_MODULE_7__.KEY_ESC:
53295
+ this.j.s.focus();
53296
+ break;
53297
+ case jodit_core_constants__WEBPACK_IMPORTED_MODULE_7__.KEY_HOME:
53298
+ buttons[0].focus();
53299
+ break;
53300
+ case jodit_core_constants__WEBPACK_IMPORTED_MODULE_7__.KEY_END:
53301
+ buttons[buttons.length - 1].focus();
53302
+ break;
53303
+ case jodit_core_constants__WEBPACK_IMPORTED_MODULE_7__.KEY_LEFT:
53304
+ case jodit_core_constants__WEBPACK_IMPORTED_MODULE_7__.KEY_RIGHT:
53305
+ {
53306
+ var index = buttons.findIndex(function(button) {
53307
+ return button.container.contains(target);
53308
+ });
53309
+ if (index === -1) {
53310
+ return;
53311
+ }
53312
+ var forward = e.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_7__.KEY_RIGHT !== this.__isRtl(), next = index + (forward ? 1 : -1);
53313
+ buttons[(next + buttons.length) % buttons.length].focus();
53314
+ break;
53315
+ }
53316
+ default:
53317
+ return;
53318
+ }
53319
+ e.preventDefault();
53320
+ e.stopPropagation();
53321
+ return false;
53322
+ }
53323
+ },
53324
+ {
53325
+ key: "__buttons",
53326
+ value: /**
53327
+ * Toolbar buttons that can take the focus right now
53328
+ */ function __buttons() {
53329
+ return this.j.toolbar.buttons.filter(function(button) {
53330
+ return !button.state.disabled && button.container.isConnected;
53331
+ });
53332
+ }
53333
+ },
53334
+ {
53335
+ key: "__isRtl",
53336
+ value: function __isRtl() {
53337
+ return (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_12__.attr)(this.j.toolbar.container, 'dir') === 'rtl';
53338
+ }
53339
+ }
53340
+ ]);
53341
+ return toolbarNavigation;
53342
+ }((0,_swc_helpers_wrap_native_super__WEBPACK_IMPORTED_MODULE_6__._)(jodit_core_plugin__WEBPACK_IMPORTED_MODULE_13__.Plugin));
53343
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
53344
+ jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_8__.autobind
53345
+ ], toolbarNavigation.prototype, "focusToolbar", null);
53346
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
53347
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_9__.watch)('j.toolbar.container:keydown.toolbar-navigation')
53348
+ ], toolbarNavigation.prototype, "onKeyDown", null);
53349
+ jodit_core_global__WEBPACK_IMPORTED_MODULE_11__.pluginSystem.add('toolbarNavigation', toolbarNavigation);
53350
+
53351
+
53078
53352
  /***/ }),
53079
53353
 
53080
53354
  /***/ 48899: