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/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.3
4
+ * Version: v4.17.5
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.3";
1808
+ */ const APP_VERSION = "4.17.5";
1809
1809
  // prettier-ignore
1810
1810
  const ES = "es2015";
1811
1811
  const IS_ES_MODERN = true;
@@ -11013,6 +11013,20 @@ class Selection {
11013
11013
  }
11014
11014
  });
11015
11015
  }
11016
+ /**
11017
+ * How many ranges the browser's own selection holds right now, as opposed
11018
+ * to the composed view that [[sel]] may answer from.
11019
+ */ __nativeRangeCount() {
11020
+ var _ref;
11021
+ var _this_win_getSelection;
11022
+ const { shadowRoot } = this.j.o;
11023
+ if (shadowRoot && (0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_6__.isFunction)(shadowRoot.getSelection)) {
11024
+ var _ref1;
11025
+ var _shadowRoot_getSelection;
11026
+ return (_ref1 = (_shadowRoot_getSelection = shadowRoot.getSelection()) === null || _shadowRoot_getSelection === void 0 ? void 0 : _shadowRoot_getSelection.rangeCount) !== null && _ref1 !== void 0 ? _ref1 : 0;
11027
+ }
11028
+ 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;
11029
+ }
11016
11030
  /**
11017
11031
  * Return first selected range or create new
11018
11032
  */ get range() {
@@ -11821,6 +11835,16 @@ class Selection {
11821
11835
  if (backward && ranges.length === 1) {
11822
11836
  const range = ranges[0];
11823
11837
  sel.setBaseAndExtent(range.endContainer, range.endOffset, range.startContainer, range.startOffset);
11838
+ } else if (ranges.length === 1 && !this.__nativeRangeCount() && (0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_6__.isFunction)(sel.setBaseAndExtent)) {
11839
+ // `addRange` is specified to ignore a range whose root is not
11840
+ // the document, which is every range inside a shadow tree.
11841
+ // Chrome's `ShadowRoot.getSelection()` takes them anyway, but
11842
+ // Safari has only the window selection, so after
11843
+ // `removeAllRanges` the caret is simply gone: a character was
11844
+ // deleted and nothing was left to type into. `setBaseAndExtent`
11845
+ // does accept nodes inside a shadow tree.
11846
+ const range = ranges[0];
11847
+ sel.setBaseAndExtent(range.startContainer, range.startOffset, range.endContainer, range.endOffset);
11824
11848
  }
11825
11849
  }
11826
11850
  /**
@@ -20947,6 +20971,16 @@ const DOCS_URL = 'https://xdsoft.net/jodit/docs/modules/file_browser.html';
20947
20971
  });
20948
20972
  return resp;
20949
20973
  }
20974
+ /**
20975
+ * Actions that only read from the connector. A newer request for one of them
20976
+ * makes the older one pointless, so it is aborted; every other action changes
20977
+ * server state and must be allowed to finish.
20978
+ */ const REPLACEABLE_ACTIONS = new Set([
20979
+ 'items',
20980
+ 'folder',
20981
+ 'permissions',
20982
+ 'getLocalFileByUrl'
20983
+ ]);
20950
20984
  class DataProvider {
20951
20985
  /**
20952
20986
  * Alias for options
@@ -20955,10 +20989,19 @@ class DataProvider {
20955
20989
  }
20956
20990
  get(name) {
20957
20991
  const instances = this.__ajaxInstances;
20958
- if (instances.has(name)) {
20959
- const ajax = instances.get(name);
20992
+ // A listing asked for again supersedes the one still loading, so the
20993
+ // earlier request is aborted. That must never happen to a request
20994
+ // that changes something on the server: aborting it does not undo it,
20995
+ // the caller just never hears the result. Removing several files at
20996
+ // once used to send one `fileRemove` per file and abort all but the
20997
+ // last, so only the last one was ever removed. Mutating requests get a
20998
+ // key of their own and run side by side.
20999
+ const replaceable = REPLACEABLE_ACTIONS.has(name);
21000
+ const key = replaceable ? name : `${name}#${++this.__requestSerial}`;
21001
+ if (replaceable && instances.has(key)) {
21002
+ const ajax = instances.get(key);
20960
21003
  ajax === null || ajax === void 0 ? void 0 : ajax.abort();
20961
- instances.delete(name);
21004
+ instances.delete(key);
20962
21005
  }
20963
21006
  const opts = (0,jodit_core_helpers_utils_config_proto__WEBPACK_IMPORTED_MODULE_11__.ConfigProto)(this.options[name] !== undefined ? this.options[name] : {}, (0,jodit_core_helpers_utils_config_proto__WEBPACK_IMPORTED_MODULE_11__.ConfigProto)({
20964
21007
  onProgress: this.progressHandler
@@ -20967,11 +21010,11 @@ class DataProvider {
20967
21010
  opts.data = opts.prepareData.call(this, opts.data);
20968
21011
  }
20969
21012
  const ajax = new jodit_core_request_ajax__WEBPACK_IMPORTED_MODULE_14__.Ajax(opts);
20970
- instances.set(name, ajax);
21013
+ instances.set(key, ajax);
20971
21014
  const promise = ajax.send();
20972
21015
  promise.finally(()=>{
20973
21016
  ajax.destruct();
20974
- instances.delete(name);
21017
+ instances.delete(key);
20975
21018
  this.progressHandler(100);
20976
21019
  }).catch(()=>null);
20977
21020
  return promise.then((resp)=>resp.json()).then((resp)=>{
@@ -21283,11 +21326,13 @@ class DataProvider {
21283
21326
  (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_1__._)(this, "options", void 0);
21284
21327
  (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_1__._)(this, "__currentPermissions", void 0);
21285
21328
  (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_1__._)(this, "__ajaxInstances", void 0);
21329
+ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_1__._)(this, "__requestSerial", void 0);
21286
21330
  (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_1__._)(this, "progressHandler", void 0);
21287
21331
  this.parent = parent;
21288
21332
  this.options = options;
21289
21333
  this.__currentPermissions = null;
21290
21334
  this.__ajaxInstances = new Map();
21335
+ this.__requestSerial = 0;
21291
21336
  this.progressHandler = (ignore)=>{};
21292
21337
  }
21293
21338
  }
@@ -42074,13 +42119,22 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
42074
42119
  j.e.fire(e.type + 'Editor', target, e);
42075
42120
  }
42076
42121
  }
42122
+ onOutsidePress(e) {
42123
+ this.__pressTarget = e.target;
42124
+ }
42077
42125
  /**
42078
42126
  * @event outsideClick(e) - when user clicked on the outside of editor
42079
42127
  */ onOutsideClick(e) {
42080
- const node = e.target;
42128
+ const node = e.target, pressed = this.__pressTarget;
42129
+ this.__pressTarget = null;
42081
42130
  if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.up(node, (elm)=>elm === this.j.editor)) {
42082
42131
  return;
42083
42132
  }
42133
+ // Selecting the text of a popup input with the mouse and releasing
42134
+ // the button past the popup's edge is not a click outside of it.
42135
+ if (pressed && jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.UIElement.closestElement(pressed, jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.Popup)) {
42136
+ return;
42137
+ }
42084
42138
  const box = jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.UIElement.closestElement(node, jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.Popup);
42085
42139
  if (!box) {
42086
42140
  this.j.e.fire('outsideClick', e);
@@ -42186,12 +42240,22 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
42186
42240
  'touchstart',
42187
42241
  'mouseup',
42188
42242
  'touchend'
42189
- ]);
42243
+ ]), /**
42244
+ * Where the last press started. Chrome reports a drag that begins in one
42245
+ * element and ends in another as a `click` on their common ancestor, so a
42246
+ * press inside a popup is remembered to tell such a drag from a real click.
42247
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__pressTarget", null);
42190
42248
  }
42191
42249
  }
42192
42250
  ;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
42193
42251
  jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
42194
42252
  ], select.prototype, "onStartSelection", null);
42253
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
42254
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
42255
+ 'ow:mousedown',
42256
+ 'ow:touchstart'
42257
+ ])
42258
+ ], select.prototype, "onOutsidePress", null);
42195
42259
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
42196
42260
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)('ow:click')
42197
42261
  ], select.prototype, "onOutsideClick", null);