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.
- package/CHANGELOG.md +10 -0
- package/README.md +7 -0
- package/es2015/jodit.css +21 -1
- package/es2015/jodit.fat.min.css +1 -1
- package/es2015/jodit.fat.min.js +7 -7
- package/es2015/jodit.js +228 -8
- package/es2015/jodit.min.css +1 -1
- package/es2015/jodit.min.js +5 -5
- package/es2015/plugins/debug/debug.css +1 -1
- package/es2015/plugins/debug/debug.js +1 -1
- package/es2015/plugins/debug/debug.min.js +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2018/jodit.fat.min.css +1 -1
- package/es2018/jodit.fat.min.js +5 -5
- package/es2018/jodit.min.css +1 -1
- package/es2018/jodit.min.js +5 -5
- package/es2018/plugins/debug/debug.min.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021/jodit.css +21 -1
- package/es2021/jodit.fat.min.css +1 -1
- package/es2021/jodit.fat.min.js +5 -5
- package/es2021/jodit.js +227 -8
- package/es2021/jodit.min.css +1 -1
- package/es2021/jodit.min.js +5 -5
- package/es2021/plugins/debug/debug.css +1 -1
- package/es2021/plugins/debug/debug.js +1 -1
- package/es2021/plugins/debug/debug.min.js +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021.en/jodit.css +21 -1
- package/es2021.en/jodit.fat.min.css +1 -1
- package/es2021.en/jodit.fat.min.js +10 -10
- package/es2021.en/jodit.js +227 -8
- package/es2021.en/jodit.min.css +1 -1
- package/es2021.en/jodit.min.js +9 -9
- package/es2021.en/plugins/debug/debug.css +1 -1
- package/es2021.en/plugins/debug/debug.js +1 -1
- package/es2021.en/plugins/debug/debug.min.js +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es5/jodit.css +22 -2
- package/es5/jodit.fat.min.css +1 -1
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +282 -8
- package/es5/jodit.min.css +3 -3
- package/es5/jodit.min.js +2 -2
- package/es5/plugins/debug/debug.css +1 -1
- package/es5/plugins/debug/debug.js +1 -1
- package/es5/plugins/debug/debug.min.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es5/polyfills.fat.min.js +1 -1
- package/es5/polyfills.js +1 -1
- package/es5/polyfills.min.js +1 -1
- package/esm/core/constants.d.ts +2 -0
- package/esm/core/constants.js +3 -1
- package/esm/modules/toolbar/button/button.d.ts +14 -0
- package/esm/modules/toolbar/button/button.js +102 -4
- package/esm/plugins/all.d.ts +1 -0
- package/esm/plugins/all.js +1 -0
- package/esm/plugins/index.d.ts +1 -0
- package/esm/plugins/index.js +1 -0
- package/esm/plugins/toolbar-navigation/toolbar-navigation.d.ts +42 -0
- package/esm/plugins/toolbar-navigation/toolbar-navigation.js +113 -0
- package/package.json +1 -1
- package/types/core/constants.d.ts +2 -0
- package/types/modules/toolbar/button/button.d.ts +14 -0
- package/types/plugins/index.d.ts +1 -0
- 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.
|
|
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.
|
|
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,
|
|
@@ -24430,6 +24434,19 @@ const instance = (j)=>j.getInstance('Table', j.o);
|
|
|
24430
24434
|
|
|
24431
24435
|
|
|
24432
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(',');
|
|
24433
24450
|
class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_21__.UIButton {
|
|
24434
24451
|
className() {
|
|
24435
24452
|
return 'ToolbarButton';
|
|
@@ -24624,7 +24641,14 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_21__.U
|
|
|
24624
24641
|
}
|
|
24625
24642
|
}
|
|
24626
24643
|
onTriggerKeyDown(e) {
|
|
24627
|
-
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 (![
|
|
24628
24652
|
jodit_core_constants__WEBPACK_IMPORTED_MODULE_5__.KEY_ENTER,
|
|
24629
24653
|
jodit_core_constants__WEBPACK_IMPORTED_MODULE_5__.KEY_SPACE,
|
|
24630
24654
|
' '
|
|
@@ -24634,6 +24658,66 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_21__.U
|
|
|
24634
24658
|
e.preventDefault();
|
|
24635
24659
|
this.trigger.click();
|
|
24636
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
|
+
}
|
|
24637
24721
|
/**
|
|
24638
24722
|
* Create an open popup list
|
|
24639
24723
|
*/ __openControlList(control) {
|
|
@@ -24703,7 +24787,7 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_21__.U
|
|
|
24703
24787
|
openPopup() {
|
|
24704
24788
|
this.__closePopup();
|
|
24705
24789
|
this.openedPopup = new jodit_core_ui_popup_popup__WEBPACK_IMPORTED_MODULE_24__.Popup(this.j, false);
|
|
24706
|
-
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);
|
|
24707
24791
|
return this.openedPopup;
|
|
24708
24792
|
}
|
|
24709
24793
|
__closePopup() {
|
|
@@ -24719,12 +24803,18 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_21__.U
|
|
|
24719
24803
|
// throws NotFoundError. See #1458
|
|
24720
24804
|
this.openedPopup = null;
|
|
24721
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);
|
|
24722
24809
|
this.state.activated = false;
|
|
24723
24810
|
popup.close();
|
|
24724
24811
|
popup.destruct();
|
|
24725
24812
|
if (this.trigger) {
|
|
24726
24813
|
(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_19__.attr)(this.trigger, 'aria-expanded', false);
|
|
24727
24814
|
}
|
|
24815
|
+
if (hadFocus) {
|
|
24816
|
+
this.focus();
|
|
24817
|
+
}
|
|
24728
24818
|
}
|
|
24729
24819
|
/**
|
|
24730
24820
|
* Click handler
|
|
@@ -24817,6 +24907,12 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_21__.U
|
|
|
24817
24907
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
|
|
24818
24908
|
(0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_9__.watch)('trigger:keydown')
|
|
24819
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);
|
|
24820
24916
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
|
|
24821
24917
|
jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_6__.autobind
|
|
24822
24918
|
], ToolbarButton.prototype, "onOutsideClick", null);
|
|
@@ -35161,10 +35257,11 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_2__.pluginSystem.add('indent', indent
|
|
|
35161
35257
|
/* harmony import */ var jodit_plugins_tab_tab__WEBPACK_IMPORTED_MODULE_55__ = __webpack_require__(81582);
|
|
35162
35258
|
/* harmony import */ var jodit_plugins_table_table__WEBPACK_IMPORTED_MODULE_56__ = __webpack_require__(7994);
|
|
35163
35259
|
/* harmony import */ var jodit_plugins_table_keyboard_navigation_table_keyboard_navigation__WEBPACK_IMPORTED_MODULE_57__ = __webpack_require__(30110);
|
|
35164
|
-
/* harmony import */ var
|
|
35165
|
-
/* harmony import */ var
|
|
35166
|
-
/* harmony import */ var
|
|
35167
|
-
/* harmony import */ var
|
|
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);
|
|
35168
35265
|
/*!
|
|
35169
35266
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
35170
35267
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -35236,6 +35333,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_2__.pluginSystem.add('indent', indent
|
|
|
35236
35333
|
|
|
35237
35334
|
|
|
35238
35335
|
|
|
35336
|
+
|
|
35239
35337
|
|
|
35240
35338
|
|
|
35241
35339
|
/***/ }),
|
|
@@ -44952,6 +45050,128 @@ function table(editor) {
|
|
|
44952
45050
|
jodit_core_global__WEBPACK_IMPORTED_MODULE_0__.pluginSystem.add('table', table);
|
|
44953
45051
|
|
|
44954
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
|
+
|
|
44955
45175
|
/***/ }),
|
|
44956
45176
|
|
|
44957
45177
|
/***/ 48899:
|