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);
@@ -7192,7 +7251,7 @@ __webpack_require__.d(__webpack_exports__, {
7192
7251
  "IL": () => (/* reexport */ TabsWidget)
7193
7252
  });
7194
7253
 
7195
- // EXTERNAL MODULE: ./src/core/helpers/index.ts + 31 modules
7254
+ // EXTERNAL MODULE: ./src/core/helpers/index.ts + 32 modules
7196
7255
  var helpers = __webpack_require__(8);
7197
7256
  // EXTERNAL MODULE: ./src/core/ui/index.ts + 1 modules
7198
7257
  var ui = __webpack_require__(27);
@@ -7209,46 +7268,31 @@ var dom = __webpack_require__(15);
7209
7268
 
7210
7269
 
7211
7270
  const ColorPickerWidget = (editor, callback, coldColor) => {
7212
- const valueHex = (0,helpers.normalizeColor)(coldColor), form = editor.c.div('jodit-color-picker'), iconPalette = editor.o.textIcons
7271
+ const cn = 'jodit-color-picker', valueHex = (0,helpers.normalizeColor)(coldColor), form = editor.c.div(cn), iconPalette = editor.o.textIcons
7213
7272
  ? `<span>${editor.i18n('palette')}</span>`
7214
7273
  : ui/* Icon.get */.JO.get('palette'), eachColor = (colors) => {
7215
7274
  const stack = [];
7216
7275
  if ((0,helpers.isPlainObject)(colors)) {
7217
7276
  Object.keys(colors).forEach(key => {
7218
- stack.push('<div class="jodit-color-picker__group jodit-color-picker__group-' +
7219
- key +
7220
- '">');
7277
+ stack.push(`<div class="${cn}__group ${cn}__group-${key}">`);
7221
7278
  stack.push(eachColor(colors[key]));
7222
7279
  stack.push('</div>');
7223
7280
  });
7224
7281
  }
7225
7282
  else if ((0,helpers.isArray)(colors)) {
7226
7283
  colors.forEach(color => {
7227
- stack.push('<a ' +
7228
- (valueHex === color
7229
- ? ' class="jodit_active" '
7230
- : '') +
7231
- ' title="' +
7232
- color +
7233
- '" style="background-color:' +
7234
- color +
7235
- '" data-color="' +
7236
- color +
7237
- '" href="javascript:void(0)"></a>');
7284
+ stack.push(`<span class='${cn}__color-item ${valueHex === color
7285
+ ? cn + '__color-item_active_true'
7286
+ : ''}' title="${color}" style="background-color:${color}" data-color="${color}"></span>`);
7238
7287
  });
7239
7288
  }
7240
7289
  return stack.join('');
7241
7290
  };
7242
- form.appendChild(editor.c.fromHTML('<div class="jodit-color-picker__groups">' +
7243
- eachColor(editor.o.colors) +
7244
- '</div>'));
7245
- form.appendChild(editor.c.fromHTML('<div data-ref="extra" class="jodit-color-picker__extra"></div>'));
7291
+ form.appendChild(editor.c.fromHTML(`<div class="${cn}__groups">${eachColor(editor.o.colors)}</div>`));
7292
+ form.appendChild(editor.c.fromHTML(`<div data-ref="extra" class="${cn}__extra"></div>`));
7246
7293
  const { extra } = (0,helpers.refs)(form);
7247
7294
  if (editor.o.showBrowserColorPicker && (0,helpers.hasBrowserColorPicker)()) {
7248
- extra.appendChild(editor.c.fromHTML('<div class="jodit-color-picker__native">' +
7249
- iconPalette +
7250
- '<input type="color" value="#ffffff"/>' +
7251
- '</div>'));
7295
+ extra.appendChild(editor.c.fromHTML(`<div class="${cn}__native">${iconPalette}<input type="color" value="#ffffff"/></div>`));
7252
7296
  editor.e.on(form, 'change', (e) => {
7253
7297
  e.stopPropagation();
7254
7298
  const target = e.target;
@@ -7270,13 +7314,14 @@ const ColorPickerWidget = (editor, callback, coldColor) => {
7270
7314
  dom/* Dom.isTag */.i.isTag(target, 'svg') ||
7271
7315
  dom/* Dom.isTag */.i.isTag(target, 'path')) &&
7272
7316
  target.parentNode) {
7273
- target = dom/* Dom.closest */.i.closest(target.parentNode, 'a', editor.editor);
7317
+ target = dom/* Dom.closest */.i.closest(target.parentNode, 'span', editor.editor);
7274
7318
  }
7275
- if (!dom/* Dom.isTag */.i.isTag(target, 'a')) {
7319
+ if (!dom/* Dom.isTag */.i.isTag(target, 'span') ||
7320
+ !target.classList.contains(cn + '__color-item')) {
7276
7321
  return;
7277
7322
  }
7278
7323
  const color = (0,helpers.attr)(target, '-color') || '';
7279
- if (callback && typeof callback === 'function') {
7324
+ if (callback && (0,helpers.isFunction)(callback)) {
7280
7325
  callback(color);
7281
7326
  }
7282
7327
  e.preventDefault();
@@ -8555,7 +8600,7 @@ var config = __webpack_require__(1);
8555
8600
  var constants = __webpack_require__(2);
8556
8601
  // EXTERNAL MODULE: ./src/core/events/index.ts + 3 modules
8557
8602
  var events = __webpack_require__(3);
8558
- // EXTERNAL MODULE: ./src/core/helpers/index.ts + 31 modules
8603
+ // EXTERNAL MODULE: ./src/core/helpers/index.ts + 32 modules
8559
8604
  var helpers = __webpack_require__(8);
8560
8605
  ;// CONCATENATED MODULE: ./src/core/async.ts
8561
8606
  /*!
@@ -9136,7 +9181,7 @@ class View extends component/* Component */.wA {
9136
9181
  this.isView = true;
9137
9182
  this.mods = {};
9138
9183
  this.components = new Set();
9139
- this.version = "3.8.2";
9184
+ this.version = "3.8.3";
9140
9185
  this.async = new Async();
9141
9186
  this.buffer = Storage.makeStorage();
9142
9187
  this.storage = Storage.makeStorage(true, this.componentName);
@@ -9234,10 +9279,10 @@ class View extends component/* Component */.wA {
9234
9279
  return this.__isFullSize;
9235
9280
  }
9236
9281
  getVersion() {
9237
- return "3.8.2";
9282
+ return "3.8.3";
9238
9283
  }
9239
9284
  static getVersion() {
9240
- return "3.8.2";
9285
+ return "3.8.3";
9241
9286
  }
9242
9287
  initOptions(options) {
9243
9288
  this.options = (0,helpers.ConfigProto)(options || {}, (0,helpers.ConfigProto)(this.options || {}, View.defaultOptions));
@@ -10648,7 +10693,7 @@ class Create {
10648
10693
  }
10649
10694
  }
10650
10695
  if (children) {
10651
- (0,helpers.asArray)(children).forEach((child) => elm.appendChild(typeof child === 'string' ? this.fromHTML(child) : child));
10696
+ (0,helpers.asArray)(children).forEach((child) => elm.appendChild((0,helpers.isString)(child) ? this.fromHTML(child) : child));
10652
10697
  }
10653
10698
  return elm;
10654
10699
  }
@@ -11494,7 +11539,7 @@ function stateListeners() {
11494
11539
  source.folders.forEach((name) => {
11495
11540
  const folderElm = create.a(F_CLASS + '__tree-item', {
11496
11541
  draggable: 'draggable',
11497
- href: 'javascript:void(0)',
11542
+ href: '#',
11498
11543
  'data-path': (0,normalize/* normalizePath */.AH)(source.path, name + '/'),
11499
11544
  'data-name': name,
11500
11545
  'data-source': sourceName,
@@ -11507,6 +11552,7 @@ function stateListeners() {
11507
11552
  source: sourceName
11508
11553
  });
11509
11554
  e.stopPropagation();
11555
+ e.preventDefault();
11510
11556
  };
11511
11557
  this.e.on(folderElm, 'click', action('openFolder'));
11512
11558
  this.tree.appendChild(folderElm);
@@ -12207,7 +12253,7 @@ function openImageEditor(href, name, path, source, onSuccess, onFailed) {
12207
12253
 
12208
12254
 
12209
12255
 
12210
- 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}">` +
12256
+ const CLASS_PREVIEW = F_CLASS + '_preview_', preview_tpl_next = (next = 'next', right = 'right') => `<div class="${CLASS_PREVIEW}navigation ${CLASS_PREVIEW}navigation-${next}">` +
12211
12257
  '' +
12212
12258
  ui/* Icon.get */.JO.get('angle-' + right) +
12213
12259
  '</a>';
@@ -13433,6 +13479,7 @@ class Select {
13433
13479
  }) {
13434
13480
  var _a, _b;
13435
13481
  if (!this.isFocused()) {
13482
+ const scrollParent = (0,helpers.getScrollParent)(this.j.container), scrollTop = scrollParent === null || scrollParent === void 0 ? void 0 : scrollParent.scrollTop;
13436
13483
  if (this.j.iframe) {
13437
13484
  if (this.doc.readyState === 'complete') {
13438
13485
  this.j.iframe.focus();
@@ -13440,6 +13487,9 @@ class Select {
13440
13487
  }
13441
13488
  this.win.focus();
13442
13489
  this.area.focus(options);
13490
+ if (scrollTop) {
13491
+ scrollParent === null || scrollParent === void 0 ? void 0 : scrollParent.scrollTo(0, scrollTop);
13492
+ }
13443
13493
  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;
13444
13494
  if (!range || !dom/* Dom.isOrContains */.i.isOrContains(this.area, range.startContainer)) {
13445
13495
  const range = this.createRange();
@@ -13524,6 +13574,7 @@ class Select {
13524
13574
  insertNode(node, insertCursorAfter = true, fireChange = true) {
13525
13575
  var _a;
13526
13576
  this.errorNode(node);
13577
+ this.j.e.fire('safeHTML', node);
13527
13578
  if (!this.isFocused() && this.j.isEditorMode()) {
13528
13579
  this.focus();
13529
13580
  this.restore();
@@ -13618,7 +13669,7 @@ class Select {
13618
13669
  String(dw).indexOf('%') < 0) {
13619
13670
  dw += 'px';
13620
13671
  }
13621
- (0,helpers.css)(image, 'width', dw);
13672
+ (0,helpers.call)(this.j.o.resizer.forImageChangeAttributes ? helpers.attr : helpers.css, image, 'width', dw);
13622
13673
  }
13623
13674
  if (styles && typeof styles === 'object') {
13624
13675
  (0,helpers.css)(image, styles);
@@ -15736,11 +15787,14 @@ class Jodit extends ViewWithToolbar {
15736
15787
  return this.getElementValue();
15737
15788
  }
15738
15789
  setNativeEditorValue(value) {
15739
- if (this.e.fire('beforeSetNativeEditorValue', value)) {
15790
+ const data = {
15791
+ value
15792
+ };
15793
+ if (this.e.fire('beforeSetNativeEditorValue', data)) {
15740
15794
  return;
15741
15795
  }
15742
15796
  if (this.editor) {
15743
- this.editor.innerHTML = value;
15797
+ this.editor.innerHTML = data.value;
15744
15798
  }
15745
15799
  }
15746
15800
  getEditorValue(removeSelectionMarkers = true) {
@@ -17330,7 +17384,9 @@ config/* Config.prototype.cleanHTML */.D.prototype.cleanHTML = {
17330
17384
  b: 'strong'
17331
17385
  },
17332
17386
  allowTags: false,
17333
- denyTags: false
17387
+ denyTags: false,
17388
+ removeOnError: true,
17389
+ safeJavaScriptLink: true
17334
17390
  };
17335
17391
  config/* Config.prototype.controls.eraser */.D.prototype.controls.eraser = {
17336
17392
  command: 'removeFormat',
@@ -17430,6 +17486,7 @@ class cleanHtml extends Plugin {
17430
17486
  return;
17431
17487
  }
17432
17488
  const editor = this.j;
17489
+ this.onSafeHTML(editor.editor);
17433
17490
  const current = editor.s.current();
17434
17491
  const replaceOldTags = editor.o.cleanHTML.replaceOldTags;
17435
17492
  if (replaceOldTags && current) {
@@ -17607,6 +17664,16 @@ class cleanHtml extends Plugin {
17607
17664
  }
17608
17665
  return false;
17609
17666
  }
17667
+ onBeforeSetNativeEditorValue(data) {
17668
+ const sandBox = this.j.createInside.div();
17669
+ sandBox.innerHTML = data.value;
17670
+ this.onSafeHTML(sandBox);
17671
+ data.value = sandBox.innerHTML;
17672
+ return false;
17673
+ }
17674
+ onSafeHTML(sandBox) {
17675
+ (0,helpers.safeHTML)(sandBox, this.j.o.cleanHTML);
17676
+ }
17610
17677
  beforeDestruct() {
17611
17678
  this.j.e.off('.cleanHtml');
17612
17679
  }
@@ -17617,6 +17684,12 @@ class cleanHtml extends Plugin {
17617
17684
  (0,tslib_es6/* __decorate */.gn)([
17618
17685
  decorators.autobind
17619
17686
  ], cleanHtml.prototype, "isInlineBlock", null);
17687
+ (0,tslib_es6/* __decorate */.gn)([
17688
+ (0,decorators.watch)(':beforeSetNativeEditorValue')
17689
+ ], cleanHtml.prototype, "onBeforeSetNativeEditorValue", null);
17690
+ (0,tslib_es6/* __decorate */.gn)([
17691
+ (0,decorators.watch)(':safeHTML')
17692
+ ], cleanHtml.prototype, "onSafeHTML", null);
17620
17693
 
17621
17694
  ;// CONCATENATED MODULE: ./src/plugins/fix/wrap-text-nodes.ts
17622
17695
  /*!
@@ -18124,6 +18197,7 @@ class paste extends Plugin {
18124
18197
 
18125
18198
 
18126
18199
 
18200
+
18127
18201
  class pasteStorage extends Plugin {
18128
18202
  constructor() {
18129
18203
  super(...arguments);
@@ -18205,7 +18279,7 @@ class pasteStorage extends Plugin {
18205
18279
  a.textContent =
18206
18280
  index + 1 + '. ' + html.replace((0,constants.SPACE_REG_EXP)(), '');
18207
18281
  this.j.e.on(a, 'keydown', this.onKeyDown);
18208
- (0,helpers.attr)(a, 'href', 'javascript:void(0)');
18282
+ (0,helpers.attr)(a, 'href', '#');
18209
18283
  (0,helpers.attr)(a, 'data-index', index.toString());
18210
18284
  (0,helpers.attr)(a, 'tab-index', '-1');
18211
18285
  this.listBox && this.listBox.appendChild(a);
@@ -18220,18 +18294,10 @@ class pasteStorage extends Plugin {
18220
18294
  this.dialog = new Dialog({
18221
18295
  language: this.j.o.language
18222
18296
  });
18223
- const pasteButton = this.j.c.fromHTML('<a href="javascript:void(0)" style="float:right;" class="jodit-button">' +
18224
- '<span>' +
18225
- this.j.i18n('Paste') +
18226
- '</span>' +
18227
- '</a>');
18228
- this.j.e.on(pasteButton, 'click', this.paste);
18229
- const cancelButton = this.j.c.fromHTML('<a href="javascript:void(0)" style="float:right; margin-right: 10px;" class="jodit-button">' +
18230
- '<span>' +
18231
- this.j.i18n('Cancel') +
18232
- '</span>' +
18233
- '</a>');
18234
- this.j.e.on(cancelButton, 'click', this.dialog.close);
18297
+ const pasteButton = (0,ui/* Button */.zx)(this.j, 'paste', 'Paste', 'primary');
18298
+ pasteButton.onAction(this.paste);
18299
+ const cancelButton = (0,ui/* Button */.zx)(this.j, '', 'Cancel');
18300
+ cancelButton.onAction(this.dialog.close);
18235
18301
  this.container = this.j.c.div();
18236
18302
  this.container.classList.add('jodit-paste-storage');
18237
18303
  this.listBox = this.j.c.div();
@@ -19750,7 +19816,7 @@ function iframe(editor) {
19750
19816
  editor.e
19751
19817
  .on('beforeGetNativeEditorValue', () => clearMarkers(editor.o.iframeDoctype +
19752
19818
  doc.documentElement.outerHTML))
19753
- .on('beforeSetNativeEditorValue', (value) => {
19819
+ .on('beforeSetNativeEditorValue', ({ value }) => {
19754
19820
  if (editor.isLocked) {
19755
19821
  return false;
19756
19822
  }
@@ -19763,15 +19829,17 @@ function iframe(editor) {
19763
19829
  clearMarkers(value));
19764
19830
  doc.close();
19765
19831
  editor.editor = doc.body;
19832
+ editor.e.fire('safeHTML', editor.editor);
19766
19833
  toggleEditable();
19767
19834
  editor.e.fire('prepareWYSIWYGEditor');
19835
+ editor.e.stopPropagation('beforeSetNativeEditorValue');
19768
19836
  }
19769
19837
  }
19770
19838
  else {
19771
19839
  doc.body.innerHTML = value;
19772
19840
  }
19773
19841
  return true;
19774
- });
19842
+ }, undefined, true);
19775
19843
  }
19776
19844
  editor.editor = doc.body;
19777
19845
  editor.e.on('afterSetMode afterInit afterAddPlace', toggleEditable);
@@ -21365,6 +21433,7 @@ class link_link extends Plugin {
21365
21433
  const snapshot = jodit.observer.snapshot.make();
21366
21434
  if (unlink) {
21367
21435
  jodit.e.on(unlink, 'click', (e) => {
21436
+ jodit.s.restore();
21368
21437
  jodit.observer.snapshot.restore(snapshot);
21369
21438
  if (link) {
21370
21439
  dom/* Dom.unwrap */.i.unwrap(link);
@@ -21381,6 +21450,7 @@ class link_link extends Plugin {
21381
21450
  return false;
21382
21451
  }
21383
21452
  let links;
21453
+ jodit.s.restore();
21384
21454
  jodit.s.removeMarkers();
21385
21455
  jodit.editor.normalize();
21386
21456
  jodit.observer.snapshot.restore(snapshot);
@@ -21401,6 +21471,7 @@ class link_link extends Plugin {
21401
21471
  jodit.s.insertNode(a, false, false);
21402
21472
  links = [a];
21403
21473
  }
21474
+ links.forEach(link => jodit.s.select(link));
21404
21475
  }
21405
21476
  else {
21406
21477
  links = [link];
@@ -21431,13 +21502,18 @@ class link_link extends Plugin {
21431
21502
  }
21432
21503
  }
21433
21504
  if (!isImageContent) {
21505
+ let newContent = a.textContent;
21434
21506
  if (content_input.value.trim().length) {
21435
21507
  if (textWasChanged) {
21436
- a.textContent = content_input.value;
21508
+ newContent = content_input.value;
21437
21509
  }
21438
21510
  }
21439
21511
  else {
21440
- a.textContent = url_input.value;
21512
+ newContent = url_input.value;
21513
+ }
21514
+ const content = a.textContent;
21515
+ if (newContent !== content) {
21516
+ a.textContent = newContent;
21441
21517
  }
21442
21518
  }
21443
21519
  if (openInNewTabCheckbox && target_checkbox) {
@@ -22110,6 +22186,7 @@ config/* Config.prototype.allowResizeTags */.D.prototype.allowResizeTags = ['img
22110
22186
  config/* Config.prototype.resizer */.D.prototype.resizer = {
22111
22187
  showSize: true,
22112
22188
  hideSizeTimeout: 1000,
22189
+ forImageChangeAttributes: true,
22113
22190
  min_width: 10,
22114
22191
  min_height: 10
22115
22192
  };
@@ -22177,14 +22254,14 @@ class resizer extends Plugin {
22177
22254
  }
22178
22255
  if (new_w > this.j.o.resizer.min_width) {
22179
22256
  if (new_w < this.rect.parentNode.offsetWidth) {
22180
- (0,helpers.css)(this.element, 'width', new_w);
22257
+ this.applySize(this.element, 'width', new_w);
22181
22258
  }
22182
22259
  else {
22183
- (0,helpers.css)(this.element, 'width', '100%');
22260
+ this.applySize(this.element, 'width', '100%');
22184
22261
  }
22185
22262
  }
22186
22263
  if (new_h > this.j.o.resizer.min_height) {
22187
- (0,helpers.css)(this.element, 'height', new_h);
22264
+ this.applySize(this.element, 'height', new_h);
22188
22265
  }
22189
22266
  this.updateSize();
22190
22267
  this.showSizeViewer(this.element.offsetWidth, this.element.offsetHeight);
@@ -22261,7 +22338,7 @@ class resizer extends Plugin {
22261
22338
  })
22262
22339
  .on('afterInit changePlace', this.addEventListeners.bind(this))
22263
22340
  .on('afterGetValueFromEditor.resizer', (data) => {
22264
- const rgx = /<jodit[^>]+data-jodit_iframe_wrapper[^>]+>(.*?<iframe[^>]+>.*?<\/iframe>.*?)<\/jodit>/gi;
22341
+ const rgx = /<jodit[^>]+data-jodit_iframe_wrapper[^>]+>(.*?<iframe[^>]*>.*?<\/iframe>.*?)<\/jodit>/gi;
22265
22342
  if (rgx.test(data.value)) {
22266
22343
  data.value = data.value.replace(rgx, '$1');
22267
22344
  }
@@ -22325,6 +22402,14 @@ class resizer extends Plugin {
22325
22402
  getWorkplacePosition() {
22326
22403
  return (0,helpers.offset)((this.rect.parentNode || this.j.od.documentElement), this.j, this.j.od, true);
22327
22404
  }
22405
+ applySize(element, key, value) {
22406
+ if (dom/* Dom.isImage */.i.isImage(element) && this.j.o.resizer.forImageChangeAttributes) {
22407
+ (0,helpers.attr)(element, key, value);
22408
+ }
22409
+ else {
22410
+ (0,helpers.css)(element, key, value);
22411
+ }
22412
+ }
22328
22413
  onDelete(e) {
22329
22414
  if (!this.element) {
22330
22415
  return;
@@ -23011,7 +23096,7 @@ let resizeHandler = class resizeHandler extends Plugin {
23011
23096
  w: 0,
23012
23097
  h: 0
23013
23098
  };
23014
- this.handle = this.j.c.div('jodit-editor__resize', '<a tabindex="-1" href="javascript:void(0)"></a>');
23099
+ this.handle = this.j.c.div('jodit-editor__resize', '<span tabindex="-1"></span>');
23015
23100
  }
23016
23101
  afterInit(editor) {
23017
23102
  const { height, width, allowResizeX } = editor.o;
@@ -24306,17 +24391,20 @@ class symbols extends Plugin {
24306
24391
  }
24307
24392
  afterInit(jodit) {
24308
24393
  jodit.e.on('generateSpecialCharactersTable.symbols', () => {
24309
- const container = jodit.c.fromHTML('<div class="jodit-symbols__container">' +
24310
- '<div class="jodit-symbols__container_table"><table><tbody></tbody></table></div>' +
24311
- '<div class="jodit-symbols__container_preview"><div class="jodit-symbols__preview"></div></div>' +
24312
- '</div>'), preview = container.querySelector('.jodit-symbols__preview'), table = container.querySelector('table'), body = table.tBodies[0], chars = [];
24394
+ const container = jodit.c.fromHTML(`<div class="jodit-symbols__container">
24395
+ <div class="jodit-symbols__container_table">
24396
+ <table><tbody></tbody></table>
24397
+ </div>
24398
+ <div class="jodit-symbols__container_preview">
24399
+ <div class="jodit-symbols__preview"></div>
24400
+ </div>
24401
+ </div>`), preview = container.querySelector('.jodit-symbols__preview'), table = container.querySelector('table'), body = table.tBodies[0], chars = [];
24313
24402
  for (let i = 0; i < jodit.o.specialCharacters.length;) {
24314
24403
  const tr = jodit.c.element('tr');
24315
24404
  for (let j = 0; j < this.countInRow && i < jodit.o.specialCharacters.length; j += 1, i += 1) {
24316
24405
  const td = jodit.c.element('td'), a = jodit.c.fromHTML(`<a
24317
24406
  data-index="${i}"
24318
24407
  data-index-j="${j}"
24319
- href="javascript:void(0)"
24320
24408
  role="option"
24321
24409
  tabindex="-1"
24322
24410
  >${jodit.o.specialCharacters[i]}</a>`);
@@ -25490,7 +25578,7 @@ class xpath extends Plugin {
25490
25578
  return false;
25491
25579
  };
25492
25580
  this.tpl = (bindElement, path, name, title) => {
25493
- 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>`);
25581
+ 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>`);
25494
25582
  const a = item.firstChild;
25495
25583
  this.j.e
25496
25584
  .on(a, 'click', this.onSelectPath.bind(this, bindElement))