jodit-pro-react 5.5.39 → 5.5.41

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-4T2ZQM4O.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.23";
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
@@ -3065,7 +3063,13 @@ var init_is_equal = __esm({
3065
3063
 
3066
3064
  // node_modules/jodit/esm/core/helpers/checker/is-html-from-word.js
3067
3065
  function isHtmlFromWord(data) {
3068
- return data.search(/<meta.*?Microsoft Excel\s[\d].*?>/) !== -1 || data.search(/<meta.*?Microsoft Word\s[\d].*?>/) !== -1 || data.search(/style="[^"]*mso-/) !== -1 && data.search(/<font/) !== -1;
3066
+ return data.search(/<meta.*?Microsoft Excel\s[\d].*?>/) !== -1 || data.search(/<meta.*?Microsoft Word\s[\d].*?>/) !== -1 || // `<meta name=ProgId content=Word.Document>` attribute values are
3067
+ // unquoted in the raw Word clipboard fragment
3068
+ data.search(/<meta[^>]*?ProgId[^>]*?(Word|Excel)\./i) !== -1 || // LibreOffice/OpenOffice Writer & Calc
3069
+ data.search(/<meta[^>]*?(LibreOffice|OpenOffice)/i) !== -1 || // Office namespaces on the root element of the clipboard fragment
3070
+ data.search(/urn:schemas-microsoft-com:office:(word|excel)/) !== -1 || // `class=MsoNormal` and friends (unquoted/quoted)
3071
+ data.search(/<\w[^>]*\sclass=("|')?Mso/) !== -1 || // the raw Word clipboard uses SINGLE quotes: style='mso-…'
3072
+ data.search(/style='[^']*mso-/) !== -1 || data.search(/style="[^"]*mso-/) !== -1 && data.search(/<font/) !== -1;
3069
3073
  }
3070
3074
  var init_is_html_from_word = __esm({
3071
3075
  "node_modules/jodit/esm/core/helpers/checker/is-html-from-word.js"() {
@@ -5845,6 +5849,9 @@ var init_view_component = __esm({
5845
5849
  */
5846
5850
  setParentView(jodit) {
5847
5851
  this.jodit = jodit;
5852
+ if (jodit.ow) {
5853
+ this.ownerWindow = jodit.ow;
5854
+ }
5848
5855
  jodit.components.add(this);
5849
5856
  return this;
5850
5857
  }
@@ -8936,8 +8943,9 @@ var Popup = class _Popup extends UIGroup {
8936
8943
  * Calculate static bound for point
8937
8944
  */
8938
8945
  getKeepBound(getBound) {
8946
+ var _a2;
8939
8947
  const oldBound = getBound();
8940
- const elmUnderCursor = this.od.elementFromPoint(oldBound.left, oldBound.top);
8948
+ const elmUnderCursor = ((_a2 = this.j.o.shadowRoot) !== null && _a2 !== void 0 ? _a2 : this.od).elementFromPoint(oldBound.left, oldBound.top);
8941
8949
  if (!elmUnderCursor) {
8942
8950
  return getBound;
8943
8951
  }
@@ -11723,7 +11731,7 @@ var Dialog = Dialog_1 = class Dialog2 extends ViewWithToolbar {
11723
11731
  e42.stopImmediatePropagation();
11724
11732
  }
11725
11733
  if (this.resizable && this.o.resizable) {
11726
- this.setSize(this.startPoint.w + e42.clientX - this.startX, this.startPoint.h + e42.clientY - this.startY);
11734
+ 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
11735
  if (this.e) {
11728
11736
  this.e.fire(this, "resizeDialog", e42.clientX - this.startX, e42.clientY - this.startY);
11729
11737
  }
@@ -11744,11 +11752,18 @@ var Dialog = Dialog_1 = class Dialog2 extends ViewWithToolbar {
11744
11752
  }
11745
11753
  }
11746
11754
  __onResizerMouseDown(e42) {
11755
+ var _a2, _b, _c;
11747
11756
  this.resizable = true;
11748
11757
  this.startX = e42.clientX;
11749
11758
  this.startY = e42.clientY;
11750
11759
  this.startPoint.w = this.dialog.offsetWidth;
11751
11760
  this.startPoint.h = this.dialog.offsetHeight;
11761
+ const header = this.getElm("header");
11762
+ const footer = this.getElm("footer");
11763
+ const content = this.getElm("content");
11764
+ const contentMinHeight = content ? parseFloat(this.ow.getComputedStyle(content).minHeight) || 0 : 0;
11765
+ 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);
11766
+ 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
11767
  this.lockSelect();
11753
11768
  this.__addGlobalResizeListeners();
11754
11769
  if (this.e) {
@@ -12032,6 +12047,7 @@ var Dialog = Dialog_1 = class Dialog2 extends ViewWithToolbar {
12032
12047
  this.setPosition();
12033
12048
  }
12034
12049
  };
12050
+ this.minSize = { w: 0, h: 0 };
12035
12051
  this.isModal = false;
12036
12052
  this.isOpened = false;
12037
12053
  const self2 = this;
@@ -16128,13 +16144,29 @@ var ToolbarContent = class ToolbarContent2 extends UIButton {
16128
16144
  }
16129
16145
  /** @override */
16130
16146
  update() {
16131
- const content = this.control.getContent(this.j, this);
16147
+ var _a2, _b, _c;
16148
+ const { control } = this;
16149
+ const content = control.getContent(this.j, this);
16132
16150
  if (isString(content) || content.parentNode !== this.container) {
16133
16151
  Dom.detach(this.container);
16134
16152
  this.container.appendChild(isString(content) ? this.j.create.fromHTML(content) : content);
16135
16153
  }
16154
+ this.state.disabled = Boolean((_a2 = control.isDisabled) === null || _a2 === void 0 ? void 0 : _a2.call(control, this.j, this));
16155
+ this.state.activated = Boolean((_b = control.isActive) === null || _b === void 0 ? void 0 : _b.call(control, this.j, this));
16156
+ (_c = control.update) === null || _c === void 0 ? void 0 : _c.call(control, this.j, this);
16157
+ this.onChangeDisabled();
16158
+ this.onChangeActivated();
16136
16159
  super.update();
16137
16160
  }
16161
+ /**
16162
+ * The content is arbitrary HTML — propagate the disabled state to the
16163
+ * nested form controls (e.g. the file input of the Upload button),
16164
+ * otherwise they stay interactive.
16165
+ */
16166
+ onChangeDisabled() {
16167
+ super.onChangeDisabled();
16168
+ this.container.querySelectorAll("input,button,select,textarea").forEach((elm) => attr(elm, "disabled", this.state.disabled || null));
16169
+ }
16138
16170
  /** @override */
16139
16171
  createContainer() {
16140
16172
  return this.j.c.span(this.componentName);
@@ -17451,6 +17483,7 @@ function unwrapChildren(style, font2) {
17451
17483
  // node_modules/jodit/esm/core/selection/style/api/wrap.js
17452
17484
  init_dom2();
17453
17485
  init_attr();
17486
+ init_css();
17454
17487
 
17455
17488
  // node_modules/jodit/esm/core/selection/style/api/wrap-unwrapped-text.js
17456
17489
  init_dom();
@@ -17493,7 +17526,18 @@ function wrapUnwrappedText(style, elm, jodit) {
17493
17526
  // node_modules/jodit/esm/core/selection/style/api/wrap.js
17494
17527
  function wrap(commitStyle, font2, jodit) {
17495
17528
  const wrapper = findOrCreateWrapper(commitStyle, font2, jodit);
17496
- return commitStyle.elementIsList ? wrapList(commitStyle, wrapper, jodit) : Dom.replace(wrapper, commitStyle.element, jodit.createInside, true);
17529
+ if (commitStyle.elementIsList) {
17530
+ return wrapList(commitStyle, wrapper, jodit);
17531
+ }
17532
+ const newWrapper = Dom.replace(wrapper, commitStyle.element, jodit.createInside, true);
17533
+ if (commitStyle.elementIsBlock) {
17534
+ css(newWrapper, "fontSize", null);
17535
+ css(newWrapper, "fontWeight", null);
17536
+ if (!attr(newWrapper, "style")) {
17537
+ attr(newWrapper, "style", null);
17538
+ }
17539
+ }
17540
+ return newWrapper;
17497
17541
  }
17498
17542
  var WRAP_NODES = /* @__PURE__ */ new Set([
17499
17543
  "td",
@@ -19017,8 +19061,9 @@ var addNewLine = class extends Plugin {
19017
19061
  }
19018
19062
  }
19019
19063
  __onMouseMove(e42) {
19064
+ var _a2;
19020
19065
  const editor = this.j;
19021
- let currentElement = editor.ed.elementFromPoint(e42.clientX, e42.clientY);
19066
+ let currentElement = ((_a2 = editor.o.shadowRoot) !== null && _a2 !== void 0 ? _a2 : editor.ed).elementFromPoint(e42.clientX, e42.clientY);
19022
19067
  if (!Dom.isHTMLElement(currentElement) || !Dom.isOrContains(editor.editor, currentElement)) {
19023
19068
  return;
19024
19069
  }
@@ -19154,13 +19199,20 @@ function checkJoinNeighbors(jodit, fakeNode, backspace2) {
19154
19199
  jodit.s.setCursorBefore(fakeNode);
19155
19200
  return true;
19156
19201
  }
19157
- if (sibling && (checkMoveListContent(jodit, mainClosestBox, sibling, backspace2) || moveContentAndRemoveEmpty(jodit, mainClosestBox, sibling, backspace2))) {
19202
+ if (sibling && (checkMoveListContent(jodit, mainClosestBox, sibling, backspace2) || moveContentAndRemoveEmpty(jodit, mainClosestBox, resolveTableSibling(sibling, backspace2), backspace2))) {
19158
19203
  jodit.s.setCursorBefore(fakeNode);
19159
19204
  return true;
19160
19205
  }
19161
19206
  }
19162
19207
  return false;
19163
19208
  }
19209
+ function resolveTableSibling(sibling, backspace2) {
19210
+ if (!Dom.isTag(sibling, "table")) {
19211
+ return sibling;
19212
+ }
19213
+ const cells = sibling.querySelectorAll("td,th");
19214
+ return cells.length ? cells[backspace2 ? cells.length - 1 : 0] : null;
19215
+ }
19164
19216
  function checkMoveListContent(jodit, mainClosestBox, sibling, backspace2) {
19165
19217
  const siblingIsList = Dom.isTag(sibling, LIST_TAGS);
19166
19218
  const boxIsList = Dom.isTag(mainClosestBox, LIST_TAGS);
@@ -20061,12 +20113,16 @@ __export(filters_exports, {
20061
20113
  // node_modules/jodit/esm/plugins/clean-html/helpers/visitor/filters/allow-attributes.js
20062
20114
  init_dom();
20063
20115
  function allowAttributes(jodit, nodeElm, hadEffect, allow) {
20064
- if (allow && Dom.isElement(nodeElm) && allow[nodeElm.nodeName] !== true) {
20116
+ const allowedForTag = allow && Dom.isElement(nodeElm) && allow[nodeElm.nodeName];
20117
+ if (allow && Dom.isElement(nodeElm) && allowedForTag !== true) {
20118
+ if (!allowedForTag) {
20119
+ return hadEffect;
20120
+ }
20065
20121
  const attrs = nodeElm.attributes;
20066
20122
  if (attrs && attrs.length) {
20067
20123
  const removeAttrs = [];
20068
20124
  for (let i53 = 0; i53 < attrs.length; i53 += 1) {
20069
- const attr2 = allow[nodeElm.nodeName][attrs[i53].name];
20125
+ const attr2 = allowedForTag[attrs[i53].name];
20070
20126
  if (!attr2 || attr2 !== true && attr2 !== attrs[i53].value) {
20071
20127
  removeAttrs.push(attrs[i53].name);
20072
20128
  }
@@ -20423,9 +20479,15 @@ var cleanHtml = class extends Plugin {
20423
20479
  * Event handler when manually assigning a value to the HTML editor.
20424
20480
  */
20425
20481
  onBeforeSetNativeEditorValue(data) {
20426
- const [sandBox, iframe2] = this.j.o.cleanHTML.useIframeSandbox ? this.j.createInside.sandbox() : [this.j.createInside.div()];
20482
+ const [sandBox, iframe2] = this.j.o.cleanHTML.useIframeSandbox ? this.j.createInside.sandbox() : [
20483
+ // an inert document never loads sub-resources, so the
20484
+ // images in the value are not re-requested from the
20485
+ // server on every assignment (e.g. on each change in
20486
+ // jodit-react). See #1237
20487
+ this.j.od.implementation.createHTMLDocument("").body
20488
+ ];
20427
20489
  sandBox.innerHTML = data.value;
20428
- this.onSafeHTML(sandBox);
20490
+ this.j.e.fire("safeHTML", sandBox);
20429
20491
  data.value = sandBox.innerHTML;
20430
20492
  safeHTML(sandBox, { safeJavaScriptLink: true, removeOnError: true });
20431
20493
  Dom.safeRemove(iframe2);
@@ -20463,6 +20525,7 @@ pluginSystem.add("cleanHtml", cleanHtml);
20463
20525
  // node_modules/jodit/esm/plugins/clipboard/clipboard.js
20464
20526
  init_constants();
20465
20527
  init_cache();
20528
+ init_dom();
20466
20529
  init_global2();
20467
20530
  init_helpers();
20468
20531
 
@@ -20526,7 +20589,7 @@ var clipboard = class {
20526
20589
  (_a2 = this.buttons) === null || _a2 === void 0 ? void 0 : _a2.forEach((btn) => editor.registerButton(btn));
20527
20590
  editor.e.off(`copy.${CLIPBOARD_ID} cut.${CLIPBOARD_ID}`).on(`copy.${CLIPBOARD_ID} cut.${CLIPBOARD_ID}`, (event) => {
20528
20591
  var _a3;
20529
- const selectedText = editor.s.html;
20592
+ const selectedText = wrapWithInlineAncestors(editor, editor.s.html);
20530
20593
  const clipboardData = getDataTransfer(event) || getDataTransfer(editor.ew) || getDataTransfer(event.originalEvent);
20531
20594
  if (clipboardData) {
20532
20595
  clipboardData.setData(TEXT_PLAIN, stripTags(selectedText));
@@ -20552,6 +20615,23 @@ var clipboard = class {
20552
20615
  (_b = editor === null || editor === void 0 ? void 0 : editor.events) === null || _b === void 0 ? void 0 : _b.off("." + CLIPBOARD_ID);
20553
20616
  }
20554
20617
  };
20618
+ function wrapWithInlineAncestors(editor, html) {
20619
+ if (!html || editor.s.isCollapsed()) {
20620
+ return html;
20621
+ }
20622
+ let node = editor.s.range.commonAncestorContainer;
20623
+ if (!Dom.isElement(node)) {
20624
+ node = node.parentElement;
20625
+ }
20626
+ let result = html;
20627
+ while (node && node !== editor.editor && Dom.isElement(node) && !Dom.isBlock(node)) {
20628
+ const shell = node.cloneNode(false);
20629
+ shell.innerHTML = result;
20630
+ result = shell.outerHTML;
20631
+ node = node.parentElement;
20632
+ }
20633
+ return result;
20634
+ }
20555
20635
  pluginSystem.add("clipboard", clipboard);
20556
20636
 
20557
20637
  // node_modules/jodit/esm/plugins/color/color.js
@@ -20959,26 +21039,19 @@ function color(editor) {
20959
21039
  group: "color"
20960
21040
  });
20961
21041
  const callback = (command, second, third) => {
21042
+ var _a2;
20962
21043
  const colorHEX = normalizeColor(third);
20963
- switch (command) {
20964
- case "background":
20965
- editor.s.commitStyle({
20966
- attributes: {
20967
- style: {
20968
- backgroundColor: !colorHEX ? "" : colorHEX
20969
- }
20970
- }
20971
- });
20972
- break;
20973
- case "forecolor":
20974
- editor.s.commitStyle({
20975
- attributes: {
20976
- style: {
20977
- color: !colorHEX ? "" : colorHEX
20978
- }
20979
- }
20980
- });
20981
- break;
21044
+ const value = !colorHEX ? "" : colorHEX;
21045
+ const style = command === "background" ? { backgroundColor: value } : { color: value };
21046
+ const selectedCells = editor.getInstance("Table", editor.o).getAllSelectedCells();
21047
+ if (selectedCells.length && editor.s.isCollapsed()) {
21048
+ selectedCells.forEach((cell) => {
21049
+ editor.s.select(cell, true);
21050
+ editor.s.commitStyle({ attributes: { style } });
21051
+ });
21052
+ (_a2 = editor.s.sel) === null || _a2 === void 0 ? void 0 : _a2.removeAllRanges();
21053
+ } else {
21054
+ editor.s.commitStyle({ attributes: { style } });
20982
21055
  }
20983
21056
  editor.synchronizeValues();
20984
21057
  return false;
@@ -24356,6 +24429,7 @@ var inlinePopup = class extends Plugin {
24356
24429
  constructor() {
24357
24430
  super(...arguments);
24358
24431
  this.type = null;
24432
+ this.__reopenSelectionPopup = false;
24359
24433
  this.snapRange = null;
24360
24434
  this.elmsList = keys(this.j.o.popup, false).filter((s48) => !this.isExcludedTarget(s48));
24361
24435
  }
@@ -24450,9 +24524,45 @@ var inlinePopup = class extends Plugin {
24450
24524
  this.hidePopup();
24451
24525
  this.previousTarget = void 0;
24452
24526
  }
24453
- }).on([this.j.ew, this.j.ow], "mouseup keyup", this.onSelectionEnd);
24527
+ }).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
24528
  this.addListenersForElements();
24455
24529
  }
24530
+ __onDocumentMouseDown(e42) {
24531
+ if (this.popup.isOpened && this.type === "selection" && e42.target && UIElement.closestElement(e42.target, Popup)) {
24532
+ this.__reopenSelectionPopup = true;
24533
+ }
24534
+ }
24535
+ __onCloseAllPopups() {
24536
+ if (!this.__reopenSelectionPopup) {
24537
+ return;
24538
+ }
24539
+ this.__reopenSelectionPopup = false;
24540
+ if (!this.j.o.toolbarInlineForSelection) {
24541
+ return;
24542
+ }
24543
+ this.j.async.setTimeout(() => {
24544
+ const sel = this.j.s.sel;
24545
+ if (sel && !sel.isCollapsed) {
24546
+ this.showPopup(() => this.__selectionBound(), "selection");
24547
+ }
24548
+ }, 1);
24549
+ }
24550
+ /**
24551
+ * The selection rect comes from the editor document — in iframe mode its
24552
+ * coordinates are iframe-local, while the popup lives in the host
24553
+ * document, so the iframe offset must be added. See
24554
+ * https://github.com/xdan/jodit/issues/1058
24555
+ */
24556
+ __selectionBound() {
24557
+ const rect = this.j.s.range.getBoundingClientRect();
24558
+ let { left, top } = rect;
24559
+ if (this.j.iframe) {
24560
+ const offset2 = position(this.j.iframe, this.j, true);
24561
+ left += offset2.left;
24562
+ top += offset2.top;
24563
+ }
24564
+ return { left, top, width: rect.width, height: rect.height };
24565
+ }
24456
24566
  onSelectionStart() {
24457
24567
  this.snapRange = this.j.s.range.cloneRange();
24458
24568
  }
@@ -24485,7 +24595,7 @@ var inlinePopup = class extends Plugin {
24485
24595
  if (!node) {
24486
24596
  return;
24487
24597
  }
24488
- this.showPopup(() => range.getBoundingClientRect(), type);
24598
+ this.showPopup(() => this.__selectionBound(), type);
24489
24599
  }
24490
24600
  /**
24491
24601
  * In not collapsed selection - only one image
@@ -24502,7 +24612,7 @@ var inlinePopup = class extends Plugin {
24502
24612
  // }
24503
24613
  /** @override **/
24504
24614
  beforeDestruct(jodit) {
24505
- jodit.e.off("showPopup").off([this.j.ew, this.j.ow], "mouseup keyup", this.onSelectionEnd);
24615
+ 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
24616
  this.removeListenersForElements();
24507
24617
  }
24508
24618
  _eventsList() {
@@ -24548,6 +24658,12 @@ __decorate48([
24548
24658
  __decorate48([
24549
24659
  watch(":outsideClick")
24550
24660
  ], inlinePopup.prototype, "onOutsideClick", null);
24661
+ __decorate48([
24662
+ autobind
24663
+ ], inlinePopup.prototype, "__onDocumentMouseDown", null);
24664
+ __decorate48([
24665
+ autobind
24666
+ ], inlinePopup.prototype, "__onCloseAllPopups", null);
24551
24667
  __decorate48([
24552
24668
  autobind
24553
24669
  ], inlinePopup.prototype, "onSelectionStart", null);
@@ -24766,7 +24882,8 @@ var limit = class extends Plugin {
24766
24882
  jodit.e.fire("denyWords.limit limit.limit");
24767
24883
  return true;
24768
24884
  }
24769
- const should = Boolean(limitChars && isGt(words.join("").length, limitChars, strict));
24885
+ const charsCount = jodit.o.countTextSpaces ? text.replace(INVISIBLE_SPACE_REG_EXP(), "").replace(/[\r\n]/g, "").length : words.join("").length;
24886
+ const should = Boolean(limitChars && isGt(charsCount, limitChars, strict));
24770
24887
  if (should) {
24771
24888
  jodit.e.fire("denyChars.limit limit.limit");
24772
24889
  }
@@ -26045,6 +26162,7 @@ Config.prototype.controls.paste = {
26045
26162
  tooltip: "Paste from clipboard",
26046
26163
  exec(_0, _1, _22) {
26047
26164
  return __async(this, arguments, function* (editor, _12, { control }) {
26165
+ var _a2;
26048
26166
  if (control.name === psKey) {
26049
26167
  editor.execCommand("showPasteStorage");
26050
26168
  return;
@@ -26055,7 +26173,9 @@ Config.prototype.controls.paste = {
26055
26173
  try {
26056
26174
  const items = yield navigator.clipboard.read();
26057
26175
  if (items && items.length) {
26058
- const textBlob = yield items[0].getType(TEXT_PLAIN);
26176
+ const item = items[0];
26177
+ const type = ((_a2 = item.types) === null || _a2 === void 0 ? void 0 : _a2.includes(TEXT_HTML)) ? TEXT_HTML : TEXT_PLAIN;
26178
+ const textBlob = yield item.getType(type);
26059
26179
  text = yield new Response(textBlob).text();
26060
26180
  }
26061
26181
  error2 = false;
@@ -26122,9 +26242,7 @@ var paste = class extends Plugin {
26122
26242
  /** @override **/
26123
26243
  afterInit(jodit) {
26124
26244
  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
- }
26245
+ this.j.e.on("processPaste.paste", this.onProcessPasteReplaceNl2Br);
26128
26246
  }
26129
26247
  /** @override **/
26130
26248
  beforeDestruct(jodit) {
@@ -26244,11 +26362,12 @@ var paste = class extends Plugin {
26244
26362
  pasteInsertHtml(e42, this.j, html);
26245
26363
  }
26246
26364
  /**
26247
- * Replace all \\n chars in plain text to br
26365
+ * Escape plain text and replace all \\n chars with br
26248
26366
  */
26249
26367
  onProcessPasteReplaceNl2Br(ignore, text, type) {
26250
26368
  if (type === TEXT_PLAIN + ";" && !isHTML(text)) {
26251
- return nl2br(text);
26369
+ const escaped = htmlspecialchars(text);
26370
+ return this.j.o.nl2brInPlainText ? nl2br(escaped) : escaped;
26252
26371
  }
26253
26372
  }
26254
26373
  };
@@ -27161,6 +27280,7 @@ pluginSystem.add("resizeCells", resizeCells);
27161
27280
  init_decorators();
27162
27281
  init_dom2();
27163
27282
  init_global2();
27283
+ init_helpers();
27164
27284
  init_plugin2();
27165
27285
 
27166
27286
  // node_modules/jodit/esm/plugins/resize-handler/config.js
@@ -27227,11 +27347,17 @@ var resizeHandler = class extends Plugin {
27227
27347
  if (!this.isResized) {
27228
27348
  return;
27229
27349
  }
27350
+ let { clientX, clientY } = e42;
27351
+ if (e42.view === this.j.ew && this.j.ew !== this.j.ow) {
27352
+ const workplacePosition = offset(this.j.workplace, this.j, this.j.od, true);
27353
+ clientX += workplacePosition.left;
27354
+ clientY += workplacePosition.top;
27355
+ }
27230
27356
  if (this.j.o.allowResizeY) {
27231
- this.j.e.fire("setHeight", this.start.h + e42.clientY - this.start.y);
27357
+ this.j.e.fire("setHeight", this.start.h + clientY - this.start.y);
27232
27358
  }
27233
27359
  if (this.j.o.allowResizeX) {
27234
- this.j.e.fire("setWidth", this.start.w + e42.clientX - this.start.x);
27360
+ this.j.e.fire("setWidth", this.start.w + clientX - this.start.x);
27235
27361
  }
27236
27362
  this.j.e.fire("resize");
27237
27363
  }
@@ -27454,7 +27580,7 @@ var resizer = class extends Plugin {
27454
27580
  this.pointerX = e42.clientX;
27455
27581
  this.pointerY = e42.clientY;
27456
27582
  let diff_x, diff_y;
27457
- if (this.j.options.iframe) {
27583
+ if (this.j.options.iframe && e42.view === this.j.ew) {
27458
27584
  const workplacePosition = this.getWorkplacePosition();
27459
27585
  diff_x = e42.clientX + workplacePosition.left - this.startX;
27460
27586
  diff_y = e42.clientY + workplacePosition.top - this.startY;
@@ -28018,20 +28144,27 @@ var UISearch = class UISearch2 extends UIElement {
28018
28144
  return false;
28019
28145
  }).on(this.queryInput, "input", () => {
28020
28146
  this.setMod("empty-query", !trim(this.queryInput.value).length);
28021
- }).on(this.queryInput, "keydown", this.j.async.debounce((e42) => __async(this, null, function* () {
28022
- switch (e42.key) {
28023
- case KEY_ENTER:
28147
+ }).on(this.queryInput, "keydown", (() => {
28148
+ const debounced = this.j.async.debounce((e42) => __async(this, null, function* () {
28149
+ switch (e42.key) {
28150
+ case KEY_ENTER:
28151
+ if (yield jodit.e.fire("searchNext")) {
28152
+ this.close();
28153
+ }
28154
+ break;
28155
+ default:
28156
+ jodit.e.fire(this, "needUpdateCounters");
28157
+ break;
28158
+ }
28159
+ }), this.j.defaultTimeout);
28160
+ return (e42) => {
28161
+ if (e42.key === KEY_ENTER) {
28024
28162
  e42.preventDefault();
28025
28163
  e42.stopImmediatePropagation();
28026
- if (yield jodit.e.fire("searchNext")) {
28027
- this.close();
28028
- }
28029
- break;
28030
- default:
28031
- jodit.e.fire(this, "needUpdateCounters");
28032
- break;
28033
- }
28034
- }), this.j.defaultTimeout));
28164
+ }
28165
+ debounced(e42);
28166
+ };
28167
+ })());
28035
28168
  }
28036
28169
  onEditorKeyDown(e42) {
28037
28170
  if (!this.isOpened) {
@@ -28725,14 +28858,14 @@ var selectCells = class extends Plugin {
28725
28858
  * Mouse move inside the table
28726
28859
  */
28727
28860
  __onMove(table2, e42) {
28728
- var _a2;
28861
+ var _a2, _b;
28729
28862
  if (this.j.o.readonly && !this.j.isLocked) {
28730
28863
  return;
28731
28864
  }
28732
28865
  if (this.j.isLockedNotBy(key2)) {
28733
28866
  return;
28734
28867
  }
28735
- const node = this.j.ed.elementFromPoint(e42.clientX, e42.clientY);
28868
+ const node = ((_a2 = this.j.o.shadowRoot) !== null && _a2 !== void 0 ? _a2 : this.j.ed).elementFromPoint(e42.clientX, e42.clientY);
28736
28869
  if (!node) {
28737
28870
  return;
28738
28871
  }
@@ -28755,7 +28888,7 @@ var selectCells = class extends Plugin {
28755
28888
  }
28756
28889
  const cellsCount = this.__tableModule.getAllSelectedCells().length;
28757
28890
  if (cellsCount > 1) {
28758
- (_a2 = this.j.s.sel) === null || _a2 === void 0 ? void 0 : _a2.removeAllRanges();
28891
+ (_b = this.j.s.sel) === null || _b === void 0 ? void 0 : _b.removeAllRanges();
28759
28892
  }
28760
28893
  this.j.e.fire("hidePopup");
28761
28894
  e42.stopPropagation();
@@ -28786,13 +28919,13 @@ var selectCells = class extends Plugin {
28786
28919
  * Stop a selection process
28787
28920
  */
28788
28921
  __onStopSelection(table2, e42) {
28789
- var _a2, _b;
28922
+ var _a2, _b, _c;
28790
28923
  if (!this.__selectedCell) {
28791
28924
  return;
28792
28925
  }
28793
28926
  this.__isSelectionMode = false;
28794
28927
  this.j.unlock();
28795
- const node = this.j.ed.elementFromPoint(e42.clientX, e42.clientY);
28928
+ const node = ((_a2 = this.j.o.shadowRoot) !== null && _a2 !== void 0 ? _a2 : this.j.ed).elementFromPoint(e42.clientX, e42.clientY);
28796
28929
  if (!node) {
28797
28930
  return;
28798
28931
  }
@@ -28808,7 +28941,7 @@ var selectCells = class extends Plugin {
28808
28941
  cell,
28809
28942
  this.__selectedCell
28810
28943
  ]), box = this.__tableModule.formalMatrix(table2);
28811
- const max = (_a2 = box[bound[1][0]]) === null || _a2 === void 0 ? void 0 : _a2[bound[1][1]], min = (_b = box[bound[0][0]]) === null || _b === void 0 ? void 0 : _b[bound[0][1]];
28944
+ const max = (_b = box[bound[1][0]]) === null || _b === void 0 ? void 0 : _b[bound[1][1]], min = (_c = box[bound[0][0]]) === null || _c === void 0 ? void 0 : _c[bound[0][1]];
28812
28945
  if (!min || !max) {
28813
28946
  return;
28814
28947
  }
@@ -29649,6 +29782,10 @@ var source = class extends Plugin {
29649
29782
  }
29650
29783
  setFocusToMirror() {
29651
29784
  var _a2;
29785
+ const active = this.j.od.activeElement;
29786
+ if (active && active !== this.j.od.body && !this.j.container.contains(active)) {
29787
+ return;
29788
+ }
29652
29789
  (_a2 = this.sourceEditor) === null || _a2 === void 0 ? void 0 : _a2.focus();
29653
29790
  }
29654
29791
  saveSelection() {
@@ -31209,7 +31346,9 @@ var aiAssistant = class extends Plugin {
31209
31346
  return new UiAiAssistant(jodit, {
31210
31347
  onInsertAfter(html) {
31211
31348
  jodit.s.focus();
31212
- jodit.s.setCursorAfter(jodit.s.current());
31349
+ const range = jodit.s.range;
31350
+ range.collapse(false);
31351
+ jodit.s.selectRange(range);
31213
31352
  jodit.s.insertHTML(html);
31214
31353
  __dialog.close();
31215
31354
  },
@@ -33045,6 +33184,13 @@ var Jodit2 = Jodit_1 = class Jodit3 extends ViewWithToolbar {
33045
33184
  const init2 = () => {
33046
33185
  if (opt.enableDragAndDropFileToEditor && opt.uploader && (opt.uploader.url || opt.uploader.insertImageAsBase64URI)) {
33047
33186
  this.uploader.bind(this.editor);
33187
+ } else if (!opt.enableDragAndDropFileToEditor) {
33188
+ this.e.on(editor, "drop", (e42) => {
33189
+ var _a2, _b;
33190
+ if ((_b = (_a2 = e42.dataTransfer) === null || _a2 === void 0 ? void 0 : _a2.files) === null || _b === void 0 ? void 0 : _b.length) {
33191
+ e42.preventDefault();
33192
+ }
33193
+ });
33048
33194
  }
33049
33195
  if (!this.__elementToPlace.get(this.editor)) {
33050
33196
  this.__elementToPlace.set(this.editor, currentPlace);
@@ -38462,7 +38608,7 @@ var tr_default6 = {
38462
38608
  Clean: "Temizle",
38463
38609
  "Insert as Text": "Yaz\u0131 olarak ekle",
38464
38610
  "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?",
38611
+ "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
38612
  "Insert only Text": "Sadece yaz\u0131y\u0131 ekle",
38467
38613
  "File Browser": "Dosya Listeleyici",
38468
38614
  "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-4T2ZQM4O.mjs";
6
6
 
7
7
  // src/index.ts
8
8
  var index_default = JoditEditor_default;