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/es2021/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
|
*/
|
|
@@ -1779,7 +1779,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1779
1779
|
* ```
|
|
1780
1780
|
* @packageDocumentation
|
|
1781
1781
|
* @module constants
|
|
1782
|
-
*/ const APP_VERSION = "4.15.
|
|
1782
|
+
*/ const APP_VERSION = "4.15.13";
|
|
1783
1783
|
// prettier-ignore
|
|
1784
1784
|
const ES = "es2021";
|
|
1785
1785
|
const IS_ES_MODERN = true;
|
|
@@ -1830,6 +1830,8 @@ const KEY_TAB = 'Tab';
|
|
|
1830
1830
|
const KEY_ENTER = 'Enter';
|
|
1831
1831
|
const KEY_ESC = 'Escape';
|
|
1832
1832
|
const KEY_ALT = 'Alt';
|
|
1833
|
+
const KEY_HOME = 'Home';
|
|
1834
|
+
const KEY_END = 'End';
|
|
1833
1835
|
const KEY_LEFT = 'ArrowLeft';
|
|
1834
1836
|
const KEY_UP = 'ArrowUp';
|
|
1835
1837
|
const KEY_RIGHT = 'ArrowRight';
|
|
@@ -2023,9 +2025,11 @@ const PASSIVE_EVENTS = new Set([
|
|
|
2023
2025
|
/* harmony export */ "KEY_BACKSPACE", 0, /* binding */ KEY_BACKSPACE,
|
|
2024
2026
|
/* harmony export */ "KEY_DELETE", 0, /* binding */ KEY_DELETE,
|
|
2025
2027
|
/* harmony export */ "KEY_DOWN", 0, /* binding */ KEY_DOWN,
|
|
2028
|
+
/* harmony export */ "KEY_END", 0, /* binding */ KEY_END,
|
|
2026
2029
|
/* harmony export */ "KEY_ENTER", 0, /* binding */ KEY_ENTER,
|
|
2027
2030
|
/* harmony export */ "KEY_ESC", 0, /* binding */ KEY_ESC,
|
|
2028
2031
|
/* harmony export */ "KEY_F3", 0, /* binding */ KEY_F3,
|
|
2032
|
+
/* harmony export */ "KEY_HOME", 0, /* binding */ KEY_HOME,
|
|
2029
2033
|
/* harmony export */ "KEY_LEFT", 0, /* binding */ KEY_LEFT,
|
|
2030
2034
|
/* harmony export */ "KEY_META", 0, /* binding */ KEY_META,
|
|
2031
2035
|
/* harmony export */ "KEY_RIGHT", 0, /* binding */ KEY_RIGHT,
|
|
@@ -24245,6 +24249,19 @@ const instance = (j)=>j.getInstance('Table', j.o);
|
|
|
24245
24249
|
|
|
24246
24250
|
|
|
24247
24251
|
|
|
24252
|
+
const INPUT_TAGS = new Set([
|
|
24253
|
+
'input',
|
|
24254
|
+
'textarea',
|
|
24255
|
+
'select'
|
|
24256
|
+
]);
|
|
24257
|
+
const FOCUSABLE_SELECTOR = [
|
|
24258
|
+
'button:not([disabled])',
|
|
24259
|
+
'a[href]',
|
|
24260
|
+
'input:not([disabled]):not([type="hidden"])',
|
|
24261
|
+
'select:not([disabled])',
|
|
24262
|
+
'textarea:not([disabled])',
|
|
24263
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
24264
|
+
].join(',');
|
|
24248
24265
|
class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_19__.UIButton {
|
|
24249
24266
|
className() {
|
|
24250
24267
|
return 'ToolbarButton';
|
|
@@ -24432,7 +24449,14 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_19__.U
|
|
|
24432
24449
|
}
|
|
24433
24450
|
}
|
|
24434
24451
|
onTriggerKeyDown(e) {
|
|
24435
|
-
if (this.state.disabled
|
|
24452
|
+
if (this.state.disabled) {
|
|
24453
|
+
return;
|
|
24454
|
+
}
|
|
24455
|
+
if (e.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_3__.KEY_DOWN) {
|
|
24456
|
+
this.onButtonKeyDown(e);
|
|
24457
|
+
return;
|
|
24458
|
+
}
|
|
24459
|
+
if (![
|
|
24436
24460
|
jodit_core_constants__WEBPACK_IMPORTED_MODULE_3__.KEY_ENTER,
|
|
24437
24461
|
jodit_core_constants__WEBPACK_IMPORTED_MODULE_3__.KEY_SPACE,
|
|
24438
24462
|
' '
|
|
@@ -24442,6 +24466,65 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_19__.U
|
|
|
24442
24466
|
e.preventDefault();
|
|
24443
24467
|
this.trigger.click();
|
|
24444
24468
|
}
|
|
24469
|
+
/**
|
|
24470
|
+
* `ArrowDown` on a button with a trigger opens its dropdown and moves the
|
|
24471
|
+
* focus into it, like the WAI-ARIA menu button pattern
|
|
24472
|
+
*/ onButtonKeyDown(e) {
|
|
24473
|
+
if (e.key !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_3__.KEY_DOWN || this.state.disabled || !this.state.hasTrigger || e.altKey || e.ctrlKey || e.metaKey) {
|
|
24474
|
+
return;
|
|
24475
|
+
}
|
|
24476
|
+
e.preventDefault();
|
|
24477
|
+
e.stopPropagation();
|
|
24478
|
+
if (!this.openedPopup) {
|
|
24479
|
+
this.trigger.click();
|
|
24480
|
+
}
|
|
24481
|
+
this.__popupFocusables()[0]?.focus();
|
|
24482
|
+
}
|
|
24483
|
+
/**
|
|
24484
|
+
* Inside the dropdown: `ArrowDown`/`ArrowUp` walk the items, `Escape` and
|
|
24485
|
+
* `ArrowUp` on the first item close it and give the focus back to the button
|
|
24486
|
+
*/ __onPopupKeyDown(e) {
|
|
24487
|
+
if (!this.openedPopup || e.altKey || e.ctrlKey || e.metaKey) {
|
|
24488
|
+
return;
|
|
24489
|
+
}
|
|
24490
|
+
const target = e.target;
|
|
24491
|
+
// A text field keeps the arrow keys for itself
|
|
24492
|
+
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isTag(target, INPUT_TAGS) && e.key !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_3__.KEY_ESC) {
|
|
24493
|
+
return;
|
|
24494
|
+
}
|
|
24495
|
+
const items = this.__popupFocusables(), index = items.indexOf(target);
|
|
24496
|
+
switch(e.key){
|
|
24497
|
+
case jodit_core_constants__WEBPACK_IMPORTED_MODULE_3__.KEY_ESC:
|
|
24498
|
+
this.__closePopup();
|
|
24499
|
+
break;
|
|
24500
|
+
case jodit_core_constants__WEBPACK_IMPORTED_MODULE_3__.KEY_UP:
|
|
24501
|
+
if (index <= 0) {
|
|
24502
|
+
this.__closePopup();
|
|
24503
|
+
} else {
|
|
24504
|
+
items[index - 1].focus();
|
|
24505
|
+
}
|
|
24506
|
+
break;
|
|
24507
|
+
case jodit_core_constants__WEBPACK_IMPORTED_MODULE_3__.KEY_DOWN:
|
|
24508
|
+
if (!items.length) {
|
|
24509
|
+
return;
|
|
24510
|
+
}
|
|
24511
|
+
items[(index + 1) % items.length].focus();
|
|
24512
|
+
break;
|
|
24513
|
+
default:
|
|
24514
|
+
return;
|
|
24515
|
+
}
|
|
24516
|
+
e.preventDefault();
|
|
24517
|
+
e.stopPropagation();
|
|
24518
|
+
}
|
|
24519
|
+
/**
|
|
24520
|
+
* Visible controls of the opened dropdown that can take the focus
|
|
24521
|
+
*/ __popupFocusables() {
|
|
24522
|
+
const popup = this.openedPopup;
|
|
24523
|
+
if (!popup) {
|
|
24524
|
+
return [];
|
|
24525
|
+
}
|
|
24526
|
+
return Array.from(popup.container.querySelectorAll(FOCUSABLE_SELECTOR)).filter((elm)=>Boolean(elm.offsetParent));
|
|
24527
|
+
}
|
|
24445
24528
|
/**
|
|
24446
24529
|
* Create an open popup list
|
|
24447
24530
|
*/ __openControlList(control) {
|
|
@@ -24511,7 +24594,7 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_19__.U
|
|
|
24511
24594
|
openPopup() {
|
|
24512
24595
|
this.__closePopup();
|
|
24513
24596
|
this.openedPopup = new jodit_core_ui_popup_popup__WEBPACK_IMPORTED_MODULE_22__.Popup(this.j, false);
|
|
24514
|
-
this.j.e.on(this.ow, 'mousedown touchstart', this.onOutsideClick).on('escape closeAllPopups', this.onOutsideClick);
|
|
24597
|
+
this.j.e.on(this.ow, 'mousedown touchstart', this.onOutsideClick).on('escape closeAllPopups', this.onOutsideClick).on(this.openedPopup.container, 'keydown', this.__onPopupKeyDown);
|
|
24515
24598
|
return this.openedPopup;
|
|
24516
24599
|
}
|
|
24517
24600
|
__closePopup() {
|
|
@@ -24527,12 +24610,18 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_19__.U
|
|
|
24527
24610
|
// throws NotFoundError. See #1458
|
|
24528
24611
|
this.openedPopup = null;
|
|
24529
24612
|
this.j.e.off(this.ow, 'mousedown touchstart', this.onOutsideClick).off('escape closeAllPopups', this.onOutsideClick);
|
|
24613
|
+
// The keyboard brought the focus into the dropdown: give it back to
|
|
24614
|
+
// the button, otherwise it would fall out to the document
|
|
24615
|
+
const { activeElement } = this.od, hadFocus = activeElement && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isOrContains(popup.container, activeElement);
|
|
24530
24616
|
this.state.activated = false;
|
|
24531
24617
|
popup.close();
|
|
24532
24618
|
popup.destruct();
|
|
24533
24619
|
if (this.trigger) {
|
|
24534
24620
|
(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_17__.attr)(this.trigger, 'aria-expanded', false);
|
|
24535
24621
|
}
|
|
24622
|
+
if (hadFocus) {
|
|
24623
|
+
this.focus();
|
|
24624
|
+
}
|
|
24536
24625
|
}
|
|
24537
24626
|
/**
|
|
24538
24627
|
* Click handler
|
|
@@ -24623,6 +24712,12 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_19__.U
|
|
|
24623
24712
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
24624
24713
|
(0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_7__.watch)('trigger:keydown')
|
|
24625
24714
|
], ToolbarButton.prototype, "onTriggerKeyDown", null);
|
|
24715
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
24716
|
+
(0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_7__.watch)('button:keydown')
|
|
24717
|
+
], ToolbarButton.prototype, "onButtonKeyDown", null);
|
|
24718
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
24719
|
+
jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_4__.autobind
|
|
24720
|
+
], ToolbarButton.prototype, "__onPopupKeyDown", null);
|
|
24626
24721
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
24627
24722
|
jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_4__.autobind
|
|
24628
24723
|
], ToolbarButton.prototype, "onOutsideClick", null);
|
|
@@ -34900,10 +34995,11 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_2__.pluginSystem.add('indent', indent
|
|
|
34900
34995
|
/* harmony import */ var jodit_plugins_tab_tab__WEBPACK_IMPORTED_MODULE_55__ = __webpack_require__(81582);
|
|
34901
34996
|
/* harmony import */ var jodit_plugins_table_table__WEBPACK_IMPORTED_MODULE_56__ = __webpack_require__(7994);
|
|
34902
34997
|
/* harmony import */ var jodit_plugins_table_keyboard_navigation_table_keyboard_navigation__WEBPACK_IMPORTED_MODULE_57__ = __webpack_require__(30110);
|
|
34903
|
-
/* harmony import */ var
|
|
34904
|
-
/* harmony import */ var
|
|
34905
|
-
/* harmony import */ var
|
|
34906
|
-
/* harmony import */ var
|
|
34998
|
+
/* harmony import */ var jodit_plugins_toolbar_navigation_toolbar_navigation__WEBPACK_IMPORTED_MODULE_58__ = __webpack_require__(74192);
|
|
34999
|
+
/* harmony import */ var jodit_plugins_video_video__WEBPACK_IMPORTED_MODULE_59__ = __webpack_require__(34142);
|
|
35000
|
+
/* harmony import */ var jodit_plugins_wrap_nodes_wrap_nodes__WEBPACK_IMPORTED_MODULE_60__ = __webpack_require__(22980);
|
|
35001
|
+
/* harmony import */ var jodit_plugins_dtd_dtd__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(56894);
|
|
35002
|
+
/* harmony import */ var jodit_plugins_xpath_xpath__WEBPACK_IMPORTED_MODULE_62__ = __webpack_require__(52014);
|
|
34907
35003
|
/*!
|
|
34908
35004
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
34909
35005
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -34975,6 +35071,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_2__.pluginSystem.add('indent', indent
|
|
|
34975
35071
|
|
|
34976
35072
|
|
|
34977
35073
|
|
|
35074
|
+
|
|
34978
35075
|
|
|
34979
35076
|
|
|
34980
35077
|
/***/ }),
|
|
@@ -44618,6 +44715,128 @@ function table(editor) {
|
|
|
44618
44715
|
jodit_core_global__WEBPACK_IMPORTED_MODULE_0__.pluginSystem.add('table', table);
|
|
44619
44716
|
|
|
44620
44717
|
|
|
44718
|
+
/***/ }),
|
|
44719
|
+
|
|
44720
|
+
/***/ 74192:
|
|
44721
|
+
/***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
|
|
44722
|
+
|
|
44723
|
+
"use strict";
|
|
44724
|
+
/* unused harmony export toolbarNavigation */
|
|
44725
|
+
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31635);
|
|
44726
|
+
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(81937);
|
|
44727
|
+
/* harmony import */ var jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(49574);
|
|
44728
|
+
/* harmony import */ var jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(68616);
|
|
44729
|
+
/* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
|
|
44730
|
+
/* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
|
|
44731
|
+
/* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(7909);
|
|
44732
|
+
/* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
|
|
44733
|
+
/*!
|
|
44734
|
+
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
44735
|
+
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
44736
|
+
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
44737
|
+
*/ /**
|
|
44738
|
+
* [[include:plugins/toolbar-navigation/README.md]]
|
|
44739
|
+
* @packageDocumentation
|
|
44740
|
+
* @module plugins/toolbar-navigation
|
|
44741
|
+
*/
|
|
44742
|
+
|
|
44743
|
+
|
|
44744
|
+
|
|
44745
|
+
|
|
44746
|
+
|
|
44747
|
+
|
|
44748
|
+
|
|
44749
|
+
const INPUT_TAGS = new Set([
|
|
44750
|
+
'input',
|
|
44751
|
+
'textarea',
|
|
44752
|
+
'select'
|
|
44753
|
+
]);
|
|
44754
|
+
/**
|
|
44755
|
+
* Makes the toolbar reachable from the keyboard, as described by the WAI-ARIA
|
|
44756
|
+
* authoring practices for a `role="toolbar"` widget.
|
|
44757
|
+
*
|
|
44758
|
+
* The focus is moved programmatically, so this works whatever
|
|
44759
|
+
* {@link Config.allowTabNavigation} does with the tab order — including the
|
|
44760
|
+
* default, where the buttons take no part in the page tab order.
|
|
44761
|
+
*/ class toolbarNavigation extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
|
|
44762
|
+
/** @override */ afterInit(jodit) {
|
|
44763
|
+
jodit.registerCommand('focusToolbar', {
|
|
44764
|
+
hotkeys: 'alt+f10',
|
|
44765
|
+
exec: this.focusToolbar
|
|
44766
|
+
});
|
|
44767
|
+
}
|
|
44768
|
+
/** @override */ beforeDestruct() {}
|
|
44769
|
+
/**
|
|
44770
|
+
* Moves the focus to the first button of the toolbar.
|
|
44771
|
+
*
|
|
44772
|
+
* Bound to `Alt+F10` by default; remap it like any other command:
|
|
44773
|
+
* `commandToHotkeys: { focusToolbar: 'alt+0' }`
|
|
44774
|
+
*/ focusToolbar() {
|
|
44775
|
+
const [first] = this.__buttons();
|
|
44776
|
+
first?.focus();
|
|
44777
|
+
return false;
|
|
44778
|
+
}
|
|
44779
|
+
/**
|
|
44780
|
+
* Arrow keys / `Home` / `End` walk the buttons, `Escape` leaves the toolbar
|
|
44781
|
+
*/ onKeyDown(e) {
|
|
44782
|
+
if (e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey) {
|
|
44783
|
+
return;
|
|
44784
|
+
}
|
|
44785
|
+
const target = e.target;
|
|
44786
|
+
// A control that needs the arrow keys for itself
|
|
44787
|
+
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) {
|
|
44788
|
+
return;
|
|
44789
|
+
}
|
|
44790
|
+
const buttons = this.__buttons();
|
|
44791
|
+
if (!buttons.length) {
|
|
44792
|
+
return;
|
|
44793
|
+
}
|
|
44794
|
+
switch(e.key){
|
|
44795
|
+
case jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.KEY_ESC:
|
|
44796
|
+
this.j.s.focus();
|
|
44797
|
+
break;
|
|
44798
|
+
case jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.KEY_HOME:
|
|
44799
|
+
buttons[0].focus();
|
|
44800
|
+
break;
|
|
44801
|
+
case jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.KEY_END:
|
|
44802
|
+
buttons[buttons.length - 1].focus();
|
|
44803
|
+
break;
|
|
44804
|
+
case jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.KEY_LEFT:
|
|
44805
|
+
case jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.KEY_RIGHT:
|
|
44806
|
+
{
|
|
44807
|
+
const index = buttons.findIndex((button)=>button.container.contains(target));
|
|
44808
|
+
if (index === -1) {
|
|
44809
|
+
return;
|
|
44810
|
+
}
|
|
44811
|
+
const forward = e.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.KEY_RIGHT !== this.__isRtl(), next = index + (forward ? 1 : -1);
|
|
44812
|
+
buttons[(next + buttons.length) % buttons.length].focus();
|
|
44813
|
+
break;
|
|
44814
|
+
}
|
|
44815
|
+
default:
|
|
44816
|
+
return;
|
|
44817
|
+
}
|
|
44818
|
+
e.preventDefault();
|
|
44819
|
+
e.stopPropagation();
|
|
44820
|
+
return false;
|
|
44821
|
+
}
|
|
44822
|
+
/**
|
|
44823
|
+
* Toolbar buttons that can take the focus right now
|
|
44824
|
+
*/ __buttons() {
|
|
44825
|
+
return this.j.toolbar.buttons.filter((button)=>!button.state.disabled && button.container.isConnected);
|
|
44826
|
+
}
|
|
44827
|
+
__isRtl() {
|
|
44828
|
+
return (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_6__.attr)(this.j.toolbar.container, 'dir') === 'rtl';
|
|
44829
|
+
}
|
|
44830
|
+
}
|
|
44831
|
+
;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
|
|
44832
|
+
jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_2__.autobind
|
|
44833
|
+
], toolbarNavigation.prototype, "focusToolbar", null);
|
|
44834
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
|
|
44835
|
+
(0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_3__.watch)('j.toolbar.container:keydown.toolbar-navigation')
|
|
44836
|
+
], toolbarNavigation.prototype, "onKeyDown", null);
|
|
44837
|
+
jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('toolbarNavigation', toolbarNavigation);
|
|
44838
|
+
|
|
44839
|
+
|
|
44621
44840
|
/***/ }),
|
|
44622
44841
|
|
|
44623
44842
|
/***/ 48899:
|