jodit 4.12.20 → 4.12.22

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 (69) hide show
  1. package/CHANGELOG.md +29 -1
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +8 -8
  4. package/es2015/jodit.js +155 -36
  5. package/es2015/jodit.min.js +8 -8
  6. package/es2015/plugins/debug/debug.css +1 -1
  7. package/es2015/plugins/debug/debug.js +1 -1
  8. package/es2015/plugins/debug/debug.min.js +1 -1
  9. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  10. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  12. package/es2018/jodit.fat.min.js +8 -8
  13. package/es2018/jodit.min.js +24 -24
  14. package/es2018/plugins/debug/debug.min.js +1 -1
  15. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  16. package/es2021/jodit.css +1 -1
  17. package/es2021/jodit.fat.min.js +9 -9
  18. package/es2021/jodit.js +154 -35
  19. package/es2021/jodit.min.js +22 -22
  20. package/es2021/plugins/debug/debug.css +1 -1
  21. package/es2021/plugins/debug/debug.js +1 -1
  22. package/es2021/plugins/debug/debug.min.js +1 -1
  23. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  24. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  25. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  26. package/es2021.en/jodit.css +1 -1
  27. package/es2021.en/jodit.fat.min.js +9 -9
  28. package/es2021.en/jodit.js +153 -34
  29. package/es2021.en/jodit.min.js +11 -11
  30. package/es2021.en/plugins/debug/debug.css +1 -1
  31. package/es2021.en/plugins/debug/debug.js +1 -1
  32. package/es2021.en/plugins/debug/debug.min.js +1 -1
  33. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  34. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  35. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  36. package/es5/jodit.css +2 -2
  37. package/es5/jodit.fat.min.js +2 -2
  38. package/es5/jodit.js +164 -36
  39. package/es5/jodit.min.css +2 -2
  40. package/es5/jodit.min.js +2 -2
  41. package/es5/plugins/debug/debug.css +1 -1
  42. package/es5/plugins/debug/debug.js +1 -1
  43. package/es5/plugins/debug/debug.min.js +1 -1
  44. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  45. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  46. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  47. package/es5/polyfills.fat.min.js +1 -1
  48. package/es5/polyfills.js +1 -1
  49. package/es5/polyfills.min.js +1 -1
  50. package/esm/core/constants.js +1 -1
  51. package/esm/core/dom/dom.js +6 -4
  52. package/esm/langs/tr.js +1 -1
  53. package/esm/modules/dialog/dialog.d.ts +5 -0
  54. package/esm/modules/dialog/dialog.js +25 -2
  55. package/esm/plugins/clean-html/clean-html.js +8 -2
  56. package/esm/plugins/clean-html/helpers/visitor/filters/allow-attributes.js +9 -2
  57. package/esm/plugins/clipboard/clipboard.js +29 -1
  58. package/esm/plugins/inline-popup/inline-popup.d.ts +8 -0
  59. package/esm/plugins/inline-popup/inline-popup.js +43 -2
  60. package/esm/plugins/limit/limit.js +7 -1
  61. package/esm/plugins/paste/paste.d.ts +1 -1
  62. package/esm/plugins/paste/paste.js +7 -5
  63. package/esm/plugins/resize-handler/resize-handler.js +13 -2
  64. package/esm/plugins/resizer/resizer.js +5 -1
  65. package/esm/plugins/source/source.js +9 -0
  66. package/package.json +1 -1
  67. package/types/modules/dialog/dialog.d.ts +5 -0
  68. package/types/plugins/inline-popup/inline-popup.d.ts +8 -0
  69. package/types/plugins/paste/paste.d.ts +1 -1
package/es2015/jodit.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.12.20
4
+ * Version: v4.12.22
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1808,7 +1808,7 @@ __webpack_require__.r(__webpack_exports__);
1808
1808
  * ```
1809
1809
  * @packageDocumentation
1810
1810
  * @module constants
1811
- */ const APP_VERSION = "4.12.20";
1811
+ */ const APP_VERSION = "4.12.22";
1812
1812
  // prettier-ignore
1813
1813
  const ES = "es2015";
1814
1814
  const IS_ES_MODERN = true;
@@ -3225,12 +3225,12 @@ function wait(condition) {
3225
3225
  /**
3226
3226
  * Check if element is element node
3227
3227
  */ static isElement(node) {
3228
- var _node_ownerDocument;
3229
3228
  if (!Dom.isNode(node)) {
3230
3229
  return false;
3231
3230
  }
3232
- const win = (_node_ownerDocument = node.ownerDocument) === null || _node_ownerDocument === void 0 ? void 0 : _node_ownerDocument.defaultView;
3233
- return Boolean(win && node.nodeType === Node.ELEMENT_NODE);
3231
+ // no `defaultView` requirement nodes of an inert document
3232
+ // (`DOMParser`, `implementation.createHTMLDocument`) are still elements
3233
+ return node.nodeType === Node.ELEMENT_NODE;
3234
3234
  }
3235
3235
  /**
3236
3236
  * Check if element is document fragment
@@ -3249,8 +3249,10 @@ function wait(condition) {
3249
3249
  if (!Dom.isNode(node)) {
3250
3250
  return false;
3251
3251
  }
3252
+ // an inert document has no browsing context (`defaultView` is null),
3253
+ // but its nodes are same-realm HTMLElements
3252
3254
  const win = (_node_ownerDocument = node.ownerDocument) === null || _node_ownerDocument === void 0 ? void 0 : _node_ownerDocument.defaultView;
3253
- return Boolean(win && node instanceof win.HTMLElement);
3255
+ return node instanceof (win ? win.HTMLElement : HTMLElement);
3254
3256
  }
3255
3257
  /**
3256
3258
  * Check element is inline block
@@ -18566,7 +18568,7 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
18566
18568
  e.stopImmediatePropagation();
18567
18569
  }
18568
18570
  if (this.resizable && this.o.resizable) {
18569
- this.setSize(this.startPoint.w + e.clientX - this.startX, this.startPoint.h + e.clientY - this.startY);
18571
+ this.setSize(Math.max(this.startPoint.w + e.clientX - this.startX, this.minSize.w), Math.max(this.startPoint.h + e.clientY - this.startY, this.minSize.h));
18570
18572
  if (this.e) {
18571
18573
  /**
18572
18574
  * Fired when dialog box is resized
@@ -18589,11 +18591,20 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
18589
18591
  }
18590
18592
  }
18591
18593
  __onResizerMouseDown(e) {
18594
+ var _ref, _ref1, _ref2;
18592
18595
  this.resizable = true;
18593
18596
  this.startX = e.clientX;
18594
18597
  this.startY = e.clientY;
18595
18598
  this.startPoint.w = this.dialog.offsetWidth;
18596
18599
  this.startPoint.h = this.dialog.offsetHeight;
18600
+ const header = this.getElm('header');
18601
+ const footer = this.getElm('footer');
18602
+ const content = this.getElm('content');
18603
+ // the content area does not shrink below its CSS `min-height`,
18604
+ // so it is part of the smallest height the panel can take
18605
+ const contentMinHeight = content ? parseFloat(this.ow.getComputedStyle(content).minHeight) || 0 : 0;
18606
+ this.minSize.w = (0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_10__.isNumber)(this.o.minWidth) ? this.o.minWidth : Math.max(100, (_ref = footer === null || footer === void 0 ? void 0 : footer.scrollWidth) !== null && _ref !== void 0 ? _ref : 0);
18607
+ this.minSize.h = (0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_10__.isNumber)(this.o.minHeight) ? this.o.minHeight : ((_ref1 = header === null || header === void 0 ? void 0 : header.offsetHeight) !== null && _ref1 !== void 0 ? _ref1 : 0) + ((_ref2 = footer === null || footer === void 0 ? void 0 : footer.offsetHeight) !== null && _ref2 !== void 0 ? _ref2 : 0) + contentMinHeight + this.resizer.offsetHeight;
18597
18608
  this.lockSelect();
18598
18609
  this.__addGlobalResizeListeners();
18599
18610
  if (this.e) {
@@ -18888,6 +18899,12 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
18888
18899
  if (this.options && this.o.resizable && !this.moved && this.isOpened && !this.offsetX && !this.offsetY) {
18889
18900
  this.setPosition();
18890
18901
  }
18902
+ }), /**
18903
+ * Minimal size the dialog can be resized to — the header and the footer
18904
+ * (with its buttons) must always stay inside the panel
18905
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "minSize", {
18906
+ w: 0,
18907
+ h: 0
18891
18908
  }), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "dialog", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "workplace", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "dialogbox_header", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "dialogbox_content", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "dialogbox_footer", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "dialogbox_toolbar", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isModal", false), /**
18892
18909
  * True, if dialog was opened
18893
18910
  */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isOpened", false);
@@ -27471,10 +27488,14 @@ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_5__.Icon.set('class-span', (_class_s
27471
27488
  * Event handler when manually assigning a value to the HTML editor.
27472
27489
  */ onBeforeSetNativeEditorValue(data) {
27473
27490
  const [sandBox, iframe] = this.j.o.cleanHTML.useIframeSandbox ? this.j.createInside.sandbox() : [
27474
- this.j.createInside.div()
27491
+ // an inert document never loads sub-resources, so the
27492
+ // images in the value are not re-requested from the
27493
+ // server on every assignment (e.g. on each change in
27494
+ // jodit-react). See #1237
27495
+ this.j.od.implementation.createHTMLDocument('').body
27475
27496
  ];
27476
27497
  sandBox.innerHTML = data.value;
27477
- this.onSafeHTML(sandBox);
27498
+ this.j.e.fire('safeHTML', sandBox);
27478
27499
  data.value = sandBox.innerHTML;
27479
27500
  (0,jodit_core_helpers_html_safe_html__WEBPACK_IMPORTED_MODULE_6__.safeHTML)(sandBox, {
27480
27501
  safeJavaScriptLink: true,
@@ -27809,12 +27830,19 @@ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_0__.Icon.set('eraser', (_eraser_svg_
27809
27830
  /**
27810
27831
  * @private
27811
27832
  */ function allowAttributes(jodit, nodeElm, hadEffect, allow) {
27812
- if (allow && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isElement(nodeElm) && allow[nodeElm.nodeName] !== true) {
27833
+ const allowedForTag = allow && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isElement(nodeElm) && allow[nodeElm.nodeName];
27834
+ if (allow && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isElement(nodeElm) && allowedForTag !== true) {
27835
+ // the tag is not in the allow list at all — attributes do not matter,
27836
+ // the element itself will be removed by the tags filter. Without this
27837
+ // check `allow[nodeName][attr]` threw on e.g. `<meta charset>`. See #1224
27838
+ if (!allowedForTag) {
27839
+ return hadEffect;
27840
+ }
27813
27841
  const attrs = nodeElm.attributes;
27814
27842
  if (attrs && attrs.length) {
27815
27843
  const removeAttrs = [];
27816
27844
  for(let i = 0; i < attrs.length; i += 1){
27817
- const attr = allow[nodeElm.nodeName][attrs[i].name];
27845
+ const attr = allowedForTag[attrs[i].name];
27818
27846
  if (!attr || attr !== true && attr !== attrs[i].value) {
27819
27847
  removeAttrs.push(attrs[i].name);
27820
27848
  }
@@ -28392,9 +28420,10 @@ const keys = Object.keys(_filters__WEBPACK_IMPORTED_MODULE_1__);
28392
28420
  /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
28393
28421
  /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(81937);
28394
28422
  /* harmony import */ var jodit_core_decorators_cache_cache__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(51676);
28395
- /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(28077);
28396
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(65946);
28397
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(81008);
28423
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(23211);
28424
+ /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(28077);
28425
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65946);
28426
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(81008);
28398
28427
  /*!
28399
28428
  * Jodit Editor (https://xdsoft.net/jodit/)
28400
28429
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -28409,6 +28438,7 @@ const keys = Object.keys(_filters__WEBPACK_IMPORTED_MODULE_1__);
28409
28438
 
28410
28439
 
28411
28440
 
28441
+
28412
28442
  /**
28413
28443
  * Clipboard plugin - cut and copy functionality
28414
28444
  */ class clipboard {
@@ -28417,10 +28447,10 @@ const keys = Object.keys(_filters__WEBPACK_IMPORTED_MODULE_1__);
28417
28447
  (_this_buttons = this.buttons) === null || _this_buttons === void 0 ? void 0 : _this_buttons.forEach((btn)=>editor.registerButton(btn));
28418
28448
  editor.e.off(`copy.${jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.CLIPBOARD_ID} cut.${jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.CLIPBOARD_ID}`).on(`copy.${jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.CLIPBOARD_ID} cut.${jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.CLIPBOARD_ID}`, (event)=>{
28419
28449
  var _editor_events;
28420
- const selectedText = editor.s.html;
28421
- const clipboardData = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.getDataTransfer)(event) || (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.getDataTransfer)(editor.ew) || (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.getDataTransfer)(event.originalEvent);
28450
+ const selectedText = wrapWithInlineAncestors(editor, editor.s.html);
28451
+ const clipboardData = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.getDataTransfer)(event) || (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.getDataTransfer)(editor.ew) || (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.getDataTransfer)(event.originalEvent);
28422
28452
  if (clipboardData) {
28423
- clipboardData.setData(jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.TEXT_PLAIN, (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.stripTags)(selectedText));
28453
+ clipboardData.setData(jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.TEXT_PLAIN, (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.stripTags)(selectedText));
28424
28454
  clipboardData.setData(jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.TEXT_HTML, selectedText);
28425
28455
  }
28426
28456
  editor.buffer.set(jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.CLIPBOARD_ID, selectedText);
@@ -28463,7 +28493,30 @@ const keys = Object.keys(_filters__WEBPACK_IMPORTED_MODULE_1__);
28463
28493
  ]);
28464
28494
  }
28465
28495
  }
28466
- jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('clipboard', clipboard);
28496
+ /**
28497
+ * `Selection.html` clones only the range contents — when the selection sits
28498
+ * entirely inside the text of a formatted element (`<strong>te|st|</strong>`),
28499
+ * the clone is bare text and the formatting would be lost on paste. Native
28500
+ * browser copy keeps that context, so the interception must restore it: wrap
28501
+ * the fragment in shallow clones of the inline ancestors of the range. See #1202
28502
+ */ function wrapWithInlineAncestors(editor, html) {
28503
+ if (!html || editor.s.isCollapsed()) {
28504
+ return html;
28505
+ }
28506
+ let node = editor.s.range.commonAncestorContainer;
28507
+ if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isElement(node)) {
28508
+ node = node.parentElement;
28509
+ }
28510
+ let result = html;
28511
+ while(node && node !== editor.editor && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isElement(node) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isBlock(node)){
28512
+ const shell = node.cloneNode(false);
28513
+ shell.innerHTML = result;
28514
+ result = shell.outerHTML;
28515
+ node = node.parentElement;
28516
+ }
28517
+ return result;
28518
+ }
28519
+ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('clipboard', clipboard);
28467
28520
 
28468
28521
 
28469
28522
  /***/ }),
@@ -34370,9 +34423,34 @@ const align = {
34370
34423
  }).on([
34371
34424
  this.j.ew,
34372
34425
  this.j.ow
34373
- ], 'mouseup keyup', this.onSelectionEnd);
34426
+ ], 'mouseup keyup', this.onSelectionEnd).on([
34427
+ this.j.ew,
34428
+ this.j.ow
34429
+ ], 'mousedown touchstart', this.__onDocumentMouseDown).on('closeAllPopups', this.__onCloseAllPopups);
34374
34430
  this.addListenersForElements();
34375
34431
  }
34432
+ __onDocumentMouseDown(e) {
34433
+ if (this.popup.isOpened && this.type === 'selection' && e.target && jodit_core_ui__WEBPACK_IMPORTED_MODULE_7__.UIElement.closestElement(e.target, jodit_core_ui_popup__WEBPACK_IMPORTED_MODULE_8__.Popup)) {
34434
+ this.__reopenSelectionPopup = true;
34435
+ }
34436
+ }
34437
+ __onCloseAllPopups() {
34438
+ if (!this.__reopenSelectionPopup) {
34439
+ return;
34440
+ }
34441
+ this.__reopenSelectionPopup = false;
34442
+ if (!this.j.o.toolbarInlineForSelection) {
34443
+ return;
34444
+ }
34445
+ // a zero timeout would run synchronously — before the popup's own
34446
+ // `closeAllPopups` handler closes it; defer to the next macrotask
34447
+ this.j.async.setTimeout(()=>{
34448
+ const sel = this.j.s.sel;
34449
+ if (sel && !sel.isCollapsed) {
34450
+ this.showPopup(()=>this.j.s.range.getBoundingClientRect(), 'selection');
34451
+ }
34452
+ }, 1);
34453
+ }
34376
34454
  onSelectionStart() {
34377
34455
  this.snapRange = this.j.s.range.cloneRange();
34378
34456
  }
@@ -34421,7 +34499,10 @@ const align = {
34421
34499
  jodit.e.off('showPopup').off([
34422
34500
  this.j.ew,
34423
34501
  this.j.ow
34424
- ], 'mouseup keyup', this.onSelectionEnd);
34502
+ ], 'mouseup keyup', this.onSelectionEnd).off([
34503
+ this.j.ew,
34504
+ this.j.ow
34505
+ ], 'mousedown touchstart', this.__onDocumentMouseDown).off('closeAllPopups', this.__onCloseAllPopups);
34425
34506
  this.removeListenersForElements();
34426
34507
  }
34427
34508
  _eventsList() {
@@ -34446,7 +34527,11 @@ const align = {
34446
34527
  }, 'toolbar');
34447
34528
  }
34448
34529
  constructor(...args){
34449
- super(...args), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "type", null), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "previousTarget", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "snapRange", null), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "elmsList", (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.keys)(this.j.o.popup, false).filter((s)=>!this.isExcludedTarget(s)));
34530
+ super(...args), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "type", null), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "previousTarget", void 0), /**
34531
+ * The user pressed a button inside the selection toolbar — after the
34532
+ * command fires `closeAllPopups`, the toolbar should be shown again
34533
+ * while the selection is still there. See #1238
34534
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__reopenSelectionPopup", false), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "snapRange", null), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "elmsList", (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.keys)(this.j.o.popup, false).filter((s)=>!this.isExcludedTarget(s)));
34450
34535
  }
34451
34536
  }
34452
34537
  (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(inlinePopup, "requires", [
@@ -34475,6 +34560,12 @@ const align = {
34475
34560
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
34476
34561
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)(':outsideClick')
34477
34562
  ], inlinePopup.prototype, "onOutsideClick", null);
34563
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
34564
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
34565
+ ], inlinePopup.prototype, "__onDocumentMouseDown", null);
34566
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
34567
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
34568
+ ], inlinePopup.prototype, "__onCloseAllPopups", null);
34478
34569
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
34479
34570
  jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
34480
34571
  ], inlinePopup.prototype, "onSelectionStart", null);
@@ -34761,7 +34852,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.limitHTML = false;
34761
34852
  jodit.e.fire('denyWords.limit limit.limit');
34762
34853
  return true;
34763
34854
  }
34764
- const should = Boolean(limitChars && isGt(words.join('').length, limitChars, strict));
34855
+ // with `countTextSpaces` enabled the limiter counts characters the
34856
+ // same way as the `stat` plugin's counter — including spaces. See #1144
34857
+ const charsCount = jodit.o.countTextSpaces ? text.replace((0,jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.INVISIBLE_SPACE_REG_EXP)(), '').replace(/[\r\n]/g, '').length : words.join('').length;
34858
+ const should = Boolean(limitChars && isGt(charsCount, limitChars, strict));
34765
34859
  if (should) {
34766
34860
  jodit.e.fire('denyChars.limit limit.limit');
34767
34861
  }
@@ -36893,9 +36987,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.paste = {
36893
36987
  */ class paste extends jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
36894
36988
  /** @override **/ afterInit(jodit) {
36895
36989
  jodit.e.on('paste.paste', this.onPaste).on('pasteStack.paste', (item)=>this.pasteStack.push(item));
36896
- if (jodit.o.nl2brInPlainText) {
36897
- this.j.e.on('processPaste.paste', this.onProcessPasteReplaceNl2Br);
36898
- }
36990
+ this.j.e.on('processPaste.paste', this.onProcessPasteReplaceNl2Br);
36899
36991
  }
36900
36992
  /** @override **/ beforeDestruct(jodit) {
36901
36993
  jodit.e.off('paste.paste', this.onPaste).off('processPaste.paste', this.onProcessPasteReplaceNl2Br).off('.paste');
@@ -37015,10 +37107,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.paste = {
37015
37107
  (0,_helpers__WEBPACK_IMPORTED_MODULE_9__.pasteInsertHtml)(e, this.j, html);
37016
37108
  }
37017
37109
  /**
37018
- * Replace all \\n chars in plain text to br
37110
+ * Escape plain text and replace all \\n chars with br
37019
37111
  */ onProcessPasteReplaceNl2Br(ignore, text, type) {
37020
37112
  if (type === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.TEXT_PLAIN + ';' && !(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isHTML)(text)) {
37021
- return (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.nl2br)(text);
37113
+ // the clipboard contains only plain text — escape special chars
37114
+ // so a stray `<` is not parsed as an unclosed tag and does not
37115
+ // swallow the rest of the string. See #1227
37116
+ const escaped = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.htmlspecialchars)(text);
37117
+ return this.j.o.nl2brInPlainText ? (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.nl2br)(escaped) : escaped;
37022
37118
  }
37023
37119
  }
37024
37120
  constructor(...args){
@@ -37887,9 +37983,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.allowResizeY = true;
37887
37983
  /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(84839);
37888
37984
  /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(27795);
37889
37985
  /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(28077);
37890
- /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(91206);
37891
- /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4099);
37892
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(58293);
37986
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65946);
37987
+ /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(91206);
37988
+ /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(4099);
37989
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(58293);
37893
37990
  /*!
37894
37991
  * Jodit Editor (https://xdsoft.net/jodit/)
37895
37992
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -37906,7 +38003,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.allowResizeY = true;
37906
38003
 
37907
38004
 
37908
38005
 
37909
- class resizeHandler extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugin {
38006
+
38007
+ class resizeHandler extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugin {
37910
38008
  /** @override **/ afterInit(editor) {
37911
38009
  const { height, width, allowResizeX } = editor.o;
37912
38010
  let { allowResizeY } = editor.o;
@@ -37940,11 +38038,21 @@ class resizeHandler extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
37940
38038
  if (!this.isResized) {
37941
38039
  return;
37942
38040
  }
38041
+ let { clientX, clientY } = e;
38042
+ if (e.view === this.j.ew && this.j.ew !== this.j.ow) {
38043
+ // the event was proxied from the editor's iframe — its client
38044
+ // coordinates are relative to the iframe viewport, while the
38045
+ // start point was captured on the host-document handle;
38046
+ // shift them into the host coordinate space
38047
+ const workplacePosition = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.offset)(this.j.workplace, this.j, this.j.od, true);
38048
+ clientX += workplacePosition.left;
38049
+ clientY += workplacePosition.top;
38050
+ }
37943
38051
  if (this.j.o.allowResizeY) {
37944
- this.j.e.fire('setHeight', this.start.h + e.clientY - this.start.y);
38052
+ this.j.e.fire('setHeight', this.start.h + clientY - this.start.y);
37945
38053
  }
37946
38054
  if (this.j.o.allowResizeX) {
37947
- this.j.e.fire('setWidth', this.start.w + e.clientX - this.start.x);
38055
+ this.j.e.fire('setWidth', this.start.w + clientX - this.start.x);
37948
38056
  }
37949
38057
  this.j.e.fire('resize');
37950
38058
  }
@@ -37973,7 +38081,7 @@ class resizeHandler extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
37973
38081
  h: 0
37974
38082
  }), /**
37975
38083
  * Resize handle
37976
- */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "handle", this.j.c.div('jodit-editor__resize', jodit_core_ui__WEBPACK_IMPORTED_MODULE_6__.Icon.get('resize_handler')));
38084
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "handle", this.j.c.div('jodit-editor__resize', jodit_core_ui__WEBPACK_IMPORTED_MODULE_7__.Icon.get('resize_handler')));
37977
38085
  }
37978
38086
  }
37979
38087
  /** @override **/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(resizeHandler, "requires", [
@@ -38158,7 +38266,11 @@ const keyBInd = '__jodit-resizer_binded';
38158
38266
  this.pointerX = e.clientX;
38159
38267
  this.pointerY = e.clientY;
38160
38268
  let diff_x, diff_y;
38161
- if (this.j.options.iframe) {
38269
+ if (this.j.options.iframe && e.view === this.j.ew) {
38270
+ // the event was proxied from the editor's iframe — its client
38271
+ // coordinates are relative to the iframe viewport, while
38272
+ // `startX/startY` were captured on a host-document handle;
38273
+ // shift them into the host coordinate space
38162
38274
  const workplacePosition = this.getWorkplacePosition();
38163
38275
  diff_x = e.clientX + workplacePosition.left - this.startX;
38164
38276
  diff_y = e.clientY + workplacePosition.top - this.startY;
@@ -40816,6 +40928,13 @@ class SourceEditor {
40816
40928
  }
40817
40929
  setFocusToMirror() {
40818
40930
  var _this_sourceEditor;
40931
+ const active = this.j.od.activeElement;
40932
+ // do not steal focus from another editor or control — e.g. when the
40933
+ // mode is switched programmatically (a Vue/React wrapper re-render)
40934
+ // while the user is already typing elsewhere. See #1356
40935
+ if (active && active !== this.j.od.body && !this.j.container.contains(active)) {
40936
+ return;
40937
+ }
40819
40938
  (_this_sourceEditor = this.sourceEditor) === null || _this_sourceEditor === void 0 ? void 0 : _this_sourceEditor.focus();
40820
40939
  }
40821
40940
  saveSelection() {
@@ -43830,7 +43949,7 @@ module.exports["default"] = ["Напишите что-либо","О Jodit","Ре
43830
43949
  /***/ 68368:
43831
43950
  /***/ (function(module) {
43832
43951
 
43833
- module.exports["default"] = ["Bir şeyler yaz","Jodit Hakkında","Jodit Editor","Jodit Kullanım Kılavuzu","kullanım için detaylı bilgiler içerir","Lisans hakkında bilgi için lütfen web sitemize gidin:","Tam versiyonunu satın al","Copyright © XDSoft.net - Chupurnov Valeriy. Tüm hakları saklıdır.","Bağlantı","Yeni sekmede aç","Editörü tam ekranda aç","Stili temizle","Renk doldur veya yazı rengi seç","Yinele","Geri Al","Kalın","İtalik","Sırasız Liste Ekle","Sıralı Liste Ekle","Ortala","Kenarlara Yasla","Sola Yasla","Sağa Yasla","Yatay Çizgi Ekle","Resim Ekle","Dosya Ekle","Youtube/Vimeo Videosu Ekle","Bağlantı Ekle","Font Boyutu","Font Ailesi","Blok Ekle","Normal","Başlık 1","Başlık 2","Başlık 3","Başlık 4","Alıntı","Kod","Ekle","Tablo Ekle","Girintiyi Azalt","Girintiyi Arttır","Özel Karakter Seç","Özel Karakter Ekle","Resim Biçimi","Mod Değiştir","Boşluklar","Üst","Sağ","Alt","Sol","CSS Stilleri","CSS Sınıfları","Hizalama","Sağ","Ortalı","Sol","Belirsiz","Kaynak","Başlık","Alternatif Yazı","Link","Bağlantıyı yeni sekmede aç","Resim","Dosya","Gelişmiş","Resim özellikleri","İptal","Tamam","Dosya Listeleyici","Liste yüklenirken hata oluştu","Klasörler yüklenirken hata oluştur","Emin misiniz?","Dizin yolu giriniz","Dizin oluştur","İsim yaz","Resim bırak","Dosya bırak","veya tıkla","Alternatif yazı","Yükle","Gözat","Arka plan","Yazı","Üst","Orta","Aşağı","Öncesine kolon ekle","Sonrasına kolon ekle","Üstüne satır ekle","Altına satır ekle","Tabloyu sil","Satırı sil","Kolonu sil","Hücreyi temizle","Harfler: %d","Kelimeler: %d","Üstü çizili","Alt çizgi","Üst yazı","Alt yazı","Seçilimi kes","Tümünü seç","Satır sonu","Ara","Şununla değiştir","Değiştir","Yapıştır","Yapıştırılacak içerik seç","Kaynak","Kalın","italik","Fırça","Bağlantı","Geri al","Yinele","Tablo","Resim","Silgi","Paragraf","Font boyutu","Video","Font","Hakkında","Yazdır","Alt çizgi","Üstü çizili","Girinti","Çıkıntı","Tam ekran","Küçült","Ayraç","Sırasız liste","Sıralı liste","Kes","Tümünü seç","Kod ekle","Bağlantıyı aç","Bağlantıyı düzenle","Nofollow özelliği","Bağlantıyı kaldır","Güncelle","Düzenlemek için","Yorumu","URL","Düzenle","Yatay hizala","Filtre","Değişime göre sırala","İsme göre sırala","Boyuta göre sırala","Klasör ekle","Sıfırla","Kaydet","Farklı kaydet","Boyutlandır","Kırp","Genişlik","Yükseklik","En boy oranını koru","Evet","Hayır","Sil","Seç","Seç: %s","Dikey hizala","Ayır","Birleştir","Kolon ekle","Satır ekle","Lisans: %s","Sil","Dikey ayır","Yatay ayır","Kenarlık","Kodunuz HTML koduna benziyor. HTML olarak devam etmek ister misiniz?","HTML olarak yapıştır","Sakla","Yazı olarak ekle","Sadece yazıyı ekle","Sadece kendi resimlerinizi düzenleyebilirsiniz. Bu görseli kendi hostunuza indirmek ister misiniz?","Görsel başarıyla hostunuza yüklendi","Palet","Bu dizinde dosya yok","Yeniden isimlendir","Yeni isim girin","Ön izleme","İndir","Panodan yapıştır ","Tarayıcınız panoya doğrudan erişimi desteklemiyor.","Seçimi kopyala","Kopyala","Sınır yarıçapı","Tümünü Göster","Uygula","Lütfen bu alanı doldurun","Lütfen bir web adresi girin","Varsayılan","Daire","Nokta","Kare","Bul","Öncekini Bul","Sonrakini Bul","Der Inhalt, den Sie einfügen, stammt aus einem Microsoft Word / Excel-Dokument. Möchten Sie das Format erhalten oder löschen?","Word biçiminde yapıştırma algılandı","Temizle","Sınıf adı girin","Özel yeniden boyutlandırma için Alt tuşuna basın",null,null,null,"Tümü"]
43952
+ module.exports["default"] = ["Bir şeyler yaz","Jodit Hakkında","Jodit Editor","Jodit Kullanım Kılavuzu","kullanım için detaylı bilgiler içerir","Lisans hakkında bilgi için lütfen web sitemize gidin:","Tam versiyonunu satın al","Copyright © XDSoft.net - Chupurnov Valeriy. Tüm hakları saklıdır.","Bağlantı","Yeni sekmede aç","Editörü tam ekranda aç","Stili temizle","Renk doldur veya yazı rengi seç","Yinele","Geri Al","Kalın","İtalik","Sırasız Liste Ekle","Sıralı Liste Ekle","Ortala","Kenarlara Yasla","Sola Yasla","Sağa Yasla","Yatay Çizgi Ekle","Resim Ekle","Dosya Ekle","Youtube/Vimeo Videosu Ekle","Bağlantı Ekle","Font Boyutu","Font Ailesi","Blok Ekle","Normal","Başlık 1","Başlık 2","Başlık 3","Başlık 4","Alıntı","Kod","Ekle","Tablo Ekle","Girintiyi Azalt","Girintiyi Arttır","Özel Karakter Seç","Özel Karakter Ekle","Resim Biçimi","Mod Değiştir","Boşluklar","Üst","Sağ","Alt","Sol","CSS Stilleri","CSS Sınıfları","Hizalama","Sağ","Ortalı","Sol","Belirsiz","Kaynak","Başlık","Alternatif Yazı","Link","Bağlantıyı yeni sekmede aç","Resim","Dosya","Gelişmiş","Resim özellikleri","İptal","Tamam","Dosya Listeleyici","Liste yüklenirken hata oluştu","Klasörler yüklenirken hata oluştur","Emin misiniz?","Dizin yolu giriniz","Dizin oluştur","İsim yaz","Resim bırak","Dosya bırak","veya tıkla","Alternatif yazı","Yükle","Gözat","Arka plan","Yazı","Üst","Orta","Aşağı","Öncesine kolon ekle","Sonrasına kolon ekle","Üstüne satır ekle","Altına satır ekle","Tabloyu sil","Satırı sil","Kolonu sil","Hücreyi temizle","Harfler: %d","Kelimeler: %d","Üstü çizili","Alt çizgi","Üst yazı","Alt yazı","Seçilimi kes","Tümünü seç","Satır sonu","Ara","Şununla değiştir","Değiştir","Yapıştır","Yapıştırılacak içerik seç","Kaynak","Kalın","italik","Fırça","Bağlantı","Geri al","Yinele","Tablo","Resim","Silgi","Paragraf","Font boyutu","Video","Font","Hakkında","Yazdır","Alt çizgi","Üstü çizili","Girinti","Çıkıntı","Tam ekran","Küçült","Ayraç","Sırasız liste","Sıralı liste","Kes","Tümünü seç","Kod ekle","Bağlantıyı aç","Bağlantıyı düzenle","Nofollow özelliği","Bağlantıyı kaldır","Güncelle","Düzenlemek için","Yorumu","URL","Düzenle","Yatay hizala","Filtre","Değişime göre sırala","İsme göre sırala","Boyuta göre sırala","Klasör ekle","Sıfırla","Kaydet","Farklı kaydet","Boyutlandır","Kırp","Genişlik","Yükseklik","En boy oranını koru","Evet","Hayır","Sil","Seç","Seç: %s","Dikey hizala","Ayır","Birleştir","Kolon ekle","Satır ekle","Lisans: %s","Sil","Dikey ayır","Yatay ayır","Kenarlık","Kodunuz HTML koduna benziyor. HTML olarak devam etmek ister misiniz?","HTML olarak yapıştır","Sakla","Yazı olarak ekle","Sadece yazıyı ekle","Sadece kendi resimlerinizi düzenleyebilirsiniz. Bu görseli kendi hostunuza indirmek ister misiniz?","Görsel başarıyla hostunuza yüklendi","Palet","Bu dizinde dosya yok","Yeniden isimlendir","Yeni isim girin","Ön izleme","İndir","Panodan yapıştır ","Tarayıcınız panoya doğrudan erişimi desteklemiyor.","Seçimi kopyala","Kopyala","Sınır yarıçapı","Tümünü Göster","Uygula","Lütfen bu alanı doldurun","Lütfen bir web adresi girin","Varsayılan","Daire","Nokta","Kare","Bul","Öncekini Bul","Sonrakini Bul","Yapıştırılan içerik bir Microsoft Word/Excel belgesinden geliyor. Formatı korumak yoksa temizlemek mi istiyorsunuz?","Word biçiminde yapıştırma algılandı","Temizle","Sınıf adı girin","Özel yeniden boyutlandırma için Alt tuşuna basın",null,null,null,"Tümü"]
43834
43953
 
43835
43954
  /***/ }),
43836
43955