jodit-pro-react 5.5.39 → 5.5.40

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  JoditEditor_default
3
- } from "./chunk-HUTDB76G.mjs";
3
+ } from "./chunk-O6YNTRQ2.mjs";
4
4
  export {
5
5
  JoditEditor_default as default
6
6
  };
@@ -193,7 +193,7 @@ var APP_VERSION, ES, IS_ES_MODERN, IS_ES_NEXT, IS_PROD, IS_TEST, FAT_MODE, HOMEP
193
193
  var init_constants = __esm({
194
194
  "node_modules/jodit/esm/core/constants.js"() {
195
195
  "use strict";
196
- APP_VERSION = "4.12.21";
196
+ APP_VERSION = "4.12.22";
197
197
  ES = "es2020";
198
198
  IS_ES_MODERN = true;
199
199
  IS_ES_NEXT = true;
@@ -1852,12 +1852,10 @@ var init_dom = __esm({
1852
1852
  * Check if element is element node
1853
1853
  */
1854
1854
  static isElement(node) {
1855
- var _a2;
1856
1855
  if (!_Dom.isNode(node)) {
1857
1856
  return false;
1858
1857
  }
1859
- const win = (_a2 = node.ownerDocument) === null || _a2 === void 0 ? void 0 : _a2.defaultView;
1860
- return Boolean(win && node.nodeType === Node.ELEMENT_NODE);
1858
+ return node.nodeType === Node.ELEMENT_NODE;
1861
1859
  }
1862
1860
  /**
1863
1861
  * Check if element is document fragment
@@ -1879,7 +1877,7 @@ var init_dom = __esm({
1879
1877
  return false;
1880
1878
  }
1881
1879
  const win = (_a2 = node.ownerDocument) === null || _a2 === void 0 ? void 0 : _a2.defaultView;
1882
- return Boolean(win && node instanceof win.HTMLElement);
1880
+ return node instanceof (win ? win.HTMLElement : HTMLElement);
1883
1881
  }
1884
1882
  /**
1885
1883
  * Check element is inline block
@@ -11723,7 +11721,7 @@ var Dialog = Dialog_1 = class Dialog2 extends ViewWithToolbar {
11723
11721
  e42.stopImmediatePropagation();
11724
11722
  }
11725
11723
  if (this.resizable && this.o.resizable) {
11726
- this.setSize(this.startPoint.w + e42.clientX - this.startX, this.startPoint.h + e42.clientY - this.startY);
11724
+ this.setSize(Math.max(this.startPoint.w + e42.clientX - this.startX, this.minSize.w), Math.max(this.startPoint.h + e42.clientY - this.startY, this.minSize.h));
11727
11725
  if (this.e) {
11728
11726
  this.e.fire(this, "resizeDialog", e42.clientX - this.startX, e42.clientY - this.startY);
11729
11727
  }
@@ -11744,11 +11742,18 @@ var Dialog = Dialog_1 = class Dialog2 extends ViewWithToolbar {
11744
11742
  }
11745
11743
  }
11746
11744
  __onResizerMouseDown(e42) {
11745
+ var _a2, _b, _c;
11747
11746
  this.resizable = true;
11748
11747
  this.startX = e42.clientX;
11749
11748
  this.startY = e42.clientY;
11750
11749
  this.startPoint.w = this.dialog.offsetWidth;
11751
11750
  this.startPoint.h = this.dialog.offsetHeight;
11751
+ const header = this.getElm("header");
11752
+ const footer = this.getElm("footer");
11753
+ const content = this.getElm("content");
11754
+ const contentMinHeight = content ? parseFloat(this.ow.getComputedStyle(content).minHeight) || 0 : 0;
11755
+ this.minSize.w = isNumber(this.o.minWidth) ? this.o.minWidth : Math.max(100, (_a2 = footer === null || footer === void 0 ? void 0 : footer.scrollWidth) !== null && _a2 !== void 0 ? _a2 : 0);
11756
+ this.minSize.h = isNumber(this.o.minHeight) ? this.o.minHeight : ((_b = header === null || header === void 0 ? void 0 : header.offsetHeight) !== null && _b !== void 0 ? _b : 0) + ((_c = footer === null || footer === void 0 ? void 0 : footer.offsetHeight) !== null && _c !== void 0 ? _c : 0) + contentMinHeight + this.resizer.offsetHeight;
11752
11757
  this.lockSelect();
11753
11758
  this.__addGlobalResizeListeners();
11754
11759
  if (this.e) {
@@ -12032,6 +12037,7 @@ var Dialog = Dialog_1 = class Dialog2 extends ViewWithToolbar {
12032
12037
  this.setPosition();
12033
12038
  }
12034
12039
  };
12040
+ this.minSize = { w: 0, h: 0 };
12035
12041
  this.isModal = false;
12036
12042
  this.isOpened = false;
12037
12043
  const self2 = this;
@@ -20061,12 +20067,16 @@ __export(filters_exports, {
20061
20067
  // node_modules/jodit/esm/plugins/clean-html/helpers/visitor/filters/allow-attributes.js
20062
20068
  init_dom();
20063
20069
  function allowAttributes(jodit, nodeElm, hadEffect, allow) {
20064
- if (allow && Dom.isElement(nodeElm) && allow[nodeElm.nodeName] !== true) {
20070
+ const allowedForTag = allow && Dom.isElement(nodeElm) && allow[nodeElm.nodeName];
20071
+ if (allow && Dom.isElement(nodeElm) && allowedForTag !== true) {
20072
+ if (!allowedForTag) {
20073
+ return hadEffect;
20074
+ }
20065
20075
  const attrs = nodeElm.attributes;
20066
20076
  if (attrs && attrs.length) {
20067
20077
  const removeAttrs = [];
20068
20078
  for (let i53 = 0; i53 < attrs.length; i53 += 1) {
20069
- const attr2 = allow[nodeElm.nodeName][attrs[i53].name];
20079
+ const attr2 = allowedForTag[attrs[i53].name];
20070
20080
  if (!attr2 || attr2 !== true && attr2 !== attrs[i53].value) {
20071
20081
  removeAttrs.push(attrs[i53].name);
20072
20082
  }
@@ -20423,9 +20433,15 @@ var cleanHtml = class extends Plugin {
20423
20433
  * Event handler when manually assigning a value to the HTML editor.
20424
20434
  */
20425
20435
  onBeforeSetNativeEditorValue(data) {
20426
- const [sandBox, iframe2] = this.j.o.cleanHTML.useIframeSandbox ? this.j.createInside.sandbox() : [this.j.createInside.div()];
20436
+ const [sandBox, iframe2] = this.j.o.cleanHTML.useIframeSandbox ? this.j.createInside.sandbox() : [
20437
+ // an inert document never loads sub-resources, so the
20438
+ // images in the value are not re-requested from the
20439
+ // server on every assignment (e.g. on each change in
20440
+ // jodit-react). See #1237
20441
+ this.j.od.implementation.createHTMLDocument("").body
20442
+ ];
20427
20443
  sandBox.innerHTML = data.value;
20428
- this.onSafeHTML(sandBox);
20444
+ this.j.e.fire("safeHTML", sandBox);
20429
20445
  data.value = sandBox.innerHTML;
20430
20446
  safeHTML(sandBox, { safeJavaScriptLink: true, removeOnError: true });
20431
20447
  Dom.safeRemove(iframe2);
@@ -20463,6 +20479,7 @@ pluginSystem.add("cleanHtml", cleanHtml);
20463
20479
  // node_modules/jodit/esm/plugins/clipboard/clipboard.js
20464
20480
  init_constants();
20465
20481
  init_cache();
20482
+ init_dom();
20466
20483
  init_global2();
20467
20484
  init_helpers();
20468
20485
 
@@ -20526,7 +20543,7 @@ var clipboard = class {
20526
20543
  (_a2 = this.buttons) === null || _a2 === void 0 ? void 0 : _a2.forEach((btn) => editor.registerButton(btn));
20527
20544
  editor.e.off(`copy.${CLIPBOARD_ID} cut.${CLIPBOARD_ID}`).on(`copy.${CLIPBOARD_ID} cut.${CLIPBOARD_ID}`, (event) => {
20528
20545
  var _a3;
20529
- const selectedText = editor.s.html;
20546
+ const selectedText = wrapWithInlineAncestors(editor, editor.s.html);
20530
20547
  const clipboardData = getDataTransfer(event) || getDataTransfer(editor.ew) || getDataTransfer(event.originalEvent);
20531
20548
  if (clipboardData) {
20532
20549
  clipboardData.setData(TEXT_PLAIN, stripTags(selectedText));
@@ -20552,6 +20569,23 @@ var clipboard = class {
20552
20569
  (_b = editor === null || editor === void 0 ? void 0 : editor.events) === null || _b === void 0 ? void 0 : _b.off("." + CLIPBOARD_ID);
20553
20570
  }
20554
20571
  };
20572
+ function wrapWithInlineAncestors(editor, html) {
20573
+ if (!html || editor.s.isCollapsed()) {
20574
+ return html;
20575
+ }
20576
+ let node = editor.s.range.commonAncestorContainer;
20577
+ if (!Dom.isElement(node)) {
20578
+ node = node.parentElement;
20579
+ }
20580
+ let result = html;
20581
+ while (node && node !== editor.editor && Dom.isElement(node) && !Dom.isBlock(node)) {
20582
+ const shell = node.cloneNode(false);
20583
+ shell.innerHTML = result;
20584
+ result = shell.outerHTML;
20585
+ node = node.parentElement;
20586
+ }
20587
+ return result;
20588
+ }
20555
20589
  pluginSystem.add("clipboard", clipboard);
20556
20590
 
20557
20591
  // node_modules/jodit/esm/plugins/color/color.js
@@ -24356,6 +24390,7 @@ var inlinePopup = class extends Plugin {
24356
24390
  constructor() {
24357
24391
  super(...arguments);
24358
24392
  this.type = null;
24393
+ this.__reopenSelectionPopup = false;
24359
24394
  this.snapRange = null;
24360
24395
  this.elmsList = keys(this.j.o.popup, false).filter((s48) => !this.isExcludedTarget(s48));
24361
24396
  }
@@ -24450,9 +24485,29 @@ var inlinePopup = class extends Plugin {
24450
24485
  this.hidePopup();
24451
24486
  this.previousTarget = void 0;
24452
24487
  }
24453
- }).on([this.j.ew, this.j.ow], "mouseup keyup", this.onSelectionEnd);
24488
+ }).on([this.j.ew, this.j.ow], "mouseup keyup", this.onSelectionEnd).on([this.j.ew, this.j.ow], "mousedown touchstart", this.__onDocumentMouseDown).on("closeAllPopups", this.__onCloseAllPopups);
24454
24489
  this.addListenersForElements();
24455
24490
  }
24491
+ __onDocumentMouseDown(e42) {
24492
+ if (this.popup.isOpened && this.type === "selection" && e42.target && UIElement.closestElement(e42.target, Popup)) {
24493
+ this.__reopenSelectionPopup = true;
24494
+ }
24495
+ }
24496
+ __onCloseAllPopups() {
24497
+ if (!this.__reopenSelectionPopup) {
24498
+ return;
24499
+ }
24500
+ this.__reopenSelectionPopup = false;
24501
+ if (!this.j.o.toolbarInlineForSelection) {
24502
+ return;
24503
+ }
24504
+ this.j.async.setTimeout(() => {
24505
+ const sel = this.j.s.sel;
24506
+ if (sel && !sel.isCollapsed) {
24507
+ this.showPopup(() => this.j.s.range.getBoundingClientRect(), "selection");
24508
+ }
24509
+ }, 1);
24510
+ }
24456
24511
  onSelectionStart() {
24457
24512
  this.snapRange = this.j.s.range.cloneRange();
24458
24513
  }
@@ -24502,7 +24557,7 @@ var inlinePopup = class extends Plugin {
24502
24557
  // }
24503
24558
  /** @override **/
24504
24559
  beforeDestruct(jodit) {
24505
- jodit.e.off("showPopup").off([this.j.ew, this.j.ow], "mouseup keyup", this.onSelectionEnd);
24560
+ jodit.e.off("showPopup").off([this.j.ew, this.j.ow], "mouseup keyup", this.onSelectionEnd).off([this.j.ew, this.j.ow], "mousedown touchstart", this.__onDocumentMouseDown).off("closeAllPopups", this.__onCloseAllPopups);
24506
24561
  this.removeListenersForElements();
24507
24562
  }
24508
24563
  _eventsList() {
@@ -24548,6 +24603,12 @@ __decorate48([
24548
24603
  __decorate48([
24549
24604
  watch(":outsideClick")
24550
24605
  ], inlinePopup.prototype, "onOutsideClick", null);
24606
+ __decorate48([
24607
+ autobind
24608
+ ], inlinePopup.prototype, "__onDocumentMouseDown", null);
24609
+ __decorate48([
24610
+ autobind
24611
+ ], inlinePopup.prototype, "__onCloseAllPopups", null);
24551
24612
  __decorate48([
24552
24613
  autobind
24553
24614
  ], inlinePopup.prototype, "onSelectionStart", null);
@@ -24766,7 +24827,8 @@ var limit = class extends Plugin {
24766
24827
  jodit.e.fire("denyWords.limit limit.limit");
24767
24828
  return true;
24768
24829
  }
24769
- const should = Boolean(limitChars && isGt(words.join("").length, limitChars, strict));
24830
+ const charsCount = jodit.o.countTextSpaces ? text.replace(INVISIBLE_SPACE_REG_EXP(), "").replace(/[\r\n]/g, "").length : words.join("").length;
24831
+ const should = Boolean(limitChars && isGt(charsCount, limitChars, strict));
24770
24832
  if (should) {
24771
24833
  jodit.e.fire("denyChars.limit limit.limit");
24772
24834
  }
@@ -26122,9 +26184,7 @@ var paste = class extends Plugin {
26122
26184
  /** @override **/
26123
26185
  afterInit(jodit) {
26124
26186
  jodit.e.on("paste.paste", this.onPaste).on("pasteStack.paste", (item) => this.pasteStack.push(item));
26125
- if (jodit.o.nl2brInPlainText) {
26126
- this.j.e.on("processPaste.paste", this.onProcessPasteReplaceNl2Br);
26127
- }
26187
+ this.j.e.on("processPaste.paste", this.onProcessPasteReplaceNl2Br);
26128
26188
  }
26129
26189
  /** @override **/
26130
26190
  beforeDestruct(jodit) {
@@ -26244,11 +26304,12 @@ var paste = class extends Plugin {
26244
26304
  pasteInsertHtml(e42, this.j, html);
26245
26305
  }
26246
26306
  /**
26247
- * Replace all \\n chars in plain text to br
26307
+ * Escape plain text and replace all \\n chars with br
26248
26308
  */
26249
26309
  onProcessPasteReplaceNl2Br(ignore, text, type) {
26250
26310
  if (type === TEXT_PLAIN + ";" && !isHTML(text)) {
26251
- return nl2br(text);
26311
+ const escaped = htmlspecialchars(text);
26312
+ return this.j.o.nl2brInPlainText ? nl2br(escaped) : escaped;
26252
26313
  }
26253
26314
  }
26254
26315
  };
@@ -27161,6 +27222,7 @@ pluginSystem.add("resizeCells", resizeCells);
27161
27222
  init_decorators();
27162
27223
  init_dom2();
27163
27224
  init_global2();
27225
+ init_helpers();
27164
27226
  init_plugin2();
27165
27227
 
27166
27228
  // node_modules/jodit/esm/plugins/resize-handler/config.js
@@ -27227,11 +27289,17 @@ var resizeHandler = class extends Plugin {
27227
27289
  if (!this.isResized) {
27228
27290
  return;
27229
27291
  }
27292
+ let { clientX, clientY } = e42;
27293
+ if (e42.view === this.j.ew && this.j.ew !== this.j.ow) {
27294
+ const workplacePosition = offset(this.j.workplace, this.j, this.j.od, true);
27295
+ clientX += workplacePosition.left;
27296
+ clientY += workplacePosition.top;
27297
+ }
27230
27298
  if (this.j.o.allowResizeY) {
27231
- this.j.e.fire("setHeight", this.start.h + e42.clientY - this.start.y);
27299
+ this.j.e.fire("setHeight", this.start.h + clientY - this.start.y);
27232
27300
  }
27233
27301
  if (this.j.o.allowResizeX) {
27234
- this.j.e.fire("setWidth", this.start.w + e42.clientX - this.start.x);
27302
+ this.j.e.fire("setWidth", this.start.w + clientX - this.start.x);
27235
27303
  }
27236
27304
  this.j.e.fire("resize");
27237
27305
  }
@@ -27454,7 +27522,7 @@ var resizer = class extends Plugin {
27454
27522
  this.pointerX = e42.clientX;
27455
27523
  this.pointerY = e42.clientY;
27456
27524
  let diff_x, diff_y;
27457
- if (this.j.options.iframe) {
27525
+ if (this.j.options.iframe && e42.view === this.j.ew) {
27458
27526
  const workplacePosition = this.getWorkplacePosition();
27459
27527
  diff_x = e42.clientX + workplacePosition.left - this.startX;
27460
27528
  diff_y = e42.clientY + workplacePosition.top - this.startY;
@@ -29649,6 +29717,10 @@ var source = class extends Plugin {
29649
29717
  }
29650
29718
  setFocusToMirror() {
29651
29719
  var _a2;
29720
+ const active = this.j.od.activeElement;
29721
+ if (active && active !== this.j.od.body && !this.j.container.contains(active)) {
29722
+ return;
29723
+ }
29652
29724
  (_a2 = this.sourceEditor) === null || _a2 === void 0 ? void 0 : _a2.focus();
29653
29725
  }
29654
29726
  saveSelection() {
@@ -38462,7 +38534,7 @@ var tr_default6 = {
38462
38534
  Clean: "Temizle",
38463
38535
  "Insert as Text": "Yaz\u0131 olarak ekle",
38464
38536
  "Word Paste Detected": "Word bi\xE7iminde yap\u0131\u015Ft\u0131rma alg\u0131land\u0131",
38465
- "The pasted content is coming from a Microsoft Word/Excel document. Do you want to keep the format or clean it up?": "Der Inhalt, den Sie einf\xFCgen, stammt aus einem Microsoft Word / Excel-Dokument. M\xF6chten Sie das Format erhalten oder l\xF6schen?",
38537
+ "The pasted content is coming from a Microsoft Word/Excel document. Do you want to keep the format or clean it up?": "Yap\u0131\u015Ft\u0131r\u0131lan i\xE7erik bir Microsoft Word/Excel belgesinden geliyor. Format\u0131 korumak m\u0131 yoksa temizlemek mi istiyorsunuz?",
38466
38538
  "Insert only Text": "Sadece yaz\u0131y\u0131 ekle",
38467
38539
  "File Browser": "Dosya Listeleyici",
38468
38540
  "Error on load list": "Liste y\xFCklenirken hata olu\u015Ftu",
@@ -2,7 +2,7 @@ import {
2
2
  Config,
3
3
  JoditEditor_default,
4
4
  n
5
- } from "./chunk-HUTDB76G.mjs";
5
+ } from "./chunk-O6YNTRQ2.mjs";
6
6
 
7
7
  // src/index.ts
8
8
  var index_default = JoditEditor_default;