jodit 4.19.6 → 4.19.7
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 +22 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +6 -6
- package/es2015/jodit.js +494 -102
- package/es2015/jodit.min.js +8 -8
- 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 +6 -6
- package/es2018/jodit.min.js +8 -8
- 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 +7 -7
- package/es2021/jodit.js +482 -101
- package/es2021/jodit.min.js +57 -57
- 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 +18 -18
- package/es2021.en/jodit.js +482 -101
- package/es2021.en/jodit.min.js +18 -18
- 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 +578 -107
- 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/core/constants.js +1 -1
- package/esm/core/selection/style/apply-style.js +31 -2
- package/esm/jodit.js +14 -2
- package/esm/plugins/backspace/cases/check-join-neighbors.js +36 -7
- package/esm/plugins/backspace/cases/check-remove-empty-parent.js +3 -1
- package/esm/plugins/bold/bold.js +4 -1
- package/esm/plugins/delete/delete.d.ts +12 -0
- package/esm/plugins/delete/delete.js +50 -1
- package/esm/plugins/resize-cells/resize-cells.d.ts +25 -1
- package/esm/plugins/resize-cells/resize-cells.js +84 -15
- package/esm/plugins/select/select.d.ts +35 -0
- package/esm/plugins/select/select.js +153 -1
- package/esm/plugins/select-cells/select-cells.d.ts +24 -0
- package/esm/plugins/select-cells/select-cells.js +81 -18
- package/esm/types/style.d.ts +5 -0
- package/package.json +1 -1
- package/types/plugins/delete/delete.d.ts +12 -0
- package/types/plugins/resize-cells/resize-cells.d.ts +25 -1
- package/types/plugins/select/select.d.ts +35 -0
- package/types/plugins/select-cells/select-cells.d.ts +24 -0
- package/types/types/style.d.ts +5 -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.19.
|
|
4
|
+
* Version: v4.19.7
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
@@ -1824,7 +1824,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1824
1824
|
* ```
|
|
1825
1825
|
* @packageDocumentation
|
|
1826
1826
|
* @module constants
|
|
1827
|
-
*/ const APP_VERSION = "4.19.
|
|
1827
|
+
*/ const APP_VERSION = "4.19.7";
|
|
1828
1828
|
// prettier-ignore
|
|
1829
1829
|
const ES = "es2021";
|
|
1830
1830
|
const IS_ES_MODERN = true;
|
|
@@ -13856,9 +13856,11 @@ const WRAP_NODES = new Set([
|
|
|
13856
13856
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
13857
13857
|
/* harmony export */ ApplyStyle: function() { return /* binding */ ApplyStyle; }
|
|
13858
13858
|
/* harmony export */ });
|
|
13859
|
-
/* harmony import */ var
|
|
13860
|
-
/* harmony import */ var
|
|
13861
|
-
/* harmony import */ var
|
|
13859
|
+
/* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23211);
|
|
13860
|
+
/* harmony import */ var jodit_core_helpers_utils_selector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(28723);
|
|
13861
|
+
/* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(51640);
|
|
13862
|
+
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(98394);
|
|
13863
|
+
/* harmony import */ var _transactions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(78462);
|
|
13862
13864
|
/*!
|
|
13863
13865
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
13864
13866
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -13868,26 +13870,54 @@ const WRAP_NODES = new Set([
|
|
|
13868
13870
|
*/
|
|
13869
13871
|
|
|
13870
13872
|
|
|
13873
|
+
|
|
13874
|
+
|
|
13875
|
+
/**
|
|
13876
|
+
* Take a selected fragment out of the elements its style takes the place
|
|
13877
|
+
* of: one around it is split, so the fragment leaves it, and one in it is
|
|
13878
|
+
* unwrapped
|
|
13879
|
+
*/ function takeOutOf(jodit, font, tags) {
|
|
13880
|
+
const range = jodit.s.createRange();
|
|
13881
|
+
let outer = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(font.parentNode, tags, jodit.editor);
|
|
13882
|
+
while(outer){
|
|
13883
|
+
range.selectNodeContents(outer);
|
|
13884
|
+
range.setEndBefore(font);
|
|
13885
|
+
const before = range.cloneContents();
|
|
13886
|
+
range.selectNodeContents(outer);
|
|
13887
|
+
range.setStartAfter(font);
|
|
13888
|
+
// Split only when there's more in it, as a split leaves empty copies
|
|
13889
|
+
// of the elements between
|
|
13890
|
+
if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isEmpty(before) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isEmpty(range.cloneContents())) {
|
|
13891
|
+
(0,_api__WEBPACK_IMPORTED_MODULE_2__.extractSelectedPart)(outer, font, jodit);
|
|
13892
|
+
}
|
|
13893
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.unwrap(outer);
|
|
13894
|
+
outer = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(font.parentNode, tags, jodit.editor);
|
|
13895
|
+
}
|
|
13896
|
+
;(0,jodit_core_helpers_utils_selector__WEBPACK_IMPORTED_MODULE_1__.$$)(tags.join(','), font).forEach((inner)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.unwrap(inner));
|
|
13897
|
+
}
|
|
13871
13898
|
/** @internal */ function ApplyStyle(jodit, cs) {
|
|
13872
13899
|
const { s: sel, editor } = jodit;
|
|
13873
13900
|
editor.firstChild?.normalize(); // FF fix for test "commandsTest - Exec command "bold"
|
|
13874
13901
|
const fakes = sel.fakes();
|
|
13875
13902
|
const collapsed = sel.isCollapsed();
|
|
13876
|
-
let mode =
|
|
13903
|
+
let mode = _constants__WEBPACK_IMPORTED_MODULE_3__.INITIAL;
|
|
13877
13904
|
try {
|
|
13878
13905
|
// for...of closes the generator on an exception, releasing every
|
|
13879
13906
|
// temporary wrapper before the selection is restored in finally.
|
|
13880
13907
|
for (const font of sel.wrapInTagGen(fakes)){
|
|
13908
|
+
if (cs.options.exclude?.length) {
|
|
13909
|
+
takeOutOf(jodit, font, cs.options.exclude);
|
|
13910
|
+
}
|
|
13881
13911
|
let state = {
|
|
13882
13912
|
collapsed,
|
|
13883
13913
|
mode,
|
|
13884
13914
|
element: font,
|
|
13885
|
-
next:
|
|
13915
|
+
next: _transactions__WEBPACK_IMPORTED_MODULE_4__.states.START,
|
|
13886
13916
|
jodit,
|
|
13887
13917
|
style: cs
|
|
13888
13918
|
};
|
|
13889
|
-
const machine = new
|
|
13890
|
-
while(!jodit.isInDestruct && machine.getState() !==
|
|
13919
|
+
const machine = new _api__WEBPACK_IMPORTED_MODULE_2__.FiniteStateMachine(_transactions__WEBPACK_IMPORTED_MODULE_4__.states.START, _transactions__WEBPACK_IMPORTED_MODULE_4__.transactions);
|
|
13920
|
+
while(!jodit.isInDestruct && machine.getState() !== _transactions__WEBPACK_IMPORTED_MODULE_4__.states.END){
|
|
13891
13921
|
state = machine.dispatch('exec', state);
|
|
13892
13922
|
}
|
|
13893
13923
|
// The first selected fragment determines how later fragments toggle.
|
|
@@ -18356,6 +18386,20 @@ const FOCUS_EVENTS = new Set([
|
|
|
18356
18386
|
'focusin',
|
|
18357
18387
|
'focusout'
|
|
18358
18388
|
]);
|
|
18389
|
+
const EDITING_KEYS = new Set([
|
|
18390
|
+
jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_ENTER,
|
|
18391
|
+
jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_BACKSPACE,
|
|
18392
|
+
jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_DELETE
|
|
18393
|
+
]);
|
|
18394
|
+
/**
|
|
18395
|
+
* Whether the input method (IME) is using the key. Safari fires the keydown
|
|
18396
|
+
* that ends a composition, as the Enter that confirms Japanese text, after
|
|
18397
|
+
* `compositionend`, and types Korean without one, so `isComposing` is false and
|
|
18398
|
+
* only keyCode 229 tells. Only the keys the editor turns into edits are held
|
|
18399
|
+
* back: the handlers that follow typing still see the rest.
|
|
18400
|
+
*/ function isInputMethodKey(event) {
|
|
18401
|
+
return event.isComposing || event.keyCode === 229 && EDITING_KEYS.has(event.key);
|
|
18402
|
+
}
|
|
18359
18403
|
const __defaultStyleDisplayKey = 'data-jodit-default-style-display';
|
|
18360
18404
|
const __defaultClassesKey = 'data-jodit-default-classes';
|
|
18361
18405
|
const NOEDIT = {
|
|
@@ -19412,7 +19456,7 @@ class Jodit extends jodit_modules__WEBPACK_IMPORTED_MODULE_10__.ViewWithToolbar
|
|
|
19412
19456
|
}
|
|
19413
19457
|
}
|
|
19414
19458
|
const w = this.ew;
|
|
19415
|
-
if (event instanceof w.KeyboardEvent && event
|
|
19459
|
+
if (event instanceof w.KeyboardEvent && isInputMethodKey(event)) {
|
|
19416
19460
|
return;
|
|
19417
19461
|
}
|
|
19418
19462
|
if (this.e && this.e.fire) {
|
|
@@ -28660,6 +28704,13 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
|
|
|
28660
28704
|
if (checkJoinBareText(jodit, fakeNode, backspace)) {
|
|
28661
28705
|
return true;
|
|
28662
28706
|
}
|
|
28707
|
+
// Old content can have an inline element round blocks beside the text:
|
|
28708
|
+
// moved inside them, the line joins the block as it would bare text
|
|
28709
|
+
// (#1781)
|
|
28710
|
+
const inline = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(fakeNode, backspace);
|
|
28711
|
+
if (joinsBareText(jodit, edgeBlock(inline, backspace)) && moveInlineInside(inline, jodit.editor)) {
|
|
28712
|
+
return joinNeighbors(jodit, fakeNode, backspace, moved);
|
|
28713
|
+
}
|
|
28663
28714
|
let nextBox = fakeNode, mainClosestBox = nextBox;
|
|
28664
28715
|
// Find the main big closest element
|
|
28665
28716
|
while(nextBox && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(nextBox, backspace) && nextBox.parentElement !== jodit.editor){
|
|
@@ -28940,7 +28991,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
|
|
|
28940
28991
|
* in `<div>a|<p>b</p>c</div>` gives `<div>a|b<br>c</div>`
|
|
28941
28992
|
*/ function checkJoinBareText(jodit, fakeNode, backspace) {
|
|
28942
28993
|
const block = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(fakeNode, backspace);
|
|
28943
|
-
if (!
|
|
28994
|
+
if (!joinsBareText(jodit, block)) {
|
|
28944
28995
|
return false;
|
|
28945
28996
|
}
|
|
28946
28997
|
const filter = (0,jodit_plugins_backspace_helpers__WEBPACK_IMPORTED_MODULE_2__.getMoveFilter)(jodit);
|
|
@@ -28967,6 +29018,23 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
|
|
|
28967
29018
|
jodit.s.setCursorBefore(fakeNode);
|
|
28968
29019
|
return true;
|
|
28969
29020
|
}
|
|
29021
|
+
/**
|
|
29022
|
+
* Whether a block joins the bare text beside it: not a list, a table or a
|
|
29023
|
+
* cell, and holding no block of its own
|
|
29024
|
+
*/ function joinsBareText(jodit, block) {
|
|
29025
|
+
return 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));
|
|
29026
|
+
}
|
|
29027
|
+
/**
|
|
29028
|
+
* The block an inline element holds on its side facing the caret, through
|
|
29029
|
+
* the inline elements in it: the `<p>` of `<span><strong><p>…</p></strong></span>`
|
|
29030
|
+
*/ function edgeBlock(node, backspace) {
|
|
29031
|
+
let edge = node;
|
|
29032
|
+
while(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(edge) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(edge)){
|
|
29033
|
+
const children = Array.from(edge.childNodes).filter((child)=>!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmptyTextNode(child));
|
|
29034
|
+
edge = (backspace ? children[children.length - 1] : children[0]) ?? null;
|
|
29035
|
+
}
|
|
29036
|
+
return edge === node ? null : edge;
|
|
29037
|
+
}
|
|
28970
29038
|
function checkMoveListContent(jodit, mainClosestBox, sibling, backspace) {
|
|
28971
29039
|
// Process UL/LI/OL cases
|
|
28972
29040
|
const siblingIsList = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(sibling, jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.LIST_TAGS);
|
|
@@ -29416,7 +29484,6 @@ function isNotEditable(jodit, node) {
|
|
|
29416
29484
|
if (!prn || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(prn)) {
|
|
29417
29485
|
return false;
|
|
29418
29486
|
}
|
|
29419
|
-
const neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptyNeighbor(fakeNode, backspace, jodit.editor);
|
|
29420
29487
|
do {
|
|
29421
29488
|
if (prn && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(prn) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell(prn)) {
|
|
29422
29489
|
jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.after(prn, fakeNode);
|
|
@@ -29431,6 +29498,9 @@ function isNotEditable(jodit, node) {
|
|
|
29431
29498
|
if (found && (0,_check_join_two_lists__WEBPACK_IMPORTED_MODULE_2__.checkJoinTwoLists)(jodit, fakeNode, backspace)) {
|
|
29432
29499
|
return true;
|
|
29433
29500
|
}
|
|
29501
|
+
// Looked for once the empty elements have gone, as the one beside the
|
|
29502
|
+
// caret can be in them: the `<br>` that Delete in `<p>|<br></p>` leaves
|
|
29503
|
+
const neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptyNeighbor(fakeNode, backspace, jodit.editor);
|
|
29434
29504
|
if (neighbor && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isText(neighbor) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(neighbor, jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.INSEPARABLE_TAGS)) {
|
|
29435
29505
|
setCursorIn(neighbor, !backspace);
|
|
29436
29506
|
} else {
|
|
@@ -29896,8 +29966,15 @@ jodit_config__WEBPACK_IMPORTED_MODULE_1__.Config.prototype.delete = {
|
|
|
29896
29966
|
}
|
|
29897
29967
|
cssRules[key] = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isArray)(cssOptions[key]) ? cssOptions[key][0] : cssOptions[key];
|
|
29898
29968
|
});
|
|
29969
|
+
const element = control.tags ? control.tags[0] : undefined;
|
|
29899
29970
|
editor.s.commitStyle({
|
|
29900
|
-
element
|
|
29971
|
+
element,
|
|
29972
|
+
// As in the browsers and Word, each takes the other's place
|
|
29973
|
+
exclude: element === 'sub' ? [
|
|
29974
|
+
'sup'
|
|
29975
|
+
] : element === 'sup' ? [
|
|
29976
|
+
'sub'
|
|
29977
|
+
] : []
|
|
29901
29978
|
});
|
|
29902
29979
|
editor.synchronizeValues();
|
|
29903
29980
|
return false;
|
|
@@ -32462,11 +32539,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
32462
32539
|
"use strict";
|
|
32463
32540
|
/* unused harmony export deleteCommand */
|
|
32464
32541
|
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
|
|
32465
|
-
/* harmony import */ var
|
|
32466
|
-
/* harmony import */ var
|
|
32467
|
-
/* harmony import */ var
|
|
32468
|
-
/* harmony import */ var
|
|
32469
|
-
/* harmony import */ var
|
|
32542
|
+
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(81937);
|
|
32543
|
+
/* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(27795);
|
|
32544
|
+
/* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(28077);
|
|
32545
|
+
/* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(65946);
|
|
32546
|
+
/* harmony import */ var jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4040);
|
|
32547
|
+
/* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(91206);
|
|
32470
32548
|
/*!
|
|
32471
32549
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
32472
32550
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -32482,6 +32560,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
32482
32560
|
|
|
32483
32561
|
|
|
32484
32562
|
|
|
32563
|
+
|
|
32485
32564
|
const NOT_EMPTY_CONTENT_TAGS = new Set([
|
|
32486
32565
|
'img',
|
|
32487
32566
|
'table',
|
|
@@ -32489,7 +32568,18 @@ const NOT_EMPTY_CONTENT_TAGS = new Set([
|
|
|
32489
32568
|
'iframe',
|
|
32490
32569
|
'hr'
|
|
32491
32570
|
]);
|
|
32492
|
-
|
|
32571
|
+
const KEEPS_SPACES = new Set([
|
|
32572
|
+
'pre',
|
|
32573
|
+
'pre-wrap',
|
|
32574
|
+
'break-spaces'
|
|
32575
|
+
]);
|
|
32576
|
+
/**
|
|
32577
|
+
* A plain space beside this neighbor isn't shown: there is none, or it's a
|
|
32578
|
+
* line break, a block or text starting (or ending) with a plain space
|
|
32579
|
+
*/ function hidesSpace(neighbor, edge) {
|
|
32580
|
+
return !neighbor || jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(neighbor, 'br') || jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(neighbor) || jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(neighbor) && edge.test(neighbor.nodeValue ?? '');
|
|
32581
|
+
}
|
|
32582
|
+
class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugin {
|
|
32493
32583
|
afterInit(jodit) {
|
|
32494
32584
|
jodit.e.on('afterCommand.delete', (command)=>{
|
|
32495
32585
|
if (command === 'delete') {
|
|
@@ -32510,11 +32600,11 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
|
|
|
32510
32600
|
*/ __afterDeleteCommand() {
|
|
32511
32601
|
const jodit = this.j;
|
|
32512
32602
|
const current = jodit.s.current();
|
|
32513
|
-
if (current &&
|
|
32603
|
+
if (current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(current.firstChild, 'br')) {
|
|
32514
32604
|
jodit.s.removeNode(current.firstChild);
|
|
32515
32605
|
}
|
|
32516
|
-
if (!(0,
|
|
32517
|
-
|
|
32606
|
+
if (!(0,jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_5__.trim)(jodit.editor.textContent || '') && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.first(jodit.editor, (node)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(node, NOT_EMPTY_CONTENT_TAGS)) && (!current || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(current, 'table', jodit.editor))) {
|
|
32607
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.detach(jodit.editor);
|
|
32518
32608
|
const node = jodit.s.setCursorIn(jodit.editor);
|
|
32519
32609
|
jodit.s.removeNode(node);
|
|
32520
32610
|
}
|
|
@@ -32534,14 +32624,15 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
|
|
|
32534
32624
|
range.deleteContents();
|
|
32535
32625
|
const fake = jodit.createInside.fake();
|
|
32536
32626
|
range.insertNode(fake);
|
|
32537
|
-
const leftSibling =
|
|
32538
|
-
const rightSibling =
|
|
32627
|
+
const leftSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.findSibling(fake, true);
|
|
32628
|
+
const rightSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.findSibling(fake, false);
|
|
32539
32629
|
this.__moveContentInLeftSibling(fake, leftSibling, rightSibling);
|
|
32630
|
+
this.__keepSpacesVisible(fake);
|
|
32540
32631
|
range.setStartBefore(fake);
|
|
32541
32632
|
range.collapse(true);
|
|
32542
32633
|
this.__moveCursorInEditableSibling(jodit, leftSibling, fake, range);
|
|
32543
32634
|
this.__addBrInEmptyBlock(fake, range);
|
|
32544
|
-
|
|
32635
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(fake);
|
|
32545
32636
|
jodit.s.selectRange(caret ?? range);
|
|
32546
32637
|
return false;
|
|
32547
32638
|
}
|
|
@@ -32555,23 +32646,23 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
|
|
|
32555
32646
|
* Returns where the caret goes, or null when no table is involved
|
|
32556
32647
|
*/ __clearSelectedCells(range) {
|
|
32557
32648
|
const { editor, createInside } = this.j;
|
|
32558
|
-
const startCell =
|
|
32559
|
-
const endCell =
|
|
32649
|
+
const startCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(range.startContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isCell, editor);
|
|
32650
|
+
const endCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(range.endContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isCell, editor);
|
|
32560
32651
|
if (startCell === endCell) {
|
|
32561
32652
|
return null;
|
|
32562
32653
|
}
|
|
32563
|
-
const startTable =
|
|
32564
|
-
const endTable =
|
|
32654
|
+
const startTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(startCell, 'table', editor);
|
|
32655
|
+
const endTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(endCell, 'table', editor);
|
|
32565
32656
|
const caret = range.cloneRange();
|
|
32566
32657
|
caret.collapse(true);
|
|
32567
32658
|
const parts = [];
|
|
32568
32659
|
const addParts = (table)=>{
|
|
32569
|
-
(0,
|
|
32660
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.toArray)(table.rows).flatMap((row)=>(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.toArray)(row.cells)).filter((cell)=>range.intersectsNode(cell)).forEach((cell)=>{
|
|
32570
32661
|
const part = range.cloneRange();
|
|
32571
|
-
if (!
|
|
32662
|
+
if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isOrContains(cell, range.startContainer)) {
|
|
32572
32663
|
part.setStart(cell, 0);
|
|
32573
32664
|
}
|
|
32574
|
-
if (!
|
|
32665
|
+
if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isOrContains(cell, range.endContainer)) {
|
|
32575
32666
|
part.setEnd(cell, cell.childNodes.length);
|
|
32576
32667
|
}
|
|
32577
32668
|
parts.push([
|
|
@@ -32594,9 +32685,9 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
|
|
|
32594
32685
|
}
|
|
32595
32686
|
parts.forEach(([cell, part])=>{
|
|
32596
32687
|
part.deleteContents();
|
|
32597
|
-
if (
|
|
32598
|
-
|
|
32599
|
-
|
|
32688
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(cell)) {
|
|
32689
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.detach(cell);
|
|
32690
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(cell, createInside.element('br'));
|
|
32600
32691
|
}
|
|
32601
32692
|
});
|
|
32602
32693
|
return startTable ? caret : null;
|
|
@@ -32604,46 +32695,72 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
|
|
|
32604
32695
|
__moveContentInLeftSibling(fake, leftSibling, rightSibling) {
|
|
32605
32696
|
leftSibling = this.__defineRightLeftBox(leftSibling);
|
|
32606
32697
|
// Nothing is moved into a table, and a block left empty after it goes
|
|
32607
|
-
if (
|
|
32608
|
-
if (
|
|
32609
|
-
|
|
32698
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(leftSibling, 'table')) {
|
|
32699
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(rightSibling)) {
|
|
32700
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(rightSibling);
|
|
32610
32701
|
}
|
|
32611
32702
|
return;
|
|
32612
32703
|
}
|
|
32613
|
-
if (!
|
|
32614
|
-
|
|
32615
|
-
|
|
32616
|
-
|
|
32704
|
+
if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isList(rightSibling) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(rightSibling, 'table') && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(leftSibling)) {
|
|
32705
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, fake);
|
|
32706
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.moveContent(rightSibling, leftSibling);
|
|
32707
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(rightSibling);
|
|
32617
32708
|
}
|
|
32618
|
-
if (
|
|
32709
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isList(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isLeaf(rightSibling.firstElementChild)) {
|
|
32619
32710
|
const item = rightSibling.firstElementChild;
|
|
32620
32711
|
// What's left of the right list's first item joins the left block,
|
|
32621
32712
|
// up to a list nested in the item
|
|
32622
|
-
if (!
|
|
32623
|
-
|
|
32624
|
-
while(item.firstChild && !
|
|
32625
|
-
|
|
32713
|
+
if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(item) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(leftSibling)) {
|
|
32714
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, fake);
|
|
32715
|
+
while(item.firstChild && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(item.firstChild)){
|
|
32716
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, item.firstChild);
|
|
32626
32717
|
}
|
|
32627
32718
|
}
|
|
32628
32719
|
// Remove empty right LI
|
|
32629
|
-
if (
|
|
32630
|
-
|
|
32720
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(item)) {
|
|
32721
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(item);
|
|
32631
32722
|
}
|
|
32632
|
-
if (
|
|
32633
|
-
|
|
32723
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(rightSibling)) {
|
|
32724
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(rightSibling);
|
|
32634
32725
|
}
|
|
32635
32726
|
}
|
|
32636
32727
|
}
|
|
32728
|
+
/**
|
|
32729
|
+
* A plain space the deletion leaves at an edge of the block, before a line
|
|
32730
|
+
* break or next to another space isn't shown, and the browser drops it when
|
|
32731
|
+
* the next char is typed. It becomes non-breaking, as in the browsers' own
|
|
32732
|
+
* delete and in Backspace without a selection (#1522)
|
|
32733
|
+
*/ __keepSpacesVisible(fake) {
|
|
32734
|
+
const { jodit } = this;
|
|
32735
|
+
const block = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock, jodit.editor) ?? jodit.editor;
|
|
32736
|
+
if (KEEPS_SPACES.has(jodit.ew.getComputedStyle(block).whiteSpace)) {
|
|
32737
|
+
return;
|
|
32738
|
+
}
|
|
32739
|
+
const before = this.__findNeighbor(fake, true, block);
|
|
32740
|
+
const after = this.__findNeighbor(fake, false, block);
|
|
32741
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(before) && hidesSpace(after, /^ /)) {
|
|
32742
|
+
before.nodeValue = before.nodeValue.replace(/ +$/, (spaces)=>jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.NBSP_SPACE.repeat(spaces.length));
|
|
32743
|
+
}
|
|
32744
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(after) && hidesSpace(before, / $/)) {
|
|
32745
|
+
after.nodeValue = after.nodeValue.replace(/^ +/, (spaces)=>jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.NBSP_SPACE.repeat(spaces.length));
|
|
32746
|
+
}
|
|
32747
|
+
}
|
|
32748
|
+
/**
|
|
32749
|
+
* The text, line break or other element next to the caret in its block,
|
|
32750
|
+
* looking inside inline elements
|
|
32751
|
+
*/ __findNeighbor(fake, left, block) {
|
|
32752
|
+
return (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.call)(left ? jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.prev : jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.next, fake, (node)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(node) ? (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.trimInv)(node.nodeValue ?? '').length > 0 : !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isComment(node) && !(jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isInlineBlock(node) && node.firstChild), block);
|
|
32753
|
+
}
|
|
32637
32754
|
/**
|
|
32638
32755
|
* If left sibling is list - return last leaf
|
|
32639
32756
|
*/ __defineRightLeftBox(leftSibling) {
|
|
32640
|
-
if (!
|
|
32757
|
+
if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isList(leftSibling)) {
|
|
32641
32758
|
return leftSibling;
|
|
32642
32759
|
}
|
|
32643
32760
|
let lastLeaf = leftSibling.lastElementChild;
|
|
32644
|
-
if (!
|
|
32761
|
+
if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isLeaf(lastLeaf)) {
|
|
32645
32762
|
lastLeaf = this.j.createInside.element('li');
|
|
32646
|
-
|
|
32763
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, lastLeaf);
|
|
32647
32764
|
}
|
|
32648
32765
|
return lastLeaf;
|
|
32649
32766
|
}
|
|
@@ -32651,21 +32768,21 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
|
|
|
32651
32768
|
* Add BR in the empty block left at the caret
|
|
32652
32769
|
*/ __addBrInEmptyBlock(fake, range) {
|
|
32653
32770
|
const jodit = this.j;
|
|
32654
|
-
if (fake.isConnected &&
|
|
32771
|
+
if (fake.isConnected && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(fake.parentNode) && !fake.nextSibling && !fake.previousSibling) {
|
|
32655
32772
|
const br = jodit.createInside.element('br');
|
|
32656
|
-
|
|
32773
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.after(fake, br);
|
|
32657
32774
|
range.setStartBefore(br);
|
|
32658
32775
|
range.collapse(true);
|
|
32659
32776
|
}
|
|
32660
32777
|
}
|
|
32661
32778
|
__moveCursorInEditableSibling(jodit, leftSibling, fake, range) {
|
|
32662
|
-
if (!leftSibling || !
|
|
32663
|
-
const root =
|
|
32664
|
-
const leftText =
|
|
32779
|
+
if (!leftSibling || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(leftSibling)) {
|
|
32780
|
+
const root = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock, jodit.editor) ?? jodit.editor;
|
|
32781
|
+
const leftText = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.prev(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText, root);
|
|
32665
32782
|
if (leftText) {
|
|
32666
32783
|
range.setStartAfter(leftText);
|
|
32667
32784
|
range.collapse(true);
|
|
32668
|
-
|
|
32785
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(fake);
|
|
32669
32786
|
}
|
|
32670
32787
|
}
|
|
32671
32788
|
}
|
|
@@ -32673,7 +32790,7 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
|
|
|
32673
32790
|
;(0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(deleteCommand, "requires", [
|
|
32674
32791
|
'backspace'
|
|
32675
32792
|
]);
|
|
32676
|
-
|
|
32793
|
+
jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('deleteCommand', deleteCommand);
|
|
32677
32794
|
|
|
32678
32795
|
|
|
32679
32796
|
/***/ }),
|
|
@@ -43572,7 +43689,7 @@ const key = 'table_processor_observer-resize';
|
|
|
43572
43689
|
/**
|
|
43573
43690
|
* Click on resize handle
|
|
43574
43691
|
*/ onHandleMouseDown(event) {
|
|
43575
|
-
if (this.j.isLocked) {
|
|
43692
|
+
if (this.j.isLocked || this.j.o.readonly) {
|
|
43576
43693
|
return;
|
|
43577
43694
|
}
|
|
43578
43695
|
this.drag = true;
|
|
@@ -43607,10 +43724,15 @@ const key = 'table_processor_observer-resize';
|
|
|
43607
43724
|
let box;
|
|
43608
43725
|
this.minX = 0;
|
|
43609
43726
|
this.maxX = 1000000;
|
|
43727
|
+
this.startTableWidth = this.workTable.offsetWidth;
|
|
43610
43728
|
if (this.wholeTable != null) {
|
|
43611
|
-
const
|
|
43729
|
+
const parent = this.workTable.parentNode;
|
|
43730
|
+
const tableBox = parent.getBoundingClientRect();
|
|
43612
43731
|
this.minX = tableBox.left;
|
|
43613
43732
|
this.maxX = this.minX + tableBox.width;
|
|
43733
|
+
const side = this.isRTL ? 'marginRight' : 'marginLeft';
|
|
43734
|
+
this.startParentWidth = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.getContentWidth)(parent, this.j.ew);
|
|
43735
|
+
this.startMargin = parseInt(this.j.ew.getComputedStyle(this.workTable)[side] || '0', 10);
|
|
43614
43736
|
} else {
|
|
43615
43737
|
// find maximum columns
|
|
43616
43738
|
const coordinate = this.module.formalCoordinate(this.workTable, this.workCell, true);
|
|
@@ -43624,6 +43746,17 @@ const key = 'table_processor_observer-resize';
|
|
|
43624
43746
|
this.maxX = Math.min(box.left + box.width - jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.NEARBY / 2, this.maxX);
|
|
43625
43747
|
}
|
|
43626
43748
|
});
|
|
43749
|
+
const matrix = this.module.formalMatrix(this.workTable);
|
|
43750
|
+
this.startWidths = this.resizedColumns().map((column)=>{
|
|
43751
|
+
const cells = matrix.map((row)=>row[column]);
|
|
43752
|
+
const index = cells.findIndex((td)=>td.colSpan === 1 || cells.length === 1);
|
|
43753
|
+
const cell = cells[index];
|
|
43754
|
+
return [
|
|
43755
|
+
cell,
|
|
43756
|
+
cell ? cell.offsetWidth : 0,
|
|
43757
|
+
cells.slice(Math.max(index, 0) + 1)
|
|
43758
|
+
];
|
|
43759
|
+
});
|
|
43627
43760
|
}
|
|
43628
43761
|
return false;
|
|
43629
43762
|
}
|
|
@@ -43651,8 +43784,11 @@ const key = 'table_processor_observer-resize';
|
|
|
43651
43784
|
x = this.maxX;
|
|
43652
43785
|
}
|
|
43653
43786
|
this.resizeDelta = x - this.startX + (!this.j.o.iframe ? 0 : workplacePosition.left);
|
|
43654
|
-
this.
|
|
43655
|
-
|
|
43787
|
+
if (this.wholeTable == null) {
|
|
43788
|
+
this.setColumnWidths();
|
|
43789
|
+
} else {
|
|
43790
|
+
this.resizeTable();
|
|
43791
|
+
}
|
|
43656
43792
|
const tableBox = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.offset)(this.workTable, this.j, this.j.ed);
|
|
43657
43793
|
Object.assign(this.resizeHandler.style, {
|
|
43658
43794
|
left: this.startLeft + this.columnEdge() - this.startEdge + 'px',
|
|
@@ -43765,21 +43901,49 @@ const key = 'table_processor_observer-resize';
|
|
|
43765
43901
|
};
|
|
43766
43902
|
this.scrollFrame = this.j.async.requestAnimationFrame(scroll);
|
|
43767
43903
|
}
|
|
43904
|
+
/**
|
|
43905
|
+
* The two columns a column drag resizes: the work cell's last, and the
|
|
43906
|
+
* next cell's first
|
|
43907
|
+
*/ resizedColumns() {
|
|
43908
|
+
const nextTD = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.call)(this.isRTL ? jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.prev : jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.next, this.workCell, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isCell, this.workCell.parentNode);
|
|
43909
|
+
return [
|
|
43910
|
+
this.module.formalCoordinate(this.workTable, this.workCell, true)[1],
|
|
43911
|
+
this.module.formalCoordinate(this.workTable, nextTD)[1]
|
|
43912
|
+
];
|
|
43913
|
+
}
|
|
43768
43914
|
/**
|
|
43769
43915
|
* Resize only one column
|
|
43770
43916
|
*/ resizeColumns() {
|
|
43771
43917
|
const delta = this.resizeDelta;
|
|
43772
43918
|
const marked = [];
|
|
43773
43919
|
const tableModule = this.module;
|
|
43774
|
-
|
|
43775
|
-
|
|
43776
|
-
tableModule.setColumnWidthByDelta(this.workTable,
|
|
43920
|
+
const [column, nextColumn] = this.resizedColumns();
|
|
43921
|
+
tableModule.setColumnWidthByDelta(this.workTable, column, delta, true, marked);
|
|
43922
|
+
tableModule.setColumnWidthByDelta(this.workTable, nextColumn, -delta, false, marked);
|
|
43923
|
+
}
|
|
43924
|
+
/**
|
|
43925
|
+
* Sets the widths `resizeColumns` would while the handle is dragged, from
|
|
43926
|
+
* the widths the drag started with, so that a move doesn't put back every
|
|
43927
|
+
* cell's style and lay the table out again to measure them
|
|
43928
|
+
*/ setColumnWidths() {
|
|
43929
|
+
this.startWidths.forEach(([cell, width, below], index)=>{
|
|
43930
|
+
const delta = index ? -this.resizeDelta : this.resizeDelta;
|
|
43931
|
+
if (cell) {
|
|
43932
|
+
(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_7__.css)(cell, 'width', ((width + delta) / this.startTableWidth * 100).toFixed(jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.ACCURACY) + '%');
|
|
43933
|
+
}
|
|
43934
|
+
below.forEach((td)=>{
|
|
43935
|
+
td.style.removeProperty('width');
|
|
43936
|
+
if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(td, 'style')) {
|
|
43937
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(td, 'style', null);
|
|
43938
|
+
}
|
|
43939
|
+
});
|
|
43940
|
+
});
|
|
43777
43941
|
}
|
|
43778
43942
|
/**
|
|
43779
43943
|
* Resize whole table
|
|
43780
43944
|
*/ resizeTable() {
|
|
43781
43945
|
const delta = this.resizeDelta * (this.isRTL ? -1 : 1);
|
|
43782
|
-
const width = this.
|
|
43946
|
+
const width = this.startTableWidth, parentWidth = this.startParentWidth;
|
|
43783
43947
|
// for RTL use mirror logic
|
|
43784
43948
|
const rightSide = !this.wholeTable;
|
|
43785
43949
|
const needChangeWidth = this.isRTL ? !rightSide : rightSide;
|
|
@@ -43788,10 +43952,9 @@ const key = 'table_processor_observer-resize';
|
|
|
43788
43952
|
(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_7__.css)(this.workTable, 'width', (width + delta) / parentWidth * 100 + '%');
|
|
43789
43953
|
} else {
|
|
43790
43954
|
const side = this.isRTL ? 'marginRight' : 'marginLeft';
|
|
43791
|
-
const margin = parseInt(this.j.ew.getComputedStyle(this.workTable)[side] || '0', 10);
|
|
43792
43955
|
(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_7__.css)(this.workTable, {
|
|
43793
43956
|
width: (width - delta) / parentWidth * 100 + '%',
|
|
43794
|
-
[side]: (
|
|
43957
|
+
[side]: (this.startMargin + delta) / parentWidth * 100 + '%'
|
|
43795
43958
|
});
|
|
43796
43959
|
}
|
|
43797
43960
|
}
|
|
@@ -43867,9 +44030,10 @@ const key = 'table_processor_observer-resize';
|
|
|
43867
44030
|
if (!editor.o.tableAllowCellResize) {
|
|
43868
44031
|
return;
|
|
43869
44032
|
}
|
|
43870
|
-
|
|
44033
|
+
const observeTables = ()=>{
|
|
43871
44034
|
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.$$)('table', editor.editor).forEach(this.observe);
|
|
43872
|
-
}
|
|
44035
|
+
};
|
|
44036
|
+
editor.e.off(this.j.ow, '.resize-cells').off('.resize-cells').on('change.resize-cells afterCommand.resize-cells afterSetMode.resize-cells', observeTables).on(this.j.ow, 'scroll.resize-cells', ()=>{
|
|
43873
44037
|
if (!this.drag || this.workRow) {
|
|
43874
44038
|
return;
|
|
43875
44039
|
}
|
|
@@ -43885,6 +44049,8 @@ const key = 'table_processor_observer-resize';
|
|
|
43885
44049
|
tableModule.normalizeTable(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(td, 'table', editor.editor));
|
|
43886
44050
|
});
|
|
43887
44051
|
});
|
|
44052
|
+
// None of those events comes with the editor's starting value
|
|
44053
|
+
observeTables();
|
|
43888
44054
|
}
|
|
43889
44055
|
/**
|
|
43890
44056
|
* Add to every Table listeners
|
|
@@ -43898,7 +44064,9 @@ const key = 'table_processor_observer-resize';
|
|
|
43898
44064
|
this.hideResizeHandle();
|
|
43899
44065
|
}
|
|
43900
44066
|
}).on(table, 'mousemove.resize-cells touchmove.resize-cells', this.j.async.throttle((event)=>{
|
|
43901
|
-
|
|
44067
|
+
// A drag from a cell isn't a resize, and the handle on
|
|
44068
|
+
// a border it passes would take its moves (#1778)
|
|
44069
|
+
if (this.j.isLocked || this.j.o.readonly || event.buttons) {
|
|
43902
44070
|
return;
|
|
43903
44071
|
}
|
|
43904
44072
|
const cell = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.up(event.target, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isCell, table);
|
|
@@ -43931,8 +44099,15 @@ const key = 'table_processor_observer-resize';
|
|
|
43931
44099
|
}
|
|
43932
44100
|
}), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "hideTimeout", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "drag", false), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "wholeTable", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "workCell", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "workTable", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "minX", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "maxX", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startX", 0), /**
|
|
43933
44101
|
* The table's and its cells' styles as a column drag started, put back
|
|
43934
|
-
* before
|
|
44102
|
+
* as it ends, before the final widths
|
|
43935
44103
|
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startStyles", []), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startLeft", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startEdge", 0), /**
|
|
44104
|
+
* For each of the two columns a drag resizes, the cell whose width
|
|
44105
|
+
* `setColumnWidthByDelta` sets, with its width as the drag started, and
|
|
44106
|
+
* the cells below it, whose widths it clears
|
|
44107
|
+
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startWidths", []), /**
|
|
44108
|
+
* The table's width as the drag started, and for a drag of its edge, the
|
|
44109
|
+
* width inside what holds it and its margin on that side
|
|
44110
|
+
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startTableWidth", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startParentWidth", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startMargin", 0), /**
|
|
43936
44111
|
* The row whose height the handle sets, or null while it sets a width
|
|
43937
44112
|
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "workRow", null), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startY", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startHeight", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "rowStyle", null), /**
|
|
43938
44113
|
* The boxes that scroll the row, with their styles, as a row drag turns
|
|
@@ -45682,7 +45857,6 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.tableAllowCellSelecti
|
|
|
45682
45857
|
|
|
45683
45858
|
|
|
45684
45859
|
const key = 'table_processor_observer';
|
|
45685
|
-
const MOUSE_MOVE_LABEL = 'onMoveTableSelectCell';
|
|
45686
45860
|
class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
|
|
45687
45861
|
/**
|
|
45688
45862
|
* Shortcut for Jodit.modules.Table
|
|
@@ -45697,6 +45871,8 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
|
|
|
45697
45871
|
// move the caret, as table-keyboard-navigation's do
|
|
45698
45872
|
.on('keydown', this.__onKeyDown, {
|
|
45699
45873
|
top: true
|
|
45874
|
+
}).on('clickEditor', this.__onClickAfterDrag, {
|
|
45875
|
+
top: true
|
|
45700
45876
|
}).on('keydown.select-cells', (event)=>{
|
|
45701
45877
|
if (event.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_TAB) {
|
|
45702
45878
|
this.unselectCells();
|
|
@@ -45814,18 +45990,35 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
|
|
|
45814
45990
|
}
|
|
45815
45991
|
this.__isSelectionMode = true;
|
|
45816
45992
|
this.__selectedCell = cell;
|
|
45993
|
+
this.__movedTo = cell;
|
|
45817
45994
|
this.__tableModule.addSelection(cell);
|
|
45818
|
-
this.j.e.on(table, 'mousemove.select-cells touchmove.select-cells',
|
|
45819
|
-
|
|
45820
|
-
|
|
45821
|
-
|
|
45822
|
-
|
|
45995
|
+
this.j.e.on(table, 'mousemove.select-cells touchmove.select-cells', this.__onMove.bind(this, table)).on(table, 'mouseup.select-cells touchend.select-cells', this.__onStopSelection.bind(this, table));
|
|
45996
|
+
new Set([
|
|
45997
|
+
this.j.ew,
|
|
45998
|
+
this.j.ow
|
|
45999
|
+
]).forEach((win)=>this.j.e.on(win, 'mouseup.select-cells touchend.select-cells', this.__onRelease.bind(this, table)));
|
|
45823
46000
|
return false;
|
|
45824
46001
|
}
|
|
45825
46002
|
onOutsideClick() {
|
|
45826
46003
|
this.__selectedCell = null;
|
|
45827
46004
|
this.__onRemoveSelection();
|
|
45828
46005
|
}
|
|
46006
|
+
onMouseDown() {
|
|
46007
|
+
this.__keepMarks = false;
|
|
46008
|
+
}
|
|
46009
|
+
/**
|
|
46010
|
+
* The click that ends a drag let go outside the table, and inside the
|
|
46011
|
+
* editor, lands on the editor. Taken on, it would unmark the cells and
|
|
46012
|
+
* close their popup. As for the click on a row after a drag over the
|
|
46013
|
+
* cells, the browser's own selection from the drag goes
|
|
46014
|
+
*/ __onClickAfterDrag() {
|
|
46015
|
+
if (this.__keepMarks) {
|
|
46016
|
+
this.__keepMarks = false;
|
|
46017
|
+
this.j.s.sel?.removeAllRanges();
|
|
46018
|
+
this.j.e.stopPropagation('clickEditor');
|
|
46019
|
+
return false;
|
|
46020
|
+
}
|
|
46021
|
+
}
|
|
45829
46022
|
onChange() {
|
|
45830
46023
|
if (!this.j.isLocked && !this.__isSelectionMode) {
|
|
45831
46024
|
this.__onRemoveSelection();
|
|
@@ -45843,16 +46036,20 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
|
|
|
45843
46036
|
// Inside Shadow DOM `document.elementFromPoint` returns the shadow
|
|
45844
46037
|
// host, so the lookup must start from the shadow root
|
|
45845
46038
|
const node = (this.j.o.shadowRoot ?? this.j.ed).elementFromPoint(e.clientX, e.clientY);
|
|
45846
|
-
|
|
45847
|
-
return;
|
|
45848
|
-
}
|
|
45849
|
-
const cell = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(node, [
|
|
46039
|
+
const cell = node && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(node, [
|
|
45850
46040
|
'td',
|
|
45851
46041
|
'th'
|
|
45852
46042
|
], table);
|
|
45853
46043
|
if (!cell || !this.__selectedCell) {
|
|
45854
46044
|
return;
|
|
45855
46045
|
}
|
|
46046
|
+
// The marks change only when the mouse goes into another cell, and then
|
|
46047
|
+
// at once rather than throttled, as the browser's own selection from
|
|
46048
|
+
// the drag shows in the cells between until they do (#1778)
|
|
46049
|
+
if (cell === this.__movedTo) {
|
|
46050
|
+
return;
|
|
46051
|
+
}
|
|
46052
|
+
this.__movedTo = cell;
|
|
45856
46053
|
if (cell !== this.__selectedCell) {
|
|
45857
46054
|
this.j.lock(key);
|
|
45858
46055
|
}
|
|
@@ -45910,10 +46107,32 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
|
|
|
45910
46107
|
if (ownTable && ownTable !== table) {
|
|
45911
46108
|
return; // Nested tables
|
|
45912
46109
|
}
|
|
45913
|
-
|
|
46110
|
+
this.__showCellsPopup(table, [
|
|
45914
46111
|
cell,
|
|
45915
46112
|
this.__selectedCell
|
|
45916
|
-
])
|
|
46113
|
+
]);
|
|
46114
|
+
this.__stopListening();
|
|
46115
|
+
}
|
|
46116
|
+
/**
|
|
46117
|
+
* A drag let go outside the table doesn't reach the table's `mouseup`, so
|
|
46118
|
+
* the window's ends it, leaving the cells marked as they were (#1774)
|
|
46119
|
+
*/ __onRelease(table, e) {
|
|
46120
|
+
if (this.__isSelectionMode) {
|
|
46121
|
+
this.__isSelectionMode = false;
|
|
46122
|
+
if (!this.j.isLockedNotBy(key)) {
|
|
46123
|
+
this.j.unlock();
|
|
46124
|
+
}
|
|
46125
|
+
const cells = this.__tableModule.getAllSelectedCells();
|
|
46126
|
+
// One let go outside the editor clicks outside it, which unmarks them
|
|
46127
|
+
if (cells.length > 1 && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(this.j.editor, e.target)) {
|
|
46128
|
+
this.__keepMarks = true;
|
|
46129
|
+
this.__showCellsPopup(table, cells);
|
|
46130
|
+
}
|
|
46131
|
+
}
|
|
46132
|
+
this.__stopListening();
|
|
46133
|
+
}
|
|
46134
|
+
__showCellsPopup(table, cells) {
|
|
46135
|
+
const bound = this.__tableModule.getSelectedBound(table, cells), box = this.__tableModule.formalMatrix(table);
|
|
45917
46136
|
const max = box[bound[1][0]]?.[bound[1][1]], min = box[bound[0][0]]?.[bound[0][1]];
|
|
45918
46137
|
// `getSelectedBound` keeps its `Infinity` sentinel when none of the
|
|
45919
46138
|
// selected cells belong to this table's matrix — e.g. after a
|
|
@@ -45933,10 +46152,16 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
|
|
|
45933
46152
|
height: maxOffset.top - minOffset.top + maxOffset.height
|
|
45934
46153
|
};
|
|
45935
46154
|
}, 'cells');
|
|
45936
|
-
|
|
46155
|
+
}
|
|
46156
|
+
__stopListening() {
|
|
46157
|
+
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.$$)('table', this.j.editor).forEach((table)=>{
|
|
45937
46158
|
this.j.e.off(table, 'mousemove.select-cells touchmove.select-cells mouseup.select-cells touchend.select-cells');
|
|
45938
46159
|
});
|
|
45939
|
-
|
|
46160
|
+
new Set([
|
|
46161
|
+
this.j.ew,
|
|
46162
|
+
this.j.ow
|
|
46163
|
+
]).forEach((win)=>this.j.e.off(win, 'mouseup.select-cells touchend.select-cells'));
|
|
46164
|
+
this.__movedTo = null;
|
|
45940
46165
|
}
|
|
45941
46166
|
/**
|
|
45942
46167
|
* Remove selection for all cells
|
|
@@ -46106,7 +46331,8 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
|
|
|
46106
46331
|
}
|
|
46107
46332
|
/** @override */ beforeDestruct(jodit) {
|
|
46108
46333
|
this.__onRemoveSelection();
|
|
46109
|
-
|
|
46334
|
+
this.__stopListening();
|
|
46335
|
+
jodit.e.off('.select-cells').off('keydown', this.__onKeyDown).off('clickEditor', this.__onClickAfterDrag);
|
|
46110
46336
|
}
|
|
46111
46337
|
constructor(...args){
|
|
46112
46338
|
super(...args), /**
|
|
@@ -46117,7 +46343,12 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
|
|
|
46117
46343
|
* First selected cell
|
|
46118
46344
|
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__selectedCell", null), /**
|
|
46119
46345
|
* User is selecting cells now
|
|
46120
|
-
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__isSelectionMode", false)
|
|
46346
|
+
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__isSelectionMode", false), /**
|
|
46347
|
+
* The cell the marks were last drawn to
|
|
46348
|
+
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__movedTo", null), /**
|
|
46349
|
+
* A drag let go outside the table ends in a click on the editor, which
|
|
46350
|
+
* would unmark its cells
|
|
46351
|
+
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__keepMarks", false);
|
|
46121
46352
|
}
|
|
46122
46353
|
}
|
|
46123
46354
|
;(0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(selectCells, "requires", [
|
|
@@ -46135,6 +46366,15 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
|
|
|
46135
46366
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
46136
46367
|
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':outsideClick')
|
|
46137
46368
|
], selectCells.prototype, "onOutsideClick", null);
|
|
46369
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
46370
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
|
|
46371
|
+
':mousedown',
|
|
46372
|
+
':touchstart'
|
|
46373
|
+
])
|
|
46374
|
+
], selectCells.prototype, "onMouseDown", null);
|
|
46375
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
46376
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
46377
|
+
], selectCells.prototype, "__onClickAfterDrag", null);
|
|
46138
46378
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
46139
46379
|
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':change')
|
|
46140
46380
|
], selectCells.prototype, "onChange", null);
|
|
@@ -46186,10 +46426,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
46186
46426
|
/* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
|
|
46187
46427
|
/* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
|
|
46188
46428
|
/* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
|
|
46189
|
-
/* harmony import */ var
|
|
46190
|
-
/* harmony import */ var
|
|
46191
|
-
/* harmony import */ var
|
|
46192
|
-
/* harmony import */ var
|
|
46429
|
+
/* harmony import */ var jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(88475);
|
|
46430
|
+
/* harmony import */ var jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(57821);
|
|
46431
|
+
/* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(91206);
|
|
46432
|
+
/* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(4099);
|
|
46433
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(47670);
|
|
46193
46434
|
/*!
|
|
46194
46435
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
46195
46436
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -46208,6 +46449,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
46208
46449
|
|
|
46209
46450
|
|
|
46210
46451
|
|
|
46452
|
+
|
|
46211
46453
|
/**
|
|
46212
46454
|
* A utility plugin that allows you to subscribe to a click/mousedown/touchstart/mouseup on an element in DOM order
|
|
46213
46455
|
*
|
|
@@ -46218,22 +46460,27 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
46218
46460
|
* console.log(img.src);
|
|
46219
46461
|
* })
|
|
46220
46462
|
* ```
|
|
46221
|
-
*/ class select extends
|
|
46463
|
+
*/ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_8__.Plugin {
|
|
46222
46464
|
afterInit(jodit) {
|
|
46223
46465
|
this.proxyEventsList.forEach((eventName)=>{
|
|
46224
46466
|
jodit.e.on(eventName + '.select', this.onStartSelection);
|
|
46225
46467
|
});
|
|
46468
|
+
jodit.e.on('dblclick', this.__onDblClickBesideRow, {
|
|
46469
|
+
top: true
|
|
46470
|
+
});
|
|
46226
46471
|
}
|
|
46227
46472
|
beforeDestruct(jodit) {
|
|
46228
46473
|
this.proxyEventsList.forEach((eventName)=>{
|
|
46229
|
-
jodit.e.
|
|
46474
|
+
jodit.e.off(eventName + '.select', this.onStartSelection);
|
|
46230
46475
|
});
|
|
46476
|
+
this.__endPressBesideRow();
|
|
46477
|
+
jodit.e.off('dblclick', this.__onDblClickBesideRow);
|
|
46231
46478
|
}
|
|
46232
46479
|
onStartSelection(e) {
|
|
46233
46480
|
const { j } = this;
|
|
46234
46481
|
let result, target = e.target;
|
|
46235
46482
|
while(result === undefined && target && target !== j.editor){
|
|
46236
|
-
result = j.e.fire((0,
|
|
46483
|
+
result = j.e.fire((0,jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_7__.camelCase)(e.type + '_' + target.nodeName.toLowerCase()), target, e);
|
|
46237
46484
|
target = target.parentElement;
|
|
46238
46485
|
}
|
|
46239
46486
|
if (e.type === 'click' && result === undefined && target === j.editor) {
|
|
@@ -46253,10 +46500,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
46253
46500
|
}
|
|
46254
46501
|
// Selecting the text of a popup input with the mouse and releasing
|
|
46255
46502
|
// the button past the popup's edge is not a click outside of it.
|
|
46256
|
-
if (pressed &&
|
|
46503
|
+
if (pressed && jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.UIElement.closestElement(pressed, jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.Popup)) {
|
|
46257
46504
|
return;
|
|
46258
46505
|
}
|
|
46259
|
-
const box =
|
|
46506
|
+
const box = jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.UIElement.closestElement(node, jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.Popup);
|
|
46260
46507
|
if (!box) {
|
|
46261
46508
|
this.j.e.fire('outsideClick', e);
|
|
46262
46509
|
}
|
|
@@ -46302,6 +46549,125 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
46302
46549
|
s.setCursorAfter(text);
|
|
46303
46550
|
}
|
|
46304
46551
|
}
|
|
46552
|
+
/**
|
|
46553
|
+
* The table row the mouse is to the right of
|
|
46554
|
+
*/ __rowBeside(e) {
|
|
46555
|
+
const { j } = this;
|
|
46556
|
+
const target = e.target;
|
|
46557
|
+
if (j.o.readonly || e.button !== 0 || e.detail > 2 || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isHTMLElement(target) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(target, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isCell, j.editor)) {
|
|
46558
|
+
return null;
|
|
46559
|
+
}
|
|
46560
|
+
const table = (0,jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_6__.toArray)(target.children).find((elm)=>{
|
|
46561
|
+
if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(elm, 'table')) {
|
|
46562
|
+
return false;
|
|
46563
|
+
}
|
|
46564
|
+
const box = elm.getBoundingClientRect();
|
|
46565
|
+
return e.clientX >= box.right && e.clientY >= box.top && e.clientY < box.bottom;
|
|
46566
|
+
});
|
|
46567
|
+
const rows = table ? (0,jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_6__.toArray)(table.rows).filter((row)=>row.cells.length) : [];
|
|
46568
|
+
if (!table || !rows.length) {
|
|
46569
|
+
return null;
|
|
46570
|
+
}
|
|
46571
|
+
const row = rows.find((row)=>e.clientY < row.getBoundingClientRect().bottom) ?? rows[rows.length - 1];
|
|
46572
|
+
return {
|
|
46573
|
+
table,
|
|
46574
|
+
row
|
|
46575
|
+
};
|
|
46576
|
+
}
|
|
46577
|
+
/**
|
|
46578
|
+
* A press to the right of a table row puts the caret where Word's typing
|
|
46579
|
+
* goes from there: the start of the next row's first cell, or of the block
|
|
46580
|
+
* after the table for the last row (#1770). The browsers put it after the
|
|
46581
|
+
* table, whichever row it's beside, so typing starts a new line below it.
|
|
46582
|
+
* Their own press is stopped, as its drag would start after the table and
|
|
46583
|
+
* take in the rows below first
|
|
46584
|
+
*/ onMouseDownBesideTableRow(e) {
|
|
46585
|
+
const { j } = this;
|
|
46586
|
+
const beside = this.__rowBeside(e);
|
|
46587
|
+
if (!beside) {
|
|
46588
|
+
return;
|
|
46589
|
+
}
|
|
46590
|
+
// A press before the last one was let go must not stack its listeners
|
|
46591
|
+
this.__endPressBesideRow();
|
|
46592
|
+
e.preventDefault();
|
|
46593
|
+
this.__putCaretBesideRow(beside.table, beside.row);
|
|
46594
|
+
this.__pressBesideRow = {
|
|
46595
|
+
row: beside.row,
|
|
46596
|
+
caret: j.s.range.cloneRange()
|
|
46597
|
+
};
|
|
46598
|
+
j.e.on(j.ew, 'mousemove', this.__onDragFromRow);
|
|
46599
|
+
new Set([
|
|
46600
|
+
j.ew,
|
|
46601
|
+
j.ow
|
|
46602
|
+
]).forEach((win)=>j.e.on(win, 'mouseup', this.__onReleaseFromRow));
|
|
46603
|
+
}
|
|
46604
|
+
/**
|
|
46605
|
+
* A drag from beside a row selects from the end of the row to the mouse,
|
|
46606
|
+
* and back beside the row it's the caret again
|
|
46607
|
+
*/ __onDragFromRow(e) {
|
|
46608
|
+
const { s } = this.j;
|
|
46609
|
+
const press = this.__pressBesideRow;
|
|
46610
|
+
if (!press || !(e.buttons & 1)) {
|
|
46611
|
+
this.__endPressBesideRow();
|
|
46612
|
+
return;
|
|
46613
|
+
}
|
|
46614
|
+
if (this.__rowBeside(e)?.row === press.row) {
|
|
46615
|
+
if (!s.isCollapsed()) {
|
|
46616
|
+
s.selectRange(press.caret.cloneRange());
|
|
46617
|
+
}
|
|
46618
|
+
return;
|
|
46619
|
+
}
|
|
46620
|
+
const { cells } = press.row;
|
|
46621
|
+
const last = cells[cells.length - 1];
|
|
46622
|
+
if (s.insertCursorAtPoint(e.clientX, e.clientY)) {
|
|
46623
|
+
const { startContainer, startOffset } = s.range;
|
|
46624
|
+
s.sel?.setBaseAndExtent(last, last.childNodes.length, startContainer, startOffset);
|
|
46625
|
+
}
|
|
46626
|
+
}
|
|
46627
|
+
/**
|
|
46628
|
+
* In iframe mode, a press in an editor without the focus puts the caret at
|
|
46629
|
+
* its end, so a release that selected nothing puts it back
|
|
46630
|
+
*/ __onReleaseFromRow() {
|
|
46631
|
+
const press = this.__pressBesideRow;
|
|
46632
|
+
this.__endPressBesideRow();
|
|
46633
|
+
if (press && this.j.s.isCollapsed()) {
|
|
46634
|
+
this.j.s.selectRange(press.caret);
|
|
46635
|
+
}
|
|
46636
|
+
}
|
|
46637
|
+
__endPressBesideRow() {
|
|
46638
|
+
const { j } = this;
|
|
46639
|
+
this.__pressBesideRow = null;
|
|
46640
|
+
j.e.off(j.ew, 'mousemove', this.__onDragFromRow);
|
|
46641
|
+
new Set([
|
|
46642
|
+
j.ew,
|
|
46643
|
+
j.ow
|
|
46644
|
+
]).forEach((win)=>j.e.off(win, 'mouseup', this.__onReleaseFromRow));
|
|
46645
|
+
}
|
|
46646
|
+
/**
|
|
46647
|
+
* A double click beside a row is two clicks there, so add-new-line,
|
|
46648
|
+
* which adds a line on a double click with a caret, doesn't see it
|
|
46649
|
+
*/ __onDblClickBesideRow(e) {
|
|
46650
|
+
if (this.__rowBeside(e)) {
|
|
46651
|
+
this.j.e.stopPropagation('dblclick');
|
|
46652
|
+
return false;
|
|
46653
|
+
}
|
|
46654
|
+
}
|
|
46655
|
+
__putCaretBesideRow(table, row) {
|
|
46656
|
+
const { j } = this;
|
|
46657
|
+
const rows = (0,jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_6__.toArray)(table.rows);
|
|
46658
|
+
const next = rows.slice(rows.indexOf(row) + 1).find((row)=>row.cells.length);
|
|
46659
|
+
let after = table.nextSibling;
|
|
46660
|
+
while(after && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isEmptyTextNode(after)){
|
|
46661
|
+
after = after.nextSibling;
|
|
46662
|
+
}
|
|
46663
|
+
if (next) {
|
|
46664
|
+
j.s.setCursorIn(next.cells[0], true);
|
|
46665
|
+
} else if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isBlock(after) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(after, 'table') && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isContentEditable(after, j.editor)) {
|
|
46666
|
+
j.s.setCursorIn(after, true);
|
|
46667
|
+
} else {
|
|
46668
|
+
j.s.setCursorAfter(table);
|
|
46669
|
+
}
|
|
46670
|
+
}
|
|
46305
46671
|
/**
|
|
46306
46672
|
* Keep pending inline formatting after a click. Toggling Bold/Italic/etc. on
|
|
46307
46673
|
* a collapsed cursor leaves empty marker elements with the caret inside; a
|
|
@@ -46363,7 +46729,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
46363
46729
|
* Where the last press started. Chrome reports a drag that begins in one
|
|
46364
46730
|
* element and ends in another as a `click` on their common ancestor, so a
|
|
46365
46731
|
* press inside a popup is remembered to tell such a drag from a real click.
|
|
46366
|
-
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__pressTarget", null)
|
|
46732
|
+
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__pressTarget", null), /**
|
|
46733
|
+
* The row a press to its right was beside, and the caret it put there,
|
|
46734
|
+
* while the button is down
|
|
46735
|
+
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__pressBesideRow", null);
|
|
46367
46736
|
}
|
|
46368
46737
|
}
|
|
46369
46738
|
;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
@@ -46393,6 +46762,18 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
46393
46762
|
':click'
|
|
46394
46763
|
])
|
|
46395
46764
|
], select.prototype, "onClickRightOfNestedListItem", null);
|
|
46765
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
46766
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':mousedown')
|
|
46767
|
+
], select.prototype, "onMouseDownBesideTableRow", null);
|
|
46768
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
46769
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
46770
|
+
], select.prototype, "__onDragFromRow", null);
|
|
46771
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
46772
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
46773
|
+
], select.prototype, "__onReleaseFromRow", null);
|
|
46774
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
46775
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
46776
|
+
], select.prototype, "__onDblClickBesideRow", null);
|
|
46396
46777
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
46397
46778
|
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
|
|
46398
46779
|
':click'
|