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.
Files changed (60) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +2 -2
  4. package/es2015/jodit.js +150 -7
  5. package/es2015/jodit.min.js +2 -2
  6. package/es2015/plugins/debug/debug.css +1 -1
  7. package/es2015/plugins/debug/debug.js +1 -1
  8. package/es2015/plugins/debug/debug.min.js +1 -1
  9. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  10. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  12. package/es2018/jodit.fat.min.js +2 -2
  13. package/es2018/jodit.min.js +2 -2
  14. package/es2018/plugins/debug/debug.min.js +1 -1
  15. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  16. package/es2021/jodit.css +1 -1
  17. package/es2021/jodit.fat.min.js +3 -3
  18. package/es2021/jodit.js +150 -7
  19. package/es2021/jodit.min.js +3 -3
  20. package/es2021/plugins/debug/debug.css +1 -1
  21. package/es2021/plugins/debug/debug.js +1 -1
  22. package/es2021/plugins/debug/debug.min.js +1 -1
  23. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  24. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  25. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  26. package/es2021.en/jodit.css +1 -1
  27. package/es2021.en/jodit.fat.min.js +24 -24
  28. package/es2021.en/jodit.js +150 -7
  29. package/es2021.en/jodit.min.js +3 -3
  30. package/es2021.en/plugins/debug/debug.css +1 -1
  31. package/es2021.en/plugins/debug/debug.js +1 -1
  32. package/es2021.en/plugins/debug/debug.min.js +1 -1
  33. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  34. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  35. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  36. package/es5/jodit.css +2 -2
  37. package/es5/jodit.fat.min.js +2 -2
  38. package/es5/jodit.js +165 -7
  39. package/es5/jodit.min.css +2 -2
  40. package/es5/jodit.min.js +2 -2
  41. package/es5/plugins/debug/debug.css +1 -1
  42. package/es5/plugins/debug/debug.js +1 -1
  43. package/es5/plugins/debug/debug.min.js +1 -1
  44. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  45. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  46. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  47. package/es5/polyfills.fat.min.js +1 -1
  48. package/es5/polyfills.js +1 -1
  49. package/es5/polyfills.min.js +1 -1
  50. package/esm/core/constants.js +1 -1
  51. package/esm/core/selection/helpers/composed-ranges.d.ts +21 -0
  52. package/esm/core/selection/helpers/composed-ranges.js +45 -0
  53. package/esm/core/selection/helpers/index.d.ts +1 -0
  54. package/esm/core/selection/helpers/index.js +1 -0
  55. package/esm/core/selection/selection.d.ts +23 -0
  56. package/esm/core/selection/selection.js +80 -4
  57. package/package.json +1 -1
  58. package/types/core/selection/helpers/composed-ranges.d.ts +21 -0
  59. package/types/core/selection/helpers/index.d.ts +1 -0
  60. package/types/core/selection/selection.d.ts +23 -0
package/es5/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.1
4
+ * Version: v4.17.2
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -2129,7 +2129,7 @@ __webpack_require__.r(__webpack_exports__);
2129
2129
  * @packageDocumentation
2130
2130
  * @module constants
2131
2131
  */
2132
- var APP_VERSION = "4.17.1";
2132
+ var APP_VERSION = "4.17.2";
2133
2133
  // prettier-ignore
2134
2134
  var ES = "es5";
2135
2135
  var IS_ES_MODERN = false;
@@ -11970,6 +11970,73 @@ var Response = /*#__PURE__*/ function() {
11970
11970
  }();
11971
11971
 
11972
11972
 
11973
+ /***/ }),
11974
+
11975
+ /***/ 43134:
11976
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
11977
+
11978
+ "use strict";
11979
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
11980
+ /* harmony export */ composedRanges: function() { return /* binding */ composedRanges; }
11981
+ /* harmony export */ });
11982
+ /* harmony import */ var jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(28686);
11983
+ /*!
11984
+ * Jodit Editor (https://xdsoft.net/jodit/)
11985
+ * Released under MIT see LICENSE.txt in the project root for license information.
11986
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
11987
+ */ /**
11988
+ * @module selection
11989
+ */
11990
+ function isInside(node, shadowRoot) {
11991
+ return node === shadowRoot || shadowRoot.contains(node);
11992
+ }
11993
+ function usable(ranges, shadowRoot) {
11994
+ return Array.isArray(ranges) && ranges.length > 0 && ranges.every(function(range) {
11995
+ return isInside(range.startContainer, shadowRoot);
11996
+ });
11997
+ }
11998
+ /**
11999
+ * Ranges of a selection that lies inside the given shadow tree.
12000
+ *
12001
+ * `window.getSelection()` stops at the shadow boundary and reports the host
12002
+ * instead of the node the caret is really in. `getComposedRanges` is the
12003
+ * standard way to ask past that boundary.
12004
+ *
12005
+ * @returns `null` when the browser has no `getComposedRanges`, or when neither
12006
+ * call shape returned ranges that point inside the shadow tree — in which case
12007
+ * there is nothing better to offer than the plain window selection.
12008
+ */ function composedRanges(selection, shadowRoot) {
12009
+ var getComposedRanges = selection.getComposedRanges;
12010
+ if (!(0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_0__.isFunction)(getComposedRanges)) {
12011
+ return null;
12012
+ }
12013
+ for(var _i = 0, _iter = [
12014
+ [
12015
+ {
12016
+ shadowRoots: [
12017
+ shadowRoot
12018
+ ]
12019
+ }
12020
+ ],
12021
+ [
12022
+ shadowRoot
12023
+ ]
12024
+ ]; _i < _iter.length; _i++){
12025
+ var args = _iter[_i];
12026
+ var ranges = void 0;
12027
+ try {
12028
+ ranges = getComposedRanges.apply(selection, args);
12029
+ } catch (unused) {
12030
+ continue;
12031
+ }
12032
+ if (usable(ranges, shadowRoot)) {
12033
+ return ranges;
12034
+ }
12035
+ }
12036
+ return null;
12037
+ }
12038
+
12039
+
11973
12040
  /***/ }),
11974
12041
 
11975
12042
  /***/ 42259:
@@ -11977,14 +12044,16 @@ var Response = /*#__PURE__*/ function() {
11977
12044
 
11978
12045
  "use strict";
11979
12046
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
12047
+ /* harmony export */ composedRanges: function() { return /* reexport safe */ _composed_ranges__WEBPACK_IMPORTED_MODULE_2__.composedRanges; },
11980
12048
  /* harmony export */ cursorInTheEdgeOfString: function() { return /* binding */ cursorInTheEdgeOfString; },
11981
12049
  /* harmony export */ findCorrectCurrentNode: function() { return /* binding */ findCorrectCurrentNode; },
11982
- /* harmony export */ moveNodeInsideStart: function() { return /* reexport safe */ _move_node_inside_start__WEBPACK_IMPORTED_MODULE_2__.moveNodeInsideStart; }
12050
+ /* harmony export */ moveNodeInsideStart: function() { return /* reexport safe */ _move_node_inside_start__WEBPACK_IMPORTED_MODULE_3__.moveNodeInsideStart; }
11983
12051
  /* harmony export */ });
11984
12052
  /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81937);
11985
12053
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(23211);
11986
- /* harmony import */ var _move_node_inside_start__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(89817);
11987
- /* harmony import */ var _move_the_node_along_the_edge_outward__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7470);
12054
+ /* harmony import */ var _composed_ranges__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(43134);
12055
+ /* harmony import */ var _move_node_inside_start__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(89817);
12056
+ /* harmony import */ var _move_the_node_along_the_edge_outward__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7470);
11988
12057
  /*!
11989
12058
  * Jodit Editor (https://xdsoft.net/jodit/)
11990
12059
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -11995,6 +12064,7 @@ var Response = /*#__PURE__*/ function() {
11995
12064
 
11996
12065
 
11997
12066
 
12067
+
11998
12068
  /**
11999
12069
  * Despite the name, returns `true` when the cursor is NOT at the checked edge
12000
12070
  * of the text node: there is significant (non invisible-space) text between
@@ -12268,12 +12338,100 @@ var Selection = /*#__PURE__*/ function() {
12268
12338
  get: /**
12269
12339
  * Return current selection object
12270
12340
  */ function get() {
12271
- if (this.j.o.shadowRoot && (0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_12__.isFunction)(this.j.o.shadowRoot.getSelection)) {
12272
- return this.j.o.shadowRoot.getSelection();
12341
+ var shadowRoot = this.j.o.shadowRoot;
12342
+ if (shadowRoot) {
12343
+ if ((0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_12__.isFunction)(shadowRoot.getSelection)) {
12344
+ return shadowRoot.getSelection();
12345
+ }
12346
+ var composed = this.__composedSelection(shadowRoot);
12347
+ if (composed) {
12348
+ return composed;
12349
+ }
12273
12350
  }
12274
12351
  return this.win.getSelection();
12275
12352
  }
12276
12353
  },
12354
+ {
12355
+ key: "__composedSelection",
12356
+ value: /**
12357
+ * Selection of a shadow tree in a browser without `ShadowRoot.getSelection`.
12358
+ *
12359
+ * `ShadowRoot.getSelection()` is a non-standard method that WebKit never
12360
+ * implemented, and `window.getSelection()` stops at the shadow boundary: for
12361
+ * a caret inside the shadow tree it reports the host, or the document
12362
+ * itself. Everything downstream then works on the wrong tree, which is why
12363
+ * Backspace used to throw `HierarchyRequestError` and Enter did nothing when
12364
+ * the editor lived in a shadow root in Safari.
12365
+ *
12366
+ * The standard replacement is `Selection.getComposedRanges()`, which does
12367
+ * reach into a shadow tree it is given. It hands back `StaticRange`s, and
12368
+ * the editor mutates ranges constantly, so they are turned into live ones.
12369
+ *
12370
+ * Reads are answered from those ranges; everything else, including the
12371
+ * writes (`addRange`, `removeAllRanges`, `setBaseAndExtent`), goes to the
12372
+ * real selection, which does accept nodes inside a shadow tree. Reading is
12373
+ * the only side the browser blocks.
12374
+ *
12375
+ * @returns `null` when the browser offers neither API, so the caller falls
12376
+ * back to the plain window selection.
12377
+ */ function __composedSelection(shadowRoot) {
12378
+ var _this = this;
12379
+ var selection = this.win.getSelection();
12380
+ if (!selection) {
12381
+ return null;
12382
+ }
12383
+ // Firefox has no `ShadowRoot.getSelection` either, but its window
12384
+ // selection does see into a shadow tree. Where the plain selection
12385
+ // already points at the right node there is nothing to work around, and
12386
+ // taking it over would change behaviour that works today.
12387
+ var anchorNode = selection.anchorNode;
12388
+ if (anchorNode && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.isOrContains(shadowRoot, anchorNode)) {
12389
+ return null;
12390
+ }
12391
+ var ranges = (0,_helpers__WEBPACK_IMPORTED_MODULE_17__.composedRanges)(selection, shadowRoot);
12392
+ if (!ranges) {
12393
+ return null;
12394
+ }
12395
+ var live = ranges.map(function(staticRange) {
12396
+ var range = _this.createRange();
12397
+ range.setStart(staticRange.startContainer, staticRange.startOffset);
12398
+ range.setEnd(staticRange.endContainer, staticRange.endOffset);
12399
+ return range;
12400
+ });
12401
+ var first = live[0];
12402
+ var overrides = {
12403
+ rangeCount: live.length,
12404
+ getRangeAt: function getRangeAt(index) {
12405
+ return live[index];
12406
+ },
12407
+ isCollapsed: live.every(function(range) {
12408
+ return range.collapsed;
12409
+ }),
12410
+ // Without these the editor asks the window selection where the
12411
+ // caret is, is told "outside the editable area", and resets the
12412
+ // caret to the start of it — which is the focus loss that shows up
12413
+ // right after a successful Backspace.
12414
+ anchorNode: first ? first.startContainer : null,
12415
+ anchorOffset: first ? first.startOffset : 0,
12416
+ focusNode: first ? first.endContainer : null,
12417
+ focusOffset: first ? first.endOffset : 0,
12418
+ toString: function toString() {
12419
+ return live.map(function(range) {
12420
+ return range.toString();
12421
+ }).join('');
12422
+ }
12423
+ };
12424
+ return new Proxy(selection, {
12425
+ get: function get(target, property) {
12426
+ if ((0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_12__.isString)(property) && property in overrides) {
12427
+ return overrides[property];
12428
+ }
12429
+ var value = Reflect.get(target, property, target);
12430
+ return (0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_12__.isFunction)(value) ? value.bind(target) : value;
12431
+ }
12432
+ });
12433
+ }
12434
+ },
12277
12435
  {
12278
12436
  key: "range",
12279
12437
  get: /**
package/es5/jodit.min.css CHANGED
@@ -1,14 +1,14 @@
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.1
4
+ * Version: v4.17.2
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
8
8
  /*!
9
9
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
10
10
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
11
- * Version: v4.17.1
11
+ * Version: v4.17.2
12
12
  * Url: https://xdsoft.net/jodit/
13
13
  * License(s): MIT
14
14
  */