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.en/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,
|
|
@@ -24221,6 +24225,19 @@ const instance = (j)=>j.getInstance('Table', j.o);
|
|
|
24221
24225
|
|
|
24222
24226
|
|
|
24223
24227
|
|
|
24228
|
+
const INPUT_TAGS = new Set([
|
|
24229
|
+
'input',
|
|
24230
|
+
'textarea',
|
|
24231
|
+
'select'
|
|
24232
|
+
]);
|
|
24233
|
+
const FOCUSABLE_SELECTOR = [
|
|
24234
|
+
'button:not([disabled])',
|
|
24235
|
+
'a[href]',
|
|
24236
|
+
'input:not([disabled]):not([type="hidden"])',
|
|
24237
|
+
'select:not([disabled])',
|
|
24238
|
+
'textarea:not([disabled])',
|
|
24239
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
24240
|
+
].join(',');
|
|
24224
24241
|
class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_19__.UIButton {
|
|
24225
24242
|
className() {
|
|
24226
24243
|
return 'ToolbarButton';
|
|
@@ -24408,7 +24425,14 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_19__.U
|
|
|
24408
24425
|
}
|
|
24409
24426
|
}
|
|
24410
24427
|
onTriggerKeyDown(e) {
|
|
24411
|
-
if (this.state.disabled
|
|
24428
|
+
if (this.state.disabled) {
|
|
24429
|
+
return;
|
|
24430
|
+
}
|
|
24431
|
+
if (e.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_3__.KEY_DOWN) {
|
|
24432
|
+
this.onButtonKeyDown(e);
|
|
24433
|
+
return;
|
|
24434
|
+
}
|
|
24435
|
+
if (![
|
|
24412
24436
|
jodit_core_constants__WEBPACK_IMPORTED_MODULE_3__.KEY_ENTER,
|
|
24413
24437
|
jodit_core_constants__WEBPACK_IMPORTED_MODULE_3__.KEY_SPACE,
|
|
24414
24438
|
' '
|
|
@@ -24418,6 +24442,65 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_19__.U
|
|
|
24418
24442
|
e.preventDefault();
|
|
24419
24443
|
this.trigger.click();
|
|
24420
24444
|
}
|
|
24445
|
+
/**
|
|
24446
|
+
* `ArrowDown` on a button with a trigger opens its dropdown and moves the
|
|
24447
|
+
* focus into it, like the WAI-ARIA menu button pattern
|
|
24448
|
+
*/ onButtonKeyDown(e) {
|
|
24449
|
+
if (e.key !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_3__.KEY_DOWN || this.state.disabled || !this.state.hasTrigger || e.altKey || e.ctrlKey || e.metaKey) {
|
|
24450
|
+
return;
|
|
24451
|
+
}
|
|
24452
|
+
e.preventDefault();
|
|
24453
|
+
e.stopPropagation();
|
|
24454
|
+
if (!this.openedPopup) {
|
|
24455
|
+
this.trigger.click();
|
|
24456
|
+
}
|
|
24457
|
+
this.__popupFocusables()[0]?.focus();
|
|
24458
|
+
}
|
|
24459
|
+
/**
|
|
24460
|
+
* Inside the dropdown: `ArrowDown`/`ArrowUp` walk the items, `Escape` and
|
|
24461
|
+
* `ArrowUp` on the first item close it and give the focus back to the button
|
|
24462
|
+
*/ __onPopupKeyDown(e) {
|
|
24463
|
+
if (!this.openedPopup || e.altKey || e.ctrlKey || e.metaKey) {
|
|
24464
|
+
return;
|
|
24465
|
+
}
|
|
24466
|
+
const target = e.target;
|
|
24467
|
+
// A text field keeps the arrow keys for itself
|
|
24468
|
+
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) {
|
|
24469
|
+
return;
|
|
24470
|
+
}
|
|
24471
|
+
const items = this.__popupFocusables(), index = items.indexOf(target);
|
|
24472
|
+
switch(e.key){
|
|
24473
|
+
case jodit_core_constants__WEBPACK_IMPORTED_MODULE_3__.KEY_ESC:
|
|
24474
|
+
this.__closePopup();
|
|
24475
|
+
break;
|
|
24476
|
+
case jodit_core_constants__WEBPACK_IMPORTED_MODULE_3__.KEY_UP:
|
|
24477
|
+
if (index <= 0) {
|
|
24478
|
+
this.__closePopup();
|
|
24479
|
+
} else {
|
|
24480
|
+
items[index - 1].focus();
|
|
24481
|
+
}
|
|
24482
|
+
break;
|
|
24483
|
+
case jodit_core_constants__WEBPACK_IMPORTED_MODULE_3__.KEY_DOWN:
|
|
24484
|
+
if (!items.length) {
|
|
24485
|
+
return;
|
|
24486
|
+
}
|
|
24487
|
+
items[(index + 1) % items.length].focus();
|
|
24488
|
+
break;
|
|
24489
|
+
default:
|
|
24490
|
+
return;
|
|
24491
|
+
}
|
|
24492
|
+
e.preventDefault();
|
|
24493
|
+
e.stopPropagation();
|
|
24494
|
+
}
|
|
24495
|
+
/**
|
|
24496
|
+
* Visible controls of the opened dropdown that can take the focus
|
|
24497
|
+
*/ __popupFocusables() {
|
|
24498
|
+
const popup = this.openedPopup;
|
|
24499
|
+
if (!popup) {
|
|
24500
|
+
return [];
|
|
24501
|
+
}
|
|
24502
|
+
return Array.from(popup.container.querySelectorAll(FOCUSABLE_SELECTOR)).filter((elm)=>Boolean(elm.offsetParent));
|
|
24503
|
+
}
|
|
24421
24504
|
/**
|
|
24422
24505
|
* Create an open popup list
|
|
24423
24506
|
*/ __openControlList(control) {
|
|
@@ -24487,7 +24570,7 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_19__.U
|
|
|
24487
24570
|
openPopup() {
|
|
24488
24571
|
this.__closePopup();
|
|
24489
24572
|
this.openedPopup = new jodit_core_ui_popup_popup__WEBPACK_IMPORTED_MODULE_22__.Popup(this.j, false);
|
|
24490
|
-
this.j.e.on(this.ow, 'mousedown touchstart', this.onOutsideClick).on('escape closeAllPopups', this.onOutsideClick);
|
|
24573
|
+
this.j.e.on(this.ow, 'mousedown touchstart', this.onOutsideClick).on('escape closeAllPopups', this.onOutsideClick).on(this.openedPopup.container, 'keydown', this.__onPopupKeyDown);
|
|
24491
24574
|
return this.openedPopup;
|
|
24492
24575
|
}
|
|
24493
24576
|
__closePopup() {
|
|
@@ -24503,12 +24586,18 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_19__.U
|
|
|
24503
24586
|
// throws NotFoundError. See #1458
|
|
24504
24587
|
this.openedPopup = null;
|
|
24505
24588
|
this.j.e.off(this.ow, 'mousedown touchstart', this.onOutsideClick).off('escape closeAllPopups', this.onOutsideClick);
|
|
24589
|
+
// The keyboard brought the focus into the dropdown: give it back to
|
|
24590
|
+
// the button, otherwise it would fall out to the document
|
|
24591
|
+
const { activeElement } = this.od, hadFocus = activeElement && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isOrContains(popup.container, activeElement);
|
|
24506
24592
|
this.state.activated = false;
|
|
24507
24593
|
popup.close();
|
|
24508
24594
|
popup.destruct();
|
|
24509
24595
|
if (this.trigger) {
|
|
24510
24596
|
(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_17__.attr)(this.trigger, 'aria-expanded', false);
|
|
24511
24597
|
}
|
|
24598
|
+
if (hadFocus) {
|
|
24599
|
+
this.focus();
|
|
24600
|
+
}
|
|
24512
24601
|
}
|
|
24513
24602
|
/**
|
|
24514
24603
|
* Click handler
|
|
@@ -24599,6 +24688,12 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_19__.U
|
|
|
24599
24688
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
24600
24689
|
(0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_7__.watch)('trigger:keydown')
|
|
24601
24690
|
], ToolbarButton.prototype, "onTriggerKeyDown", null);
|
|
24691
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
24692
|
+
(0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_7__.watch)('button:keydown')
|
|
24693
|
+
], ToolbarButton.prototype, "onButtonKeyDown", null);
|
|
24694
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
24695
|
+
jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_4__.autobind
|
|
24696
|
+
], ToolbarButton.prototype, "__onPopupKeyDown", null);
|
|
24602
24697
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
24603
24698
|
jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_4__.autobind
|
|
24604
24699
|
], ToolbarButton.prototype, "onOutsideClick", null);
|
|
@@ -34513,10 +34608,11 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_2__.pluginSystem.add('indent', indent
|
|
|
34513
34608
|
/* harmony import */ var jodit_plugins_tab_tab__WEBPACK_IMPORTED_MODULE_55__ = __webpack_require__(81582);
|
|
34514
34609
|
/* harmony import */ var jodit_plugins_table_table__WEBPACK_IMPORTED_MODULE_56__ = __webpack_require__(7994);
|
|
34515
34610
|
/* harmony import */ var jodit_plugins_table_keyboard_navigation_table_keyboard_navigation__WEBPACK_IMPORTED_MODULE_57__ = __webpack_require__(30110);
|
|
34516
|
-
/* harmony import */ var
|
|
34517
|
-
/* harmony import */ var
|
|
34518
|
-
/* harmony import */ var
|
|
34519
|
-
/* harmony import */ var
|
|
34611
|
+
/* harmony import */ var jodit_plugins_toolbar_navigation_toolbar_navigation__WEBPACK_IMPORTED_MODULE_58__ = __webpack_require__(74192);
|
|
34612
|
+
/* harmony import */ var jodit_plugins_video_video__WEBPACK_IMPORTED_MODULE_59__ = __webpack_require__(34142);
|
|
34613
|
+
/* harmony import */ var jodit_plugins_wrap_nodes_wrap_nodes__WEBPACK_IMPORTED_MODULE_60__ = __webpack_require__(22980);
|
|
34614
|
+
/* harmony import */ var jodit_plugins_dtd_dtd__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(56894);
|
|
34615
|
+
/* harmony import */ var jodit_plugins_xpath_xpath__WEBPACK_IMPORTED_MODULE_62__ = __webpack_require__(52014);
|
|
34520
34616
|
/*!
|
|
34521
34617
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
34522
34618
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -34588,6 +34684,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_2__.pluginSystem.add('indent', indent
|
|
|
34588
34684
|
|
|
34589
34685
|
|
|
34590
34686
|
|
|
34687
|
+
|
|
34591
34688
|
|
|
34592
34689
|
|
|
34593
34690
|
/***/ }),
|
|
@@ -43133,6 +43230,128 @@ function table(editor) {
|
|
|
43133
43230
|
jodit_core_global__WEBPACK_IMPORTED_MODULE_0__.pluginSystem.add('table', table);
|
|
43134
43231
|
|
|
43135
43232
|
|
|
43233
|
+
/***/ }),
|
|
43234
|
+
|
|
43235
|
+
/***/ 74192:
|
|
43236
|
+
/***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
|
|
43237
|
+
|
|
43238
|
+
"use strict";
|
|
43239
|
+
/* unused harmony export toolbarNavigation */
|
|
43240
|
+
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31635);
|
|
43241
|
+
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(81937);
|
|
43242
|
+
/* harmony import */ var jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(49574);
|
|
43243
|
+
/* harmony import */ var jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(68616);
|
|
43244
|
+
/* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
|
|
43245
|
+
/* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
|
|
43246
|
+
/* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(7909);
|
|
43247
|
+
/* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
|
|
43248
|
+
/*!
|
|
43249
|
+
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
43250
|
+
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
43251
|
+
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
43252
|
+
*/ /**
|
|
43253
|
+
* [[include:plugins/toolbar-navigation/README.md]]
|
|
43254
|
+
* @packageDocumentation
|
|
43255
|
+
* @module plugins/toolbar-navigation
|
|
43256
|
+
*/
|
|
43257
|
+
|
|
43258
|
+
|
|
43259
|
+
|
|
43260
|
+
|
|
43261
|
+
|
|
43262
|
+
|
|
43263
|
+
|
|
43264
|
+
const INPUT_TAGS = new Set([
|
|
43265
|
+
'input',
|
|
43266
|
+
'textarea',
|
|
43267
|
+
'select'
|
|
43268
|
+
]);
|
|
43269
|
+
/**
|
|
43270
|
+
* Makes the toolbar reachable from the keyboard, as described by the WAI-ARIA
|
|
43271
|
+
* authoring practices for a `role="toolbar"` widget.
|
|
43272
|
+
*
|
|
43273
|
+
* The focus is moved programmatically, so this works whatever
|
|
43274
|
+
* {@link Config.allowTabNavigation} does with the tab order — including the
|
|
43275
|
+
* default, where the buttons take no part in the page tab order.
|
|
43276
|
+
*/ class toolbarNavigation extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
|
|
43277
|
+
/** @override */ afterInit(jodit) {
|
|
43278
|
+
jodit.registerCommand('focusToolbar', {
|
|
43279
|
+
hotkeys: 'alt+f10',
|
|
43280
|
+
exec: this.focusToolbar
|
|
43281
|
+
});
|
|
43282
|
+
}
|
|
43283
|
+
/** @override */ beforeDestruct() {}
|
|
43284
|
+
/**
|
|
43285
|
+
* Moves the focus to the first button of the toolbar.
|
|
43286
|
+
*
|
|
43287
|
+
* Bound to `Alt+F10` by default; remap it like any other command:
|
|
43288
|
+
* `commandToHotkeys: { focusToolbar: 'alt+0' }`
|
|
43289
|
+
*/ focusToolbar() {
|
|
43290
|
+
const [first] = this.__buttons();
|
|
43291
|
+
first?.focus();
|
|
43292
|
+
return false;
|
|
43293
|
+
}
|
|
43294
|
+
/**
|
|
43295
|
+
* Arrow keys / `Home` / `End` walk the buttons, `Escape` leaves the toolbar
|
|
43296
|
+
*/ onKeyDown(e) {
|
|
43297
|
+
if (e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey) {
|
|
43298
|
+
return;
|
|
43299
|
+
}
|
|
43300
|
+
const target = e.target;
|
|
43301
|
+
// A control that needs the arrow keys for itself
|
|
43302
|
+
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) {
|
|
43303
|
+
return;
|
|
43304
|
+
}
|
|
43305
|
+
const buttons = this.__buttons();
|
|
43306
|
+
if (!buttons.length) {
|
|
43307
|
+
return;
|
|
43308
|
+
}
|
|
43309
|
+
switch(e.key){
|
|
43310
|
+
case jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.KEY_ESC:
|
|
43311
|
+
this.j.s.focus();
|
|
43312
|
+
break;
|
|
43313
|
+
case jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.KEY_HOME:
|
|
43314
|
+
buttons[0].focus();
|
|
43315
|
+
break;
|
|
43316
|
+
case jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.KEY_END:
|
|
43317
|
+
buttons[buttons.length - 1].focus();
|
|
43318
|
+
break;
|
|
43319
|
+
case jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.KEY_LEFT:
|
|
43320
|
+
case jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.KEY_RIGHT:
|
|
43321
|
+
{
|
|
43322
|
+
const index = buttons.findIndex((button)=>button.container.contains(target));
|
|
43323
|
+
if (index === -1) {
|
|
43324
|
+
return;
|
|
43325
|
+
}
|
|
43326
|
+
const forward = e.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.KEY_RIGHT !== this.__isRtl(), next = index + (forward ? 1 : -1);
|
|
43327
|
+
buttons[(next + buttons.length) % buttons.length].focus();
|
|
43328
|
+
break;
|
|
43329
|
+
}
|
|
43330
|
+
default:
|
|
43331
|
+
return;
|
|
43332
|
+
}
|
|
43333
|
+
e.preventDefault();
|
|
43334
|
+
e.stopPropagation();
|
|
43335
|
+
return false;
|
|
43336
|
+
}
|
|
43337
|
+
/**
|
|
43338
|
+
* Toolbar buttons that can take the focus right now
|
|
43339
|
+
*/ __buttons() {
|
|
43340
|
+
return this.j.toolbar.buttons.filter((button)=>!button.state.disabled && button.container.isConnected);
|
|
43341
|
+
}
|
|
43342
|
+
__isRtl() {
|
|
43343
|
+
return (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_6__.attr)(this.j.toolbar.container, 'dir') === 'rtl';
|
|
43344
|
+
}
|
|
43345
|
+
}
|
|
43346
|
+
;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
|
|
43347
|
+
jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_2__.autobind
|
|
43348
|
+
], toolbarNavigation.prototype, "focusToolbar", null);
|
|
43349
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
|
|
43350
|
+
(0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_3__.watch)('j.toolbar.container:keydown.toolbar-navigation')
|
|
43351
|
+
], toolbarNavigation.prototype, "onKeyDown", null);
|
|
43352
|
+
jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('toolbarNavigation', toolbarNavigation);
|
|
43353
|
+
|
|
43354
|
+
|
|
43136
43355
|
/***/ }),
|
|
43137
43356
|
|
|
43138
43357
|
/***/ 48899:
|