jodit 4.19.5 → 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 +32 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +21 -8
- package/es2015/jodit.js +847 -155
- package/es2015/jodit.min.js +21 -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 +20 -7
- package/es2018/jodit.min.js +21 -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 +21 -8
- package/es2021/jodit.js +832 -154
- package/es2021/jodit.min.js +69 -56
- 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 +31 -18
- package/es2021.en/jodit.js +832 -154
- package/es2021.en/jodit.min.js +31 -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 +947 -166
- 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 +31 -0
- package/esm/core/constants.js +1 -1
- package/esm/core/selection/helpers/move-node-inside-start.js +5 -2
- 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/link/config.d.ts +31 -0
- package/esm/plugins/link/config.js +3 -0
- package/esm/plugins/link/link.d.ts +27 -0
- package/esm/plugins/link/link.js +144 -2
- package/esm/plugins/link/tlds.d.ts +18 -0
- package/esm/plugins/link/tlds.js +33 -0
- package/esm/plugins/link/typed-link.d.ts +23 -0
- package/esm/plugins/link/typed-link.js +92 -0
- 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/config.d.ts +31 -0
- package/types/plugins/delete/delete.d.ts +12 -0
- package/types/plugins/link/config.d.ts +31 -0
- package/types/plugins/link/link.d.ts +27 -0
- package/types/plugins/link/tlds.d.ts +18 -0
- package/types/plugins/link/typed-link.d.ts +23 -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;
|
|
@@ -11222,7 +11222,10 @@ function findCorrectCurrentNode(node, range, rightMode, isCollapsed, checkChild,
|
|
|
11222
11222
|
* When the cursor is positioned in its place, it must be inside the element and not outside its border.
|
|
11223
11223
|
* @private
|
|
11224
11224
|
*/ function moveNodeInsideStart(j, node, start) {
|
|
11225
|
-
|
|
11225
|
+
// A text node of non-breaking spaces trims to nothing, but it's text the
|
|
11226
|
+
// node mustn't move past
|
|
11227
|
+
const isContent = (n)=>!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmptyTextNode(n) || Boolean(n.nodeValue?.includes(jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.NBSP_SPACE));
|
|
11228
|
+
let sibling = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findSibling(node, start, isContent), anotherSibling = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findSibling(node, !start, isContent);
|
|
11226
11229
|
while(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(sibling) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(sibling, jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.INSEPARABLE_TAGS) && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isContentEditable(sibling, j.editor) && (!anotherSibling || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(node, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement, j.editor))){
|
|
11227
11230
|
if (start || !sibling.firstChild) {
|
|
11228
11231
|
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(sibling, node);
|
|
@@ -13853,9 +13856,11 @@ const WRAP_NODES = new Set([
|
|
|
13853
13856
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
13854
13857
|
/* harmony export */ ApplyStyle: function() { return /* binding */ ApplyStyle; }
|
|
13855
13858
|
/* harmony export */ });
|
|
13856
|
-
/* harmony import */ var
|
|
13857
|
-
/* harmony import */ var
|
|
13858
|
-
/* 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);
|
|
13859
13864
|
/*!
|
|
13860
13865
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
13861
13866
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -13865,26 +13870,54 @@ const WRAP_NODES = new Set([
|
|
|
13865
13870
|
*/
|
|
13866
13871
|
|
|
13867
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
|
+
}
|
|
13868
13898
|
/** @internal */ function ApplyStyle(jodit, cs) {
|
|
13869
13899
|
const { s: sel, editor } = jodit;
|
|
13870
13900
|
editor.firstChild?.normalize(); // FF fix for test "commandsTest - Exec command "bold"
|
|
13871
13901
|
const fakes = sel.fakes();
|
|
13872
13902
|
const collapsed = sel.isCollapsed();
|
|
13873
|
-
let mode =
|
|
13903
|
+
let mode = _constants__WEBPACK_IMPORTED_MODULE_3__.INITIAL;
|
|
13874
13904
|
try {
|
|
13875
13905
|
// for...of closes the generator on an exception, releasing every
|
|
13876
13906
|
// temporary wrapper before the selection is restored in finally.
|
|
13877
13907
|
for (const font of sel.wrapInTagGen(fakes)){
|
|
13908
|
+
if (cs.options.exclude?.length) {
|
|
13909
|
+
takeOutOf(jodit, font, cs.options.exclude);
|
|
13910
|
+
}
|
|
13878
13911
|
let state = {
|
|
13879
13912
|
collapsed,
|
|
13880
13913
|
mode,
|
|
13881
13914
|
element: font,
|
|
13882
|
-
next:
|
|
13915
|
+
next: _transactions__WEBPACK_IMPORTED_MODULE_4__.states.START,
|
|
13883
13916
|
jodit,
|
|
13884
13917
|
style: cs
|
|
13885
13918
|
};
|
|
13886
|
-
const machine = new
|
|
13887
|
-
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){
|
|
13888
13921
|
state = machine.dispatch('exec', state);
|
|
13889
13922
|
}
|
|
13890
13923
|
// The first selected fragment determines how later fragments toggle.
|
|
@@ -18353,6 +18386,20 @@ const FOCUS_EVENTS = new Set([
|
|
|
18353
18386
|
'focusin',
|
|
18354
18387
|
'focusout'
|
|
18355
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
|
+
}
|
|
18356
18403
|
const __defaultStyleDisplayKey = 'data-jodit-default-style-display';
|
|
18357
18404
|
const __defaultClassesKey = 'data-jodit-default-classes';
|
|
18358
18405
|
const NOEDIT = {
|
|
@@ -19409,7 +19456,7 @@ class Jodit extends jodit_modules__WEBPACK_IMPORTED_MODULE_10__.ViewWithToolbar
|
|
|
19409
19456
|
}
|
|
19410
19457
|
}
|
|
19411
19458
|
const w = this.ew;
|
|
19412
|
-
if (event instanceof w.KeyboardEvent && event
|
|
19459
|
+
if (event instanceof w.KeyboardEvent && isInputMethodKey(event)) {
|
|
19413
19460
|
return;
|
|
19414
19461
|
}
|
|
19415
19462
|
if (this.e && this.e.fire) {
|
|
@@ -28657,6 +28704,13 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
|
|
|
28657
28704
|
if (checkJoinBareText(jodit, fakeNode, backspace)) {
|
|
28658
28705
|
return true;
|
|
28659
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
|
+
}
|
|
28660
28714
|
let nextBox = fakeNode, mainClosestBox = nextBox;
|
|
28661
28715
|
// Find the main big closest element
|
|
28662
28716
|
while(nextBox && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(nextBox, backspace) && nextBox.parentElement !== jodit.editor){
|
|
@@ -28937,7 +28991,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
|
|
|
28937
28991
|
* in `<div>a|<p>b</p>c</div>` gives `<div>a|b<br>c</div>`
|
|
28938
28992
|
*/ function checkJoinBareText(jodit, fakeNode, backspace) {
|
|
28939
28993
|
const block = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(fakeNode, backspace);
|
|
28940
|
-
if (!
|
|
28994
|
+
if (!joinsBareText(jodit, block)) {
|
|
28941
28995
|
return false;
|
|
28942
28996
|
}
|
|
28943
28997
|
const filter = (0,jodit_plugins_backspace_helpers__WEBPACK_IMPORTED_MODULE_2__.getMoveFilter)(jodit);
|
|
@@ -28964,6 +29018,23 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
|
|
|
28964
29018
|
jodit.s.setCursorBefore(fakeNode);
|
|
28965
29019
|
return true;
|
|
28966
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
|
+
}
|
|
28967
29038
|
function checkMoveListContent(jodit, mainClosestBox, sibling, backspace) {
|
|
28968
29039
|
// Process UL/LI/OL cases
|
|
28969
29040
|
const siblingIsList = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(sibling, jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.LIST_TAGS);
|
|
@@ -29413,7 +29484,6 @@ function isNotEditable(jodit, node) {
|
|
|
29413
29484
|
if (!prn || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(prn)) {
|
|
29414
29485
|
return false;
|
|
29415
29486
|
}
|
|
29416
|
-
const neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptyNeighbor(fakeNode, backspace, jodit.editor);
|
|
29417
29487
|
do {
|
|
29418
29488
|
if (prn && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(prn) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell(prn)) {
|
|
29419
29489
|
jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.after(prn, fakeNode);
|
|
@@ -29428,6 +29498,9 @@ function isNotEditable(jodit, node) {
|
|
|
29428
29498
|
if (found && (0,_check_join_two_lists__WEBPACK_IMPORTED_MODULE_2__.checkJoinTwoLists)(jodit, fakeNode, backspace)) {
|
|
29429
29499
|
return true;
|
|
29430
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);
|
|
29431
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)) {
|
|
29432
29505
|
setCursorIn(neighbor, !backspace);
|
|
29433
29506
|
} else {
|
|
@@ -29893,8 +29966,15 @@ jodit_config__WEBPACK_IMPORTED_MODULE_1__.Config.prototype.delete = {
|
|
|
29893
29966
|
}
|
|
29894
29967
|
cssRules[key] = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isArray)(cssOptions[key]) ? cssOptions[key][0] : cssOptions[key];
|
|
29895
29968
|
});
|
|
29969
|
+
const element = control.tags ? control.tags[0] : undefined;
|
|
29896
29970
|
editor.s.commitStyle({
|
|
29897
|
-
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
|
+
] : []
|
|
29898
29978
|
});
|
|
29899
29979
|
editor.synchronizeValues();
|
|
29900
29980
|
return false;
|
|
@@ -32459,11 +32539,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
32459
32539
|
"use strict";
|
|
32460
32540
|
/* unused harmony export deleteCommand */
|
|
32461
32541
|
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
|
|
32462
|
-
/* harmony import */ var
|
|
32463
|
-
/* harmony import */ var
|
|
32464
|
-
/* harmony import */ var
|
|
32465
|
-
/* harmony import */ var
|
|
32466
|
-
/* 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);
|
|
32467
32548
|
/*!
|
|
32468
32549
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
32469
32550
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -32479,6 +32560,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
32479
32560
|
|
|
32480
32561
|
|
|
32481
32562
|
|
|
32563
|
+
|
|
32482
32564
|
const NOT_EMPTY_CONTENT_TAGS = new Set([
|
|
32483
32565
|
'img',
|
|
32484
32566
|
'table',
|
|
@@ -32486,7 +32568,18 @@ const NOT_EMPTY_CONTENT_TAGS = new Set([
|
|
|
32486
32568
|
'iframe',
|
|
32487
32569
|
'hr'
|
|
32488
32570
|
]);
|
|
32489
|
-
|
|
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 {
|
|
32490
32583
|
afterInit(jodit) {
|
|
32491
32584
|
jodit.e.on('afterCommand.delete', (command)=>{
|
|
32492
32585
|
if (command === 'delete') {
|
|
@@ -32507,11 +32600,11 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
|
|
|
32507
32600
|
*/ __afterDeleteCommand() {
|
|
32508
32601
|
const jodit = this.j;
|
|
32509
32602
|
const current = jodit.s.current();
|
|
32510
|
-
if (current &&
|
|
32603
|
+
if (current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(current.firstChild, 'br')) {
|
|
32511
32604
|
jodit.s.removeNode(current.firstChild);
|
|
32512
32605
|
}
|
|
32513
|
-
if (!(0,
|
|
32514
|
-
|
|
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);
|
|
32515
32608
|
const node = jodit.s.setCursorIn(jodit.editor);
|
|
32516
32609
|
jodit.s.removeNode(node);
|
|
32517
32610
|
}
|
|
@@ -32531,14 +32624,15 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
|
|
|
32531
32624
|
range.deleteContents();
|
|
32532
32625
|
const fake = jodit.createInside.fake();
|
|
32533
32626
|
range.insertNode(fake);
|
|
32534
|
-
const leftSibling =
|
|
32535
|
-
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);
|
|
32536
32629
|
this.__moveContentInLeftSibling(fake, leftSibling, rightSibling);
|
|
32630
|
+
this.__keepSpacesVisible(fake);
|
|
32537
32631
|
range.setStartBefore(fake);
|
|
32538
32632
|
range.collapse(true);
|
|
32539
32633
|
this.__moveCursorInEditableSibling(jodit, leftSibling, fake, range);
|
|
32540
32634
|
this.__addBrInEmptyBlock(fake, range);
|
|
32541
|
-
|
|
32635
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(fake);
|
|
32542
32636
|
jodit.s.selectRange(caret ?? range);
|
|
32543
32637
|
return false;
|
|
32544
32638
|
}
|
|
@@ -32552,23 +32646,23 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
|
|
|
32552
32646
|
* Returns where the caret goes, or null when no table is involved
|
|
32553
32647
|
*/ __clearSelectedCells(range) {
|
|
32554
32648
|
const { editor, createInside } = this.j;
|
|
32555
|
-
const startCell =
|
|
32556
|
-
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);
|
|
32557
32651
|
if (startCell === endCell) {
|
|
32558
32652
|
return null;
|
|
32559
32653
|
}
|
|
32560
|
-
const startTable =
|
|
32561
|
-
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);
|
|
32562
32656
|
const caret = range.cloneRange();
|
|
32563
32657
|
caret.collapse(true);
|
|
32564
32658
|
const parts = [];
|
|
32565
32659
|
const addParts = (table)=>{
|
|
32566
|
-
(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)=>{
|
|
32567
32661
|
const part = range.cloneRange();
|
|
32568
|
-
if (!
|
|
32662
|
+
if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isOrContains(cell, range.startContainer)) {
|
|
32569
32663
|
part.setStart(cell, 0);
|
|
32570
32664
|
}
|
|
32571
|
-
if (!
|
|
32665
|
+
if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isOrContains(cell, range.endContainer)) {
|
|
32572
32666
|
part.setEnd(cell, cell.childNodes.length);
|
|
32573
32667
|
}
|
|
32574
32668
|
parts.push([
|
|
@@ -32591,9 +32685,9 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
|
|
|
32591
32685
|
}
|
|
32592
32686
|
parts.forEach(([cell, part])=>{
|
|
32593
32687
|
part.deleteContents();
|
|
32594
|
-
if (
|
|
32595
|
-
|
|
32596
|
-
|
|
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'));
|
|
32597
32691
|
}
|
|
32598
32692
|
});
|
|
32599
32693
|
return startTable ? caret : null;
|
|
@@ -32601,46 +32695,72 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
|
|
|
32601
32695
|
__moveContentInLeftSibling(fake, leftSibling, rightSibling) {
|
|
32602
32696
|
leftSibling = this.__defineRightLeftBox(leftSibling);
|
|
32603
32697
|
// Nothing is moved into a table, and a block left empty after it goes
|
|
32604
|
-
if (
|
|
32605
|
-
if (
|
|
32606
|
-
|
|
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);
|
|
32607
32701
|
}
|
|
32608
32702
|
return;
|
|
32609
32703
|
}
|
|
32610
|
-
if (!
|
|
32611
|
-
|
|
32612
|
-
|
|
32613
|
-
|
|
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);
|
|
32614
32708
|
}
|
|
32615
|
-
if (
|
|
32709
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isList(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isLeaf(rightSibling.firstElementChild)) {
|
|
32616
32710
|
const item = rightSibling.firstElementChild;
|
|
32617
32711
|
// What's left of the right list's first item joins the left block,
|
|
32618
32712
|
// up to a list nested in the item
|
|
32619
|
-
if (!
|
|
32620
|
-
|
|
32621
|
-
while(item.firstChild && !
|
|
32622
|
-
|
|
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);
|
|
32623
32717
|
}
|
|
32624
32718
|
}
|
|
32625
32719
|
// Remove empty right LI
|
|
32626
|
-
if (
|
|
32627
|
-
|
|
32720
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(item)) {
|
|
32721
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(item);
|
|
32628
32722
|
}
|
|
32629
|
-
if (
|
|
32630
|
-
|
|
32723
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(rightSibling)) {
|
|
32724
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(rightSibling);
|
|
32631
32725
|
}
|
|
32632
32726
|
}
|
|
32633
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
|
+
}
|
|
32634
32754
|
/**
|
|
32635
32755
|
* If left sibling is list - return last leaf
|
|
32636
32756
|
*/ __defineRightLeftBox(leftSibling) {
|
|
32637
|
-
if (!
|
|
32757
|
+
if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isList(leftSibling)) {
|
|
32638
32758
|
return leftSibling;
|
|
32639
32759
|
}
|
|
32640
32760
|
let lastLeaf = leftSibling.lastElementChild;
|
|
32641
|
-
if (!
|
|
32761
|
+
if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isLeaf(lastLeaf)) {
|
|
32642
32762
|
lastLeaf = this.j.createInside.element('li');
|
|
32643
|
-
|
|
32763
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, lastLeaf);
|
|
32644
32764
|
}
|
|
32645
32765
|
return lastLeaf;
|
|
32646
32766
|
}
|
|
@@ -32648,21 +32768,21 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
|
|
|
32648
32768
|
* Add BR in the empty block left at the caret
|
|
32649
32769
|
*/ __addBrInEmptyBlock(fake, range) {
|
|
32650
32770
|
const jodit = this.j;
|
|
32651
|
-
if (fake.isConnected &&
|
|
32771
|
+
if (fake.isConnected && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(fake.parentNode) && !fake.nextSibling && !fake.previousSibling) {
|
|
32652
32772
|
const br = jodit.createInside.element('br');
|
|
32653
|
-
|
|
32773
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.after(fake, br);
|
|
32654
32774
|
range.setStartBefore(br);
|
|
32655
32775
|
range.collapse(true);
|
|
32656
32776
|
}
|
|
32657
32777
|
}
|
|
32658
32778
|
__moveCursorInEditableSibling(jodit, leftSibling, fake, range) {
|
|
32659
|
-
if (!leftSibling || !
|
|
32660
|
-
const root =
|
|
32661
|
-
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);
|
|
32662
32782
|
if (leftText) {
|
|
32663
32783
|
range.setStartAfter(leftText);
|
|
32664
32784
|
range.collapse(true);
|
|
32665
|
-
|
|
32785
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(fake);
|
|
32666
32786
|
}
|
|
32667
32787
|
}
|
|
32668
32788
|
}
|
|
@@ -32670,7 +32790,7 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
|
|
|
32670
32790
|
;(0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(deleteCommand, "requires", [
|
|
32671
32791
|
'backspace'
|
|
32672
32792
|
]);
|
|
32673
|
-
|
|
32793
|
+
jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('deleteCommand', deleteCommand);
|
|
32674
32794
|
|
|
32675
32795
|
|
|
32676
32796
|
/***/ }),
|
|
@@ -40705,6 +40825,16 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.link = {
|
|
|
40705
40825
|
followOnDblClick: false,
|
|
40706
40826
|
processVideoLink: true,
|
|
40707
40827
|
processPastedLink: true,
|
|
40828
|
+
processTypedLink: false,
|
|
40829
|
+
typedLinkTlds: [],
|
|
40830
|
+
typedLinkFileEndings: [
|
|
40831
|
+
'zip',
|
|
40832
|
+
'mov',
|
|
40833
|
+
'md',
|
|
40834
|
+
'py',
|
|
40835
|
+
'sh',
|
|
40836
|
+
'pub'
|
|
40837
|
+
],
|
|
40708
40838
|
deriveUrlFromText: false,
|
|
40709
40839
|
noFollowCheckbox: true,
|
|
40710
40840
|
openInNewTabCheckbox: true,
|
|
@@ -40756,12 +40886,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40756
40886
|
/* unused harmony export link */
|
|
40757
40887
|
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
|
|
40758
40888
|
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
|
|
40759
|
-
/* harmony import */ var
|
|
40760
|
-
/* harmony import */ var
|
|
40761
|
-
/* harmony import */ var
|
|
40762
|
-
/* harmony import */ var
|
|
40763
|
-
/* harmony import */ var
|
|
40764
|
-
/* harmony import */ var
|
|
40889
|
+
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
|
|
40890
|
+
/* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
|
|
40891
|
+
/* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(27795);
|
|
40892
|
+
/* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
|
|
40893
|
+
/* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(65946);
|
|
40894
|
+
/* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
|
|
40895
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(65230);
|
|
40896
|
+
/* harmony import */ var _typed_link__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(99763);
|
|
40765
40897
|
/*!
|
|
40766
40898
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
40767
40899
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -40778,9 +40910,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40778
40910
|
|
|
40779
40911
|
|
|
40780
40912
|
|
|
40913
|
+
|
|
40914
|
+
|
|
40781
40915
|
/**
|
|
40782
40916
|
* Process link. Insert, dblclick or remove format
|
|
40783
|
-
*/ class link extends
|
|
40917
|
+
*/ class link extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
|
|
40784
40918
|
/** @override */ afterInit(jodit) {
|
|
40785
40919
|
if (jodit.o.link.followOnDblClick) {
|
|
40786
40920
|
jodit.e.on('dblclick.link', this.__onDblClickOnLink);
|
|
@@ -40789,6 +40923,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40789
40923
|
if (jodit.o.link.processPastedLink) {
|
|
40790
40924
|
jodit.e.on('processPaste.link', this.onProcessPasteLink);
|
|
40791
40925
|
}
|
|
40926
|
+
if (jodit.o.link.processTypedLink) {
|
|
40927
|
+
this.__linkAfterEnter = jodit.async.microDebounce(this.__linkTyped);
|
|
40928
|
+
jodit.e.on('input.link', this.__onTypedSpace).on('beforeEnter.link', this.__onBeforeEnter).on('afterEnter.link', this.__onAfterEnter).on('mousedown.link blur.link beforeCommand.link', this.__forgetLink)// Without a namespace it runs ahead of table navigation,
|
|
40929
|
+
// which moves the caret on Tab, and of the backspace plugin
|
|
40930
|
+
.on('keydown', this.__onKeyDown, {
|
|
40931
|
+
top: true
|
|
40932
|
+
});
|
|
40933
|
+
}
|
|
40792
40934
|
jodit.e.on('generateLinkForm.link', this.__generateForm);
|
|
40793
40935
|
jodit.registerCommand('openLinkDialog', {
|
|
40794
40936
|
exec: ()=>{
|
|
@@ -40802,7 +40944,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40802
40944
|
dialog.setContent(htmlForm);
|
|
40803
40945
|
dialog.open();
|
|
40804
40946
|
jodit.async.requestIdleCallback(()=>{
|
|
40805
|
-
const { url_input } = (0,
|
|
40947
|
+
const { url_input } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.refs)(htmlForm.container);
|
|
40806
40948
|
url_input?.focus();
|
|
40807
40949
|
});
|
|
40808
40950
|
},
|
|
@@ -40810,10 +40952,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40810
40952
|
});
|
|
40811
40953
|
}
|
|
40812
40954
|
__onDblClickOnLink(e) {
|
|
40813
|
-
if (!
|
|
40955
|
+
if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(e.target, 'a')) {
|
|
40814
40956
|
return;
|
|
40815
40957
|
}
|
|
40816
|
-
const href = (0,
|
|
40958
|
+
const href = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(e.target, 'href');
|
|
40817
40959
|
if (href) {
|
|
40818
40960
|
location.href = href;
|
|
40819
40961
|
e.preventDefault();
|
|
@@ -40821,23 +40963,23 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40821
40963
|
}
|
|
40822
40964
|
onProcessPasteLink(ignore, html) {
|
|
40823
40965
|
const { jodit } = this;
|
|
40824
|
-
if (!(0,
|
|
40966
|
+
if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isURL)(html) || !jodit.o.link.processPastedLink) {
|
|
40825
40967
|
return;
|
|
40826
40968
|
}
|
|
40827
40969
|
jodit.e.stopPropagation('processPaste');
|
|
40828
40970
|
if (jodit.o.link.processVideoLink) {
|
|
40829
|
-
const embed = (0,
|
|
40971
|
+
const embed = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.call)(jodit.o.video?.parseUrlToVideoEmbed ?? jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.convertMediaUrlToVideoEmbed, html, {
|
|
40830
40972
|
width: jodit.o.video?.defaultWidth,
|
|
40831
40973
|
height: jodit.o.video?.defaultHeight
|
|
40832
40974
|
});
|
|
40833
40975
|
if (embed !== html) {
|
|
40834
|
-
const media = (0,
|
|
40835
|
-
return (0,
|
|
40976
|
+
const media = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.prepareEmbedCode)(jodit, embed);
|
|
40977
|
+
return (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isString)(media) ? jodit.createInside.fromHTML(media) : media;
|
|
40836
40978
|
}
|
|
40837
40979
|
}
|
|
40838
40980
|
if (jodit.s.isCollapsed()) {
|
|
40839
40981
|
const a = jodit.createInside.element('a');
|
|
40840
|
-
(0,
|
|
40982
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'href', html);
|
|
40841
40983
|
a.textContent = html;
|
|
40842
40984
|
jodit.e.fire('applyLink', jodit, a, null);
|
|
40843
40985
|
return a;
|
|
@@ -40855,16 +40997,16 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40855
40997
|
const i18n = jodit.i18n.bind(jodit);
|
|
40856
40998
|
const { openInNewTabCheckbox, openInNewTabCheckboxDefaultChecked, noFollowCheckbox, formTemplate, formClassName, modeClassName } = jodit.o.link;
|
|
40857
40999
|
const html = formTemplate(jodit);
|
|
40858
|
-
const form = (0,
|
|
41000
|
+
const form = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isString)(html) ? jodit.c.fromHTML(html, {
|
|
40859
41001
|
target_checkbox_box: openInNewTabCheckbox,
|
|
40860
41002
|
nofollow_checkbox_box: noFollowCheckbox
|
|
40861
41003
|
}) : html;
|
|
40862
|
-
const htmlForm =
|
|
40863
|
-
const elements = (0,
|
|
41004
|
+
const htmlForm = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(form) ? form : form.container;
|
|
41005
|
+
const elements = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.refs)(htmlForm);
|
|
40864
41006
|
const { insert, unlink, content_input_box } = elements;
|
|
40865
41007
|
const { target_checkbox, nofollow_checkbox, url_input } = elements;
|
|
40866
41008
|
const currentElement = current;
|
|
40867
|
-
const isImageContent =
|
|
41009
|
+
const isImageContent = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isImage(currentElement);
|
|
40868
41010
|
let { content_input } = elements;
|
|
40869
41011
|
const { className_input } = elements, { className_select } = elements, { aria_label_input } = elements;
|
|
40870
41012
|
if (!content_input) {
|
|
@@ -40877,12 +41019,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40877
41019
|
htmlForm.classList.add(formClassName);
|
|
40878
41020
|
}
|
|
40879
41021
|
if (isImageContent) {
|
|
40880
|
-
|
|
41022
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.hide(content_input_box);
|
|
40881
41023
|
}
|
|
40882
41024
|
let link;
|
|
40883
|
-
const getSelectionText = ()=>link ? link.innerText : (0,
|
|
40884
|
-
if (current &&
|
|
40885
|
-
link =
|
|
41025
|
+
const getSelectionText = ()=>link ? link.innerText : (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.stripTags)(jodit.s.range.cloneContents(), jodit.ed);
|
|
41026
|
+
if (current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(current, 'a', jodit.editor)) {
|
|
41027
|
+
link = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(current, 'a', jodit.editor);
|
|
40886
41028
|
} else {
|
|
40887
41029
|
link = false;
|
|
40888
41030
|
}
|
|
@@ -40890,22 +41032,22 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40890
41032
|
content_input.value = getSelectionText();
|
|
40891
41033
|
}
|
|
40892
41034
|
if (aria_label_input) {
|
|
40893
|
-
aria_label_input.value = link ? (0,
|
|
41035
|
+
aria_label_input.value = link ? (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'aria-label') || '' : '';
|
|
40894
41036
|
}
|
|
40895
41037
|
if (link) {
|
|
40896
|
-
url_input.value = (0,
|
|
41038
|
+
url_input.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'href') || '';
|
|
40897
41039
|
if (modeClassName) {
|
|
40898
41040
|
readClassnames(modeClassName, className_input, link, className_select);
|
|
40899
41041
|
}
|
|
40900
41042
|
if (openInNewTabCheckbox && target_checkbox) {
|
|
40901
|
-
target_checkbox.checked = (0,
|
|
41043
|
+
target_checkbox.checked = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'target') === '_blank';
|
|
40902
41044
|
}
|
|
40903
41045
|
if (noFollowCheckbox && nofollow_checkbox) {
|
|
40904
|
-
nofollow_checkbox.checked = ((0,
|
|
41046
|
+
nofollow_checkbox.checked = ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'rel') || '').split(/\s+/).includes('nofollow');
|
|
40905
41047
|
}
|
|
40906
41048
|
insert.textContent = i18n('Update');
|
|
40907
41049
|
} else {
|
|
40908
|
-
|
|
41050
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.hide(unlink);
|
|
40909
41051
|
if (jodit.o.link.deriveUrlFromText && url_input && !isImageContent && !url_input.value.trim()) {
|
|
40910
41052
|
url_input.value = guessUrlFromText(content_input.value);
|
|
40911
41053
|
}
|
|
@@ -40920,7 +41062,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40920
41062
|
jodit.s.restore();
|
|
40921
41063
|
jodit.history.snapshot.restore(snapshot);
|
|
40922
41064
|
if (link) {
|
|
40923
|
-
|
|
41065
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.unwrap(link);
|
|
40924
41066
|
}
|
|
40925
41067
|
jodit.synchronizeValues();
|
|
40926
41068
|
close();
|
|
@@ -40941,12 +41083,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40941
41083
|
const textWasChanged = getSelectionText() !== content_input.value.trim();
|
|
40942
41084
|
const ci = jodit.createInside;
|
|
40943
41085
|
let caretAfter = null;
|
|
40944
|
-
if (!link || !
|
|
41086
|
+
if (!link || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(jodit.editor, link)) {
|
|
40945
41087
|
if (!jodit.s.isCollapsed()) {
|
|
40946
41088
|
const node = jodit.s.current();
|
|
40947
|
-
if (
|
|
41089
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(node, 'img')) {
|
|
40948
41090
|
links = [
|
|
40949
|
-
|
|
41091
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.wrap(node, 'a', ci)
|
|
40950
41092
|
];
|
|
40951
41093
|
} else {
|
|
40952
41094
|
links = jodit.s.wrapInTag('a');
|
|
@@ -40966,27 +41108,27 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40966
41108
|
];
|
|
40967
41109
|
}
|
|
40968
41110
|
links.forEach((a)=>{
|
|
40969
|
-
;(0,
|
|
41111
|
+
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'href', url_input.value);
|
|
40970
41112
|
writeClasses(modeClassName, className_input, className_select, a);
|
|
40971
41113
|
if (!isImageContent) {
|
|
40972
41114
|
writeImage(a, content_input, textWasChanged, url_input);
|
|
40973
41115
|
}
|
|
40974
41116
|
if (openInNewTabCheckbox && target_checkbox) {
|
|
40975
|
-
(0,
|
|
41117
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'target', target_checkbox.checked ? '_blank' : null);
|
|
40976
41118
|
}
|
|
40977
41119
|
if (noFollowCheckbox && nofollow_checkbox) {
|
|
40978
|
-
const relParts = ((0,
|
|
41120
|
+
const relParts = ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'rel') || '').split(/\s+/).filter(Boolean);
|
|
40979
41121
|
const hasNofollow = relParts.includes('nofollow');
|
|
40980
41122
|
if (nofollow_checkbox.checked && !hasNofollow) {
|
|
40981
41123
|
relParts.push('nofollow');
|
|
40982
41124
|
} else if (!nofollow_checkbox.checked && hasNofollow) {
|
|
40983
41125
|
relParts.splice(relParts.indexOf('nofollow'), 1);
|
|
40984
41126
|
}
|
|
40985
|
-
;(0,
|
|
41127
|
+
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'rel', relParts.length ? relParts.join(' ') : null);
|
|
40986
41128
|
}
|
|
40987
41129
|
if (aria_label_input) {
|
|
40988
41130
|
const ariaLabel = aria_label_input.value.trim();
|
|
40989
|
-
(0,
|
|
41131
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'aria-label', ariaLabel || null);
|
|
40990
41132
|
}
|
|
40991
41133
|
jodit.e.fire('applyLink', jodit, a, form);
|
|
40992
41134
|
});
|
|
@@ -41001,7 +41143,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41001
41143
|
close();
|
|
41002
41144
|
return false;
|
|
41003
41145
|
};
|
|
41004
|
-
if (
|
|
41146
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(form)) {
|
|
41005
41147
|
jodit.e.on(form, 'submit', (event)=>{
|
|
41006
41148
|
event.preventDefault();
|
|
41007
41149
|
event.stopImmediatePropagation();
|
|
@@ -41014,11 +41156,96 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41014
41156
|
return form;
|
|
41015
41157
|
}
|
|
41016
41158
|
/** @override */ beforeDestruct(jodit) {
|
|
41017
|
-
jodit.e.off('generateLinkForm.link', this.__generateForm).off('dblclick.link', this.__onDblClickOnLink).off(jodit.editor, 'click.link', this.__onClickReadOnlyLink).off('processPaste.link', this.onProcessPasteLink);
|
|
41159
|
+
jodit.e.off('generateLinkForm.link', this.__generateForm).off('dblclick.link', this.__onDblClickOnLink).off(jodit.editor, 'click.link', this.__onClickReadOnlyLink).off('processPaste.link', this.onProcessPasteLink).off('input.link', this.__onTypedSpace).off('beforeEnter.link', this.__onBeforeEnter).off('afterEnter.link', this.__onAfterEnter).off('mousedown.link blur.link beforeCommand.link', this.__forgetLink).off('keydown', this.__onKeyDown);
|
|
41160
|
+
}
|
|
41161
|
+
__onTypedSpace(event) {
|
|
41162
|
+
if (event.inputType !== 'insertText' || !event.data || /\S/.test(event.data)) {
|
|
41163
|
+
return;
|
|
41164
|
+
}
|
|
41165
|
+
const { range } = this.j.s;
|
|
41166
|
+
if (range.collapsed) {
|
|
41167
|
+
this.__linkTyped(range.startContainer, range.startOffset - event.data.length);
|
|
41168
|
+
}
|
|
41169
|
+
}
|
|
41170
|
+
__onBeforeEnter() {
|
|
41171
|
+
const { range } = this.j.s;
|
|
41172
|
+
this.__enteredAt = range.collapsed ? [
|
|
41173
|
+
range.startContainer,
|
|
41174
|
+
range.startOffset
|
|
41175
|
+
] : null;
|
|
41176
|
+
}
|
|
41177
|
+
__onAfterEnter() {
|
|
41178
|
+
if (this.__enteredAt) {
|
|
41179
|
+
this.__linkAfterEnter(...this.__enteredAt);
|
|
41180
|
+
this.__enteredAt = null;
|
|
41181
|
+
}
|
|
41182
|
+
}
|
|
41183
|
+
__forgetLink() {
|
|
41184
|
+
this.__justLinked = null;
|
|
41185
|
+
}
|
|
41186
|
+
__onKeyDown(event) {
|
|
41187
|
+
const { jodit } = this;
|
|
41188
|
+
if (jodit.o.readonly) {
|
|
41189
|
+
return;
|
|
41190
|
+
}
|
|
41191
|
+
const link = this.__justLinked;
|
|
41192
|
+
const modified = event.ctrlKey || event.metaKey || event.altKey;
|
|
41193
|
+
if (!MODIFIER_KEYS.has(event.key)) {
|
|
41194
|
+
this.__justLinked = null;
|
|
41195
|
+
}
|
|
41196
|
+
if (event.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_BACKSPACE && !modified && link?.isConnected) {
|
|
41197
|
+
this.__recordStep();
|
|
41198
|
+
jodit.s.save();
|
|
41199
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.unwrap(link);
|
|
41200
|
+
jodit.s.restore();
|
|
41201
|
+
this.__recordStep();
|
|
41202
|
+
// Or the backspace plugin takes a character too
|
|
41203
|
+
jodit.e.stopPropagation('keydown');
|
|
41204
|
+
return false;
|
|
41205
|
+
}
|
|
41206
|
+
const { range } = jodit.s;
|
|
41207
|
+
if (event.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_TAB && !modified && range.collapsed) {
|
|
41208
|
+
this.__linkTyped(range.startContainer, range.startOffset);
|
|
41209
|
+
}
|
|
41210
|
+
}
|
|
41211
|
+
/**
|
|
41212
|
+
* Links the address that ends at `end` in a text node, as a step of its
|
|
41213
|
+
* own in the history, so Undo straight after takes the link off and
|
|
41214
|
+
* leaves the text
|
|
41215
|
+
*/ __linkTyped(node, end) {
|
|
41216
|
+
const { jodit } = this;
|
|
41217
|
+
if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(node) || !node.isConnected || end < 0 || end > node.length || jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(node, NO_TYPED_LINKS, jodit.editor)) {
|
|
41218
|
+
return;
|
|
41219
|
+
}
|
|
41220
|
+
const found = (0,_typed_link__WEBPACK_IMPORTED_MODULE_9__.findTypedLink)(node.data, end, jodit.o.link.typedLinkTlds, jodit.o.link.typedLinkFileEndings);
|
|
41221
|
+
if (!found) {
|
|
41222
|
+
return;
|
|
41223
|
+
}
|
|
41224
|
+
const [start, stop, href] = found;
|
|
41225
|
+
this.__recordStep();
|
|
41226
|
+
// The text round the caret splits, and WebKit doesn't keep the caret
|
|
41227
|
+
// where it was
|
|
41228
|
+
jodit.s.save();
|
|
41229
|
+
const range = jodit.ed.createRange();
|
|
41230
|
+
range.setStart(node, start);
|
|
41231
|
+
range.setEnd(node, stop);
|
|
41232
|
+
const a = jodit.createInside.element('a');
|
|
41233
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'href', href);
|
|
41234
|
+
range.surroundContents(a);
|
|
41235
|
+
jodit.s.restore();
|
|
41236
|
+
jodit.e.fire('applyLink', jodit, a, null);
|
|
41237
|
+
this.__recordStep();
|
|
41238
|
+
this.__justLinked = a;
|
|
41239
|
+
}
|
|
41240
|
+
/**
|
|
41241
|
+
* Reports what's changed and makes it a history step of its own
|
|
41242
|
+
*/ __recordStep() {
|
|
41243
|
+
this.j.setEditorValue();
|
|
41244
|
+
this.j.e.fire('internalChange');
|
|
41018
41245
|
}
|
|
41019
41246
|
__onClickReadOnlyLink(e) {
|
|
41020
41247
|
const { jodit } = this;
|
|
41021
|
-
if (jodit.o.readonly && jodit.o.link.preventReadOnlyNavigation &&
|
|
41248
|
+
if (jodit.o.readonly && jodit.o.link.preventReadOnlyNavigation && jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(e.target, 'a')) {
|
|
41022
41249
|
e.preventDefault();
|
|
41023
41250
|
}
|
|
41024
41251
|
}
|
|
@@ -41028,22 +41255,59 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41028
41255
|
name: 'link',
|
|
41029
41256
|
group: 'insert'
|
|
41030
41257
|
}
|
|
41031
|
-
])
|
|
41258
|
+
]), /**
|
|
41259
|
+
* Where the caret was when Enter was pressed. Enter splits the line in a
|
|
41260
|
+
* history transaction, so the link waits until it's over
|
|
41261
|
+
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__enteredAt", null), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__linkAfterEnter", ()=>{}), /**
|
|
41262
|
+
* The link just made, which Backspace straight after takes off again, as
|
|
41263
|
+
* in CKEditor 5. Any other key but a modifier, a click or a command
|
|
41264
|
+
* forgets it
|
|
41265
|
+
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__justLinked", null);
|
|
41032
41266
|
}
|
|
41033
41267
|
}
|
|
41034
41268
|
;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41035
|
-
|
|
41269
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41036
41270
|
], link.prototype, "__onDblClickOnLink", null);
|
|
41037
41271
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41038
|
-
|
|
41272
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41039
41273
|
], link.prototype, "onProcessPasteLink", null);
|
|
41040
41274
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41041
|
-
|
|
41275
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41042
41276
|
], link.prototype, "__generateForm", null);
|
|
41043
41277
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41044
|
-
|
|
41278
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41279
|
+
], link.prototype, "__onTypedSpace", null);
|
|
41280
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41281
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41282
|
+
], link.prototype, "__onBeforeEnter", null);
|
|
41283
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41284
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41285
|
+
], link.prototype, "__onAfterEnter", null);
|
|
41286
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41287
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41288
|
+
], link.prototype, "__forgetLink", null);
|
|
41289
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41290
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41291
|
+
], link.prototype, "__onKeyDown", null);
|
|
41292
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41293
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41294
|
+
], link.prototype, "__linkTyped", null);
|
|
41295
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41296
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41045
41297
|
], link.prototype, "__onClickReadOnlyLink", null);
|
|
41046
|
-
|
|
41298
|
+
const NO_TYPED_LINKS = new Set([
|
|
41299
|
+
'a',
|
|
41300
|
+
'pre',
|
|
41301
|
+
'code'
|
|
41302
|
+
]);
|
|
41303
|
+
const MODIFIER_KEYS = new Set([
|
|
41304
|
+
'Shift',
|
|
41305
|
+
'Control',
|
|
41306
|
+
'Alt',
|
|
41307
|
+
'Meta',
|
|
41308
|
+
'CapsLock'
|
|
41309
|
+
]);
|
|
41310
|
+
jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('link', link);
|
|
41047
41311
|
/**
|
|
41048
41312
|
* Guess a usable `href` from the selected text for the link dialog.
|
|
41049
41313
|
* Returns an empty string when the text is not a plausible URL/email,
|
|
@@ -41058,7 +41322,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('link', link);
|
|
|
41058
41322
|
return value;
|
|
41059
41323
|
}
|
|
41060
41324
|
// email address -> mailto:
|
|
41061
|
-
if (
|
|
41325
|
+
if (_typed_link__WEBPACK_IMPORTED_MODULE_9__.EMAIL.test(value)) {
|
|
41062
41326
|
return `mailto:${value}`;
|
|
41063
41327
|
}
|
|
41064
41328
|
// bare domain like example.com or www.example.com/path -> https://
|
|
@@ -41071,14 +41335,14 @@ function writeClasses(modeClassName, className_input, className_select, a) {
|
|
|
41071
41335
|
if (modeClassName && (className_input ?? className_select)) {
|
|
41072
41336
|
if (modeClassName === 'input') {
|
|
41073
41337
|
if (className_input.value === '' && a.hasAttribute('class')) {
|
|
41074
|
-
(0,
|
|
41338
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'class', null);
|
|
41075
41339
|
}
|
|
41076
41340
|
if (className_input.value !== '') {
|
|
41077
|
-
(0,
|
|
41341
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'class', className_input.value);
|
|
41078
41342
|
}
|
|
41079
41343
|
} else if (modeClassName === 'select') {
|
|
41080
41344
|
if (a.hasAttribute('class')) {
|
|
41081
|
-
(0,
|
|
41345
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'class', null);
|
|
41082
41346
|
}
|
|
41083
41347
|
for(let i = 0; i < className_select.selectedOptions.length; i++){
|
|
41084
41348
|
const className = className_select.selectedOptions.item(i)?.value;
|
|
@@ -41095,7 +41359,7 @@ function readClassnames(modeClassName, className_input, link, className_select)
|
|
|
41095
41359
|
switch(modeClassName){
|
|
41096
41360
|
case 'input':
|
|
41097
41361
|
if (className_input) {
|
|
41098
|
-
className_input.value = (0,
|
|
41362
|
+
className_input.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'class') || '';
|
|
41099
41363
|
}
|
|
41100
41364
|
break;
|
|
41101
41365
|
case 'select':
|
|
@@ -41106,7 +41370,7 @@ function readClassnames(modeClassName, className_input, link, className_select)
|
|
|
41106
41370
|
option.selected = false;
|
|
41107
41371
|
}
|
|
41108
41372
|
}
|
|
41109
|
-
const classNames = (0,
|
|
41373
|
+
const classNames = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'class') || '';
|
|
41110
41374
|
classNames.split(/\s+/).filter((cn)=>cn.trim().length > 0).forEach((className)=>{
|
|
41111
41375
|
if (className) {
|
|
41112
41376
|
for(let i = 0; i < className_select.options.length; i++){
|
|
@@ -41237,6 +41501,156 @@ const formTemplate = (editor)=>{
|
|
|
41237
41501
|
/* harmony export */ ]);
|
|
41238
41502
|
|
|
41239
41503
|
|
|
41504
|
+
/***/ }),
|
|
41505
|
+
|
|
41506
|
+
/***/ 4441:
|
|
41507
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
41508
|
+
|
|
41509
|
+
"use strict";
|
|
41510
|
+
/*!
|
|
41511
|
+
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
41512
|
+
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
41513
|
+
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
41514
|
+
*/ /**
|
|
41515
|
+
* @module plugins/link
|
|
41516
|
+
*/ /**
|
|
41517
|
+
* The endings a bare domain links with, besides those `link.typedLinkTlds`
|
|
41518
|
+
* adds: the generic ones of at least 1 in 1,000 of the sites in Tranco's top
|
|
41519
|
+
* million (list GQ38K, https://tranco-list.eu/list/GQ38K), then every
|
|
41520
|
+
* two-letter one in IANA's list (version 2026102900,
|
|
41521
|
+
* https://data.iana.org/TLD/tlds-alpha-by-domain.txt). Together they're the
|
|
41522
|
+
* endings of 96% of those sites
|
|
41523
|
+
* @private
|
|
41524
|
+
*/ const TLDS = new Set(`
|
|
41525
|
+
app biz casino click cloud club com dev edu gov info live net online org pro
|
|
41526
|
+
shop site space store tech top vip xyz
|
|
41527
|
+
ac ad ae af ag ai al am ao aq ar as at au aw ax az ba bb bd be bf bg bh bi
|
|
41528
|
+
bj bm bn bo br bs bt bv bw by bz ca cc cd cf cg ch ci ck cl cm cn co cr cu
|
|
41529
|
+
cv cw cx cy cz de dj dk dm do dz ec ee eg er es et eu fi fj fk fm fo fr ga
|
|
41530
|
+
gb gd ge gf gg gh gi gl gm gn gp gq gr gs gt gu gw gy hk hm hn hr ht hu id
|
|
41531
|
+
ie il im in io iq ir is it je jm jo jp ke kg kh ki km kn kp kr kw ky kz la
|
|
41532
|
+
lb lc li lk lr ls lt lu lv ly ma mc md me mg mh mk ml mm mn mo mp mq mr ms
|
|
41533
|
+
mt mu mv mw mx my mz na nc ne nf ng ni nl no np nr nu nz om pa pe pf pg ph
|
|
41534
|
+
pk pl pm pn pr ps pt pw py qa re ro rs ru rw sa sb sc sd se sg sh si sj sk
|
|
41535
|
+
sl sm sn so sr ss st su sv sx sy sz tc td tf tg th tj tk tl tm tn to tr tt
|
|
41536
|
+
tv tw tz ua ug uk us uy uz va vc ve vg vi vn vu wf ws ye yt za zm zw
|
|
41537
|
+
`.trim().split(/\s+/));
|
|
41538
|
+
|
|
41539
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, [
|
|
41540
|
+
/* harmony export */ "TLDS", 0, /* binding */ TLDS
|
|
41541
|
+
/* harmony export */ ]);
|
|
41542
|
+
|
|
41543
|
+
|
|
41544
|
+
/***/ }),
|
|
41545
|
+
|
|
41546
|
+
/***/ 99763:
|
|
41547
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
41548
|
+
|
|
41549
|
+
"use strict";
|
|
41550
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
41551
|
+
/* harmony export */ findTypedLink: function() { return /* binding */ findTypedLink; }
|
|
41552
|
+
/* harmony export */ });
|
|
41553
|
+
/* harmony import */ var jodit_core_helpers_checker_is_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(91764);
|
|
41554
|
+
/* harmony import */ var _tlds__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4441);
|
|
41555
|
+
/*!
|
|
41556
|
+
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
41557
|
+
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
41558
|
+
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
41559
|
+
*/ /**
|
|
41560
|
+
* @module plugins/link
|
|
41561
|
+
*/
|
|
41562
|
+
|
|
41563
|
+
/**
|
|
41564
|
+
* An email address, for `mailto:`
|
|
41565
|
+
* @private
|
|
41566
|
+
*/ const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
41567
|
+
const OPENING = new Set([
|
|
41568
|
+
'(',
|
|
41569
|
+
'[',
|
|
41570
|
+
'"',
|
|
41571
|
+
"'",
|
|
41572
|
+
'“',
|
|
41573
|
+
'‘',
|
|
41574
|
+
'<'
|
|
41575
|
+
]);
|
|
41576
|
+
const CLOSING = new Set([
|
|
41577
|
+
'.',
|
|
41578
|
+
',',
|
|
41579
|
+
';',
|
|
41580
|
+
':',
|
|
41581
|
+
'!',
|
|
41582
|
+
'?',
|
|
41583
|
+
'"',
|
|
41584
|
+
"'",
|
|
41585
|
+
'”',
|
|
41586
|
+
'’',
|
|
41587
|
+
'>'
|
|
41588
|
+
]);
|
|
41589
|
+
const BRACKETS = {
|
|
41590
|
+
')': '(',
|
|
41591
|
+
']': '['
|
|
41592
|
+
};
|
|
41593
|
+
const LABEL = /^[a-z\d][a-z\d-]{0,62}$/i;
|
|
41594
|
+
/**
|
|
41595
|
+
* The address that ends at `end` in a line of text typed, back to the
|
|
41596
|
+
* whitespace before it, as `[start, end, href]`. Punctuation round it, such as
|
|
41597
|
+
* a sentence's full stop or a bracket the address doesn't open, stays out.
|
|
41598
|
+
* An address counts with a scheme, with `www.`, as an email address, or as a
|
|
41599
|
+
* bare domain that `isBareDomain` accepts, so `Node.js` or `e.g.` don't
|
|
41600
|
+
* @private
|
|
41601
|
+
*/ function findTypedLink(text, end, tlds, fileEndings) {
|
|
41602
|
+
let start = end;
|
|
41603
|
+
while(start > 0 && !/\s/.test(text[start - 1])){
|
|
41604
|
+
start -= 1;
|
|
41605
|
+
}
|
|
41606
|
+
while(start < end && OPENING.has(text[start])){
|
|
41607
|
+
start += 1;
|
|
41608
|
+
}
|
|
41609
|
+
while(end > start){
|
|
41610
|
+
const char = text[end - 1];
|
|
41611
|
+
const opening = BRACKETS[char];
|
|
41612
|
+
if (CLOSING.has(char) || opening && !text.slice(start, end - 1).includes(opening)) {
|
|
41613
|
+
end -= 1;
|
|
41614
|
+
} else {
|
|
41615
|
+
break;
|
|
41616
|
+
}
|
|
41617
|
+
}
|
|
41618
|
+
const href = typedLinkHref(text.slice(start, end), tlds, fileEndings);
|
|
41619
|
+
return href ? [
|
|
41620
|
+
start,
|
|
41621
|
+
end,
|
|
41622
|
+
href
|
|
41623
|
+
] : null;
|
|
41624
|
+
}
|
|
41625
|
+
function typedLinkHref(address, tlds, fileEndings) {
|
|
41626
|
+
const email = address.replace(/^mailto:/i, '');
|
|
41627
|
+
if (EMAIL.test(email)) {
|
|
41628
|
+
return `mailto:${email}`;
|
|
41629
|
+
}
|
|
41630
|
+
if (/^www\.[^\s.]+\.\S+$/i.test(address) || isBareDomain(address, tlds, fileEndings)) {
|
|
41631
|
+
return `https://${address}`;
|
|
41632
|
+
}
|
|
41633
|
+
return /^[a-z][a-z\d+.-]*:\/\//i.test(address) && (0,jodit_core_helpers_checker_is_url__WEBPACK_IMPORTED_MODULE_0__.isURL)(address) ? address : '';
|
|
41634
|
+
}
|
|
41635
|
+
/**
|
|
41636
|
+
* A domain typed without a scheme or `www.`, as `example.com`, `elections.nz`
|
|
41637
|
+
* or `bit.ly/enrol`. Its ending has to be in `TLDS` or `tlds`, typed in lower
|
|
41638
|
+
* case, so `Node.js` and a sentence run on, as in `home.It`, don't count, and
|
|
41639
|
+
* not in `fileEndings`, as in `photos.zip`. The first part has a letter,
|
|
41640
|
+
* which leaves out a time or a numbered step such as `11.am`
|
|
41641
|
+
*/ function isBareDomain(address, tlds, fileEndings) {
|
|
41642
|
+
const cut = address.search(/[/?#]/);
|
|
41643
|
+
const host = cut < 0 ? address : address.slice(0, cut);
|
|
41644
|
+
const labels = host.split('.');
|
|
41645
|
+
const ending = labels[labels.length - 1];
|
|
41646
|
+
return labels.length > 1 && labels.every((label)=>LABEL.test(label) && !label.endsWith('-')) && (_tlds__WEBPACK_IMPORTED_MODULE_1__.TLDS.has(ending) || tlds.includes(ending)) && !fileEndings.includes(ending) && /[a-z]/i.test(labels[0]);
|
|
41647
|
+
}
|
|
41648
|
+
|
|
41649
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, [
|
|
41650
|
+
/* harmony export */ "EMAIL", 0, /* binding */ EMAIL
|
|
41651
|
+
/* harmony export */ ]);
|
|
41652
|
+
|
|
41653
|
+
|
|
41240
41654
|
/***/ }),
|
|
41241
41655
|
|
|
41242
41656
|
/***/ 51730:
|
|
@@ -43275,7 +43689,7 @@ const key = 'table_processor_observer-resize';
|
|
|
43275
43689
|
/**
|
|
43276
43690
|
* Click on resize handle
|
|
43277
43691
|
*/ onHandleMouseDown(event) {
|
|
43278
|
-
if (this.j.isLocked) {
|
|
43692
|
+
if (this.j.isLocked || this.j.o.readonly) {
|
|
43279
43693
|
return;
|
|
43280
43694
|
}
|
|
43281
43695
|
this.drag = true;
|
|
@@ -43310,10 +43724,15 @@ const key = 'table_processor_observer-resize';
|
|
|
43310
43724
|
let box;
|
|
43311
43725
|
this.minX = 0;
|
|
43312
43726
|
this.maxX = 1000000;
|
|
43727
|
+
this.startTableWidth = this.workTable.offsetWidth;
|
|
43313
43728
|
if (this.wholeTable != null) {
|
|
43314
|
-
const
|
|
43729
|
+
const parent = this.workTable.parentNode;
|
|
43730
|
+
const tableBox = parent.getBoundingClientRect();
|
|
43315
43731
|
this.minX = tableBox.left;
|
|
43316
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);
|
|
43317
43736
|
} else {
|
|
43318
43737
|
// find maximum columns
|
|
43319
43738
|
const coordinate = this.module.formalCoordinate(this.workTable, this.workCell, true);
|
|
@@ -43327,6 +43746,17 @@ const key = 'table_processor_observer-resize';
|
|
|
43327
43746
|
this.maxX = Math.min(box.left + box.width - jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.NEARBY / 2, this.maxX);
|
|
43328
43747
|
}
|
|
43329
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
|
+
});
|
|
43330
43760
|
}
|
|
43331
43761
|
return false;
|
|
43332
43762
|
}
|
|
@@ -43354,8 +43784,11 @@ const key = 'table_processor_observer-resize';
|
|
|
43354
43784
|
x = this.maxX;
|
|
43355
43785
|
}
|
|
43356
43786
|
this.resizeDelta = x - this.startX + (!this.j.o.iframe ? 0 : workplacePosition.left);
|
|
43357
|
-
this.
|
|
43358
|
-
|
|
43787
|
+
if (this.wholeTable == null) {
|
|
43788
|
+
this.setColumnWidths();
|
|
43789
|
+
} else {
|
|
43790
|
+
this.resizeTable();
|
|
43791
|
+
}
|
|
43359
43792
|
const tableBox = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.offset)(this.workTable, this.j, this.j.ed);
|
|
43360
43793
|
Object.assign(this.resizeHandler.style, {
|
|
43361
43794
|
left: this.startLeft + this.columnEdge() - this.startEdge + 'px',
|
|
@@ -43468,21 +43901,49 @@ const key = 'table_processor_observer-resize';
|
|
|
43468
43901
|
};
|
|
43469
43902
|
this.scrollFrame = this.j.async.requestAnimationFrame(scroll);
|
|
43470
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
|
+
}
|
|
43471
43914
|
/**
|
|
43472
43915
|
* Resize only one column
|
|
43473
43916
|
*/ resizeColumns() {
|
|
43474
43917
|
const delta = this.resizeDelta;
|
|
43475
43918
|
const marked = [];
|
|
43476
43919
|
const tableModule = this.module;
|
|
43477
|
-
|
|
43478
|
-
|
|
43479
|
-
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
|
+
});
|
|
43480
43941
|
}
|
|
43481
43942
|
/**
|
|
43482
43943
|
* Resize whole table
|
|
43483
43944
|
*/ resizeTable() {
|
|
43484
43945
|
const delta = this.resizeDelta * (this.isRTL ? -1 : 1);
|
|
43485
|
-
const width = this.
|
|
43946
|
+
const width = this.startTableWidth, parentWidth = this.startParentWidth;
|
|
43486
43947
|
// for RTL use mirror logic
|
|
43487
43948
|
const rightSide = !this.wholeTable;
|
|
43488
43949
|
const needChangeWidth = this.isRTL ? !rightSide : rightSide;
|
|
@@ -43491,10 +43952,9 @@ const key = 'table_processor_observer-resize';
|
|
|
43491
43952
|
(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_7__.css)(this.workTable, 'width', (width + delta) / parentWidth * 100 + '%');
|
|
43492
43953
|
} else {
|
|
43493
43954
|
const side = this.isRTL ? 'marginRight' : 'marginLeft';
|
|
43494
|
-
const margin = parseInt(this.j.ew.getComputedStyle(this.workTable)[side] || '0', 10);
|
|
43495
43955
|
(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_7__.css)(this.workTable, {
|
|
43496
43956
|
width: (width - delta) / parentWidth * 100 + '%',
|
|
43497
|
-
[side]: (
|
|
43957
|
+
[side]: (this.startMargin + delta) / parentWidth * 100 + '%'
|
|
43498
43958
|
});
|
|
43499
43959
|
}
|
|
43500
43960
|
}
|
|
@@ -43570,9 +44030,10 @@ const key = 'table_processor_observer-resize';
|
|
|
43570
44030
|
if (!editor.o.tableAllowCellResize) {
|
|
43571
44031
|
return;
|
|
43572
44032
|
}
|
|
43573
|
-
|
|
44033
|
+
const observeTables = ()=>{
|
|
43574
44034
|
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.$$)('table', editor.editor).forEach(this.observe);
|
|
43575
|
-
}
|
|
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', ()=>{
|
|
43576
44037
|
if (!this.drag || this.workRow) {
|
|
43577
44038
|
return;
|
|
43578
44039
|
}
|
|
@@ -43588,6 +44049,8 @@ const key = 'table_processor_observer-resize';
|
|
|
43588
44049
|
tableModule.normalizeTable(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(td, 'table', editor.editor));
|
|
43589
44050
|
});
|
|
43590
44051
|
});
|
|
44052
|
+
// None of those events comes with the editor's starting value
|
|
44053
|
+
observeTables();
|
|
43591
44054
|
}
|
|
43592
44055
|
/**
|
|
43593
44056
|
* Add to every Table listeners
|
|
@@ -43601,7 +44064,9 @@ const key = 'table_processor_observer-resize';
|
|
|
43601
44064
|
this.hideResizeHandle();
|
|
43602
44065
|
}
|
|
43603
44066
|
}).on(table, 'mousemove.resize-cells touchmove.resize-cells', this.j.async.throttle((event)=>{
|
|
43604
|
-
|
|
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) {
|
|
43605
44070
|
return;
|
|
43606
44071
|
}
|
|
43607
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);
|
|
@@ -43634,8 +44099,15 @@ const key = 'table_processor_observer-resize';
|
|
|
43634
44099
|
}
|
|
43635
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), /**
|
|
43636
44101
|
* The table's and its cells' styles as a column drag started, put back
|
|
43637
|
-
* before
|
|
44102
|
+
* as it ends, before the final widths
|
|
43638
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), /**
|
|
43639
44111
|
* The row whose height the handle sets, or null while it sets a width
|
|
43640
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), /**
|
|
43641
44113
|
* The boxes that scroll the row, with their styles, as a row drag turns
|
|
@@ -45385,7 +45857,6 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.tableAllowCellSelecti
|
|
|
45385
45857
|
|
|
45386
45858
|
|
|
45387
45859
|
const key = 'table_processor_observer';
|
|
45388
|
-
const MOUSE_MOVE_LABEL = 'onMoveTableSelectCell';
|
|
45389
45860
|
class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
|
|
45390
45861
|
/**
|
|
45391
45862
|
* Shortcut for Jodit.modules.Table
|
|
@@ -45400,6 +45871,8 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
|
|
|
45400
45871
|
// move the caret, as table-keyboard-navigation's do
|
|
45401
45872
|
.on('keydown', this.__onKeyDown, {
|
|
45402
45873
|
top: true
|
|
45874
|
+
}).on('clickEditor', this.__onClickAfterDrag, {
|
|
45875
|
+
top: true
|
|
45403
45876
|
}).on('keydown.select-cells', (event)=>{
|
|
45404
45877
|
if (event.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_TAB) {
|
|
45405
45878
|
this.unselectCells();
|
|
@@ -45517,18 +45990,35 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
|
|
|
45517
45990
|
}
|
|
45518
45991
|
this.__isSelectionMode = true;
|
|
45519
45992
|
this.__selectedCell = cell;
|
|
45993
|
+
this.__movedTo = cell;
|
|
45520
45994
|
this.__tableModule.addSelection(cell);
|
|
45521
|
-
this.j.e.on(table, 'mousemove.select-cells touchmove.select-cells',
|
|
45522
|
-
|
|
45523
|
-
|
|
45524
|
-
|
|
45525
|
-
|
|
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)));
|
|
45526
46000
|
return false;
|
|
45527
46001
|
}
|
|
45528
46002
|
onOutsideClick() {
|
|
45529
46003
|
this.__selectedCell = null;
|
|
45530
46004
|
this.__onRemoveSelection();
|
|
45531
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
|
+
}
|
|
45532
46022
|
onChange() {
|
|
45533
46023
|
if (!this.j.isLocked && !this.__isSelectionMode) {
|
|
45534
46024
|
this.__onRemoveSelection();
|
|
@@ -45546,16 +46036,20 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
|
|
|
45546
46036
|
// Inside Shadow DOM `document.elementFromPoint` returns the shadow
|
|
45547
46037
|
// host, so the lookup must start from the shadow root
|
|
45548
46038
|
const node = (this.j.o.shadowRoot ?? this.j.ed).elementFromPoint(e.clientX, e.clientY);
|
|
45549
|
-
|
|
45550
|
-
return;
|
|
45551
|
-
}
|
|
45552
|
-
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, [
|
|
45553
46040
|
'td',
|
|
45554
46041
|
'th'
|
|
45555
46042
|
], table);
|
|
45556
46043
|
if (!cell || !this.__selectedCell) {
|
|
45557
46044
|
return;
|
|
45558
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;
|
|
45559
46053
|
if (cell !== this.__selectedCell) {
|
|
45560
46054
|
this.j.lock(key);
|
|
45561
46055
|
}
|
|
@@ -45613,10 +46107,32 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
|
|
|
45613
46107
|
if (ownTable && ownTable !== table) {
|
|
45614
46108
|
return; // Nested tables
|
|
45615
46109
|
}
|
|
45616
|
-
|
|
46110
|
+
this.__showCellsPopup(table, [
|
|
45617
46111
|
cell,
|
|
45618
46112
|
this.__selectedCell
|
|
45619
|
-
])
|
|
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);
|
|
45620
46136
|
const max = box[bound[1][0]]?.[bound[1][1]], min = box[bound[0][0]]?.[bound[0][1]];
|
|
45621
46137
|
// `getSelectedBound` keeps its `Infinity` sentinel when none of the
|
|
45622
46138
|
// selected cells belong to this table's matrix — e.g. after a
|
|
@@ -45636,10 +46152,16 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
|
|
|
45636
46152
|
height: maxOffset.top - minOffset.top + maxOffset.height
|
|
45637
46153
|
};
|
|
45638
46154
|
}, 'cells');
|
|
45639
|
-
|
|
46155
|
+
}
|
|
46156
|
+
__stopListening() {
|
|
46157
|
+
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.$$)('table', this.j.editor).forEach((table)=>{
|
|
45640
46158
|
this.j.e.off(table, 'mousemove.select-cells touchmove.select-cells mouseup.select-cells touchend.select-cells');
|
|
45641
46159
|
});
|
|
45642
|
-
|
|
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;
|
|
45643
46165
|
}
|
|
45644
46166
|
/**
|
|
45645
46167
|
* Remove selection for all cells
|
|
@@ -45809,7 +46331,8 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
|
|
|
45809
46331
|
}
|
|
45810
46332
|
/** @override */ beforeDestruct(jodit) {
|
|
45811
46333
|
this.__onRemoveSelection();
|
|
45812
|
-
|
|
46334
|
+
this.__stopListening();
|
|
46335
|
+
jodit.e.off('.select-cells').off('keydown', this.__onKeyDown).off('clickEditor', this.__onClickAfterDrag);
|
|
45813
46336
|
}
|
|
45814
46337
|
constructor(...args){
|
|
45815
46338
|
super(...args), /**
|
|
@@ -45820,7 +46343,12 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
|
|
|
45820
46343
|
* First selected cell
|
|
45821
46344
|
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__selectedCell", null), /**
|
|
45822
46345
|
* User is selecting cells now
|
|
45823
|
-
*/ (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);
|
|
45824
46352
|
}
|
|
45825
46353
|
}
|
|
45826
46354
|
;(0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(selectCells, "requires", [
|
|
@@ -45838,6 +46366,15 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
|
|
|
45838
46366
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
45839
46367
|
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':outsideClick')
|
|
45840
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);
|
|
45841
46378
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
45842
46379
|
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':change')
|
|
45843
46380
|
], selectCells.prototype, "onChange", null);
|
|
@@ -45889,10 +46426,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
45889
46426
|
/* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
|
|
45890
46427
|
/* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
|
|
45891
46428
|
/* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
|
|
45892
|
-
/* harmony import */ var
|
|
45893
|
-
/* harmony import */ var
|
|
45894
|
-
/* harmony import */ var
|
|
45895
|
-
/* 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);
|
|
45896
46434
|
/*!
|
|
45897
46435
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
45898
46436
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -45911,6 +46449,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
45911
46449
|
|
|
45912
46450
|
|
|
45913
46451
|
|
|
46452
|
+
|
|
45914
46453
|
/**
|
|
45915
46454
|
* A utility plugin that allows you to subscribe to a click/mousedown/touchstart/mouseup on an element in DOM order
|
|
45916
46455
|
*
|
|
@@ -45921,22 +46460,27 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
45921
46460
|
* console.log(img.src);
|
|
45922
46461
|
* })
|
|
45923
46462
|
* ```
|
|
45924
|
-
*/ class select extends
|
|
46463
|
+
*/ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_8__.Plugin {
|
|
45925
46464
|
afterInit(jodit) {
|
|
45926
46465
|
this.proxyEventsList.forEach((eventName)=>{
|
|
45927
46466
|
jodit.e.on(eventName + '.select', this.onStartSelection);
|
|
45928
46467
|
});
|
|
46468
|
+
jodit.e.on('dblclick', this.__onDblClickBesideRow, {
|
|
46469
|
+
top: true
|
|
46470
|
+
});
|
|
45929
46471
|
}
|
|
45930
46472
|
beforeDestruct(jodit) {
|
|
45931
46473
|
this.proxyEventsList.forEach((eventName)=>{
|
|
45932
|
-
jodit.e.
|
|
46474
|
+
jodit.e.off(eventName + '.select', this.onStartSelection);
|
|
45933
46475
|
});
|
|
46476
|
+
this.__endPressBesideRow();
|
|
46477
|
+
jodit.e.off('dblclick', this.__onDblClickBesideRow);
|
|
45934
46478
|
}
|
|
45935
46479
|
onStartSelection(e) {
|
|
45936
46480
|
const { j } = this;
|
|
45937
46481
|
let result, target = e.target;
|
|
45938
46482
|
while(result === undefined && target && target !== j.editor){
|
|
45939
|
-
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);
|
|
45940
46484
|
target = target.parentElement;
|
|
45941
46485
|
}
|
|
45942
46486
|
if (e.type === 'click' && result === undefined && target === j.editor) {
|
|
@@ -45956,10 +46500,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
45956
46500
|
}
|
|
45957
46501
|
// Selecting the text of a popup input with the mouse and releasing
|
|
45958
46502
|
// the button past the popup's edge is not a click outside of it.
|
|
45959
|
-
if (pressed &&
|
|
46503
|
+
if (pressed && jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.UIElement.closestElement(pressed, jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.Popup)) {
|
|
45960
46504
|
return;
|
|
45961
46505
|
}
|
|
45962
|
-
const box =
|
|
46506
|
+
const box = jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.UIElement.closestElement(node, jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.Popup);
|
|
45963
46507
|
if (!box) {
|
|
45964
46508
|
this.j.e.fire('outsideClick', e);
|
|
45965
46509
|
}
|
|
@@ -46005,6 +46549,125 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
46005
46549
|
s.setCursorAfter(text);
|
|
46006
46550
|
}
|
|
46007
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
|
+
}
|
|
46008
46671
|
/**
|
|
46009
46672
|
* Keep pending inline formatting after a click. Toggling Bold/Italic/etc. on
|
|
46010
46673
|
* a collapsed cursor leaves empty marker elements with the caret inside; a
|
|
@@ -46066,7 +46729,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
46066
46729
|
* Where the last press started. Chrome reports a drag that begins in one
|
|
46067
46730
|
* element and ends in another as a `click` on their common ancestor, so a
|
|
46068
46731
|
* press inside a popup is remembered to tell such a drag from a real click.
|
|
46069
|
-
*/ (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);
|
|
46070
46736
|
}
|
|
46071
46737
|
}
|
|
46072
46738
|
;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
@@ -46096,6 +46762,18 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
46096
46762
|
':click'
|
|
46097
46763
|
])
|
|
46098
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);
|
|
46099
46777
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
46100
46778
|
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
|
|
46101
46779
|
':click'
|