jodit 4.17.3 → 4.17.5

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 (66) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +4 -4
  4. package/es2015/jodit.js +73 -9
  5. package/es2015/jodit.min.js +10 -10
  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 +4 -4
  13. package/es2018/jodit.min.js +4 -4
  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 +5 -5
  18. package/es2021/jodit.js +69 -9
  19. package/es2021/jodit.min.js +5 -5
  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 +5 -5
  28. package/es2021.en/jodit.js +69 -9
  29. package/es2021.en/jodit.min.js +5 -5
  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 +79 -9
  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/selection.d.ts +5 -0
  52. package/esm/core/selection/selection.js +25 -0
  53. package/esm/modules/file-browser/data-provider.d.ts +1 -0
  54. package/esm/modules/file-browser/data-provider.js +26 -5
  55. package/esm/plugins/select/select.d.ts +7 -0
  56. package/esm/plugins/select/select.js +19 -1
  57. package/package.json +1 -1
  58. package/types/core/selection/selection.d.ts +5 -0
  59. package/types/modules/file-browser/data-provider.d.ts +1 -0
  60. package/types/plugins/select/select.d.ts +7 -0
  61. package/.nvmrc +0 -1
  62. package/examples/build/es2015/jodit.min.css +0 -1
  63. package/examples/build/es2015/jodit.min.js +0 -10
  64. package/examples/build/es2015/plugins/debug/debug.min.js +0 -10
  65. package/examples/build/es2015/plugins/speech-recognize/speech-recognize.min.css +0 -1
  66. package/examples/build/es2015/plugins/speech-recognize/speech-recognize.min.js +0 -10
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.3
4
+ * Version: v4.17.5
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.3";
2132
+ var APP_VERSION = "4.17.5";
2133
2133
  // prettier-ignore
2134
2134
  var ES = "es5";
2135
2135
  var IS_ES_MODERN = false;
@@ -12464,6 +12464,23 @@ var Selection = /*#__PURE__*/ function() {
12464
12464
  });
12465
12465
  }
12466
12466
  },
12467
+ {
12468
+ key: "__nativeRangeCount",
12469
+ value: /**
12470
+ * How many ranges the browser's own selection holds right now, as opposed
12471
+ * to the composed view that [[sel]] may answer from.
12472
+ */ function __nativeRangeCount() {
12473
+ var _ref;
12474
+ var _this_win_getSelection;
12475
+ var shadowRoot = this.j.o.shadowRoot;
12476
+ if (shadowRoot && (0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_12__.isFunction)(shadowRoot.getSelection)) {
12477
+ var _ref1;
12478
+ var _shadowRoot_getSelection;
12479
+ return (_ref1 = (_shadowRoot_getSelection = shadowRoot.getSelection()) === null || _shadowRoot_getSelection === void 0 ? void 0 : _shadowRoot_getSelection.rangeCount) !== null && _ref1 !== void 0 ? _ref1 : 0;
12480
+ }
12481
+ return (_ref = (_this_win_getSelection = this.win.getSelection()) === null || _this_win_getSelection === void 0 ? void 0 : _this_win_getSelection.rangeCount) !== null && _ref !== void 0 ? _ref : 0;
12482
+ }
12483
+ },
12467
12484
  {
12468
12485
  key: "range",
12469
12486
  get: /**
@@ -13465,6 +13482,16 @@ var Selection = /*#__PURE__*/ function() {
13465
13482
  if (backward && ranges.length === 1) {
13466
13483
  var range = ranges[0];
13467
13484
  sel.setBaseAndExtent(range.endContainer, range.endOffset, range.startContainer, range.startOffset);
13485
+ } else if (ranges.length === 1 && !this.__nativeRangeCount() && (0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_12__.isFunction)(sel.setBaseAndExtent)) {
13486
+ // `addRange` is specified to ignore a range whose root is not
13487
+ // the document, which is every range inside a shadow tree.
13488
+ // Chrome's `ShadowRoot.getSelection()` takes them anyway, but
13489
+ // Safari has only the window selection, so after
13490
+ // `removeAllRanges` the caret is simply gone: a character was
13491
+ // deleted and nothing was left to type into. `setBaseAndExtent`
13492
+ // does accept nodes inside a shadow tree.
13493
+ var range1 = ranges[0];
13494
+ sel.setBaseAndExtent(range1.startContainer, range1.startOffset, range1.endContainer, range1.endOffset);
13468
13495
  }
13469
13496
  }
13470
13497
  /**
@@ -25164,6 +25191,16 @@ var DOCS_URL = 'https://xdsoft.net/jodit/docs/modules/file_browser.html';
25164
25191
  });
25165
25192
  return resp;
25166
25193
  }
25194
+ /**
25195
+ * Actions that only read from the connector. A newer request for one of them
25196
+ * makes the older one pointless, so it is aborted; every other action changes
25197
+ * server state and must be allowed to finish.
25198
+ */ var REPLACEABLE_ACTIONS = new Set([
25199
+ 'items',
25200
+ 'folder',
25201
+ 'permissions',
25202
+ 'getLocalFileByUrl'
25203
+ ]);
25167
25204
  var DataProvider = /*#__PURE__*/ function() {
25168
25205
  "use strict";
25169
25206
  function DataProvider(parent, options) {
@@ -25172,11 +25209,13 @@ var DataProvider = /*#__PURE__*/ function() {
25172
25209
  (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(this, "options", void 0);
25173
25210
  (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(this, "__currentPermissions", void 0);
25174
25211
  (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(this, "__ajaxInstances", void 0);
25212
+ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(this, "__requestSerial", void 0);
25175
25213
  (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(this, "progressHandler", void 0);
25176
25214
  this.parent = parent;
25177
25215
  this.options = options;
25178
25216
  this.__currentPermissions = null;
25179
25217
  this.__ajaxInstances = new Map();
25218
+ this.__requestSerial = 0;
25180
25219
  this.progressHandler = function(ignore) {};
25181
25220
  }
25182
25221
  ;(0,_swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_2__._)(DataProvider, [
@@ -25193,10 +25232,19 @@ var DataProvider = /*#__PURE__*/ function() {
25193
25232
  value: function get(name) {
25194
25233
  var _this = this;
25195
25234
  var instances = this.__ajaxInstances;
25196
- if (instances.has(name)) {
25197
- var ajax = instances.get(name);
25235
+ // A listing asked for again supersedes the one still loading, so the
25236
+ // earlier request is aborted. That must never happen to a request
25237
+ // that changes something on the server: aborting it does not undo it,
25238
+ // the caller just never hears the result. Removing several files at
25239
+ // once used to send one `fileRemove` per file and abort all but the
25240
+ // last, so only the last one was ever removed. Mutating requests get a
25241
+ // key of their own and run side by side.
25242
+ var replaceable = REPLACEABLE_ACTIONS.has(name);
25243
+ var key = replaceable ? name : "".concat(name, "#").concat(++this.__requestSerial);
25244
+ if (replaceable && instances.has(key)) {
25245
+ var ajax = instances.get(key);
25198
25246
  ajax === null || ajax === void 0 ? void 0 : ajax.abort();
25199
- instances.delete(name);
25247
+ instances.delete(key);
25200
25248
  }
25201
25249
  var opts = (0,jodit_core_helpers_utils_config_proto__WEBPACK_IMPORTED_MODULE_15__.ConfigProto)(this.options[name] !== undefined ? this.options[name] : {}, (0,jodit_core_helpers_utils_config_proto__WEBPACK_IMPORTED_MODULE_15__.ConfigProto)({
25202
25250
  onProgress: this.progressHandler
@@ -25205,11 +25253,11 @@ var DataProvider = /*#__PURE__*/ function() {
25205
25253
  opts.data = opts.prepareData.call(this, opts.data);
25206
25254
  }
25207
25255
  var ajax1 = new jodit_core_request_ajax__WEBPACK_IMPORTED_MODULE_18__.Ajax(opts);
25208
- instances.set(name, ajax1);
25256
+ instances.set(key, ajax1);
25209
25257
  var promise = ajax1.send();
25210
25258
  promise.finally(function() {
25211
25259
  ajax1.destruct();
25212
- instances.delete(name);
25260
+ instances.delete(key);
25213
25261
  _this.progressHandler(100);
25214
25262
  }).catch(function() {
25215
25263
  return null;
@@ -49769,7 +49817,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
49769
49817
  'touchstart',
49770
49818
  'mouseup',
49771
49819
  'touchend'
49772
- ]);
49820
+ ]), /**
49821
+ * Where the last press started. Chrome reports a drag that begins in one
49822
+ * element and ends in another as a `click` on their common ancestor, so a
49823
+ * press inside a popup is remembered to tell such a drag from a real click.
49824
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "__pressTarget", null);
49773
49825
  return _this;
49774
49826
  }
49775
49827
  ;(0,_swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_2__._)(select, [
@@ -49805,18 +49857,30 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
49805
49857
  }
49806
49858
  }
49807
49859
  },
49860
+ {
49861
+ key: "onOutsidePress",
49862
+ value: function onOutsidePress(e) {
49863
+ this.__pressTarget = e.target;
49864
+ }
49865
+ },
49808
49866
  {
49809
49867
  key: "onOutsideClick",
49810
49868
  value: /**
49811
49869
  * @event outsideClick(e) - when user clicked on the outside of editor
49812
49870
  */ function onOutsideClick(e) {
49813
49871
  var _this = this;
49814
- var node = e.target;
49872
+ var node = e.target, pressed = this.__pressTarget;
49873
+ this.__pressTarget = null;
49815
49874
  if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.up(node, function(elm) {
49816
49875
  return elm === _this.j.editor;
49817
49876
  })) {
49818
49877
  return;
49819
49878
  }
49879
+ // Selecting the text of a popup input with the mouse and releasing
49880
+ // the button past the popup's edge is not a click outside of it.
49881
+ if (pressed && jodit_core_ui__WEBPACK_IMPORTED_MODULE_13__.UIElement.closestElement(pressed, jodit_core_ui__WEBPACK_IMPORTED_MODULE_13__.Popup)) {
49882
+ return;
49883
+ }
49820
49884
  var box = jodit_core_ui__WEBPACK_IMPORTED_MODULE_13__.UIElement.closestElement(node, jodit_core_ui__WEBPACK_IMPORTED_MODULE_13__.Popup);
49821
49885
  if (!box) {
49822
49886
  this.j.e.fire('outsideClick', e);
@@ -49942,6 +50006,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
49942
50006
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
49943
50007
  jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__.autobind
49944
50008
  ], select.prototype, "onStartSelection", null);
50009
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
50010
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__.watch)([
50011
+ 'ow:mousedown',
50012
+ 'ow:touchstart'
50013
+ ])
50014
+ ], select.prototype, "onOutsidePress", null);
49945
50015
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
49946
50016
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__.watch)('ow:click')
49947
50017
  ], select.prototype, "onOutsideClick", null);
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.3
4
+ * Version: v4.17.5
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.3
11
+ * Version: v4.17.5
12
12
  * Url: https://xdsoft.net/jodit/
13
13
  * License(s): MIT
14
14
  */