jodit 4.18.6 → 4.18.8
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 +19 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +9 -9
- package/es2015/jodit.js +265 -36
- package/es2015/jodit.min.js +9 -9
- 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.js +9 -9
- package/es2018/jodit.min.js +7 -7
- package/es2018/plugins/debug/debug.min.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021/jodit.css +1 -1
- package/es2021/jodit.fat.min.js +11 -11
- package/es2021/jodit.js +264 -36
- package/es2021/jodit.min.js +7 -7
- 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 +1 -1
- package/es2021.en/jodit.fat.min.js +8 -8
- package/es2021.en/jodit.js +264 -36
- package/es2021.en/jodit.min.js +7 -7
- 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 +2 -2
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +280 -35
- package/es5/jodit.min.css +2 -2
- 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/config.d.ts +4 -2
- package/esm/core/constants.js +1 -1
- package/esm/core/decorators/component/component.js +12 -0
- package/esm/core/ui/popup/popup.js +14 -9
- package/esm/jodit.js +5 -1
- package/esm/modules/dialog/dialog.js +18 -3
- package/esm/modules/file-browser/ui/files/files.js +17 -2
- package/esm/modules/file-browser/ui/tree/tree.js +17 -2
- package/esm/plugins/backspace/cases/check-join-neighbors.js +81 -0
- package/esm/plugins/backspace/cases/check-remove-char.d.ts +2 -1
- package/esm/plugins/backspace/cases/check-remove-char.js +31 -9
- package/esm/plugins/backspace/cases/check-unwrap-list-item.d.ts +26 -0
- package/esm/plugins/backspace/cases/check-unwrap-list-item.js +56 -0
- package/esm/plugins/backspace/cases/index.js +2 -0
- package/esm/plugins/backspace/config.d.ts +4 -2
- package/esm/plugins/backspace/config.js +6 -3
- package/esm/plugins/enter/enter.js +1 -1
- package/esm/plugins/enter/helpers/check-br.js +7 -2
- package/esm/plugins/image-properties/image-properties.d.ts +5 -0
- package/esm/plugins/image-properties/image-properties.js +30 -5
- package/esm/plugins/mobile/mobile.js +7 -4
- package/package.json +1 -1
- package/types/config.d.ts +4 -2
- package/types/plugins/backspace/cases/check-remove-char.d.ts +2 -1
- package/types/plugins/backspace/cases/check-unwrap-list-item.d.ts +26 -0
- package/types/plugins/backspace/config.d.ts +4 -2
- package/types/plugins/image-properties/image-properties.d.ts +5 -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.18.
|
|
4
|
+
* Version: v4.18.8
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
@@ -1828,7 +1828,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1828
1828
|
* ```
|
|
1829
1829
|
* @packageDocumentation
|
|
1830
1830
|
* @module constants
|
|
1831
|
-
*/ const APP_VERSION = "4.18.
|
|
1831
|
+
*/ const APP_VERSION = "4.18.8";
|
|
1832
1832
|
// prettier-ignore
|
|
1833
1833
|
const ES = "es2015";
|
|
1834
1834
|
const IS_ES_MODERN = true;
|
|
@@ -2568,6 +2568,8 @@ function cacheHTML(target, _, descriptor) {
|
|
|
2568
2568
|
*/
|
|
2569
2569
|
|
|
2570
2570
|
const componentRegistry = new Map();
|
|
2571
|
+
const decoratedClasses = new WeakSet();
|
|
2572
|
+
const warnedClasses = new WeakSet();
|
|
2571
2573
|
/**
|
|
2572
2574
|
* Decorate components and set status isReady after constructor
|
|
2573
2575
|
* @param constructorFunction - Component constructor class
|
|
@@ -2584,9 +2586,16 @@ const componentRegistry = new Map();
|
|
|
2584
2586
|
Object.setPrototypeOf(this, newConstructorFunction.prototype);
|
|
2585
2587
|
}
|
|
2586
2588
|
this.setStatus('ready');
|
|
2589
|
+
} else if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.IS_PROD && !decoratedClasses.has(this.constructor) && !warnedClasses.has(this.constructor)) {
|
|
2590
|
+
// Only the outermost class's decorator sets `ready`, so a subclass
|
|
2591
|
+
// without its own decorator stays in `beforeInit`. See #1685
|
|
2592
|
+
warnedClasses.add(this.constructor);
|
|
2593
|
+
console.warn(`Component "${this.constructor.name || (0,jodit_core_helpers_utils_get_class_name__WEBPACK_IMPORTED_MODULE_1__.getClassName)(this)}" extends a @component class without being decorated itself, so it never becomes ready and its @watch, @debounce, @throttle and @hook handlers never run`);
|
|
2587
2594
|
}
|
|
2588
2595
|
}
|
|
2589
2596
|
}
|
|
2597
|
+
decoratedClasses.add(constructorFunction);
|
|
2598
|
+
decoratedClasses.add(newConstructorFunction);
|
|
2590
2599
|
const name = (0,jodit_core_helpers_utils_get_class_name__WEBPACK_IMPORTED_MODULE_1__.getClassName)(constructorFunction.prototype);
|
|
2591
2600
|
if (componentRegistry.has(name) && !jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.IS_PROD) {
|
|
2592
2601
|
throw new Error(`Component with name "${name}" is already registered`);
|
|
@@ -17705,6 +17714,9 @@ class Popup extends jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_12__.UIGr
|
|
|
17705
17714
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
|
|
17706
17715
|
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_5__.autobind
|
|
17707
17716
|
], Popup.prototype, "__closeOnOutsideClick", null);
|
|
17717
|
+
Popup = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
|
|
17718
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_5__.component
|
|
17719
|
+
], Popup);
|
|
17708
17720
|
|
|
17709
17721
|
|
|
17710
17722
|
/***/ }),
|
|
@@ -18825,7 +18837,7 @@ class Jodit extends jodit_modules__WEBPACK_IMPORTED_MODULE_11__.ViewWithToolbar
|
|
|
18825
18837
|
commands.push(command);
|
|
18826
18838
|
if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction)(command)) {
|
|
18827
18839
|
const hotkeys = this.o.commandToHotkeys[commandName] || this.o.commandToHotkeys[commandNameOriginal] || command.hotkeys;
|
|
18828
|
-
if (hotkeys) {
|
|
18840
|
+
if (hotkeys && hotkeys.length) {
|
|
18829
18841
|
this.registerHotkeyToCommand(hotkeys, commandName, options === null || options === void 0 ? void 0 : options.stopPropagation);
|
|
18830
18842
|
}
|
|
18831
18843
|
}
|
|
@@ -18834,6 +18846,10 @@ class Jodit extends jodit_modules__WEBPACK_IMPORTED_MODULE_11__.ViewWithToolbar
|
|
|
18834
18846
|
/**
|
|
18835
18847
|
* Register hotkey for command
|
|
18836
18848
|
*/ registerHotkeyToCommand(hotkeys, commandName, shouldStop = true) {
|
|
18849
|
+
// An empty list (e.g. `commandToHotkeys: { cmd: [] }`) turns the key off
|
|
18850
|
+
if (!hotkeys || !hotkeys.length) {
|
|
18851
|
+
return;
|
|
18852
|
+
}
|
|
18837
18853
|
const shortcuts = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.asArray)(hotkeys).map(jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.normalizeKeyAliases).map((hotkey)=>hotkey + '.hotkey').join(' ');
|
|
18838
18854
|
this.e.off(shortcuts).on(shortcuts, (type, stop)=>{
|
|
18839
18855
|
if (stop) {
|
|
@@ -19990,6 +20006,9 @@ ContextMenu = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__.__decorat
|
|
|
19990
20006
|
|
|
19991
20007
|
|
|
19992
20008
|
|
|
20009
|
+
/**
|
|
20010
|
+
* A position from 0 up to `max`, or 0 when the panel is larger than the window
|
|
20011
|
+
*/ const clampToWindow = (value, max)=>Math.max(0, Math.min(value, max));
|
|
19993
20012
|
jodit_config__WEBPACK_IMPORTED_MODULE_17__.Config.prototype.dialog = {
|
|
19994
20013
|
namespace: '',
|
|
19995
20014
|
extraButtons: [],
|
|
@@ -20080,6 +20099,11 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
|
|
|
20080
20099
|
this.startY = e.clientY;
|
|
20081
20100
|
this.startPoint.x = (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_12__.css)(this.dialog, 'left');
|
|
20082
20101
|
this.startPoint.y = (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_12__.css)(this.dialog, 'top');
|
|
20102
|
+
// Rounded up: at the right edge a fraction of a pixel less room would
|
|
20103
|
+
// wrap the header of a panel that has no width of its own
|
|
20104
|
+
const { width, height } = this.dialog.getBoundingClientRect();
|
|
20105
|
+
this.startPoint.w = Math.ceil(width);
|
|
20106
|
+
this.startPoint.h = Math.ceil(height);
|
|
20083
20107
|
this.setMaxZIndex();
|
|
20084
20108
|
if (e.cancelable) {
|
|
20085
20109
|
e.preventDefault();
|
|
@@ -20095,7 +20119,11 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
|
|
|
20095
20119
|
}
|
|
20096
20120
|
__onMouseMove(e) {
|
|
20097
20121
|
if (this.draggable && this.o.draggable) {
|
|
20098
|
-
|
|
20122
|
+
const { documentElement } = this.od;
|
|
20123
|
+
// Keep the whole panel in the window at the size it had when the
|
|
20124
|
+
// drag began. A panel with no width of its own would otherwise
|
|
20125
|
+
// shrink as it neared the right edge, and then leave the window
|
|
20126
|
+
this.setPosition(clampToWindow(this.startPoint.x + e.clientX - this.startX, (documentElement.clientWidth || this.ow.innerWidth) - this.startPoint.w), clampToWindow(this.startPoint.y + e.clientY - this.startY, (documentElement.clientHeight || this.ow.innerHeight) - this.startPoint.h));
|
|
20099
20127
|
if (this.e) {
|
|
20100
20128
|
/**
|
|
20101
20129
|
* Fired when dialog box is moved
|
|
@@ -20221,8 +20249,8 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
|
|
|
20221
20249
|
}
|
|
20222
20250
|
// strings on purpose: `css()` would truncate fractional pixels
|
|
20223
20251
|
;(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_12__.css)(this.dialog, {
|
|
20224
|
-
left: (x
|
|
20225
|
-
top: (y
|
|
20252
|
+
left: (x !== null && x !== void 0 ? x : left) + 'px',
|
|
20253
|
+
top: (y !== null && y !== void 0 ? y : top) + 'px'
|
|
20226
20254
|
});
|
|
20227
20255
|
return this;
|
|
20228
20256
|
}
|
|
@@ -22794,18 +22822,25 @@ const DEFAULT_SOURCE_NAME = 'default';
|
|
|
22794
22822
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
22795
22823
|
/* harmony export */ FileBrowserFiles: function() { return /* binding */ FileBrowserFiles; }
|
|
22796
22824
|
/* harmony export */ });
|
|
22797
|
-
/* harmony import */ var
|
|
22825
|
+
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31635);
|
|
22826
|
+
/* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84839);
|
|
22827
|
+
/* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4099);
|
|
22828
|
+
|
|
22798
22829
|
/*!
|
|
22799
22830
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
22800
22831
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
22801
22832
|
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
22802
22833
|
*/
|
|
22803
22834
|
|
|
22804
|
-
|
|
22835
|
+
|
|
22836
|
+
class FileBrowserFiles extends jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.UIGroup {
|
|
22805
22837
|
className() {
|
|
22806
22838
|
return 'FileBrowserFiles';
|
|
22807
22839
|
}
|
|
22808
22840
|
}
|
|
22841
|
+
FileBrowserFiles = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
|
|
22842
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.component
|
|
22843
|
+
], FileBrowserFiles);
|
|
22809
22844
|
|
|
22810
22845
|
|
|
22811
22846
|
/***/ }),
|
|
@@ -22839,18 +22874,25 @@ class FileBrowserFiles extends jodit_core_ui__WEBPACK_IMPORTED_MODULE_0__.UIGrou
|
|
|
22839
22874
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
22840
22875
|
/* harmony export */ FileBrowserTree: function() { return /* binding */ FileBrowserTree; }
|
|
22841
22876
|
/* harmony export */ });
|
|
22842
|
-
/* harmony import */ var
|
|
22877
|
+
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31635);
|
|
22878
|
+
/* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84839);
|
|
22879
|
+
/* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4099);
|
|
22880
|
+
|
|
22843
22881
|
/*!
|
|
22844
22882
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
22845
22883
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
22846
22884
|
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
22847
22885
|
*/
|
|
22848
22886
|
|
|
22849
|
-
|
|
22887
|
+
|
|
22888
|
+
class FileBrowserTree extends jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.UIGroup {
|
|
22850
22889
|
className() {
|
|
22851
22890
|
return 'FileBrowserTree';
|
|
22852
22891
|
}
|
|
22853
22892
|
}
|
|
22893
|
+
FileBrowserTree = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
|
|
22894
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.component
|
|
22895
|
+
], FileBrowserTree);
|
|
22854
22896
|
|
|
22855
22897
|
|
|
22856
22898
|
/***/ }),
|
|
@@ -28461,6 +28503,9 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
|
|
|
28461
28503
|
* Check if two separate elements can be connected
|
|
28462
28504
|
* @private
|
|
28463
28505
|
*/ function checkJoinNeighbors(jodit, fakeNode, backspace) {
|
|
28506
|
+
if (checkJoinBareText(jodit, fakeNode, backspace)) {
|
|
28507
|
+
return true;
|
|
28508
|
+
}
|
|
28464
28509
|
let nextBox = fakeNode, mainClosestBox = nextBox;
|
|
28465
28510
|
// Find the main big closest element
|
|
28466
28511
|
while(nextBox && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(nextBox, backspace) && nextBox.parentElement !== jodit.editor){
|
|
@@ -28488,7 +28533,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
|
|
|
28488
28533
|
return true;
|
|
28489
28534
|
}
|
|
28490
28535
|
const box = findCaretBox(fakeNode, mainClosestBox);
|
|
28491
|
-
if (sibling && (checkPullNextLine(jodit, fakeNode, box, sibling, backspace) || checkMoveListContent(jodit, box, sibling, backspace) || moveContentAndRemoveEmpty(jodit, box, findEdgeBlock(resolveTableSibling(sibling, backspace), backspace, jodit.editor), backspace))) {
|
|
28536
|
+
if (sibling && (checkPullNextLine(jodit, fakeNode, box, sibling, backspace) || checkMoveListContent(jodit, box, sibling, backspace) || checkJoinInlineSibling(jodit, box, sibling, backspace) || moveContentAndRemoveEmpty(jodit, box, findEdgeBlock(resolveTableSibling(sibling, backspace), backspace, jodit.editor), backspace))) {
|
|
28492
28537
|
jodit.s.setCursorBefore(fakeNode);
|
|
28493
28538
|
return true;
|
|
28494
28539
|
}
|
|
@@ -28573,6 +28618,70 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
|
|
|
28573
28618
|
}
|
|
28574
28619
|
return true;
|
|
28575
28620
|
}
|
|
28621
|
+
/**
|
|
28622
|
+
* A block next to bare text in the same parent joins that text, as the
|
|
28623
|
+
* browsers do: `<li>one<p>|two</p></li>` gives `<li>one|two</li>`, and
|
|
28624
|
+
* `<li><p>one|</p>two</li>` gives `<li><p>one|two</p></li>`
|
|
28625
|
+
* @private
|
|
28626
|
+
*/ function checkJoinInlineSibling(jodit, box, sibling, backspace) {
|
|
28627
|
+
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(sibling) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(box) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isList(box) || // The caret's block is nested deeper than the text: `text<div><p>|x</p></div>`
|
|
28628
|
+
box.parentNode !== sibling.parentNode || Array.from(box.childNodes).some((node)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(node))) {
|
|
28629
|
+
return false;
|
|
28630
|
+
}
|
|
28631
|
+
if (backspace) {
|
|
28632
|
+
// Text after the block keeps its own line
|
|
28633
|
+
const next = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(box, false);
|
|
28634
|
+
if (next && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(next) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(next, 'br')) {
|
|
28635
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.after(box, jodit.createInside.element('br'));
|
|
28636
|
+
}
|
|
28637
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.unwrap(box);
|
|
28638
|
+
return true;
|
|
28639
|
+
}
|
|
28640
|
+
const filter = (0,jodit_plugins_backspace_helpers__WEBPACK_IMPORTED_MODULE_2__.getMoveFilter)(jodit);
|
|
28641
|
+
for(let node = sibling; node && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(node);){
|
|
28642
|
+
const next = node.nextSibling;
|
|
28643
|
+
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(node, 'br')) {
|
|
28644
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(node);
|
|
28645
|
+
break;
|
|
28646
|
+
}
|
|
28647
|
+
filter(node) ? jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(box, node) : jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(node);
|
|
28648
|
+
node = next;
|
|
28649
|
+
}
|
|
28650
|
+
return true;
|
|
28651
|
+
}
|
|
28652
|
+
/**
|
|
28653
|
+
* Bare text next to a block in the same parent, as the browsers join them:
|
|
28654
|
+
* Backspace in `<div><p>a</p>|b</div>` gives `<div><p>a|b</p></div>`, Delete
|
|
28655
|
+
* in `<div>a|<p>b</p>c</div>` gives `<div>a|b<br>c</div>`
|
|
28656
|
+
*/ function checkJoinBareText(jodit, fakeNode, backspace) {
|
|
28657
|
+
const block = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(fakeNode, backspace);
|
|
28658
|
+
if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(block) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(block) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isList(block) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(block, 'table') || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell(block) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isContentEditable(block, jodit.editor) || Array.from(block.childNodes).some((node)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(node))) {
|
|
28659
|
+
return false;
|
|
28660
|
+
}
|
|
28661
|
+
const filter = (0,jodit_plugins_backspace_helpers__WEBPACK_IMPORTED_MODULE_2__.getMoveFilter)(jodit);
|
|
28662
|
+
if (backspace) {
|
|
28663
|
+
// The caret's line goes to the end of the block before it
|
|
28664
|
+
for(let node = fakeNode; node && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(node);){
|
|
28665
|
+
const next = node.nextSibling;
|
|
28666
|
+
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(node, 'br')) {
|
|
28667
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(node);
|
|
28668
|
+
break;
|
|
28669
|
+
}
|
|
28670
|
+
filter(node) ? jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(block, node) : jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(node);
|
|
28671
|
+
node = next;
|
|
28672
|
+
}
|
|
28673
|
+
} else {
|
|
28674
|
+
// The block's content joins the caret's line, and text after the
|
|
28675
|
+
// block keeps its own line
|
|
28676
|
+
const next = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(block, false);
|
|
28677
|
+
if (next && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(next) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(next, 'br')) {
|
|
28678
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.after(block, jodit.createInside.element('br'));
|
|
28679
|
+
}
|
|
28680
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.unwrap(block);
|
|
28681
|
+
}
|
|
28682
|
+
jodit.s.setCursorBefore(fakeNode);
|
|
28683
|
+
return true;
|
|
28684
|
+
}
|
|
28576
28685
|
function checkMoveListContent(jodit, mainClosestBox, sibling, backspace) {
|
|
28577
28686
|
// Process UL/LI/OL cases
|
|
28578
28687
|
const siblingIsList = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(sibling, jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.LIST_TAGS);
|
|
@@ -28723,9 +28832,10 @@ function moveContentAndRemoveEmpty(jodit, mainClosestBox, sibling, backspace) {
|
|
|
28723
28832
|
* ```html
|
|
28724
28833
|
* t|st
|
|
28725
28834
|
* ```
|
|
28835
|
+
* With `stopBeforeSpace`, nothing is removed when the next char is a space.
|
|
28726
28836
|
* @private
|
|
28727
28837
|
*/ // eslint-disable-next-line complexity
|
|
28728
|
-
function checkRemoveChar(jodit, fakeNode, backspace, mode) {
|
|
28838
|
+
function checkRemoveChar(jodit, fakeNode, backspace, mode, stopBeforeSpace = false) {
|
|
28729
28839
|
const step = backspace ? -1 : 1;
|
|
28730
28840
|
const anotherSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.sibling(fakeNode, !backspace);
|
|
28731
28841
|
let sibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.sibling(fakeNode, backspace);
|
|
@@ -28744,6 +28854,9 @@ function checkRemoveChar(jodit, fakeNode, backspace, mode) {
|
|
|
28744
28854
|
break;
|
|
28745
28855
|
}
|
|
28746
28856
|
if ((_sibling_nodeValue = sibling.nodeValue) === null || _sibling_nodeValue === void 0 ? void 0 : _sibling_nodeValue.length) {
|
|
28857
|
+
if (stopBeforeSpace && isSpace(nextChar(sibling.nodeValue, backspace))) {
|
|
28858
|
+
break;
|
|
28859
|
+
}
|
|
28747
28860
|
removed = tryRemoveChar(sibling, backspace, step, anotherSibling);
|
|
28748
28861
|
if (!sibling.nodeValue.length && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isInlineBlock(sibling.parentNode)) {
|
|
28749
28862
|
sibling.nodeValue = jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.INVISIBLE_SPACE;
|
|
@@ -28781,10 +28894,11 @@ function getNextInlineSibling(sibling, backspace, root) {
|
|
|
28781
28894
|
let nextSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.sibling(sibling, backspace);
|
|
28782
28895
|
if (!nextSibling && sibling.parentNode && sibling.parentNode !== root) {
|
|
28783
28896
|
nextSibling = (0,jodit_plugins_backspace_helpers__WEBPACK_IMPORTED_MODULE_3__.findMostNestedNeighbor)(sibling, !backspace, root, true);
|
|
28784
|
-
// Do not cross a
|
|
28785
|
-
// neighbor can be the text of the parent/previous item
|
|
28786
|
-
//
|
|
28787
|
-
|
|
28897
|
+
// Do not cross a block boundary. At the start of a list item the
|
|
28898
|
+
// neighbor can be the text of the parent/previous item (#1277), and at
|
|
28899
|
+
// the start of a paragraph the text before it in the same parent
|
|
28900
|
+
// (#1693); deleting a char there is wrong — the join cases handle them.
|
|
28901
|
+
if (nextSibling && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(sibling, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock, root) !== jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(nextSibling, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock, root)) {
|
|
28788
28902
|
return null;
|
|
28789
28903
|
}
|
|
28790
28904
|
}
|
|
@@ -28851,9 +28965,25 @@ function replaceSpaceOnNBSP(anotherSibling, backspace, value) {
|
|
|
28851
28965
|
}
|
|
28852
28966
|
function checkRepeatRemoveCharAction(backspace, sibling, fakeNode, mode, removed, jodit) {
|
|
28853
28967
|
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.call)(backspace ? jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.after : jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before, sibling, fakeNode);
|
|
28854
|
-
|
|
28855
|
-
|
|
28968
|
+
const wordChar = mode === 'word' && !isSpace(removed);
|
|
28969
|
+
// Backspace by word removes the spaces before the caret, then the word, and keeps the space in front of it
|
|
28970
|
+
if (mode === 'sentence' || wordChar || mode === 'word' && backspace) {
|
|
28971
|
+
checkRemoveChar(jodit, fakeNode, backspace, mode, wordChar && backspace);
|
|
28972
|
+
}
|
|
28973
|
+
}
|
|
28974
|
+
/**
|
|
28975
|
+
* The char tryRemoveChar would remove next
|
|
28976
|
+
*/ function nextChar(value, backspace) {
|
|
28977
|
+
const chars = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.toArray)(value);
|
|
28978
|
+
const step = backspace ? -1 : 1;
|
|
28979
|
+
let index = backspace ? chars.length - 1 : 0;
|
|
28980
|
+
while(chars[index] === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.INVISIBLE_SPACE){
|
|
28981
|
+
index += step;
|
|
28856
28982
|
}
|
|
28983
|
+
return chars[index];
|
|
28984
|
+
}
|
|
28985
|
+
function isSpace(char) {
|
|
28986
|
+
return char === ' ' || char === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.NBSP_SPACE;
|
|
28857
28987
|
}
|
|
28858
28988
|
|
|
28859
28989
|
|
|
@@ -29148,6 +29278,69 @@ function checkRepeatRemoveCharAction(backspace, sibling, fakeNode, mode, removed
|
|
|
29148
29278
|
}
|
|
29149
29279
|
|
|
29150
29280
|
|
|
29281
|
+
/***/ }),
|
|
29282
|
+
|
|
29283
|
+
/***/ 88426:
|
|
29284
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
29285
|
+
|
|
29286
|
+
"use strict";
|
|
29287
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
29288
|
+
/* harmony export */ checkUnwrapListItem: function() { return /* binding */ checkUnwrapListItem; }
|
|
29289
|
+
/* harmony export */ });
|
|
29290
|
+
/* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23211);
|
|
29291
|
+
/*!
|
|
29292
|
+
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
29293
|
+
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
29294
|
+
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
29295
|
+
*/ /**
|
|
29296
|
+
* @module plugins/backspace
|
|
29297
|
+
*/
|
|
29298
|
+
/**
|
|
29299
|
+
* Backspace at the start of a later list item takes the bullet off, as Word
|
|
29300
|
+
* does: the item becomes a paragraph where it was, and the list is split
|
|
29301
|
+
* around it. A split `<ol>` carries its numbering on with `start`.
|
|
29302
|
+
*
|
|
29303
|
+
* @example
|
|
29304
|
+
* ```html
|
|
29305
|
+
* <ol><li>first</li><li>|second</li><li>third</li></ol>
|
|
29306
|
+
* ```
|
|
29307
|
+
* Result
|
|
29308
|
+
* ```html
|
|
29309
|
+
* <ol><li>first</li></ol><p>|second</p><ol start="2"><li>third</li></ol>
|
|
29310
|
+
* ```
|
|
29311
|
+
*
|
|
29312
|
+
* @private
|
|
29313
|
+
*/ function checkUnwrapListItem(jodit, fakeNode, backspace) {
|
|
29314
|
+
if (!backspace) {
|
|
29315
|
+
return false;
|
|
29316
|
+
}
|
|
29317
|
+
const li = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(fakeNode, 'li', jodit.editor);
|
|
29318
|
+
const list = li ? li.parentElement : null;
|
|
29319
|
+
if (!li || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isList(list) || !li.previousElementSibling || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isEmpty(li) || Array.from(li.childNodes).some((node)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isBlock(node)) || !jodit.s.cursorInTheEdge(true, li)) {
|
|
29320
|
+
return false;
|
|
29321
|
+
}
|
|
29322
|
+
const p = jodit.createInside.element(jodit.o.enterBlock);
|
|
29323
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.after(list, p);
|
|
29324
|
+
if (li.nextElementSibling) {
|
|
29325
|
+
const rest = list.cloneNode(false);
|
|
29326
|
+
// Two lists cannot share one id
|
|
29327
|
+
rest.removeAttribute('id');
|
|
29328
|
+
while(li.nextSibling){
|
|
29329
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.append(rest, li.nextSibling);
|
|
29330
|
+
}
|
|
29331
|
+
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(list, 'ol')) {
|
|
29332
|
+
const start = parseInt(list.getAttribute('start') || '1', 10) || 1;
|
|
29333
|
+
rest.setAttribute('start', String(start + list.children.length - 1));
|
|
29334
|
+
}
|
|
29335
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.after(p, rest);
|
|
29336
|
+
}
|
|
29337
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.moveContent(li, p);
|
|
29338
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.safeRemove(li);
|
|
29339
|
+
jodit.s.setCursorBefore(fakeNode);
|
|
29340
|
+
return true;
|
|
29341
|
+
}
|
|
29342
|
+
|
|
29343
|
+
|
|
29151
29344
|
/***/ }),
|
|
29152
29345
|
|
|
29153
29346
|
/***/ 17523:
|
|
@@ -29164,6 +29357,7 @@ function checkRepeatRemoveCharAction(backspace, sibling, fakeNode, mode, removed
|
|
|
29164
29357
|
/* harmony import */ var _check_remove_unbreakable_element__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(93890);
|
|
29165
29358
|
/* harmony import */ var _check_table_cell__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(12443);
|
|
29166
29359
|
/* harmony import */ var _check_unwrap_first_list_item__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(10157);
|
|
29360
|
+
/* harmony import */ var _check_unwrap_list_item__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(88426);
|
|
29167
29361
|
/*!
|
|
29168
29362
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
29169
29363
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -29179,6 +29373,7 @@ function checkRepeatRemoveCharAction(backspace, sibling, fakeNode, mode, removed
|
|
|
29179
29373
|
|
|
29180
29374
|
|
|
29181
29375
|
|
|
29376
|
+
|
|
29182
29377
|
/**
|
|
29183
29378
|
* Ordered delete/backspace cases with stable keys. The first one returning
|
|
29184
29379
|
* `true` wins. The keys are stable across minified builds (function names are
|
|
@@ -29213,6 +29408,10 @@ function checkRepeatRemoveCharAction(backspace, sibling, fakeNode, mode, removed
|
|
|
29213
29408
|
'join-two-lists',
|
|
29214
29409
|
_check_join_two_lists__WEBPACK_IMPORTED_MODULE_1__.checkJoinTwoLists
|
|
29215
29410
|
],
|
|
29411
|
+
[
|
|
29412
|
+
'unwrap-list-item',
|
|
29413
|
+
_check_unwrap_list_item__WEBPACK_IMPORTED_MODULE_9__.checkUnwrapListItem
|
|
29414
|
+
],
|
|
29216
29415
|
[
|
|
29217
29416
|
'join-neighbors',
|
|
29218
29417
|
_check_join_neighbors__WEBPACK_IMPORTED_MODULE_0__.checkJoinNeighbors
|
|
@@ -29238,7 +29437,8 @@ function checkRepeatRemoveCharAction(backspace, sibling, fakeNode, mode, removed
|
|
|
29238
29437
|
/***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
|
|
29239
29438
|
|
|
29240
29439
|
"use strict";
|
|
29241
|
-
/* harmony import */ var
|
|
29440
|
+
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81937);
|
|
29441
|
+
/* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5266);
|
|
29242
29442
|
/*!
|
|
29243
29443
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
29244
29444
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -29246,13 +29446,18 @@ function checkRepeatRemoveCharAction(backspace, sibling, fakeNode, mode, removed
|
|
|
29246
29446
|
*/ /**
|
|
29247
29447
|
* @module plugins/backspace
|
|
29248
29448
|
*/
|
|
29249
|
-
|
|
29449
|
+
|
|
29450
|
+
jodit_config__WEBPACK_IMPORTED_MODULE_1__.Config.prototype.delete = {
|
|
29250
29451
|
hotkeys: {
|
|
29251
|
-
delete: [
|
|
29452
|
+
delete: jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.IS_MAC ? [
|
|
29453
|
+
'delete'
|
|
29454
|
+
] : [
|
|
29252
29455
|
'delete',
|
|
29253
29456
|
'cmd+backspace'
|
|
29254
29457
|
],
|
|
29255
|
-
deleteWord: [
|
|
29458
|
+
deleteWord: jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.IS_MAC ? [
|
|
29459
|
+
'ctrl+delete'
|
|
29460
|
+
] : [
|
|
29256
29461
|
'ctrl+delete',
|
|
29257
29462
|
'cmd+alt+backspace',
|
|
29258
29463
|
'ctrl+alt+backspace'
|
|
@@ -29264,7 +29469,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.delete = {
|
|
|
29264
29469
|
backspace: [
|
|
29265
29470
|
'backspace'
|
|
29266
29471
|
],
|
|
29267
|
-
backspaceWord: [
|
|
29472
|
+
backspaceWord: jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.IS_MAC ? [] : [
|
|
29268
29473
|
'ctrl+backspace'
|
|
29269
29474
|
],
|
|
29270
29475
|
backspaceSentence: [
|
|
@@ -32879,7 +33084,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_2__.pluginSystem.add('dtd', dtd);
|
|
|
32879
33084
|
]);
|
|
32880
33085
|
let block = (0,_helpers__WEBPACK_IMPORTED_MODULE_7__.getBlockWrapper)(fake, jodit);
|
|
32881
33086
|
const isLi = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isLeaf(block);
|
|
32882
|
-
// if use <br> defaultTag for break line or when was entered SHIFt key or in <td
|
|
33087
|
+
// if use <br> defaultTag for break line or when was entered SHIFt key or in <td>, <th> or <blockquote> without an inner block
|
|
32883
33088
|
if ((!isLi || (event === null || event === void 0 ? void 0 : event.shiftKey)) && (0,_helpers__WEBPACK_IMPORTED_MODULE_7__.checkBR)(fake, jodit, event === null || event === void 0 ? void 0 : event.shiftKey, block)) {
|
|
32884
33089
|
return false;
|
|
32885
33090
|
}
|
|
@@ -32943,10 +33148,9 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('enter', enter);
|
|
|
32943
33148
|
* Checks the possibility and necessity of inserting a BR instead of a block
|
|
32944
33149
|
* @private
|
|
32945
33150
|
*/ function checkBR(fake, jodit, shiftKeyPressed, block) {
|
|
32946
|
-
|
|
32947
|
-
|
|
32948
|
-
|
|
32949
|
-
], jodit.editor));
|
|
33151
|
+
// Text in a <pre>, or bare text in a quote, gets a BR. A real block inside
|
|
33152
|
+
// a quote (<p>, <h3>, ...) is split like anywhere else, as in a cell below.
|
|
33153
|
+
const isMultiLineBlock = Boolean(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(fake, 'pre', jodit.editor)) || (block ? jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(block, 'blockquote') : Boolean(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(fake, 'blockquote', jodit.editor)));
|
|
32950
33154
|
// A cell itself can't be split into two cells, so bare cell content gets
|
|
32951
33155
|
// a BR. But when the cell already holds a real block (<p>, <h3>, ...) that
|
|
32952
33156
|
// block is split like anywhere else, otherwise every line of the cell
|
|
@@ -32956,7 +33160,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('enter', enter);
|
|
|
32956
33160
|
'th'
|
|
32957
33161
|
], jodit.editor)));
|
|
32958
33162
|
const isBRMode = jodit.o.enter.toLowerCase() === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.BR.toLowerCase();
|
|
32959
|
-
// if you use <br> defaultTag for break line or when was entered SHIFt key or in <td
|
|
33163
|
+
// if you use <br> defaultTag for break line or when was entered SHIFt key or in <td>, <th> or <blockquote> without an inner block
|
|
32960
33164
|
if (isBRMode || isCell || shiftKeyPressed && !isMultiLineBlock || !shiftKeyPressed && isMultiLineBlock) {
|
|
32961
33165
|
// 2 BR before
|
|
32962
33166
|
if (isMultiLineBlock && checkSeveralBR(fake)) {
|
|
@@ -35310,8 +35514,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.image = {
|
|
|
35310
35514
|
dialog.close();
|
|
35311
35515
|
});
|
|
35312
35516
|
buttons.remove.onAction(()=>{
|
|
35517
|
+
const caret = j.s.createRange();
|
|
35518
|
+
caret.setStartBefore(this.state.sourceImage);
|
|
35519
|
+
caret.collapse(true);
|
|
35313
35520
|
j.s.removeNode(this.state.sourceImage);
|
|
35314
35521
|
dialog.close();
|
|
35522
|
+
j.s.selectRange(caret);
|
|
35315
35523
|
});
|
|
35316
35524
|
buttons.cancel.onAction(()=>{
|
|
35317
35525
|
dialog.close();
|
|
@@ -35325,10 +35533,20 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.image = {
|
|
|
35325
35533
|
],
|
|
35326
35534
|
buttons.check
|
|
35327
35535
|
]);
|
|
35328
|
-
|
|
35329
|
-
|
|
35330
|
-
|
|
35536
|
+
// The dialog fires `afterClose` on its own emitter, not the editor's
|
|
35537
|
+
dialog.e.on(dialog, 'afterClose', ()=>{
|
|
35538
|
+
const { sourceImage } = this.state;
|
|
35539
|
+
if (j.isInDestruct || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(j.editor, sourceImage)) {
|
|
35540
|
+
return;
|
|
35541
|
+
}
|
|
35542
|
+
if (j.o.image.selectImageAfterClose) {
|
|
35543
|
+
j.s.select(sourceImage);
|
|
35544
|
+
return;
|
|
35331
35545
|
}
|
|
35546
|
+
const caret = j.s.createRange();
|
|
35547
|
+
caret.setStartAfter(sourceImage);
|
|
35548
|
+
caret.collapse(true);
|
|
35549
|
+
j.s.selectRange(caret);
|
|
35332
35550
|
});
|
|
35333
35551
|
dialog.setSize(j.o.image.dialogWidth);
|
|
35334
35552
|
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.markOwner)(j, dialog.container);
|
|
@@ -35359,6 +35577,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.image = {
|
|
|
35359
35577
|
this.activeTabState.activeTab = 'Image';
|
|
35360
35578
|
this.__lock();
|
|
35361
35579
|
this.dialog.open().setModal(true).setPosition();
|
|
35580
|
+
this.__focusFirstField();
|
|
35362
35581
|
this.async.promise((resolve, reject)=>(0,_readers__WEBPACK_IMPORTED_MODULE_13__.readValuesFromImage)(this.j, this.state).then(resolve, reject)).catch((e)=>{
|
|
35363
35582
|
if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isAbortError)(e)) {
|
|
35364
35583
|
this.dialog.message.error(e.message);
|
|
@@ -35366,6 +35585,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.image = {
|
|
|
35366
35585
|
}).finally(()=>this.__unlock());
|
|
35367
35586
|
return false;
|
|
35368
35587
|
}
|
|
35588
|
+
/**
|
|
35589
|
+
* Keys typed while the dialog is open must not reach the editor behind it,
|
|
35590
|
+
* so focus the active tab's first field, or else the first field shown
|
|
35591
|
+
*/ __focusFirstField() {
|
|
35592
|
+
var _fields_concat_find;
|
|
35593
|
+
const fields = (box)=>(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.toArray)(box.querySelectorAll('input, select, textarea'));
|
|
35594
|
+
(_fields_concat_find = fields(this.form.getElm('tabsBox')).concat(fields(this.form.container)).find((field)=>field.offsetParent != null)) === null || _fields_concat_find === void 0 ? void 0 : _fields_concat_find.focus();
|
|
35595
|
+
}
|
|
35369
35596
|
__lock() {
|
|
35370
35597
|
this.dialog.lock();
|
|
35371
35598
|
this.form.setMod('lock', true);
|
|
@@ -39850,9 +40077,11 @@ const isButtonSeparator = (item)=>item === '|' || item === '---' || item === '\n
|
|
|
39850
40077
|
return cleaned;
|
|
39851
40078
|
}
|
|
39852
40079
|
/**
|
|
39853
|
-
* The width that decides which breakpoint set the toolbar uses
|
|
39854
|
-
*
|
|
39855
|
-
*
|
|
40080
|
+
* The width that decides which breakpoint set the toolbar uses: the editor's
|
|
40081
|
+
* own width, or its parent's while the editor has none yet (for example
|
|
40082
|
+
* while hidden at init). A toolbar rendered into an external container
|
|
40083
|
+
* (`toolbar` set to an element or a selector) lays out in that container, so
|
|
40084
|
+
* its width is what matters there.
|
|
39856
40085
|
*/ function adaptiveWidth(editor) {
|
|
39857
40086
|
var _editor_container_parentElement;
|
|
39858
40087
|
const { toolbar } = editor.o;
|
|
@@ -39862,7 +40091,7 @@ const isButtonSeparator = (item)=>item === '|' || item === '---' || item === '\n
|
|
|
39862
40091
|
return width;
|
|
39863
40092
|
}
|
|
39864
40093
|
}
|
|
39865
|
-
return ((_editor_container_parentElement = editor.container.parentElement) !== null && _editor_container_parentElement !== void 0 ? _editor_container_parentElement : editor.container).offsetWidth;
|
|
40094
|
+
return editor.container.offsetWidth || ((_editor_container_parentElement = editor.container.parentElement) !== null && _editor_container_parentElement !== void 0 ? _editor_container_parentElement : editor.container).offsetWidth;
|
|
39866
40095
|
}
|
|
39867
40096
|
/**
|
|
39868
40097
|
* Rebuild toolbar in depends on editor's width
|