jodit 3.8.2 → 3.8.3

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 (48) hide show
  1. package/.idea/workspace.xml +153 -155
  2. package/CHANGELOG.MD +36 -9
  3. package/app.css +2 -1
  4. package/build/jodit.css +73 -73
  5. package/build/jodit.es2018.css +56 -56
  6. package/build/jodit.es2018.en.css +56 -56
  7. package/build/jodit.es2018.en.js +172 -84
  8. package/build/jodit.es2018.en.min.css +1 -1
  9. package/build/jodit.es2018.en.min.js +2 -2
  10. package/build/jodit.es2018.js +172 -84
  11. package/build/jodit.es2018.min.css +1 -1
  12. package/build/jodit.es2018.min.js +2 -2
  13. package/build/jodit.js +835 -742
  14. package/build/jodit.min.css +2 -2
  15. package/build/jodit.min.js +2 -2
  16. package/package.json +7 -7
  17. package/src/config.ts +4 -4
  18. package/src/core/create.ts +15 -15
  19. package/src/core/helpers/css.ts +3 -5
  20. package/src/core/helpers/html/strip-tags.ts +36 -4
  21. package/src/core/helpers/selector.ts +6 -8
  22. package/src/core/helpers/size/get-scroll-parent.ts +28 -0
  23. package/src/core/helpers/size/index.ts +1 -0
  24. package/src/core/selection/select.ts +35 -45
  25. package/src/core/ui/button/button/button.less +4 -1
  26. package/src/core/ui/button/button/button.ts +6 -8
  27. package/src/core/ui/popup/popup.less +4 -4
  28. package/src/core/ui/popup/popup.ts +17 -7
  29. package/src/core/view/view-with-toolbar.less +3 -2
  30. package/src/jodit.ts +6 -3
  31. package/src/modules/dialog/dialog.ts +1 -2
  32. package/src/modules/file-browser/builders/context-menu.ts +1 -1
  33. package/src/modules/file-browser/listeners/state-listeners.ts +2 -1
  34. package/src/modules/file-browser/styles/preview.less +17 -14
  35. package/src/modules/widget/color-picker/color-picker.less +12 -11
  36. package/src/modules/widget/color-picker/color-picker.ts +20 -30
  37. package/src/plugins/clipboard/paste-storage/paste-storage.ts +9 -20
  38. package/src/plugins/fix/clean-html.ts +36 -3
  39. package/src/plugins/iframe.ts +12 -2
  40. package/src/plugins/link/link.ts +14 -2
  41. package/src/plugins/resizer/resizer.ts +22 -4
  42. package/src/plugins/size/resize-handler.ts +1 -1
  43. package/src/plugins/size/size.less +10 -7
  44. package/src/plugins/symbols/symbols.less +12 -7
  45. package/src/plugins/symbols/symbols.ts +9 -6
  46. package/src/plugins/xpath/xpath.ts +1 -1
  47. package/src/styles/jodit.less +1 -1
  48. package/src/types/ui.d.ts +9 -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.2
4
+ * Version: v3.8.3
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -193,10 +193,6 @@ class Config {
193
193
  this.sizeMD = 700;
194
194
  this.sizeSM = 400;
195
195
  this.buttons = [
196
- {
197
- group: 'source',
198
- buttons: []
199
- },
200
196
  {
201
197
  group: 'font-style',
202
198
  buttons: []
@@ -250,6 +246,10 @@ class Config {
250
246
  group: 'search',
251
247
  buttons: []
252
248
  },
249
+ {
250
+ group: 'source',
251
+ buttons: []
252
+ },
253
253
  {
254
254
  group: 'other',
255
255
  buttons: []
@@ -955,7 +955,7 @@ class EventsNative {
955
955
 
956
956
  // EXTERNAL MODULE: ./node_modules/tslib/tslib.es6.js
957
957
  var tslib_es6 = __webpack_require__(39);
958
- // EXTERNAL MODULE: ./src/core/helpers/index.ts + 31 modules
958
+ // EXTERNAL MODULE: ./src/core/helpers/index.ts + 32 modules
959
959
  var helpers = __webpack_require__(8);
960
960
  // EXTERNAL MODULE: ./src/core/decorators/index.ts + 9 modules
961
961
  var decorators = __webpack_require__(36);
@@ -1191,6 +1191,7 @@ __webpack_require__.d(__webpack_exports__, {
1191
1191
  "get": () => (/* reexport */ utils/* get */.U2),
1192
1192
  "getClassName": () => (/* reexport */ utils/* getClassName */.gj),
1193
1193
  "getContentWidth": () => (/* reexport */ getContentWidth),
1194
+ "getScrollParent": () => (/* reexport */ getScrollParent),
1194
1195
  "getXPathByElement": () => (/* reexport */ getXPathByElement),
1195
1196
  "hasBrowserColorPicker": () => (/* reexport */ checker/* hasBrowserColorPicker */.EO),
1196
1197
  "hasContainer": () => (/* reexport */ checker/* hasContainer */.Zt),
@@ -1248,6 +1249,7 @@ __webpack_require__.d(__webpack_exports__, {
1248
1249
  "refs": () => (/* reexport */ refs),
1249
1250
  "reset": () => (/* reexport */ utils/* reset */.mc),
1250
1251
  "resolveElement": () => (/* reexport */ resolveElement),
1252
+ "safeHTML": () => (/* reexport */ safeHTML),
1251
1253
  "scrollIntoViewIfNeeded": () => (/* reexport */ scrollIntoViewIfNeeded),
1252
1254
  "set": () => (/* reexport */ utils/* set */.t8),
1253
1255
  "setTimeout": () => (/* reexport */ set_timeout_setTimeout),
@@ -1704,6 +1706,7 @@ function htmlspecialchars(html) {
1704
1706
 
1705
1707
 
1706
1708
 
1709
+
1707
1710
  function stripTags(html, doc = document) {
1708
1711
  const tmp = doc.createElement('div');
1709
1712
  if ((0,checker/* isString */.HD)(html)) {
@@ -1727,6 +1730,25 @@ function stripTags(html, doc = document) {
1727
1730
  });
1728
1731
  return (0,string/* trim */.fy)(tmp.innerText) || '';
1729
1732
  }
1733
+ function safeHTML(box, options) {
1734
+ if (!dom/* Dom.isElement */.i.isElement(box)) {
1735
+ return;
1736
+ }
1737
+ const removeOnError = (elm) => (0,utils/* attr */.Lj)(elm, 'onerror', null), safeLink = (elm) => {
1738
+ const href = elm.getAttribute('href');
1739
+ if (href && href.trim().indexOf('javascript') === 0) {
1740
+ (0,utils/* attr */.Lj)(elm, 'href', location.protocol + '//' + href);
1741
+ }
1742
+ };
1743
+ if (options.removeOnError) {
1744
+ removeOnError(box);
1745
+ $$('[onerror]', box).forEach(removeOnError);
1746
+ }
1747
+ if (options.safeJavaScriptLink) {
1748
+ safeLink(box);
1749
+ $$('a[href^="javascript"]', box).forEach(safeLink);
1750
+ }
1751
+ }
1730
1752
 
1731
1753
  ;// CONCATENATED MODULE: ./src/core/helpers/html/nl2br.ts
1732
1754
  /*!
@@ -1763,6 +1785,31 @@ const getContentWidth = (element, win) => {
1763
1785
  return width - paddingLeft - paddingRight;
1764
1786
  };
1765
1787
 
1788
+ // EXTERNAL MODULE: ./src/core/helpers/css.ts
1789
+ var css = __webpack_require__(31);
1790
+ ;// CONCATENATED MODULE: ./src/core/helpers/size/get-scroll-parent.ts
1791
+ /*!
1792
+ * Jodit Editor (https://xdsoft.net/jodit/)
1793
+ * Released under MIT see LICENSE.txt in the project root for license information.
1794
+ * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
1795
+ */
1796
+
1797
+
1798
+ function getScrollParent(node) {
1799
+ const isElement = dom/* Dom.isHTMLElement */.i.isHTMLElement(node);
1800
+ const overflowY = isElement && (0,css/* css */.i)(node, 'overflowY');
1801
+ const isScrollable = isElement && overflowY !== 'visible' && overflowY !== 'hidden';
1802
+ if (!node) {
1803
+ return null;
1804
+ }
1805
+ else if (isScrollable && node.scrollHeight >= node.clientHeight) {
1806
+ return node;
1807
+ }
1808
+ return (getScrollParent(node.parentNode) ||
1809
+ document.scrollingElement ||
1810
+ document.body);
1811
+ }
1812
+
1766
1813
  ;// CONCATENATED MODULE: ./src/core/helpers/size/inner-width.ts
1767
1814
  /*!
1768
1815
  * Jodit Editor (https://xdsoft.net/jodit/)
@@ -1858,6 +1905,7 @@ function position(elm, jodit, recurse = false) {
1858
1905
 
1859
1906
 
1860
1907
 
1908
+
1861
1909
  ;// CONCATENATED MODULE: ./src/core/helpers/complete-url.ts
1862
1910
  /*!
1863
1911
  * Jodit Editor (https://xdsoft.net/jodit/)
@@ -2038,8 +2086,6 @@ const convertMediaUrlToVideoEmbed = (url, width = 400, height = 345) => {
2038
2086
  return url;
2039
2087
  };
2040
2088
 
2041
- // EXTERNAL MODULE: ./src/core/helpers/css.ts
2042
- var css = __webpack_require__(31);
2043
2089
  ;// CONCATENATED MODULE: ./src/core/helpers/ctrl-key.ts
2044
2090
  /*!
2045
2091
  * Jodit Editor (https://xdsoft.net/jodit/)
@@ -2559,7 +2605,7 @@ var STATUSES;
2559
2605
  STATUSES["destructed"] = "destructed";
2560
2606
  })(STATUSES || (STATUSES = {}));
2561
2607
 
2562
- // EXTERNAL MODULE: ./src/core/helpers/index.ts + 31 modules
2608
+ // EXTERNAL MODULE: ./src/core/helpers/index.ts + 32 modules
2563
2609
  var helpers = __webpack_require__(8);
2564
2610
  // EXTERNAL MODULE: ./src/core/global.ts
2565
2611
  var global = __webpack_require__(13);
@@ -3988,7 +4034,7 @@ const ucfirst = (value) => {
3988
4034
  var config = __webpack_require__(1);
3989
4035
  // EXTERNAL MODULE: ./src/core/helpers/default-language.ts
3990
4036
  var default_language = __webpack_require__(26);
3991
- // EXTERNAL MODULE: ./src/core/helpers/index.ts + 31 modules
4037
+ // EXTERNAL MODULE: ./src/core/helpers/index.ts + 32 modules
3992
4038
  var helpers = __webpack_require__(8);
3993
4039
  // EXTERNAL MODULE: ./src/core/global.ts
3994
4040
  var global = __webpack_require__(13);
@@ -4831,7 +4877,7 @@ var tslib_es6 = __webpack_require__(39);
4831
4877
  var ui_element = __webpack_require__(28);
4832
4878
  // EXTERNAL MODULE: ./src/core/dom.ts
4833
4879
  var dom = __webpack_require__(15);
4834
- // EXTERNAL MODULE: ./src/core/helpers/index.ts + 31 modules
4880
+ // EXTERNAL MODULE: ./src/core/helpers/index.ts + 32 modules
4835
4881
  var helpers = __webpack_require__(8);
4836
4882
  // EXTERNAL MODULE: ./src/core/ui/icon.ts
4837
4883
  var icon = __webpack_require__(30);
@@ -4861,7 +4907,7 @@ const UIButtonState = () => ({
4861
4907
  type: 'button',
4862
4908
  name: '',
4863
4909
  value: '',
4864
- status: '',
4910
+ status: 'initial',
4865
4911
  disabled: false,
4866
4912
  activated: false,
4867
4913
  icon: {
@@ -5147,7 +5193,7 @@ var get_control_type = __webpack_require__(35);
5147
5193
  var config = __webpack_require__(1);
5148
5194
  // EXTERNAL MODULE: ./src/core/helpers/checker/index.ts + 14 modules
5149
5195
  var checker = __webpack_require__(16);
5150
- // EXTERNAL MODULE: ./src/core/helpers/index.ts + 31 modules
5196
+ // EXTERNAL MODULE: ./src/core/helpers/index.ts + 32 modules
5151
5197
  var helpers = __webpack_require__(8);
5152
5198
  ;// CONCATENATED MODULE: ./src/core/ui/helpers/get-strong-control-types.ts
5153
5199
  /*!
@@ -5373,7 +5419,7 @@ __webpack_require__.d(__webpack_exports__, {
5373
5419
  "watch": () => (/* reexport */ watch)
5374
5420
  });
5375
5421
 
5376
- // EXTERNAL MODULE: ./src/core/helpers/index.ts + 31 modules
5422
+ // EXTERNAL MODULE: ./src/core/helpers/index.ts + 32 modules
5377
5423
  var helpers = __webpack_require__(8);
5378
5424
  ;// CONCATENATED MODULE: ./src/core/decorators/cache.ts
5379
5425
  /*!
@@ -6320,7 +6366,7 @@ __webpack_require__.d(__webpack_exports__, {
6320
6366
  var tslib_es6 = __webpack_require__(39);
6321
6367
  // EXTERNAL MODULE: ./src/core/dom.ts
6322
6368
  var dom = __webpack_require__(15);
6323
- // EXTERNAL MODULE: ./src/core/helpers/index.ts + 31 modules
6369
+ // EXTERNAL MODULE: ./src/core/helpers/index.ts + 32 modules
6324
6370
  var helpers = __webpack_require__(8);
6325
6371
  // EXTERNAL MODULE: ./src/core/global.ts
6326
6372
  var global = __webpack_require__(13);
@@ -6442,6 +6488,9 @@ class Popup extends ui_element/* UIElement */.u {
6442
6488
  this.childrenPopups.forEach(popup => popup.updatePosition());
6443
6489
  return this;
6444
6490
  }
6491
+ throttleUpdatePosition() {
6492
+ this.updatePosition();
6493
+ }
6445
6494
  calculatePosition(target, view, container, defaultStrategy = this.strategy) {
6446
6495
  const x = {
6447
6496
  left: target.left,
@@ -6516,7 +6565,7 @@ class Popup extends ui_element/* UIElement */.u {
6516
6565
  this.close();
6517
6566
  }
6518
6567
  addGlobalListeners() {
6519
- const up = this.updatePosition, ow = this.ow;
6568
+ const up = this.throttleUpdatePosition, ow = this.ow;
6520
6569
  global/* eventEmitter.on */.TB.on('closeAllPopups', this.close);
6521
6570
  if (this.smart) {
6522
6571
  this.j.e
@@ -6530,9 +6579,12 @@ class Popup extends ui_element/* UIElement */.u {
6530
6579
  .on(this.container, 'scroll mousewheel', up)
6531
6580
  .on(ow, 'scroll', up)
6532
6581
  .on(ow, 'resize', up);
6582
+ dom/* Dom.up */.i.up(this.j.container, box => {
6583
+ box && this.j.e.on(box, 'scroll mousewheel', up);
6584
+ });
6533
6585
  }
6534
6586
  removeGlobalListeners() {
6535
- const up = this.updatePosition, ow = this.ow;
6587
+ const up = this.throttleUpdatePosition, ow = this.ow;
6536
6588
  global/* eventEmitter.off */.TB.off('closeAllPopups', this.close);
6537
6589
  if (this.smart) {
6538
6590
  this.j.e
@@ -6546,6 +6598,9 @@ class Popup extends ui_element/* UIElement */.u {
6546
6598
  .off(this.container, 'scroll mousewheel', up)
6547
6599
  .off(ow, 'scroll', up)
6548
6600
  .off(ow, 'resize', up);
6601
+ dom/* Dom.up */.i.up(this.j.container, box => {
6602
+ box && this.j.e.off(box, 'scroll mousewheel', up);
6603
+ });
6549
6604
  }
6550
6605
  setZIndex(index) {
6551
6606
  this.container.style.zIndex = index.toString();
@@ -6558,6 +6613,10 @@ class Popup extends ui_element/* UIElement */.u {
6558
6613
  (0,tslib_es6/* __decorate */.gn)([
6559
6614
  decorators.autobind
6560
6615
  ], Popup.prototype, "updatePosition", null);
6616
+ (0,tslib_es6/* __decorate */.gn)([
6617
+ (0,decorators.throttle)(10),
6618
+ decorators.autobind
6619
+ ], Popup.prototype, "throttleUpdatePosition", null);
6561
6620
  (0,tslib_es6/* __decorate */.gn)([
6562
6621
  decorators.autobind
6563
6622
  ], Popup.prototype, "close", null);
@@ -6605,7 +6664,7 @@ var tslib_es6 = __webpack_require__(39);
6605
6664
  var group = __webpack_require__(38);
6606
6665
  // EXTERNAL MODULE: ./src/core/ui/element.ts
6607
6666
  var ui_element = __webpack_require__(28);
6608
- // EXTERNAL MODULE: ./src/core/helpers/index.ts + 31 modules
6667
+ // EXTERNAL MODULE: ./src/core/helpers/index.ts + 32 modules
6609
6668
  var helpers = __webpack_require__(8);
6610
6669
  // EXTERNAL MODULE: ./src/core/dom.ts
6611
6670
  var dom = __webpack_require__(15);
@@ -11386,7 +11445,7 @@ __webpack_require__.d(__webpack_exports__, {
11386
11445
  "IL": () => (/* reexport */ TabsWidget)
11387
11446
  });
11388
11447
 
11389
- // EXTERNAL MODULE: ./src/core/helpers/index.ts + 31 modules
11448
+ // EXTERNAL MODULE: ./src/core/helpers/index.ts + 32 modules
11390
11449
  var helpers = __webpack_require__(8);
11391
11450
  // EXTERNAL MODULE: ./src/core/ui/index.ts + 1 modules
11392
11451
  var ui = __webpack_require__(27);
@@ -11403,46 +11462,31 @@ var dom = __webpack_require__(15);
11403
11462
 
11404
11463
 
11405
11464
  const ColorPickerWidget = (editor, callback, coldColor) => {
11406
- const valueHex = (0,helpers.normalizeColor)(coldColor), form = editor.c.div('jodit-color-picker'), iconPalette = editor.o.textIcons
11465
+ const cn = 'jodit-color-picker', valueHex = (0,helpers.normalizeColor)(coldColor), form = editor.c.div(cn), iconPalette = editor.o.textIcons
11407
11466
  ? `<span>${editor.i18n('palette')}</span>`
11408
11467
  : ui/* Icon.get */.JO.get('palette'), eachColor = (colors) => {
11409
11468
  const stack = [];
11410
11469
  if ((0,helpers.isPlainObject)(colors)) {
11411
11470
  Object.keys(colors).forEach(key => {
11412
- stack.push('<div class="jodit-color-picker__group jodit-color-picker__group-' +
11413
- key +
11414
- '">');
11471
+ stack.push(`<div class="${cn}__group ${cn}__group-${key}">`);
11415
11472
  stack.push(eachColor(colors[key]));
11416
11473
  stack.push('</div>');
11417
11474
  });
11418
11475
  }
11419
11476
  else if ((0,helpers.isArray)(colors)) {
11420
11477
  colors.forEach(color => {
11421
- stack.push('<a ' +
11422
- (valueHex === color
11423
- ? ' class="jodit_active" '
11424
- : '') +
11425
- ' title="' +
11426
- color +
11427
- '" style="background-color:' +
11428
- color +
11429
- '" data-color="' +
11430
- color +
11431
- '" href="javascript:void(0)"></a>');
11478
+ stack.push(`<span class='${cn}__color-item ${valueHex === color
11479
+ ? cn + '__color-item_active_true'
11480
+ : ''}' title="${color}" style="background-color:${color}" data-color="${color}"></span>`);
11432
11481
  });
11433
11482
  }
11434
11483
  return stack.join('');
11435
11484
  };
11436
- form.appendChild(editor.c.fromHTML('<div class="jodit-color-picker__groups">' +
11437
- eachColor(editor.o.colors) +
11438
- '</div>'));
11439
- form.appendChild(editor.c.fromHTML('<div data-ref="extra" class="jodit-color-picker__extra"></div>'));
11485
+ form.appendChild(editor.c.fromHTML(`<div class="${cn}__groups">${eachColor(editor.o.colors)}</div>`));
11486
+ form.appendChild(editor.c.fromHTML(`<div data-ref="extra" class="${cn}__extra"></div>`));
11440
11487
  const { extra } = (0,helpers.refs)(form);
11441
11488
  if (editor.o.showBrowserColorPicker && (0,helpers.hasBrowserColorPicker)()) {
11442
- extra.appendChild(editor.c.fromHTML('<div class="jodit-color-picker__native">' +
11443
- iconPalette +
11444
- '<input type="color" value="#ffffff"/>' +
11445
- '</div>'));
11489
+ extra.appendChild(editor.c.fromHTML(`<div class="${cn}__native">${iconPalette}<input type="color" value="#ffffff"/></div>`));
11446
11490
  editor.e.on(form, 'change', (e) => {
11447
11491
  e.stopPropagation();
11448
11492
  const target = e.target;
@@ -11464,13 +11508,14 @@ const ColorPickerWidget = (editor, callback, coldColor) => {
11464
11508
  dom/* Dom.isTag */.i.isTag(target, 'svg') ||
11465
11509
  dom/* Dom.isTag */.i.isTag(target, 'path')) &&
11466
11510
  target.parentNode) {
11467
- target = dom/* Dom.closest */.i.closest(target.parentNode, 'a', editor.editor);
11511
+ target = dom/* Dom.closest */.i.closest(target.parentNode, 'span', editor.editor);
11468
11512
  }
11469
- if (!dom/* Dom.isTag */.i.isTag(target, 'a')) {
11513
+ if (!dom/* Dom.isTag */.i.isTag(target, 'span') ||
11514
+ !target.classList.contains(cn + '__color-item')) {
11470
11515
  return;
11471
11516
  }
11472
11517
  const color = (0,helpers.attr)(target, '-color') || '';
11473
- if (callback && typeof callback === 'function') {
11518
+ if (callback && (0,helpers.isFunction)(callback)) {
11474
11519
  callback(color);
11475
11520
  }
11476
11521
  e.preventDefault();
@@ -12749,7 +12794,7 @@ var config = __webpack_require__(1);
12749
12794
  var constants = __webpack_require__(2);
12750
12795
  // EXTERNAL MODULE: ./src/core/events/index.ts + 3 modules
12751
12796
  var events = __webpack_require__(3);
12752
- // EXTERNAL MODULE: ./src/core/helpers/index.ts + 31 modules
12797
+ // EXTERNAL MODULE: ./src/core/helpers/index.ts + 32 modules
12753
12798
  var helpers = __webpack_require__(8);
12754
12799
  ;// CONCATENATED MODULE: ./src/core/async.ts
12755
12800
  /*!
@@ -13330,7 +13375,7 @@ class View extends component/* Component */.wA {
13330
13375
  this.isView = true;
13331
13376
  this.mods = {};
13332
13377
  this.components = new Set();
13333
- this.version = "3.8.2";
13378
+ this.version = "3.8.3";
13334
13379
  this.async = new Async();
13335
13380
  this.buffer = Storage.makeStorage();
13336
13381
  this.storage = Storage.makeStorage(true, this.componentName);
@@ -13428,10 +13473,10 @@ class View extends component/* Component */.wA {
13428
13473
  return this.__isFullSize;
13429
13474
  }
13430
13475
  getVersion() {
13431
- return "3.8.2";
13476
+ return "3.8.3";
13432
13477
  }
13433
13478
  static getVersion() {
13434
- return "3.8.2";
13479
+ return "3.8.3";
13435
13480
  }
13436
13481
  initOptions(options) {
13437
13482
  this.options = (0,helpers.ConfigProto)(options || {}, (0,helpers.ConfigProto)(this.options || {}, View.defaultOptions));
@@ -14842,7 +14887,7 @@ class Create {
14842
14887
  }
14843
14888
  }
14844
14889
  if (children) {
14845
- (0,helpers.asArray)(children).forEach((child) => elm.appendChild(typeof child === 'string' ? this.fromHTML(child) : child));
14890
+ (0,helpers.asArray)(children).forEach((child) => elm.appendChild((0,helpers.isString)(child) ? this.fromHTML(child) : child));
14846
14891
  }
14847
14892
  return elm;
14848
14893
  }
@@ -15688,7 +15733,7 @@ function stateListeners() {
15688
15733
  source.folders.forEach((name) => {
15689
15734
  const folderElm = create.a(F_CLASS + '__tree-item', {
15690
15735
  draggable: 'draggable',
15691
- href: 'javascript:void(0)',
15736
+ href: '#',
15692
15737
  'data-path': (0,normalize/* normalizePath */.AH)(source.path, name + '/'),
15693
15738
  'data-name': name,
15694
15739
  'data-source': sourceName,
@@ -15701,6 +15746,7 @@ function stateListeners() {
15701
15746
  source: sourceName
15702
15747
  });
15703
15748
  e.stopPropagation();
15749
+ e.preventDefault();
15704
15750
  };
15705
15751
  this.e.on(folderElm, 'click', action('openFolder'));
15706
15752
  this.tree.appendChild(folderElm);
@@ -16401,7 +16447,7 @@ function openImageEditor(href, name, path, source, onSuccess, onFailed) {
16401
16447
 
16402
16448
 
16403
16449
 
16404
- const CLASS_PREVIEW = F_CLASS + '_preview_', preview_tpl_next = (next = 'next', right = 'right') => `<a href="javascript:void(0)" class="${CLASS_PREVIEW}navigation ${CLASS_PREVIEW}navigation-${next}">` +
16450
+ const CLASS_PREVIEW = F_CLASS + '_preview_', preview_tpl_next = (next = 'next', right = 'right') => `<div class="${CLASS_PREVIEW}navigation ${CLASS_PREVIEW}navigation-${next}">` +
16405
16451
  '' +
16406
16452
  ui/* Icon.get */.JO.get('angle-' + right) +
16407
16453
  '</a>';
@@ -17627,6 +17673,7 @@ class Select {
17627
17673
  }) {
17628
17674
  var _a, _b;
17629
17675
  if (!this.isFocused()) {
17676
+ const scrollParent = (0,helpers.getScrollParent)(this.j.container), scrollTop = scrollParent === null || scrollParent === void 0 ? void 0 : scrollParent.scrollTop;
17630
17677
  if (this.j.iframe) {
17631
17678
  if (this.doc.readyState === 'complete') {
17632
17679
  this.j.iframe.focus();
@@ -17634,6 +17681,9 @@ class Select {
17634
17681
  }
17635
17682
  this.win.focus();
17636
17683
  this.area.focus(options);
17684
+ if (scrollTop) {
17685
+ scrollParent === null || scrollParent === void 0 ? void 0 : scrollParent.scrollTo(0, scrollTop);
17686
+ }
17637
17687
  const sel = this.sel, range = (sel === null || sel === void 0 ? void 0 : sel.rangeCount) ? sel === null || sel === void 0 ? void 0 : sel.getRangeAt(0) : null;
17638
17688
  if (!range || !dom/* Dom.isOrContains */.i.isOrContains(this.area, range.startContainer)) {
17639
17689
  const range = this.createRange();
@@ -17718,6 +17768,7 @@ class Select {
17718
17768
  insertNode(node, insertCursorAfter = true, fireChange = true) {
17719
17769
  var _a;
17720
17770
  this.errorNode(node);
17771
+ this.j.e.fire('safeHTML', node);
17721
17772
  if (!this.isFocused() && this.j.isEditorMode()) {
17722
17773
  this.focus();
17723
17774
  this.restore();
@@ -17812,7 +17863,7 @@ class Select {
17812
17863
  String(dw).indexOf('%') < 0) {
17813
17864
  dw += 'px';
17814
17865
  }
17815
- (0,helpers.css)(image, 'width', dw);
17866
+ (0,helpers.call)(this.j.o.resizer.forImageChangeAttributes ? helpers.attr : helpers.css, image, 'width', dw);
17816
17867
  }
17817
17868
  if (styles && typeof styles === 'object') {
17818
17869
  (0,helpers.css)(image, styles);
@@ -19930,11 +19981,14 @@ class Jodit extends ViewWithToolbar {
19930
19981
  return this.getElementValue();
19931
19982
  }
19932
19983
  setNativeEditorValue(value) {
19933
- if (this.e.fire('beforeSetNativeEditorValue', value)) {
19984
+ const data = {
19985
+ value
19986
+ };
19987
+ if (this.e.fire('beforeSetNativeEditorValue', data)) {
19934
19988
  return;
19935
19989
  }
19936
19990
  if (this.editor) {
19937
- this.editor.innerHTML = value;
19991
+ this.editor.innerHTML = data.value;
19938
19992
  }
19939
19993
  }
19940
19994
  getEditorValue(removeSelectionMarkers = true) {
@@ -21564,7 +21618,9 @@ config/* Config.prototype.cleanHTML */.D.prototype.cleanHTML = {
21564
21618
  b: 'strong'
21565
21619
  },
21566
21620
  allowTags: false,
21567
- denyTags: false
21621
+ denyTags: false,
21622
+ removeOnError: true,
21623
+ safeJavaScriptLink: true
21568
21624
  };
21569
21625
  config/* Config.prototype.controls.eraser */.D.prototype.controls.eraser = {
21570
21626
  command: 'removeFormat',
@@ -21664,6 +21720,7 @@ class cleanHtml extends Plugin {
21664
21720
  return;
21665
21721
  }
21666
21722
  const editor = this.j;
21723
+ this.onSafeHTML(editor.editor);
21667
21724
  const current = editor.s.current();
21668
21725
  const replaceOldTags = editor.o.cleanHTML.replaceOldTags;
21669
21726
  if (replaceOldTags && current) {
@@ -21841,6 +21898,16 @@ class cleanHtml extends Plugin {
21841
21898
  }
21842
21899
  return false;
21843
21900
  }
21901
+ onBeforeSetNativeEditorValue(data) {
21902
+ const sandBox = this.j.createInside.div();
21903
+ sandBox.innerHTML = data.value;
21904
+ this.onSafeHTML(sandBox);
21905
+ data.value = sandBox.innerHTML;
21906
+ return false;
21907
+ }
21908
+ onSafeHTML(sandBox) {
21909
+ (0,helpers.safeHTML)(sandBox, this.j.o.cleanHTML);
21910
+ }
21844
21911
  beforeDestruct() {
21845
21912
  this.j.e.off('.cleanHtml');
21846
21913
  }
@@ -21851,6 +21918,12 @@ class cleanHtml extends Plugin {
21851
21918
  (0,tslib_es6/* __decorate */.gn)([
21852
21919
  decorators.autobind
21853
21920
  ], cleanHtml.prototype, "isInlineBlock", null);
21921
+ (0,tslib_es6/* __decorate */.gn)([
21922
+ (0,decorators.watch)(':beforeSetNativeEditorValue')
21923
+ ], cleanHtml.prototype, "onBeforeSetNativeEditorValue", null);
21924
+ (0,tslib_es6/* __decorate */.gn)([
21925
+ (0,decorators.watch)(':safeHTML')
21926
+ ], cleanHtml.prototype, "onSafeHTML", null);
21854
21927
 
21855
21928
  ;// CONCATENATED MODULE: ./src/plugins/fix/wrap-text-nodes.ts
21856
21929
  /*!
@@ -22358,6 +22431,7 @@ class paste extends Plugin {
22358
22431
 
22359
22432
 
22360
22433
 
22434
+
22361
22435
  class pasteStorage extends Plugin {
22362
22436
  constructor() {
22363
22437
  super(...arguments);
@@ -22439,7 +22513,7 @@ class pasteStorage extends Plugin {
22439
22513
  a.textContent =
22440
22514
  index + 1 + '. ' + html.replace((0,constants.SPACE_REG_EXP)(), '');
22441
22515
  this.j.e.on(a, 'keydown', this.onKeyDown);
22442
- (0,helpers.attr)(a, 'href', 'javascript:void(0)');
22516
+ (0,helpers.attr)(a, 'href', '#');
22443
22517
  (0,helpers.attr)(a, 'data-index', index.toString());
22444
22518
  (0,helpers.attr)(a, 'tab-index', '-1');
22445
22519
  this.listBox && this.listBox.appendChild(a);
@@ -22454,18 +22528,10 @@ class pasteStorage extends Plugin {
22454
22528
  this.dialog = new Dialog({
22455
22529
  language: this.j.o.language
22456
22530
  });
22457
- const pasteButton = this.j.c.fromHTML('<a href="javascript:void(0)" style="float:right;" class="jodit-button">' +
22458
- '<span>' +
22459
- this.j.i18n('Paste') +
22460
- '</span>' +
22461
- '</a>');
22462
- this.j.e.on(pasteButton, 'click', this.paste);
22463
- const cancelButton = this.j.c.fromHTML('<a href="javascript:void(0)" style="float:right; margin-right: 10px;" class="jodit-button">' +
22464
- '<span>' +
22465
- this.j.i18n('Cancel') +
22466
- '</span>' +
22467
- '</a>');
22468
- this.j.e.on(cancelButton, 'click', this.dialog.close);
22531
+ const pasteButton = (0,ui/* Button */.zx)(this.j, 'paste', 'Paste', 'primary');
22532
+ pasteButton.onAction(this.paste);
22533
+ const cancelButton = (0,ui/* Button */.zx)(this.j, '', 'Cancel');
22534
+ cancelButton.onAction(this.dialog.close);
22469
22535
  this.container = this.j.c.div();
22470
22536
  this.container.classList.add('jodit-paste-storage');
22471
22537
  this.listBox = this.j.c.div();
@@ -23984,7 +24050,7 @@ function iframe(editor) {
23984
24050
  editor.e
23985
24051
  .on('beforeGetNativeEditorValue', () => clearMarkers(editor.o.iframeDoctype +
23986
24052
  doc.documentElement.outerHTML))
23987
- .on('beforeSetNativeEditorValue', (value) => {
24053
+ .on('beforeSetNativeEditorValue', ({ value }) => {
23988
24054
  if (editor.isLocked) {
23989
24055
  return false;
23990
24056
  }
@@ -23997,15 +24063,17 @@ function iframe(editor) {
23997
24063
  clearMarkers(value));
23998
24064
  doc.close();
23999
24065
  editor.editor = doc.body;
24066
+ editor.e.fire('safeHTML', editor.editor);
24000
24067
  toggleEditable();
24001
24068
  editor.e.fire('prepareWYSIWYGEditor');
24069
+ editor.e.stopPropagation('beforeSetNativeEditorValue');
24002
24070
  }
24003
24071
  }
24004
24072
  else {
24005
24073
  doc.body.innerHTML = value;
24006
24074
  }
24007
24075
  return true;
24008
- });
24076
+ }, undefined, true);
24009
24077
  }
24010
24078
  editor.editor = doc.body;
24011
24079
  editor.e.on('afterSetMode afterInit afterAddPlace', toggleEditable);
@@ -25599,6 +25667,7 @@ class link_link extends Plugin {
25599
25667
  const snapshot = jodit.observer.snapshot.make();
25600
25668
  if (unlink) {
25601
25669
  jodit.e.on(unlink, 'click', (e) => {
25670
+ jodit.s.restore();
25602
25671
  jodit.observer.snapshot.restore(snapshot);
25603
25672
  if (link) {
25604
25673
  dom/* Dom.unwrap */.i.unwrap(link);
@@ -25615,6 +25684,7 @@ class link_link extends Plugin {
25615
25684
  return false;
25616
25685
  }
25617
25686
  let links;
25687
+ jodit.s.restore();
25618
25688
  jodit.s.removeMarkers();
25619
25689
  jodit.editor.normalize();
25620
25690
  jodit.observer.snapshot.restore(snapshot);
@@ -25635,6 +25705,7 @@ class link_link extends Plugin {
25635
25705
  jodit.s.insertNode(a, false, false);
25636
25706
  links = [a];
25637
25707
  }
25708
+ links.forEach(link => jodit.s.select(link));
25638
25709
  }
25639
25710
  else {
25640
25711
  links = [link];
@@ -25665,13 +25736,18 @@ class link_link extends Plugin {
25665
25736
  }
25666
25737
  }
25667
25738
  if (!isImageContent) {
25739
+ let newContent = a.textContent;
25668
25740
  if (content_input.value.trim().length) {
25669
25741
  if (textWasChanged) {
25670
- a.textContent = content_input.value;
25742
+ newContent = content_input.value;
25671
25743
  }
25672
25744
  }
25673
25745
  else {
25674
- a.textContent = url_input.value;
25746
+ newContent = url_input.value;
25747
+ }
25748
+ const content = a.textContent;
25749
+ if (newContent !== content) {
25750
+ a.textContent = newContent;
25675
25751
  }
25676
25752
  }
25677
25753
  if (openInNewTabCheckbox && target_checkbox) {
@@ -26344,6 +26420,7 @@ config/* Config.prototype.allowResizeTags */.D.prototype.allowResizeTags = ['img
26344
26420
  config/* Config.prototype.resizer */.D.prototype.resizer = {
26345
26421
  showSize: true,
26346
26422
  hideSizeTimeout: 1000,
26423
+ forImageChangeAttributes: true,
26347
26424
  min_width: 10,
26348
26425
  min_height: 10
26349
26426
  };
@@ -26411,14 +26488,14 @@ class resizer extends Plugin {
26411
26488
  }
26412
26489
  if (new_w > this.j.o.resizer.min_width) {
26413
26490
  if (new_w < this.rect.parentNode.offsetWidth) {
26414
- (0,helpers.css)(this.element, 'width', new_w);
26491
+ this.applySize(this.element, 'width', new_w);
26415
26492
  }
26416
26493
  else {
26417
- (0,helpers.css)(this.element, 'width', '100%');
26494
+ this.applySize(this.element, 'width', '100%');
26418
26495
  }
26419
26496
  }
26420
26497
  if (new_h > this.j.o.resizer.min_height) {
26421
- (0,helpers.css)(this.element, 'height', new_h);
26498
+ this.applySize(this.element, 'height', new_h);
26422
26499
  }
26423
26500
  this.updateSize();
26424
26501
  this.showSizeViewer(this.element.offsetWidth, this.element.offsetHeight);
@@ -26495,7 +26572,7 @@ class resizer extends Plugin {
26495
26572
  })
26496
26573
  .on('afterInit changePlace', this.addEventListeners.bind(this))
26497
26574
  .on('afterGetValueFromEditor.resizer', (data) => {
26498
- const rgx = /<jodit[^>]+data-jodit_iframe_wrapper[^>]+>(.*?<iframe[^>]+>.*?<\/iframe>.*?)<\/jodit>/gi;
26575
+ const rgx = /<jodit[^>]+data-jodit_iframe_wrapper[^>]+>(.*?<iframe[^>]*>.*?<\/iframe>.*?)<\/jodit>/gi;
26499
26576
  if (rgx.test(data.value)) {
26500
26577
  data.value = data.value.replace(rgx, '$1');
26501
26578
  }
@@ -26559,6 +26636,14 @@ class resizer extends Plugin {
26559
26636
  getWorkplacePosition() {
26560
26637
  return (0,helpers.offset)((this.rect.parentNode || this.j.od.documentElement), this.j, this.j.od, true);
26561
26638
  }
26639
+ applySize(element, key, value) {
26640
+ if (dom/* Dom.isImage */.i.isImage(element) && this.j.o.resizer.forImageChangeAttributes) {
26641
+ (0,helpers.attr)(element, key, value);
26642
+ }
26643
+ else {
26644
+ (0,helpers.css)(element, key, value);
26645
+ }
26646
+ }
26562
26647
  onDelete(e) {
26563
26648
  if (!this.element) {
26564
26649
  return;
@@ -27245,7 +27330,7 @@ let resizeHandler = class resizeHandler extends Plugin {
27245
27330
  w: 0,
27246
27331
  h: 0
27247
27332
  };
27248
- this.handle = this.j.c.div('jodit-editor__resize', '<a tabindex="-1" href="javascript:void(0)"></a>');
27333
+ this.handle = this.j.c.div('jodit-editor__resize', '<span tabindex="-1"></span>');
27249
27334
  }
27250
27335
  afterInit(editor) {
27251
27336
  const { height, width, allowResizeX } = editor.o;
@@ -28540,17 +28625,20 @@ class symbols extends Plugin {
28540
28625
  }
28541
28626
  afterInit(jodit) {
28542
28627
  jodit.e.on('generateSpecialCharactersTable.symbols', () => {
28543
- const container = jodit.c.fromHTML('<div class="jodit-symbols__container">' +
28544
- '<div class="jodit-symbols__container_table"><table><tbody></tbody></table></div>' +
28545
- '<div class="jodit-symbols__container_preview"><div class="jodit-symbols__preview"></div></div>' +
28546
- '</div>'), preview = container.querySelector('.jodit-symbols__preview'), table = container.querySelector('table'), body = table.tBodies[0], chars = [];
28628
+ const container = jodit.c.fromHTML(`<div class="jodit-symbols__container">
28629
+ <div class="jodit-symbols__container_table">
28630
+ <table><tbody></tbody></table>
28631
+ </div>
28632
+ <div class="jodit-symbols__container_preview">
28633
+ <div class="jodit-symbols__preview"></div>
28634
+ </div>
28635
+ </div>`), preview = container.querySelector('.jodit-symbols__preview'), table = container.querySelector('table'), body = table.tBodies[0], chars = [];
28547
28636
  for (let i = 0; i < jodit.o.specialCharacters.length;) {
28548
28637
  const tr = jodit.c.element('tr');
28549
28638
  for (let j = 0; j < this.countInRow && i < jodit.o.specialCharacters.length; j += 1, i += 1) {
28550
28639
  const td = jodit.c.element('td'), a = jodit.c.fromHTML(`<a
28551
28640
  data-index="${i}"
28552
28641
  data-index-j="${j}"
28553
- href="javascript:void(0)"
28554
28642
  role="option"
28555
28643
  tabindex="-1"
28556
28644
  >${jodit.o.specialCharacters[i]}</a>`);
@@ -29724,7 +29812,7 @@ class xpath extends Plugin {
29724
29812
  return false;
29725
29813
  };
29726
29814
  this.tpl = (bindElement, path, name, title) => {
29727
- const item = this.j.c.fromHTML(`<span class="jodit-xpath__item"><a role="button" data-path="${path}" href="javascript:void(0)" title="${title}" tabindex="-1"'>${(0,helpers.trim)(name)}</a></span>`);
29815
+ const item = this.j.c.fromHTML(`<span class="jodit-xpath__item"><a role="button" data-path="${path}" title="${title}" tabindex="-1"'>${(0,helpers.trim)(name)}</a></span>`);
29728
29816
  const a = item.firstChild;
29729
29817
  this.j.e
29730
29818
  .on(a, 'click', this.onSelectPath.bind(this, bindElement))