jodit 3.8.8 → 3.9.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 (118) hide show
  1. package/.github/workflows/tests.yml +23 -0
  2. package/.idea/dictionaries/v_chupurnov.xml +1 -0
  3. package/.idea/workspace.xml +295 -286
  4. package/CHANGELOG.MD +110 -24
  5. package/README.md +3 -3
  6. package/build/jodit.css +2 -2
  7. package/build/jodit.es2018.css +1 -1
  8. package/build/jodit.es2018.en.css +1 -1
  9. package/build/jodit.es2018.en.js +329 -210
  10. package/build/jodit.es2018.en.min.js +1 -1
  11. package/build/jodit.es2018.js +329 -210
  12. package/build/jodit.es2018.min.js +1 -1
  13. package/build/jodit.js +1066 -881
  14. package/build/jodit.min.css +1 -1
  15. package/build/jodit.min.js +1 -1
  16. package/package.json +1 -1
  17. package/src/core/async.ts +1 -1
  18. package/src/core/constants.ts +2 -0
  19. package/src/core/dom.ts +113 -99
  20. package/src/core/events/{events-native.ts → event-emitter.ts} +14 -9
  21. package/src/core/events/index.ts +1 -1
  22. package/src/core/global.ts +2 -2
  23. package/src/core/helpers/array/to-array.ts +1 -0
  24. package/src/core/helpers/data-bind.ts +2 -2
  25. package/src/core/helpers/utils/utils.ts +20 -4
  26. package/src/core/request/ajax.ts +212 -0
  27. package/src/core/request/config.ts +37 -0
  28. package/{build-system/minimizer/index.js → src/core/request/index.ts} +2 -1
  29. package/src/core/request/response.ts +39 -0
  30. package/src/core/selection/select.ts +59 -27
  31. package/src/core/selection/style/api/element-has-same-style.ts +13 -0
  32. package/src/core/selection/style/api/get-suit-parent.ts +1 -1
  33. package/src/core/selection/style/api/is-suit-element.ts +24 -4
  34. package/src/core/selection/style/api/unwrap-children.ts +45 -16
  35. package/src/core/selection/style/api/wrap-unwrapped-text.ts +28 -23
  36. package/src/core/selection/style/apply-style.ts +14 -8
  37. package/src/core/traits/elms.ts +1 -0
  38. package/src/core/ui/helpers/get-control-type.ts +3 -1
  39. package/src/core/view/view.ts +3 -3
  40. package/src/modules/context-menu/context-menu.ts +1 -1
  41. package/src/modules/file-browser/README.MD +1 -1
  42. package/src/modules/file-browser/data-provider.ts +22 -42
  43. package/src/modules/file-browser/file-browser.ts +3 -0
  44. package/src/modules/index.ts +1 -1
  45. package/src/modules/table.ts +106 -101
  46. package/src/modules/uploader/uploader.ts +4 -3
  47. package/src/plugins/fix/clean-html.ts +37 -16
  48. package/src/plugins/indent.ts +25 -18
  49. package/src/plugins/size/resize-handler.ts +1 -1
  50. package/src/plugins/size/size.ts +1 -3
  51. package/src/plugins/source/source.ts +1 -1
  52. package/src/plugins/table/select-cells.ts +23 -5
  53. package/src/types/ajax.d.ts +15 -6
  54. package/src/types/async.d.ts +1 -1
  55. package/src/types/events.d.ts +12 -12
  56. package/src/types/view.d.ts +2 -2
  57. package/types/core/async.d.ts +1 -1
  58. package/types/core/constants.d.ts +1 -0
  59. package/types/core/dom.d.ts +25 -19
  60. package/types/core/events/{events-native.d.ts → event-emitter.d.ts} +8 -3
  61. package/types/core/events/index.d.ts +1 -1
  62. package/types/core/global.d.ts +2 -2
  63. package/types/core/helpers/utils/utils.d.ts +12 -4
  64. package/types/core/{ajax.d.ts → request/ajax.d.ts} +4 -14
  65. package/types/core/request/config.d.ts +14 -0
  66. package/{build-system/rules/css.js → types/core/request/index.d.ts} +2 -7
  67. package/types/core/request/response.d.ts +16 -0
  68. package/types/core/selection/style/api/element-has-same-style.d.ts +4 -0
  69. package/types/core/selection/style/api/is-suit-element.d.ts +1 -0
  70. package/types/core/selection/style/api/wrap-unwrapped-text.d.ts +2 -2
  71. package/types/core/view/view.d.ts +2 -2
  72. package/types/modules/file-browser/data-provider.d.ts +1 -1
  73. package/types/modules/index.d.ts +1 -1
  74. package/types/plugins/fix/clean-html.d.ts +4 -0
  75. package/types/plugins/size/resize-handler.d.ts +1 -1
  76. package/types/plugins/source/source.d.ts +1 -1
  77. package/types/types/ajax.d.ts +15 -6
  78. package/types/types/async.d.ts +1 -1
  79. package/types/types/events.d.ts +12 -12
  80. package/types/types/view.d.ts +2 -2
  81. package/.editorconfig +0 -15
  82. package/.eslintignore +0 -3
  83. package/.eslintrc.js +0 -109
  84. package/.prettierrc.json +0 -9
  85. package/.stylelintrc +0 -17
  86. package/app.css +0 -112
  87. package/build-system/index.js +0 -78
  88. package/build-system/loaders/css-variables-prefixes.js +0 -12
  89. package/build-system/loaders/lang-loader.js +0 -57
  90. package/build-system/loaders/style.js +0 -31
  91. package/build-system/loaders/svg-loader.js +0 -21
  92. package/build-system/minimizer/css.js +0 -20
  93. package/build-system/minimizer/js.js +0 -41
  94. package/build-system/plugins/banner.js +0 -15
  95. package/build-system/plugins/define.js +0 -22
  96. package/build-system/plugins/extract-css.js +0 -14
  97. package/build-system/plugins/index.js +0 -31
  98. package/build-system/plugins/post-build.js +0 -52
  99. package/build-system/rules/extra-typescript.js +0 -22
  100. package/build-system/rules/index.js +0 -17
  101. package/build-system/rules/internal-typescript.js +0 -23
  102. package/build-system/rules/langs.js +0 -20
  103. package/build-system/rules/svg.js +0 -19
  104. package/build-system/utils/filename.js +0 -17
  105. package/build-system/utils/post-build.js +0 -28
  106. package/build-system/variables.js +0 -53
  107. package/composer.json +0 -12
  108. package/src/core/ajax.ts +0 -266
  109. package/src/types/core.d.ts +0 -7
  110. package/src/types/core.js +0 -8
  111. package/src/types/core.js.map +0 -1
  112. package/src/types/storage.d.ts +0 -13
  113. package/src/types/storage.js +0 -8
  114. package/src/types/storage.js.map +0 -1
  115. package/types/types/core.js +0 -8
  116. package/types/types/core.js.map +0 -1
  117. package/types/types/storage.js +0 -8
  118. package/types/types/storage.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is awesome and usefully wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/)
4
- * Version: v3.8.8
4
+ * Version: v3.9.2
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -395,7 +395,8 @@ __webpack_require__.r(__webpack_exports__);
395
395
  /* harmony export */ "SAFE_COUNT_CHANGE_CALL": function() { return /* binding */ SAFE_COUNT_CHANGE_CALL; },
396
396
  /* harmony export */ "IS_MAC": function() { return /* binding */ IS_MAC; },
397
397
  /* harmony export */ "KEY_ALIASES": function() { return /* binding */ KEY_ALIASES; },
398
- /* harmony export */ "BASE_PATH": function() { return /* binding */ BASE_PATH; }
398
+ /* harmony export */ "BASE_PATH": function() { return /* binding */ BASE_PATH; },
399
+ /* harmony export */ "TEMP_ATTR": function() { return /* binding */ TEMP_ATTR; }
399
400
  /* harmony export */ });
400
401
  /*!
401
402
  * Jodit Editor (https://xdsoft.net/jodit/)
@@ -507,6 +508,7 @@ const BASE_PATH = (() => {
507
508
  }
508
509
  return window.location.href;
509
510
  })();
511
+ const TEMP_ATTR = 'data-jodit-temp';
510
512
 
511
513
 
512
514
  /***/ }),
@@ -517,6 +519,7 @@ const BASE_PATH = (() => {
517
519
 
518
520
  // EXPORTS
519
521
  __webpack_require__.d(__webpack_exports__, {
522
+ "vp": function() { return /* reexport */ EventEmitter; },
520
523
  "DG": function() { return /* reexport */ EventHandlersStore; },
521
524
  "ng": function() { return /* reexport */ EventsNative; },
522
525
  "P5": function() { return /* reexport */ ObserveObject; },
@@ -586,7 +589,7 @@ var is_function = __webpack_require__(6);
586
589
  var is_array = __webpack_require__(7);
587
590
  // EXTERNAL MODULE: ./src/core/helpers/type.ts
588
591
  var type = __webpack_require__(4);
589
- ;// CONCATENATED MODULE: ./src/core/events/events-native.ts
592
+ ;// CONCATENATED MODULE: ./src/core/events/event-emitter.ts
590
593
  /*!
591
594
  * Jodit Editor (https://xdsoft.net/jodit/)
592
595
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -597,10 +600,10 @@ var type = __webpack_require__(4);
597
600
 
598
601
 
599
602
 
600
- class EventsNative {
603
+ class EventEmitter {
601
604
  constructor(doc) {
602
605
  this.mutedEvents = new Set();
603
- this.__key = '__JoditEventsNativeNamespaces';
606
+ this.__key = '__JoditEventEmitterNamespaces';
604
607
  this.doc = document;
605
608
  this.prepareEvent = (event) => {
606
609
  if (event.cancelBubble) {
@@ -972,6 +975,8 @@ class EventsNative {
972
975
  delete this[this.__key];
973
976
  }
974
977
  }
978
+ class EventsNative extends EventEmitter {
979
+ }
975
980
 
976
981
  // EXTERNAL MODULE: ./node_modules/tslib/tslib.es6.js
977
982
  var tslib_es6 = __webpack_require__(18);
@@ -2887,7 +2892,7 @@ function getContainer(jodit, classFunc, tag = 'div', createInsideEditor = false)
2887
2892
  data[key].classList.add(`jodit_theme_${view.o.theme || 'default'}`);
2888
2893
  return data[key];
2889
2894
  }
2890
- const eventEmitter = new _events__WEBPACK_IMPORTED_MODULE_3__/* .EventsNative */ .ng();
2895
+ const eventEmitter = new _events__WEBPACK_IMPORTED_MODULE_3__/* .EventEmitter */ .vp();
2891
2896
 
2892
2897
 
2893
2898
  /***/ }),
@@ -3064,6 +3069,7 @@ PluginSystem.styles = new Set();
3064
3069
 
3065
3070
 
3066
3071
 
3072
+
3067
3073
  class Dom {
3068
3074
  static detach(node) {
3069
3075
  while (node.firstChild) {
@@ -3124,22 +3130,6 @@ class Dom {
3124
3130
  Dom.safeRemove(node);
3125
3131
  }
3126
3132
  }
3127
- static each(elm, callback) {
3128
- let node = elm.firstChild;
3129
- if (node) {
3130
- while (node) {
3131
- const next = Dom.next(node, Boolean, elm);
3132
- if (callback(node) === false) {
3133
- return false;
3134
- }
3135
- if (node.parentNode && !Dom.each(node, callback)) {
3136
- return false;
3137
- }
3138
- node = next;
3139
- }
3140
- }
3141
- return true;
3142
- }
3143
3133
  static between(start, end, callback) {
3144
3134
  let next = start;
3145
3135
  while (next && next !== end) {
@@ -3282,10 +3272,10 @@ class Dom {
3282
3272
  return null;
3283
3273
  }
3284
3274
  static prev(node, condition, root, withChild = true) {
3285
- return Dom.find(node, condition, root, false, 'previousSibling', withChild ? 'lastChild' : false);
3275
+ return Dom.find(node, condition, root, false, withChild);
3286
3276
  }
3287
3277
  static next(node, condition, root, withChild = true) {
3288
- return Dom.find(node, condition, root, undefined, undefined, withChild ? 'firstChild' : false);
3278
+ return Dom.find(node, condition, root, true, withChild);
3289
3279
  }
3290
3280
  static prevWithClass(node, className) {
3291
3281
  return Dom.prev(node, node => {
@@ -3295,28 +3285,63 @@ class Dom {
3295
3285
  static nextWithClass(node, className) {
3296
3286
  return Dom.next(node, elm => Dom.isElement(elm) && elm.classList.contains(className), node.parentNode);
3297
3287
  }
3298
- static find(node, condition, root, recurse = false, sibling = 'nextSibling', child = 'firstChild') {
3299
- if (recurse && condition(node)) {
3300
- return node;
3288
+ static find(node, condition, root, leftToRight = true, withChild = true) {
3289
+ const gen = this.nextGen(node, root, leftToRight, withChild);
3290
+ let item = gen.next();
3291
+ while (!item.done) {
3292
+ if (condition(item.value)) {
3293
+ return item.value;
3294
+ }
3295
+ item = gen.next();
3301
3296
  }
3302
- let start = node, next;
3297
+ return null;
3298
+ }
3299
+ static *nextGen(start, root, leftToRight = true, withChild = true) {
3300
+ const stack = [];
3301
+ let currentNode = start;
3303
3302
  do {
3304
- next = start[sibling];
3305
- if (condition(next)) {
3306
- return next ? next : null;
3303
+ let next = leftToRight
3304
+ ? currentNode.nextSibling
3305
+ : currentNode.previousSibling;
3306
+ while (next) {
3307
+ stack.unshift(next);
3308
+ next = leftToRight ? next.nextSibling : next.previousSibling;
3309
+ }
3310
+ yield* this.runInStack(start, stack, leftToRight, withChild);
3311
+ currentNode = currentNode.parentNode;
3312
+ } while (currentNode !== root);
3313
+ return null;
3314
+ }
3315
+ static each(elm, callback, leftToRight = true) {
3316
+ const gen = this.eachGen(elm, leftToRight);
3317
+ let item = gen.next();
3318
+ while (!item.done) {
3319
+ if (callback(item.value) === false) {
3320
+ return false;
3307
3321
  }
3308
- if (child && next && next[child]) {
3309
- const nextOne = Dom.find(next[child], condition, next, true, sibling, child);
3310
- if (nextOne) {
3311
- return nextOne;
3312
- }
3322
+ item = gen.next();
3323
+ }
3324
+ return true;
3325
+ }
3326
+ static eachGen(root, leftToRight = true) {
3327
+ return this.runInStack(root, [root], leftToRight);
3328
+ }
3329
+ static *runInStack(start, stack, leftToRight, withChild = true) {
3330
+ while (stack.length) {
3331
+ const item = stack.pop();
3332
+ if (start !== item) {
3333
+ yield item;
3313
3334
  }
3314
- if (!next) {
3315
- next = start.parentNode;
3335
+ if (withChild) {
3336
+ let child = leftToRight ? item.lastChild : item.firstChild;
3337
+ while (child) {
3338
+ stack.push(child);
3339
+ child = leftToRight
3340
+ ? child.previousSibling
3341
+ : child.nextSibling;
3342
+ }
3316
3343
  }
3317
- start = next;
3318
- } while (start && start !== root);
3319
- return null;
3344
+ }
3320
3345
  }
3321
3346
  static findWithCurrent(node, condition, root, sibling = 'nextSibling', child = 'firstChild') {
3322
3347
  let next = node;
@@ -3495,21 +3520,20 @@ class Dom {
3495
3520
  }
3496
3521
  static markTemporary(element, attributes) {
3497
3522
  attributes && (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.attr)(element, attributes);
3498
- (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.attr)(element, 'data-jodit-temp', true);
3523
+ (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.attr)(element, _constants__WEBPACK_IMPORTED_MODULE_0__.TEMP_ATTR, true);
3499
3524
  return element;
3500
3525
  }
3501
3526
  static isTemporary(element) {
3502
3527
  if (!Dom.isElement(element)) {
3503
3528
  return false;
3504
3529
  }
3505
- return (_selection__WEBPACK_IMPORTED_MODULE_2__/* .Select.isMarker */ .P.isMarker(element) ||
3506
- (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.attr)(element, 'data-jodit-temp') === 'true');
3530
+ return _selection__WEBPACK_IMPORTED_MODULE_2__/* .Select.isMarker */ .P.isMarker(element) || (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.attr)(element, _constants__WEBPACK_IMPORTED_MODULE_0__.TEMP_ATTR) === 'true';
3507
3531
  }
3508
3532
  static replaceTemporaryFromString(value) {
3509
3533
  return value.replace(/<([a-z]+)[^>]+data-jodit-temp[^>]+>(.+?)<\/\1>/gi, '$2');
3510
3534
  }
3511
3535
  static temporaryList(root) {
3512
- return (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.$$)('[data-jodit-temp]', root);
3536
+ return (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.$$)(`[${_constants__WEBPACK_IMPORTED_MODULE_0__.TEMP_ATTR}]`, root);
3513
3537
  }
3514
3538
  }
3515
3539
 
@@ -3564,6 +3588,11 @@ function elementHasSameStyle(elm, rules) {
3564
3588
  .toLowerCase() === value.toString().toLowerCase());
3565
3589
  }));
3566
3590
  }
3591
+ function elementHasSameStyleKeys(elm, rules) {
3592
+ return Boolean(!dom/* Dom.isTag */.i.isTag(elm, 'font') &&
3593
+ dom/* Dom.isHTMLElement */.i.isHTMLElement(elm) &&
3594
+ Object.keys(rules).every(property => !(0,helpers.isVoid)((0,helpers.css)(elm, property, true))));
3595
+ }
3567
3596
 
3568
3597
  ;// CONCATENATED MODULE: ./src/core/selection/style/api/is-suit-element.ts
3569
3598
 
@@ -3580,10 +3609,16 @@ function isSuitElement(commitStyle, elm, strict) {
3580
3609
  (elmHasSameStyle && isNormalNode(elm))) {
3581
3610
  return true;
3582
3611
  }
3583
- if (!elmIsSame && !strict && elementIsDefault && dom/* Dom.isInlineBlock */.i.isInlineBlock(elm)) {
3584
- return true;
3612
+ return Boolean(!elmIsSame && !strict && elementIsDefault && dom/* Dom.isInlineBlock */.i.isInlineBlock(elm));
3613
+ }
3614
+ function isSameStyleChild(commitStyle, elm) {
3615
+ const { element, options } = commitStyle;
3616
+ if (!elm || !isNormalNode(elm)) {
3617
+ return false;
3585
3618
  }
3586
- return false;
3619
+ const elmIsSame = elm.nodeName.toLowerCase() === element;
3620
+ const elmHasSameStyle = Boolean(options.style && elementHasSameStyleKeys(elm, options.style));
3621
+ return elmIsSame && elmHasSameStyle;
3587
3622
  }
3588
3623
 
3589
3624
  ;// CONCATENATED MODULE: ./src/core/selection/style/api/get-suit-parent.ts
@@ -3597,7 +3632,7 @@ function isSuitElement(commitStyle, elm, strict) {
3597
3632
 
3598
3633
  function getSuitParent(style, node, root) {
3599
3634
  const { parentNode } = node;
3600
- if (parentNode &&
3635
+ if (dom/* Dom.isHTMLElement */.i.isHTMLElement(parentNode) &&
3601
3636
  !dom/* Dom.next */.i.next(node, isNormalNode, parentNode) &&
3602
3637
  !dom/* Dom.prev */.i.prev(node, isNormalNode, parentNode) &&
3603
3638
  isSuitElement(style, parentNode, false) &&
@@ -4090,24 +4125,48 @@ class Select {
4090
4125
  this.j.e.fire('afterInsertImage', image);
4091
4126
  }
4092
4127
  eachSelection(callback) {
4128
+ var _a;
4093
4129
  const sel = this.sel;
4094
4130
  if (sel && sel.rangeCount) {
4095
4131
  const range = sel.getRangeAt(0);
4096
- const nodes = [], startOffset = range.startOffset, length = this.area.childNodes.length, elementOffset = startOffset < length ? startOffset : length - 1, start = range.startContainer === this.area
4097
- ? this.area.childNodes[elementOffset]
4132
+ let root = range.commonAncestorContainer;
4133
+ if (!dom/* Dom.isHTMLElement */.i.isHTMLElement(root)) {
4134
+ root = root.parentElement;
4135
+ }
4136
+ const nodes = [], startOffset = range.startOffset, length = root.childNodes.length, elementOffset = startOffset < length ? startOffset : length - 1;
4137
+ let start = range.startContainer === this.area
4138
+ ? root.childNodes[elementOffset]
4098
4139
  : range.startContainer, end = range.endContainer === this.area
4099
- ? this.area.childNodes[range.endOffset - 1]
4140
+ ? root.childNodes[range.endOffset - 1]
4100
4141
  : range.endContainer;
4101
- dom/* Dom.find */.i.find(start, (node) => {
4142
+ if (dom/* Dom.isText */.i.isText(start) &&
4143
+ start === range.startContainer &&
4144
+ range.startOffset === ((_a = start.nodeValue) === null || _a === void 0 ? void 0 : _a.length) &&
4145
+ start.nextSibling) {
4146
+ start = start.nextSibling;
4147
+ }
4148
+ if (dom/* Dom.isText */.i.isText(end) &&
4149
+ end === range.endContainer &&
4150
+ range.endOffset === 0 &&
4151
+ end.previousSibling) {
4152
+ end = end.previousSibling;
4153
+ }
4154
+ const checkElm = (node) => {
4102
4155
  if (node &&
4103
- node !== this.area &&
4156
+ node !== root &&
4104
4157
  !dom/* Dom.isEmptyTextNode */.i.isEmptyTextNode(node) &&
4105
4158
  !Select.isMarker(node)) {
4106
4159
  nodes.push(node);
4107
4160
  }
4108
- return (node === end ||
4109
- (node && node.contains && node.contains(end)));
4110
- }, this.area, true, 'nextSibling', false);
4161
+ };
4162
+ checkElm(start);
4163
+ if (start !== end) {
4164
+ dom/* Dom.find */.i.find(start, node => {
4165
+ checkElm(node);
4166
+ return (node === end ||
4167
+ (node && node.contains && node.contains(end)));
4168
+ }, root, true, false);
4169
+ }
4111
4170
  const forEvery = (current) => {
4112
4171
  if (!dom/* Dom.isOrContains */.i.isOrContains(this.j.editor, current, true)) {
4113
4172
  return;
@@ -4495,25 +4554,49 @@ function extractAndMove(wrapper, range, left) {
4495
4554
  */
4496
4555
 
4497
4556
 
4557
+
4498
4558
  function unwrapChildren(style, font) {
4499
4559
  const needUnwrap = [];
4560
+ const needChangeStyle = [];
4500
4561
  let firstElementSuit;
4562
+ const cssStyle = style.options.style;
4501
4563
  if (font.firstChild) {
4502
- dom/* Dom.find */.i.find(font.firstChild, (elm) => {
4503
- if (elm && isSuitElement(style, elm, true)) {
4564
+ const gen = dom/* Dom.eachGen */.i.eachGen(font);
4565
+ let item = gen.next();
4566
+ while (!item.done) {
4567
+ const elm = item.value;
4568
+ if (isSuitElement(style, elm, true)) {
4504
4569
  if (firstElementSuit === undefined) {
4505
4570
  firstElementSuit = true;
4506
4571
  }
4507
4572
  needUnwrap.push(elm);
4508
4573
  }
4509
- else {
4574
+ else if (cssStyle && isSameStyleChild(style, elm)) {
4510
4575
  if (firstElementSuit === undefined) {
4511
4576
  firstElementSuit = false;
4512
4577
  }
4578
+ needChangeStyle.push(() => {
4579
+ (0,helpers.css)(elm, Object.keys(cssStyle).reduce((acc, key) => {
4580
+ acc[key] = null;
4581
+ return acc;
4582
+ }, {}));
4583
+ if (!(0,helpers.attr)(elm, 'style')) {
4584
+ (0,helpers.attr)(elm, 'style', null);
4585
+ }
4586
+ if (elm.nodeName.toLowerCase() === style.element) {
4587
+ needUnwrap.push(elm);
4588
+ }
4589
+ });
4513
4590
  }
4514
- return false;
4515
- }, font, true);
4591
+ else if (!dom/* Dom.isEmptyTextNode */.i.isEmptyTextNode(elm)) {
4592
+ if (firstElementSuit === undefined) {
4593
+ firstElementSuit = false;
4594
+ }
4595
+ }
4596
+ item = gen.next();
4597
+ }
4516
4598
  }
4599
+ needChangeStyle.forEach(clb => clb());
4517
4600
  needUnwrap.forEach(dom/* Dom.unwrap */.i.unwrap);
4518
4601
  return Boolean(firstElementSuit);
4519
4602
  }
@@ -4544,10 +4627,13 @@ function postProcessListElement(style, wrapper, ci) {
4544
4627
  */
4545
4628
 
4546
4629
 
4547
- function wrapUnwrappedText(style, elm, root, ci, getRange) {
4548
- const edge = (n, key = 'previousSibling') => {
4630
+ function wrapUnwrappedText(style, elm, jodit, getRange) {
4631
+ const root = jodit.editor, ci = jodit.createInside, edge = (n, key = 'previousSibling') => {
4549
4632
  let edgeNode = n, node = n;
4550
4633
  while (node) {
4634
+ if (dom/* Dom.isTag */.i.isTag(node, jodit.o.enter)) {
4635
+ break;
4636
+ }
4551
4637
  edgeNode = node;
4552
4638
  if (node[key]) {
4553
4639
  node = node[key];
@@ -4651,19 +4737,20 @@ function toggleStyles(style, elm, wrap) {
4651
4737
 
4652
4738
 
4653
4739
  function ApplyStyle(jodit, style) {
4654
- const { s: sel, editor: root, createInside: ci } = jodit, rng = () => sel.createRange();
4740
+ const { s: sel } = jodit, rng = () => sel.createRange();
4655
4741
  let wrap = null;
4656
4742
  sel.save();
4657
4743
  (0,helpers.normalizeNode)(sel.area.firstChild);
4658
4744
  const gen = jodit.s.wrapInTagGen();
4659
4745
  let font = gen.next();
4660
4746
  while (!font.done) {
4661
- wrap = applyToElement(style, font.value, root, rng, ci, wrap);
4747
+ wrap = applyToElement(style, font.value, rng, jodit, wrap);
4662
4748
  font = gen.next();
4663
4749
  }
4664
4750
  sel.restore();
4665
4751
  }
4666
- function applyToElement(style, font, root, range, ci, wrap) {
4752
+ function applyToElement(style, font, range, jodit, wrap) {
4753
+ const root = jodit.editor;
4667
4754
  if (checkSpecialElements(font, root)) {
4668
4755
  return wrap;
4669
4756
  }
@@ -4698,13 +4785,13 @@ function applyToElement(style, font, root, range, ci, wrap) {
4698
4785
  wrapper = box;
4699
4786
  }
4700
4787
  else {
4701
- wrapper = wrapUnwrappedText(style, font, root, ci, range);
4788
+ wrapper = wrapUnwrappedText(style, font, jodit, range);
4702
4789
  }
4703
4790
  }
4704
- const newWrapper = dom/* Dom.replace */.i.replace(wrapper, style.element, ci, true);
4791
+ const newWrapper = dom/* Dom.replace */.i.replace(wrapper, style.element, jodit.createInside, true);
4705
4792
  (0,helpers.attr)(newWrapper, 'size', null);
4706
4793
  if (style.elementIsBlock) {
4707
- postProcessListElement(style, newWrapper, ci);
4794
+ postProcessListElement(style, newWrapper, jodit.createInside);
4708
4795
  }
4709
4796
  if (style.options.style && style.elementIsDefault) {
4710
4797
  (0,helpers.css)(newWrapper, style.options.style);
@@ -7415,8 +7502,9 @@ UIList = (0,tslib_es6/* __decorate */.gn)([
7415
7502
 
7416
7503
  function getControlType(button, controls) {
7417
7504
  let buttonControl;
7418
- if (!controls)
7505
+ if (!controls) {
7419
7506
  controls = _config__WEBPACK_IMPORTED_MODULE_1__/* .Config.defaultOptions.controls */ .D.defaultOptions.controls;
7507
+ }
7420
7508
  if (!(0,_helpers__WEBPACK_IMPORTED_MODULE_0__.isString)(button)) {
7421
7509
  buttonControl = { name: 'empty', ...(0,_helpers__WEBPACK_IMPORTED_MODULE_0__.ConfigFlatten)(button) };
7422
7510
  if (controls[buttonControl.name] !== undefined) {
@@ -9676,6 +9764,7 @@ __webpack_require__.d(modules_namespaceObject, {
9676
9764
  "Create": function() { return Create; },
9677
9765
  "Dialog": function() { return Dialog; },
9678
9766
  "Dom": function() { return dom/* Dom */.i; },
9767
+ "EventEmitter": function() { return events/* EventEmitter */.vp; },
9679
9768
  "EventHandlersStore": function() { return events/* EventHandlersStore */.DG; },
9680
9769
  "EventsNative": function() { return events/* EventsNative */.ng; },
9681
9770
  "FileBrowser": function() { return FileBrowser; },
@@ -9689,6 +9778,7 @@ __webpack_require__.d(modules_namespaceObject, {
9689
9778
  "Popup": function() { return ui/* Popup */.GI; },
9690
9779
  "ProgressBar": function() { return ui/* ProgressBar */.ko; },
9691
9780
  "Prompt": function() { return Prompt; },
9781
+ "Response": function() { return response_Response; },
9692
9782
  "STATUSES": function() { return component/* STATUSES */.n$; },
9693
9783
  "Select": function() { return selection/* Select */.P; },
9694
9784
  "Snapshot": function() { return Snapshot; },
@@ -10064,15 +10154,39 @@ class Async {
10064
10154
  }
10065
10155
  }
10066
10156
 
10067
- ;// CONCATENATED MODULE: ./src/core/ajax.ts
10157
+ ;// CONCATENATED MODULE: ./src/core/request/response.ts
10068
10158
  /*!
10069
10159
  * Jodit Editor (https://xdsoft.net/jodit/)
10070
10160
  * Released under MIT see LICENSE.txt in the project root for license information.
10071
10161
  * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
10072
10162
  */
10163
+ class response_Response {
10164
+ constructor(request, status, statusText, body) {
10165
+ this.request = request;
10166
+ this.status = status;
10167
+ this.statusText = statusText;
10168
+ this.body = body;
10169
+ }
10170
+ get url() {
10171
+ return this.request.url;
10172
+ }
10173
+ async json() {
10174
+ return JSON.parse(this.body);
10175
+ }
10176
+ text() {
10177
+ return Promise.resolve(this.body);
10178
+ }
10179
+ }
10073
10180
 
10181
+ ;// CONCATENATED MODULE: ./src/core/request/config.ts
10182
+ /*!
10183
+ * Jodit Editor (https://xdsoft.net/jodit/)
10184
+ * Released under MIT see LICENSE.txt in the project root for license information.
10185
+ * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
10186
+ */
10074
10187
 
10075
10188
  config/* Config.prototype.defaultAjaxOptions */.D.prototype.defaultAjaxOptions = {
10189
+ successStatuses: [200, 201, 202],
10076
10190
  dataType: 'json',
10077
10191
  method: 'GET',
10078
10192
  url: '',
@@ -10086,15 +10200,25 @@ config/* Config.prototype.defaultAjaxOptions */.D.prototype.defaultAjaxOptions =
10086
10200
  return new XMLHttpRequest();
10087
10201
  }
10088
10202
  };
10203
+
10204
+ ;// CONCATENATED MODULE: ./src/core/request/ajax.ts
10205
+ /*!
10206
+ * Jodit Editor (https://xdsoft.net/jodit/)
10207
+ * Released under MIT see LICENSE.txt in the project root for license information.
10208
+ * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
10209
+ */
10210
+
10211
+
10212
+
10213
+
10089
10214
  class Ajax {
10090
10215
  constructor(jodit, options) {
10091
10216
  this.jodit = jodit;
10092
- this.successResponseCodes = [200, 201, 202];
10093
10217
  this.resolved = false;
10094
10218
  this.activated = false;
10095
10219
  this.options = (0,helpers.ConfigProto)(options || {}, config/* Config.prototype.defaultAjaxOptions */.D.prototype.defaultAjaxOptions);
10096
10220
  this.xhr = this.o.xhr ? this.o.xhr() : new XMLHttpRequest();
10097
- jodit && jodit.e && jodit.e.on('beforeDestruct', () => this.abort());
10221
+ jodit && jodit.e && jodit.e.on('beforeDestruct', () => this.destruct());
10098
10222
  }
10099
10223
  __buildParams(obj, prefix) {
10100
10224
  if ((0,helpers.isFunction)(this.o.queryBuild)) {
@@ -10122,33 +10246,22 @@ class Ajax {
10122
10246
  }
10123
10247
  send() {
10124
10248
  this.activated = true;
10125
- return new Promise((resolve, reject) => {
10126
- const __parse = (resp) => {
10127
- let result = null;
10128
- if (this.o.dataType === 'json') {
10129
- result = JSON.parse(resp);
10130
- }
10131
- if (!result) {
10132
- throw (0,helpers.error)('No JSON format');
10133
- }
10134
- return result;
10135
- };
10136
- this.xhr.onabort = () => {
10137
- reject((0,helpers.error)(this.xhr.statusText));
10138
- };
10139
- this.xhr.onerror = () => {
10140
- reject((0,helpers.error)(this.xhr.statusText));
10141
- };
10142
- this.xhr.ontimeout = () => {
10143
- reject((0,helpers.error)(this.xhr.statusText));
10249
+ const { xhr, o } = this;
10250
+ const request = this.prepareRequest();
10251
+ return this.j.async.promise((resolve, reject) => {
10252
+ var _a;
10253
+ const onReject = () => {
10254
+ reject((0,helpers.error)('Connection error'));
10144
10255
  };
10145
- this.xhr.onload = () => {
10146
- this.response = this.xhr.responseText;
10147
- this.status = this.xhr.status;
10256
+ const onResolve = () => {
10148
10257
  this.resolved = true;
10149
- resolve.call(this.xhr, __parse(this.response) || {});
10258
+ resolve(new response_Response(request, xhr.status, xhr.statusText, xhr.responseText));
10150
10259
  };
10151
- this.xhr.onprogress = (e) => {
10260
+ xhr.onabort = onReject;
10261
+ xhr.onerror = onReject;
10262
+ xhr.ontimeout = onReject;
10263
+ xhr.onload = onResolve;
10264
+ xhr.onprogress = (e) => {
10152
10265
  var _a, _b;
10153
10266
  let percentComplete = 0;
10154
10267
  if (e.lengthComputable) {
@@ -10156,37 +10269,32 @@ class Ajax {
10156
10269
  }
10157
10270
  (_b = (_a = this.options).onProgress) === null || _b === void 0 ? void 0 : _b.call(_a, percentComplete);
10158
10271
  };
10159
- this.xhr.onreadystatechange = () => {
10272
+ xhr.onreadystatechange = () => {
10160
10273
  var _a, _b;
10161
10274
  (_b = (_a = this.options).onProgress) === null || _b === void 0 ? void 0 : _b.call(_a, 10);
10162
- if (this.xhr.readyState === XMLHttpRequest.DONE) {
10163
- const resp = this.xhr.responseText;
10164
- this.response = resp;
10165
- this.status = this.xhr.status;
10166
- this.resolved = true;
10167
- if (this.successResponseCodes.indexOf(this.xhr.status) >
10168
- -1) {
10169
- resolve.call(this.xhr, __parse(resp));
10275
+ if (xhr.readyState === XMLHttpRequest.DONE) {
10276
+ if (o.successStatuses.includes(xhr.status)) {
10277
+ onResolve();
10170
10278
  }
10171
10279
  else {
10172
- reject.call(this.xhr, (0,helpers.error)(this.xhr.statusText ||
10173
- this.j.i18n('Connection error!')));
10280
+ reject((0,helpers.error)(xhr.statusText || 'Connection error'));
10174
10281
  }
10175
10282
  }
10176
10283
  };
10177
- this.xhr.withCredentials = this.o.withCredentials || false;
10178
- const { url, data, method } = this.prepareRequest();
10179
- this.xhr.open(method, url, true);
10180
- if (this.o.contentType && this.xhr.setRequestHeader) {
10181
- this.xhr.setRequestHeader('Content-type', this.o.contentType);
10182
- }
10183
- if (this.o.headers && this.xhr.setRequestHeader) {
10184
- (0,helpers.each)(this.o.headers, (key, value) => {
10185
- this.xhr.setRequestHeader(key, value);
10284
+ xhr.withCredentials = (_a = o.withCredentials) !== null && _a !== void 0 ? _a : false;
10285
+ const { url, data, method } = request;
10286
+ xhr.open(method, url, true);
10287
+ if (o.contentType && xhr.setRequestHeader) {
10288
+ xhr.setRequestHeader('Content-type', o.contentType);
10289
+ }
10290
+ const { headers } = o;
10291
+ if (headers && xhr.setRequestHeader) {
10292
+ Object.keys(headers).forEach(key => {
10293
+ xhr.setRequestHeader(key, headers[key]);
10186
10294
  });
10187
10295
  }
10188
10296
  this.j.async.setTimeout(() => {
10189
- this.xhr.send(data ? this.__buildParams(data) : undefined);
10297
+ xhr.send(data ? this.__buildParams(data) : undefined);
10190
10298
  }, 0);
10191
10299
  });
10192
10300
  }
@@ -10228,6 +10336,15 @@ class Ajax {
10228
10336
  }
10229
10337
  Ajax.log = [];
10230
10338
 
10339
+ ;// CONCATENATED MODULE: ./src/core/request/index.ts
10340
+ /*!
10341
+ * Jodit Editor (https://xdsoft.net/jodit/)
10342
+ * Released under MIT see LICENSE.txt in the project root for license information.
10343
+ * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
10344
+ */
10345
+
10346
+
10347
+
10231
10348
  // EXTERNAL MODULE: ./src/core/component/index.ts + 3 modules
10232
10349
  var component = __webpack_require__(12);
10233
10350
  // EXTERNAL MODULE: ./src/core/ui/popup/index.ts + 1 modules
@@ -10251,7 +10368,7 @@ class ContextMenu extends ui_popup/* Popup */.G {
10251
10368
  return 'ContextMenu';
10252
10369
  }
10253
10370
  show(x, y, actions) {
10254
- const self = this, content = this.j.c.div('jodit-context-menu__actions');
10371
+ const self = this, content = this.j.c.div(this.getFullElName('actions'));
10255
10372
  if (!(0,checker/* isArray */.kJ)(actions)) {
10256
10373
  return;
10257
10374
  }
@@ -10450,7 +10567,7 @@ class View extends component/* Component */.wA {
10450
10567
  this.isView = true;
10451
10568
  this.mods = {};
10452
10569
  this.components = new Set();
10453
- this.version = "3.8.8";
10570
+ this.version = "3.9.2";
10454
10571
  this.async = new Async();
10455
10572
  this.buffer = Storage.makeStorage();
10456
10573
  this.storage = Storage.makeStorage(true, this.componentName);
@@ -10463,7 +10580,7 @@ class View extends component/* Component */.wA {
10463
10580
  this.buffer = Storage.makeStorage();
10464
10581
  this.initOptions(options);
10465
10582
  this.initOwners();
10466
- this.events = new events/* EventsNative */.ng(this.od);
10583
+ this.events = new events/* EventEmitter */.vp(this.od);
10467
10584
  this.create = new Create(this.od);
10468
10585
  this.container = this.c.div();
10469
10586
  this.container.classList.add('jodit');
@@ -10548,10 +10665,10 @@ class View extends component/* Component */.wA {
10548
10665
  return this.__isFullSize;
10549
10666
  }
10550
10667
  getVersion() {
10551
- return "3.8.8";
10668
+ return "3.9.2";
10552
10669
  }
10553
10670
  static getVersion() {
10554
- return "3.8.8";
10671
+ return "3.9.2";
10555
10672
  }
10556
10673
  initOptions(options) {
10557
10674
  this.options = (0,helpers.ConfigProto)(options || {}, (0,helpers.ConfigProto)(this.options || {}, View.defaultOptions));
@@ -12434,7 +12551,7 @@ class DataProvider {
12434
12551
  get o() {
12435
12552
  return this.options;
12436
12553
  }
12437
- get(name, success, error) {
12554
+ get(name) {
12438
12555
  const ai = this.ajaxInstances;
12439
12556
  if (ai.has(name)) {
12440
12557
  const ajax = ai.get(name);
@@ -12450,25 +12567,21 @@ class DataProvider {
12450
12567
  opts.data = opts.prepareData.call(this, opts.data);
12451
12568
  }
12452
12569
  const ajax = new Ajax(this.parent, opts);
12453
- let promise = ajax.send();
12454
12570
  ai.set(name, ajax);
12455
- promise = promise.then(resp => {
12456
- if (!this.isSuccess(resp)) {
12457
- throw new Error(this.getMessage(resp));
12458
- }
12459
- return resp;
12460
- });
12461
- if (success) {
12462
- promise = promise.then(success);
12463
- }
12464
- if (error) {
12465
- promise = promise.catch(error);
12466
- }
12467
- return promise.finally(() => {
12571
+ const promise = ajax.send();
12572
+ promise.finally(() => {
12468
12573
  ajax.destruct();
12469
12574
  ai.delete(name);
12470
12575
  this.progressHandler(100);
12471
12576
  });
12577
+ return promise
12578
+ .then(resp => resp.json())
12579
+ .then(resp => {
12580
+ if (resp && !this.isSuccess(resp)) {
12581
+ throw new Error(this.getMessage(resp));
12582
+ }
12583
+ return resp;
12584
+ });
12472
12585
  }
12473
12586
  onProgress(callback) {
12474
12587
  this.progressHandler = callback;
@@ -12570,7 +12683,7 @@ class DataProvider {
12570
12683
  }
12571
12684
  getPathByUrl(url) {
12572
12685
  (0,helpers.set)('options.getLocalFileByUrl.data.url', url, this);
12573
- return this.get('getLocalFileByUrl', resp => {
12686
+ return this.get('getLocalFileByUrl').then(resp => {
12574
12687
  if (this.isSuccess(resp)) {
12575
12688
  return resp.data;
12576
12689
  }
@@ -12622,9 +12735,6 @@ class DataProvider {
12622
12735
  if (fr.process) {
12623
12736
  resp = fr.process.call(this, resp);
12624
12737
  }
12625
- if (!this.isSuccess(resp)) {
12626
- throw (0,helpers.error)(this.getMessage(resp));
12627
- }
12628
12738
  return this.getMessage(resp);
12629
12739
  });
12630
12740
  }
@@ -12647,9 +12757,6 @@ class DataProvider {
12647
12757
  if (fr.process) {
12648
12758
  resp = fr.process.call(self, resp);
12649
12759
  }
12650
- if (!this.isSuccess(resp)) {
12651
- throw (0,helpers.error)(this.getMessage(resp));
12652
- }
12653
12760
  return this.getMessage(resp);
12654
12761
  });
12655
12762
  }
@@ -12678,11 +12785,8 @@ class DataProvider {
12678
12785
  query.data.path = path;
12679
12786
  query.data.name = name;
12680
12787
  query.data.source = source;
12681
- return this.get(type).then(resp => {
12682
- if (this.isSuccess(resp)) {
12683
- return true;
12684
- }
12685
- throw (0,helpers.error)(this.getMessage(resp));
12788
+ return this.get(type).then(() => {
12789
+ return true;
12686
12790
  });
12687
12791
  }
12688
12792
  crop(path, source, name, newname, box) {
@@ -14646,9 +14750,7 @@ class Table extends component/* ViewComponent */.Hr {
14646
14750
  }
14647
14751
  static getColumnsCount(table) {
14648
14752
  const matrix = Table.formalMatrix(table);
14649
- return matrix.reduce((max_count, cells) => {
14650
- return Math.max(max_count, cells.length);
14651
- }, 0);
14753
+ return matrix.reduce((max_count, cells) => Math.max(max_count, cells.length), 0);
14652
14754
  }
14653
14755
  static formalMatrix(table, callback) {
14654
14756
  const matrix = [[]];
@@ -14703,6 +14805,7 @@ class Table extends component/* ViewComponent */.Hr {
14703
14805
  return [i, j, width, height];
14704
14806
  }
14705
14807
  static appendRow(table, line, after, create) {
14808
+ var _a;
14706
14809
  let row;
14707
14810
  if (!line) {
14708
14811
  const columnsCount = Table.getColumnsCount(table);
@@ -14732,7 +14835,7 @@ class Table extends component/* ViewComponent */.Hr {
14732
14835
  line.parentNode && line.parentNode.insertBefore(row, line);
14733
14836
  }
14734
14837
  else {
14735
- ((0,helpers.$$)(':scope>tbody', table)[0] || table).appendChild(row);
14838
+ (((_a = table.getElementsByTagName('tbody')) === null || _a === void 0 ? void 0 : _a[0]) || table).appendChild(row);
14736
14839
  }
14737
14840
  }
14738
14841
  static removeRow(table, rowIndex) {
@@ -14752,12 +14855,14 @@ class Table extends component/* ViewComponent */.Hr {
14752
14855
  while (box[rowIndex + 1][nextCell] === cell) {
14753
14856
  nextCell += 1;
14754
14857
  }
14755
- const nextRow = dom/* Dom.next */.i.next(cell.parentNode, (elm) => dom/* Dom.isTag */.i.isTag(elm, 'tr'), table);
14756
- if (box[rowIndex + 1][nextCell]) {
14757
- nextRow.insertBefore(cell, box[rowIndex + 1][nextCell]);
14758
- }
14759
- else {
14760
- nextRow.appendChild(cell);
14858
+ const nextRow = dom/* Dom.next */.i.next(cell.parentNode, elm => dom/* Dom.isTag */.i.isTag(elm, 'tr'), table);
14859
+ if (nextRow) {
14860
+ if (box[rowIndex + 1][nextCell]) {
14861
+ nextRow.insertBefore(cell, box[rowIndex + 1][nextCell]);
14862
+ }
14863
+ else {
14864
+ nextRow.appendChild(cell);
14865
+ }
14761
14866
  }
14762
14867
  }
14763
14868
  }
@@ -14767,7 +14872,7 @@ class Table extends component/* ViewComponent */.Hr {
14767
14872
  if (dec &&
14768
14873
  (cell.parentNode === row || cell !== box[rowIndex][j - 1])) {
14769
14874
  const rowSpan = cell.rowSpan;
14770
- (0,helpers.attr)(cell, 'rowspan', rowSpan - 1 > 1 ? (rowSpan - 1).toString() : null);
14875
+ (0,helpers.attr)(cell, 'rowspan', rowSpan - 1 > 1 ? rowSpan - 1 : null);
14771
14876
  }
14772
14877
  });
14773
14878
  dom/* Dom.safeRemove */.i.safeRemove(row);
@@ -14786,8 +14891,7 @@ class Table extends component/* ViewComponent */.Hr {
14786
14891
  if ((box[i] && td && j + 1 >= box[i].length) ||
14787
14892
  td !== box[i][j + 1]) {
14788
14893
  if (td.nextSibling) {
14789
- td.parentNode &&
14790
- td.parentNode.insertBefore(cell, td.nextSibling);
14894
+ dom/* Dom.before */.i.before(td.nextSibling, cell);
14791
14895
  }
14792
14896
  else {
14793
14897
  td.parentNode && td.parentNode.appendChild(cell);
@@ -14798,13 +14902,12 @@ class Table extends component/* ViewComponent */.Hr {
14798
14902
  else {
14799
14903
  if (j - 1 < 0 ||
14800
14904
  (box[i][j] !== box[i][j - 1] && box[i][j].parentNode)) {
14801
- td.parentNode &&
14802
- td.parentNode.insertBefore(cell, box[i][j]);
14905
+ dom/* Dom.before */.i.before(box[i][j], cell);
14803
14906
  added = true;
14804
14907
  }
14805
14908
  }
14806
14909
  if (!added) {
14807
- box[i][j].setAttribute('colspan', (parseInt((0,helpers.attr)(box[i][j], 'colspan') || '1', 10) + 1).toString());
14910
+ (0,helpers.attr)(box[i][j], 'colspan', parseInt((0,helpers.attr)(box[i][j], 'colspan') || '1', 10) + 1);
14808
14911
  }
14809
14912
  }
14810
14913
  }
@@ -14929,15 +15032,15 @@ class Table extends component/* ViewComponent */.Hr {
14929
15032
  }
14930
15033
  if (box[i][j].hasAttribute('rowspan') &&
14931
15034
  box[i][j].rowSpan === 1) {
14932
- box[i][j].removeAttribute('rowspan');
15035
+ (0,helpers.attr)(box[i][j], 'rowspan', null);
14933
15036
  }
14934
15037
  if (box[i][j].hasAttribute('colspan') &&
14935
15038
  box[i][j].colSpan === 1) {
14936
- box[i][j].removeAttribute('colspan');
15039
+ (0,helpers.attr)(box[i][j], 'colspan', null);
14937
15040
  }
14938
15041
  if (box[i][j].hasAttribute('class') &&
14939
15042
  !(0,helpers.attr)(box[i][j], 'class')) {
14940
- box[i][j].removeAttribute('class');
15043
+ (0,helpers.attr)(box[i][j], 'class', null);
14941
15044
  }
14942
15045
  }
14943
15046
  }
@@ -15058,13 +15161,11 @@ class Table extends component/* ViewComponent */.Hr {
15058
15161
  static splitVertical(table, jodit) {
15059
15162
  let coord, td, percentage;
15060
15163
  const __marked = [];
15061
- Table.getSelectedCellsByTable(table).forEach((cell) => {
15164
+ Table.getSelectedCellsByTable(table).forEach(cell => {
15062
15165
  coord = Table.formalCoordinate(table, cell);
15063
15166
  if (cell.colSpan < 2) {
15064
15167
  Table.formalMatrix(table, (tdElm, i, j) => {
15065
- if (coord[1] === j &&
15066
- coord[0] !== i &&
15067
- tdElm !== cell) {
15168
+ if (coord[1] === j && coord[0] !== i && tdElm !== cell) {
15068
15169
  Table.__mark(tdElm, 'colspan', tdElm.colSpan + 1, __marked);
15069
15170
  }
15070
15171
  });
@@ -15091,12 +15192,13 @@ class Table extends component/* ViewComponent */.Hr {
15091
15192
  const box = Table.formalMatrix(table);
15092
15193
  for (let i = 0; i < box.length; i += 1) {
15093
15194
  const cell = box[i][column];
15094
- if (cell.colSpan > 1) {
15195
+ if (cell.colSpan > 1 && box.length > 1) {
15095
15196
  continue;
15096
15197
  }
15097
15198
  const w = cell.offsetWidth;
15098
15199
  const percent = ((w + delta) / table.offsetWidth) * 100;
15099
15200
  Table.__mark(cell, 'width', percent.toFixed(constants.ACCURACY) + '%', marked);
15201
+ break;
15100
15202
  }
15101
15203
  if (!noUnmark) {
15102
15204
  Table.__unmark(marked);
@@ -15118,20 +15220,10 @@ class Table extends component/* ViewComponent */.Hr {
15118
15220
  dom/* Dom.safeRemove */.i.safeRemove(cell);
15119
15221
  break;
15120
15222
  case 'rowspan':
15121
- if (value > 1) {
15122
- cell.setAttribute('rowspan', value.toString());
15123
- }
15124
- else {
15125
- cell.removeAttribute('rowspan');
15126
- }
15223
+ (0,helpers.attr)(cell, 'rowspan', value > 1 ? value : null);
15127
15224
  break;
15128
15225
  case 'colspan':
15129
- if (value > 1) {
15130
- cell.setAttribute('colspan', value.toString());
15131
- }
15132
- else {
15133
- cell.removeAttribute('colspan');
15134
- }
15226
+ (0,helpers.attr)(cell, 'colspan', value > 1 ? value : null);
15135
15227
  break;
15136
15228
  case 'width':
15137
15229
  cell.style.width = value.toString();
@@ -15329,6 +15421,7 @@ class Uploader extends component/* ViewComponent */.Hr {
15329
15421
  };
15330
15422
  return ajax
15331
15423
  .send()
15424
+ .then(resp => resp.json())
15332
15425
  .then(resp => {
15333
15426
  removeAjaxInstanceFromList();
15334
15427
  success.call(this, resp);
@@ -17450,6 +17543,7 @@ class cleanHtml extends Plugin {
17450
17543
  if (!nodeElm) {
17451
17544
  return work;
17452
17545
  }
17546
+ nodeElm = this.replaceIfMatched(nodeElm);
17453
17547
  if (this.isRemovableNode(nodeElm, current)) {
17454
17548
  remove.push(nodeElm);
17455
17549
  return this.visitNode(nodeElm.nextSibling, current, remove);
@@ -17525,6 +17619,18 @@ class cleanHtml extends Plugin {
17525
17619
  .on('keyup.cleanHtml', this.onKeyUpCleanUp)
17526
17620
  .on('beforeCommand.cleanHtml', this.beforeCommand);
17527
17621
  }
17622
+ replaceIfMatched(oldParent) {
17623
+ const replaceOldTags = this.j.o.cleanHTML.replaceOldTags;
17624
+ if (!replaceOldTags || !dom/* Dom.isHTMLElement */.i.isHTMLElement(oldParent)) {
17625
+ return oldParent;
17626
+ }
17627
+ const tagName = replaceOldTags[oldParent.nodeName.toLowerCase()] ||
17628
+ replaceOldTags[oldParent.nodeName];
17629
+ if (tagName) {
17630
+ return dom/* Dom.replace */.i.replace(oldParent, tagName, this.j.createInside, true, false);
17631
+ }
17632
+ return oldParent;
17633
+ }
17528
17634
  onChangeCleanHTML() {
17529
17635
  if (!this.allowEdit()) {
17530
17636
  return;
@@ -17539,9 +17645,7 @@ class cleanHtml extends Plugin {
17539
17645
  const oldParent = dom/* Dom.closest */.i.closest(current, tags, editor.editor);
17540
17646
  if (oldParent) {
17541
17647
  editor.s.save();
17542
- const tagName = replaceOldTags[oldParent.nodeName.toLowerCase()] ||
17543
- replaceOldTags[oldParent.nodeName];
17544
- dom/* Dom.replace */.i.replace(oldParent, tagName, editor.createInside, true, false);
17648
+ this.replaceIfMatched(oldParent);
17545
17649
  editor.s.restore();
17546
17650
  }
17547
17651
  }
@@ -17656,13 +17760,16 @@ class cleanHtml extends Plugin {
17656
17760
  if (this.isInlineBlock(node)) {
17657
17761
  shouldUnwrap.push(node);
17658
17762
  }
17763
+ if (dom/* Dom.isElement */.i.isElement(node) && (0,helpers.attr)(node, 'style')) {
17764
+ (0,helpers.attr)(node, 'style', null);
17765
+ }
17659
17766
  });
17660
17767
  shouldUnwrap.forEach(node => dom/* Dom.unwrap */.i.unwrap(node));
17661
17768
  const clearParent = (node, left) => {
17662
17769
  if (!findNotEmptySibling(node, left)) {
17663
17770
  const pn = node.parentNode;
17664
- if (pn && pn !== s.area && pn.getAttribute('style')) {
17665
- pn.removeAttribute('style');
17771
+ if (pn && pn !== s.area && (0,helpers.attr)(pn, 'style')) {
17772
+ (0,helpers.attr)(pn, 'style', null);
17666
17773
  clearParent(pn, left);
17667
17774
  return true;
17668
17775
  }
@@ -20632,15 +20739,16 @@ function image_image(editor) {
20632
20739
  config/* Config.prototype.controls.indent */.D.prototype.controls.indent = {
20633
20740
  tooltip: 'Increase Indent'
20634
20741
  };
20635
- const getKey = (direction) => direction === 'rtl' ? 'marginRight' : 'marginLeft';
20742
+ const getKey = (direction, box) => `${dom/* Dom.isCell */.i.isCell(box) ? 'padding' : 'margin'}${direction === 'rtl' ? 'Right' : 'Left'}`;
20636
20743
  config/* Config.prototype.controls.outdent */.D.prototype.controls.outdent = {
20637
20744
  isDisabled: (editor) => {
20638
20745
  const current = editor.s.current();
20639
20746
  if (current) {
20640
20747
  const currentBox = dom/* Dom.closest */.i.closest(current, dom/* Dom.isBlock */.i.isBlock, editor.editor);
20641
- const key = getKey(editor.o.direction);
20642
- if (currentBox && currentBox.style && currentBox.style[key]) {
20643
- return parseInt(currentBox.style[key], 10) <= 0;
20748
+ if (currentBox) {
20749
+ const arrow = getKey(editor.o.direction, currentBox);
20750
+ return (!currentBox.style[arrow] ||
20751
+ parseInt(currentBox.style[arrow], 10) <= 0);
20644
20752
  }
20645
20753
  }
20646
20754
  return true;
@@ -20649,7 +20757,6 @@ config/* Config.prototype.controls.outdent */.D.prototype.controls.outdent = {
20649
20757
  };
20650
20758
  config/* Config.prototype.indentMargin */.D.prototype.indentMargin = 10;
20651
20759
  function indent(editor) {
20652
- const key = getKey(editor.o.direction);
20653
20760
  editor
20654
20761
  .registerButton({
20655
20762
  name: 'indent',
@@ -20660,13 +20767,13 @@ function indent(editor) {
20660
20767
  group: 'indent'
20661
20768
  });
20662
20769
  const callback = (command) => {
20663
- const indentedBoxes = [];
20770
+ const processedElements = [];
20664
20771
  editor.s.eachSelection((current) => {
20665
20772
  editor.s.save();
20666
20773
  let currentBox = current
20667
20774
  ? dom/* Dom.up */.i.up(current, dom/* Dom.isBlock */.i.isBlock, editor.editor)
20668
20775
  : false;
20669
- const enter = editor.o.enter;
20776
+ const { enter } = editor.o;
20670
20777
  if (!currentBox && current) {
20671
20778
  currentBox = dom/* Dom.wrapInline */.i.wrapInline(current, enter !== constants.BR ? enter : constants.PARAGRAPH, editor);
20672
20779
  }
@@ -20674,9 +20781,10 @@ function indent(editor) {
20674
20781
  editor.s.restore();
20675
20782
  return false;
20676
20783
  }
20677
- const alreadyIndented = indentedBoxes.indexOf(currentBox) !== -1;
20678
- if (currentBox && currentBox.style && !alreadyIndented) {
20679
- indentedBoxes.push(currentBox);
20784
+ const alreadyIndented = processedElements.includes(currentBox);
20785
+ if (currentBox && !alreadyIndented) {
20786
+ const key = getKey(editor.o.direction, currentBox);
20787
+ processedElements.push(currentBox);
20680
20788
  let value = currentBox.style[key]
20681
20789
  ? parseInt(currentBox.style[key], 10)
20682
20790
  : 0;
@@ -20684,7 +20792,7 @@ function indent(editor) {
20684
20792
  editor.o.indentMargin * (command === 'outdent' ? -1 : 1);
20685
20793
  currentBox.style[key] = value > 0 ? value + 'px' : '';
20686
20794
  if (!(0,helpers.attr)(currentBox, 'style')) {
20687
- currentBox.removeAttribute('style');
20795
+ (0,helpers.attr)(currentBox, 'style', null);
20688
20796
  }
20689
20797
  }
20690
20798
  editor.s.restore();
@@ -23191,7 +23299,7 @@ let resizeHandler = class resizeHandler extends Plugin {
23191
23299
  this.j.unlock();
23192
23300
  }
23193
23301
  }
23194
- beforeDestruct(editor) {
23302
+ beforeDestruct() {
23195
23303
  dom/* Dom.safeRemove */.i.safeRemove(this.handle);
23196
23304
  this.j.e.off(this.j.ow, 'mouseup touchsend', this.onHandleResizeEnd);
23197
23305
  }
@@ -23316,9 +23424,7 @@ let size = class size extends Plugin {
23316
23424
  }
23317
23425
  }
23318
23426
  beforeDestruct(jodit) {
23319
- this.j.e
23320
- .off(this.j.ow, 'load.size', this.resizeWorkspaces)
23321
- .off('.size');
23427
+ jodit.e.off(jodit.ow, 'load.size', this.resizeWorkspaces).off('.size');
23322
23428
  }
23323
23429
  };
23324
23430
  size = (0,tslib_es6/* __decorate */.gn)([
@@ -23973,7 +24079,7 @@ class source extends Plugin {
23973
24079
  });
23974
24080
  }
23975
24081
  }
23976
- beforeDestruct(jodit) {
24082
+ beforeDestruct() {
23977
24083
  if (this.sourceEditor) {
23978
24084
  this.sourceEditor.destruct();
23979
24085
  delete this.sourceEditor;
@@ -25163,10 +25269,23 @@ class selectCells extends Plugin {
25163
25269
  dom/* Dom.safeRemove */.i.safeRemove(table);
25164
25270
  break;
25165
25271
  case 'binrow':
25166
- Table.removeRow(table, cell.parentNode.rowIndex);
25272
+ new Set(cells.map(td => td.parentNode)).forEach(row => {
25273
+ Table.removeRow(table, row.rowIndex);
25274
+ });
25167
25275
  break;
25168
25276
  case 'bincolumn':
25169
- Table.removeColumn(table, cell.cellIndex);
25277
+ {
25278
+ const columnsSet = new Set(), columns = cells.reduce((acc, td) => {
25279
+ if (!columnsSet.has(td.cellIndex)) {
25280
+ acc.push(td);
25281
+ columnsSet.add(td.cellIndex);
25282
+ }
25283
+ return acc;
25284
+ }, []);
25285
+ columns.forEach(td => {
25286
+ Table.removeColumn(table, td.cellIndex);
25287
+ });
25288
+ }
25170
25289
  break;
25171
25290
  case 'addcolumnafter':
25172
25291
  case 'addcolumnbefore':