jodit 4.17.1 → 4.17.2
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 +6 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +2 -2
- package/es2015/jodit.js +150 -7
- package/es2015/jodit.min.js +2 -2
- 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 +2 -2
- package/es2018/jodit.min.js +2 -2
- 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 +3 -3
- package/es2021/jodit.js +150 -7
- package/es2021/jodit.min.js +3 -3
- 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 +24 -24
- package/es2021.en/jodit.js +150 -7
- package/es2021.en/jodit.min.js +3 -3
- 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 +165 -7
- package/es5/jodit.min.css +2 -2
- package/es5/jodit.min.js +2 -2
- package/es5/plugins/debug/debug.css +1 -1
- package/es5/plugins/debug/debug.js +1 -1
- package/es5/plugins/debug/debug.min.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es5/polyfills.fat.min.js +1 -1
- package/es5/polyfills.js +1 -1
- package/es5/polyfills.min.js +1 -1
- package/esm/core/constants.js +1 -1
- package/esm/core/selection/helpers/composed-ranges.d.ts +21 -0
- package/esm/core/selection/helpers/composed-ranges.js +45 -0
- package/esm/core/selection/helpers/index.d.ts +1 -0
- package/esm/core/selection/helpers/index.js +1 -0
- package/esm/core/selection/selection.d.ts +23 -0
- package/esm/core/selection/selection.js +80 -4
- package/package.json +1 -1
- package/types/core/selection/helpers/composed-ranges.d.ts +21 -0
- package/types/core/selection/helpers/index.d.ts +1 -0
- package/types/core/selection/selection.d.ts +23 -0
package/es2015/jodit.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
|
|
3
3
|
* Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
|
|
4
|
-
* Version: v4.17.
|
|
4
|
+
* Version: v4.17.2
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
@@ -1805,7 +1805,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1805
1805
|
* ```
|
|
1806
1806
|
* @packageDocumentation
|
|
1807
1807
|
* @module constants
|
|
1808
|
-
*/ const APP_VERSION = "4.17.
|
|
1808
|
+
*/ const APP_VERSION = "4.17.2";
|
|
1809
1809
|
// prettier-ignore
|
|
1810
1810
|
const ES = "es2015";
|
|
1811
1811
|
const IS_ES_MODERN = true;
|
|
@@ -10596,6 +10596,70 @@ class Response {
|
|
|
10596
10596
|
}
|
|
10597
10597
|
|
|
10598
10598
|
|
|
10599
|
+
/***/ }),
|
|
10600
|
+
|
|
10601
|
+
/***/ 43134:
|
|
10602
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
10603
|
+
|
|
10604
|
+
"use strict";
|
|
10605
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10606
|
+
/* harmony export */ composedRanges: function() { return /* binding */ composedRanges; }
|
|
10607
|
+
/* harmony export */ });
|
|
10608
|
+
/* harmony import */ var jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(28686);
|
|
10609
|
+
/*!
|
|
10610
|
+
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
10611
|
+
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
10612
|
+
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
10613
|
+
*/ /**
|
|
10614
|
+
* @module selection
|
|
10615
|
+
*/
|
|
10616
|
+
function isInside(node, shadowRoot) {
|
|
10617
|
+
return node === shadowRoot || shadowRoot.contains(node);
|
|
10618
|
+
}
|
|
10619
|
+
function usable(ranges, shadowRoot) {
|
|
10620
|
+
return Array.isArray(ranges) && ranges.length > 0 && ranges.every((range)=>isInside(range.startContainer, shadowRoot));
|
|
10621
|
+
}
|
|
10622
|
+
/**
|
|
10623
|
+
* Ranges of a selection that lies inside the given shadow tree.
|
|
10624
|
+
*
|
|
10625
|
+
* `window.getSelection()` stops at the shadow boundary and reports the host
|
|
10626
|
+
* instead of the node the caret is really in. `getComposedRanges` is the
|
|
10627
|
+
* standard way to ask past that boundary.
|
|
10628
|
+
*
|
|
10629
|
+
* @returns `null` when the browser has no `getComposedRanges`, or when neither
|
|
10630
|
+
* call shape returned ranges that point inside the shadow tree — in which case
|
|
10631
|
+
* there is nothing better to offer than the plain window selection.
|
|
10632
|
+
*/ function composedRanges(selection, shadowRoot) {
|
|
10633
|
+
const getComposedRanges = selection.getComposedRanges;
|
|
10634
|
+
if (!(0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_0__.isFunction)(getComposedRanges)) {
|
|
10635
|
+
return null;
|
|
10636
|
+
}
|
|
10637
|
+
for (const args of [
|
|
10638
|
+
[
|
|
10639
|
+
{
|
|
10640
|
+
shadowRoots: [
|
|
10641
|
+
shadowRoot
|
|
10642
|
+
]
|
|
10643
|
+
}
|
|
10644
|
+
],
|
|
10645
|
+
[
|
|
10646
|
+
shadowRoot
|
|
10647
|
+
]
|
|
10648
|
+
]){
|
|
10649
|
+
let ranges;
|
|
10650
|
+
try {
|
|
10651
|
+
ranges = getComposedRanges.apply(selection, args);
|
|
10652
|
+
} catch (unused) {
|
|
10653
|
+
continue;
|
|
10654
|
+
}
|
|
10655
|
+
if (usable(ranges, shadowRoot)) {
|
|
10656
|
+
return ranges;
|
|
10657
|
+
}
|
|
10658
|
+
}
|
|
10659
|
+
return null;
|
|
10660
|
+
}
|
|
10661
|
+
|
|
10662
|
+
|
|
10599
10663
|
/***/ }),
|
|
10600
10664
|
|
|
10601
10665
|
/***/ 42259:
|
|
@@ -10603,14 +10667,16 @@ class Response {
|
|
|
10603
10667
|
|
|
10604
10668
|
"use strict";
|
|
10605
10669
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10670
|
+
/* harmony export */ composedRanges: function() { return /* reexport safe */ _composed_ranges__WEBPACK_IMPORTED_MODULE_2__.composedRanges; },
|
|
10606
10671
|
/* harmony export */ cursorInTheEdgeOfString: function() { return /* binding */ cursorInTheEdgeOfString; },
|
|
10607
10672
|
/* harmony export */ findCorrectCurrentNode: function() { return /* binding */ findCorrectCurrentNode; },
|
|
10608
|
-
/* harmony export */ moveNodeInsideStart: function() { return /* reexport safe */
|
|
10673
|
+
/* harmony export */ moveNodeInsideStart: function() { return /* reexport safe */ _move_node_inside_start__WEBPACK_IMPORTED_MODULE_3__.moveNodeInsideStart; }
|
|
10609
10674
|
/* harmony export */ });
|
|
10610
10675
|
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81937);
|
|
10611
10676
|
/* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(23211);
|
|
10612
|
-
/* harmony import */ var
|
|
10613
|
-
/* harmony import */ var
|
|
10677
|
+
/* harmony import */ var _composed_ranges__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(43134);
|
|
10678
|
+
/* harmony import */ var _move_node_inside_start__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(89817);
|
|
10679
|
+
/* harmony import */ var _move_the_node_along_the_edge_outward__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7470);
|
|
10614
10680
|
/*!
|
|
10615
10681
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
10616
10682
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -10621,6 +10687,7 @@ class Response {
|
|
|
10621
10687
|
|
|
10622
10688
|
|
|
10623
10689
|
|
|
10690
|
+
|
|
10624
10691
|
/**
|
|
10625
10692
|
* Despite the name, returns `true` when the cursor is NOT at the checked edge
|
|
10626
10693
|
* of the text node: there is significant (non invisible-space) text between
|
|
@@ -10850,11 +10917,87 @@ class Selection {
|
|
|
10850
10917
|
/**
|
|
10851
10918
|
* Return current selection object
|
|
10852
10919
|
*/ get sel() {
|
|
10853
|
-
|
|
10854
|
-
|
|
10920
|
+
const { shadowRoot } = this.j.o;
|
|
10921
|
+
if (shadowRoot) {
|
|
10922
|
+
if ((0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_6__.isFunction)(shadowRoot.getSelection)) {
|
|
10923
|
+
return shadowRoot.getSelection();
|
|
10924
|
+
}
|
|
10925
|
+
const composed = this.__composedSelection(shadowRoot);
|
|
10926
|
+
if (composed) {
|
|
10927
|
+
return composed;
|
|
10928
|
+
}
|
|
10855
10929
|
}
|
|
10856
10930
|
return this.win.getSelection();
|
|
10857
10931
|
}
|
|
10932
|
+
/**
|
|
10933
|
+
* Selection of a shadow tree in a browser without `ShadowRoot.getSelection`.
|
|
10934
|
+
*
|
|
10935
|
+
* `ShadowRoot.getSelection()` is a non-standard method that WebKit never
|
|
10936
|
+
* implemented, and `window.getSelection()` stops at the shadow boundary: for
|
|
10937
|
+
* a caret inside the shadow tree it reports the host, or the document
|
|
10938
|
+
* itself. Everything downstream then works on the wrong tree, which is why
|
|
10939
|
+
* Backspace used to throw `HierarchyRequestError` and Enter did nothing when
|
|
10940
|
+
* the editor lived in a shadow root in Safari.
|
|
10941
|
+
*
|
|
10942
|
+
* The standard replacement is `Selection.getComposedRanges()`, which does
|
|
10943
|
+
* reach into a shadow tree it is given. It hands back `StaticRange`s, and
|
|
10944
|
+
* the editor mutates ranges constantly, so they are turned into live ones.
|
|
10945
|
+
*
|
|
10946
|
+
* Reads are answered from those ranges; everything else, including the
|
|
10947
|
+
* writes (`addRange`, `removeAllRanges`, `setBaseAndExtent`), goes to the
|
|
10948
|
+
* real selection, which does accept nodes inside a shadow tree. Reading is
|
|
10949
|
+
* the only side the browser blocks.
|
|
10950
|
+
*
|
|
10951
|
+
* @returns `null` when the browser offers neither API, so the caller falls
|
|
10952
|
+
* back to the plain window selection.
|
|
10953
|
+
*/ __composedSelection(shadowRoot) {
|
|
10954
|
+
const selection = this.win.getSelection();
|
|
10955
|
+
if (!selection) {
|
|
10956
|
+
return null;
|
|
10957
|
+
}
|
|
10958
|
+
// Firefox has no `ShadowRoot.getSelection` either, but its window
|
|
10959
|
+
// selection does see into a shadow tree. Where the plain selection
|
|
10960
|
+
// already points at the right node there is nothing to work around, and
|
|
10961
|
+
// taking it over would change behaviour that works today.
|
|
10962
|
+
const { anchorNode } = selection;
|
|
10963
|
+
if (anchorNode && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(shadowRoot, anchorNode)) {
|
|
10964
|
+
return null;
|
|
10965
|
+
}
|
|
10966
|
+
const ranges = (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.composedRanges)(selection, shadowRoot);
|
|
10967
|
+
if (!ranges) {
|
|
10968
|
+
return null;
|
|
10969
|
+
}
|
|
10970
|
+
const live = ranges.map((staticRange)=>{
|
|
10971
|
+
const range = this.createRange();
|
|
10972
|
+
range.setStart(staticRange.startContainer, staticRange.startOffset);
|
|
10973
|
+
range.setEnd(staticRange.endContainer, staticRange.endOffset);
|
|
10974
|
+
return range;
|
|
10975
|
+
});
|
|
10976
|
+
const first = live[0];
|
|
10977
|
+
const overrides = {
|
|
10978
|
+
rangeCount: live.length,
|
|
10979
|
+
getRangeAt: (index)=>live[index],
|
|
10980
|
+
isCollapsed: live.every((range)=>range.collapsed),
|
|
10981
|
+
// Without these the editor asks the window selection where the
|
|
10982
|
+
// caret is, is told "outside the editable area", and resets the
|
|
10983
|
+
// caret to the start of it — which is the focus loss that shows up
|
|
10984
|
+
// right after a successful Backspace.
|
|
10985
|
+
anchorNode: first ? first.startContainer : null,
|
|
10986
|
+
anchorOffset: first ? first.startOffset : 0,
|
|
10987
|
+
focusNode: first ? first.endContainer : null,
|
|
10988
|
+
focusOffset: first ? first.endOffset : 0,
|
|
10989
|
+
toString: ()=>live.map((range)=>range.toString()).join('')
|
|
10990
|
+
};
|
|
10991
|
+
return new Proxy(selection, {
|
|
10992
|
+
get (target, property) {
|
|
10993
|
+
if ((0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_6__.isString)(property) && property in overrides) {
|
|
10994
|
+
return overrides[property];
|
|
10995
|
+
}
|
|
10996
|
+
const value = Reflect.get(target, property, target);
|
|
10997
|
+
return (0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_6__.isFunction)(value) ? value.bind(target) : value;
|
|
10998
|
+
}
|
|
10999
|
+
});
|
|
11000
|
+
}
|
|
10858
11001
|
/**
|
|
10859
11002
|
* Return first selected range or create new
|
|
10860
11003
|
*/ get range() {
|