jodit 4.17.2 → 4.17.4

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 (59) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +5 -5
  4. package/es2015/jodit.js +60 -7
  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 +5 -5
  13. package/es2018/jodit.min.js +5 -5
  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 +6 -6
  18. package/es2021/jodit.js +60 -7
  19. package/es2021/jodit.min.js +6 -6
  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 +6 -6
  28. package/es2021.en/jodit.js +60 -7
  29. package/es2021.en/jodit.min.js +6 -6
  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 +80 -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/helpers/html/safe-html.js +15 -0
  52. package/esm/jodit.js +5 -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/clean-html/clean-html.d.ts +8 -0
  56. package/esm/plugins/clean-html/clean-html.js +13 -0
  57. package/package.json +1 -1
  58. package/types/modules/file-browser/data-provider.d.ts +1 -0
  59. package/types/plugins/clean-html/clean-html.d.ts +8 -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.2
4
+ * Version: v4.17.4
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.2";
2132
+ var APP_VERSION = "4.17.4";
2133
2133
  // prettier-ignore
2134
2134
  var ES = "es5";
2135
2135
  var IS_ES_MODERN = false;
@@ -7161,6 +7161,38 @@ function isSmuggledForeignHtml(elm) {
7161
7161
  }
7162
7162
  }
7163
7163
  }
7164
+ // `<noscript>` is parsed as markup in a document with scripting off (the
7165
+ // inert document the value is sanitized in) and as raw text in one with
7166
+ // scripting on (the live editor). The same serialized bytes therefore
7167
+ // describe two different trees, and markup hidden as inert text in the
7168
+ // first comes alive as elements in the second. The element has no use in
7169
+ // editor content, so it goes, together with everything it carried.
7170
+ var noscript = [];
7171
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.each(box, function(node) {
7172
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isElement(node) && node.nodeName === 'NOSCRIPT') {
7173
+ noscript.push(node);
7174
+ }
7175
+ });
7176
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
7177
+ try {
7178
+ for(var _iterator1 = noscript[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
7179
+ var elm1 = _step1.value;
7180
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.safeRemove(elm1);
7181
+ }
7182
+ } catch (err) {
7183
+ _didIteratorError1 = true;
7184
+ _iteratorError1 = err;
7185
+ } finally{
7186
+ try {
7187
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
7188
+ _iterator1.return();
7189
+ }
7190
+ } finally{
7191
+ if (_didIteratorError1) {
7192
+ throw _iteratorError1;
7193
+ }
7194
+ }
7195
+ }
7164
7196
  var removeEvents = (_options_removeEventAttributes = options.removeEventAttributes) !== null && _options_removeEventAttributes !== void 0 ? _options_removeEventAttributes : options.removeOnError;
7165
7197
  // Single synchronous traversal of the subtree. Besides removing event
7166
7198
  // handlers and `javascript:` links, `sanitizeHTMLElement` neutralises
@@ -21907,6 +21939,11 @@ var Jodit = /*#__PURE__*/ function(ViewWithToolbar) {
21907
21939
  }
21908
21940
  if (this.editor) {
21909
21941
  this.editor.innerHTML = data.value;
21942
+ // Fired synchronously, before any task can run: the value was
21943
+ // sanitized in an inert document and re-parsed here with scripting
21944
+ // on, and the two parsers do not always agree. Listeners get to
21945
+ // look at the tree that actually exists.
21946
+ this.e.fire('afterSetNativeEditorValue');
21910
21947
  }
21911
21948
  }
21912
21949
  },
@@ -25127,6 +25164,16 @@ var DOCS_URL = 'https://xdsoft.net/jodit/docs/modules/file_browser.html';
25127
25164
  });
25128
25165
  return resp;
25129
25166
  }
25167
+ /**
25168
+ * Actions that only read from the connector. A newer request for one of them
25169
+ * makes the older one pointless, so it is aborted; every other action changes
25170
+ * server state and must be allowed to finish.
25171
+ */ var REPLACEABLE_ACTIONS = new Set([
25172
+ 'items',
25173
+ 'folder',
25174
+ 'permissions',
25175
+ 'getLocalFileByUrl'
25176
+ ]);
25130
25177
  var DataProvider = /*#__PURE__*/ function() {
25131
25178
  "use strict";
25132
25179
  function DataProvider(parent, options) {
@@ -25135,11 +25182,13 @@ var DataProvider = /*#__PURE__*/ function() {
25135
25182
  (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(this, "options", void 0);
25136
25183
  (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(this, "__currentPermissions", void 0);
25137
25184
  (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(this, "__ajaxInstances", void 0);
25185
+ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(this, "__requestSerial", void 0);
25138
25186
  (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(this, "progressHandler", void 0);
25139
25187
  this.parent = parent;
25140
25188
  this.options = options;
25141
25189
  this.__currentPermissions = null;
25142
25190
  this.__ajaxInstances = new Map();
25191
+ this.__requestSerial = 0;
25143
25192
  this.progressHandler = function(ignore) {};
25144
25193
  }
25145
25194
  ;(0,_swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_2__._)(DataProvider, [
@@ -25156,10 +25205,19 @@ var DataProvider = /*#__PURE__*/ function() {
25156
25205
  value: function get(name) {
25157
25206
  var _this = this;
25158
25207
  var instances = this.__ajaxInstances;
25159
- if (instances.has(name)) {
25160
- var ajax = instances.get(name);
25208
+ // A listing asked for again supersedes the one still loading, so the
25209
+ // earlier request is aborted. That must never happen to a request
25210
+ // that changes something on the server: aborting it does not undo it,
25211
+ // the caller just never hears the result. Removing several files at
25212
+ // once used to send one `fileRemove` per file and abort all but the
25213
+ // last, so only the last one was ever removed. Mutating requests get a
25214
+ // key of their own and run side by side.
25215
+ var replaceable = REPLACEABLE_ACTIONS.has(name);
25216
+ var key = replaceable ? name : "".concat(name, "#").concat(++this.__requestSerial);
25217
+ if (replaceable && instances.has(key)) {
25218
+ var ajax = instances.get(key);
25161
25219
  ajax === null || ajax === void 0 ? void 0 : ajax.abort();
25162
- instances.delete(name);
25220
+ instances.delete(key);
25163
25221
  }
25164
25222
  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)({
25165
25223
  onProgress: this.progressHandler
@@ -25168,11 +25226,11 @@ var DataProvider = /*#__PURE__*/ function() {
25168
25226
  opts.data = opts.prepareData.call(this, opts.data);
25169
25227
  }
25170
25228
  var ajax1 = new jodit_core_request_ajax__WEBPACK_IMPORTED_MODULE_18__.Ajax(opts);
25171
- instances.set(name, ajax1);
25229
+ instances.set(key, ajax1);
25172
25230
  var promise = ajax1.send();
25173
25231
  promise.finally(function() {
25174
25232
  ajax1.destruct();
25175
- instances.delete(name);
25233
+ instances.delete(key);
25176
25234
  _this.progressHandler(100);
25177
25235
  }).catch(function() {
25178
25236
  return null;
@@ -34607,6 +34665,18 @@ var cleanHtml = /*#__PURE__*/ function(Plugin) {
34607
34665
  }
34608
34666
  }
34609
34667
  },
34668
+ {
34669
+ key: "onAfterSetNativeEditorValue",
34670
+ value: /**
34671
+ * The value was sanitized in an inert document and has just been re-parsed
34672
+ * into the live editor with scripting on. Where the two parsers disagree
34673
+ * (`<noscript>`, raw-text elements), markup that was inert text a moment
34674
+ * ago is a real element now, so the live tree is sanitized once more, in
34675
+ * the same call stack, before any handler it might carry can fire.
34676
+ */ function onAfterSetNativeEditorValue() {
34677
+ ;(0,jodit_core_helpers_html_safe_html__WEBPACK_IMPORTED_MODULE_13__.safeHTML)(this.j.editor, this.j.o.cleanHTML);
34678
+ }
34679
+ },
34610
34680
  {
34611
34681
  key: "onBeforeSetNativeEditorValue",
34612
34682
  value: /**
@@ -34744,6 +34814,9 @@ var cleanHtml = /*#__PURE__*/ function(Plugin) {
34744
34814
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_7__.__decorate)([
34745
34815
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_9__.watch)(':beforeCommand')
34746
34816
  ], cleanHtml.prototype, "beforeCommand", null);
34817
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_7__.__decorate)([
34818
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_9__.watch)(':afterSetNativeEditorValue')
34819
+ ], cleanHtml.prototype, "onAfterSetNativeEditorValue", null);
34747
34820
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_7__.__decorate)([
34748
34821
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_9__.watch)(':beforeSetNativeEditorValue')
34749
34822
  ], cleanHtml.prototype, "onBeforeSetNativeEditorValue", 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.2
4
+ * Version: v4.17.4
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.2
11
+ * Version: v4.17.4
12
12
  * Url: https://xdsoft.net/jodit/
13
13
  * License(s): MIT
14
14
  */