jodit-pro-react 5.6.16 → 5.6.18

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-X776F2QN.mjs";
3
+ } from "./chunk-VWIIE462.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.15.7";
196
+ APP_VERSION = "4.15.10";
197
197
  ES = "es2020";
198
198
  IS_ES_MODERN = true;
199
199
  IS_ES_NEXT = true;
@@ -20392,10 +20392,32 @@ var Selection = class {
20392
20392
  if (!Dom.up(node, (elm) => elm === this.area || elm && elm.parentNode === this.area, this.area)) {
20393
20393
  throw error("Node element must be in editor");
20394
20394
  }
20395
+ const target = !inward && this.__closestNotEditable(node) || node;
20395
20396
  const range = this.createRange();
20396
- range[inward || node === this.area ? "selectNodeContents" : "selectNode"](node);
20397
+ range[inward || target === this.area ? "selectNodeContents" : "selectNode"](target);
20397
20398
  return this.selectRange(range);
20398
20399
  }
20400
+ /**
20401
+ * The outermost `contenteditable="false"` ancestor of the node inside the
20402
+ * editable area, if there is one.
20403
+ *
20404
+ * A range can be put inside such an island (e.g. on an `<img>` wrapped in a
20405
+ * `<picture contenteditable="false">`), but the browser cannot place a caret
20406
+ * there: the arrow keys then have nothing to move from and the selection
20407
+ * cannot be escaped. Selecting the island itself keeps the range in editable
20408
+ * content, so the caret can step over it. See #1184
20409
+ */
20410
+ __closestNotEditable(node) {
20411
+ const { area } = this;
20412
+ let result = null, elm = node.parentNode;
20413
+ while (elm && elm !== area && area.contains(elm)) {
20414
+ if (Dom.isElement(elm) && elm.getAttribute("contenteditable") === "false") {
20415
+ result = elm;
20416
+ }
20417
+ elm = elm.parentNode;
20418
+ }
20419
+ return result;
20420
+ }
20399
20421
  /**
20400
20422
  * Return current selected HTML
20401
20423
  * @example
@@ -22268,7 +22290,10 @@ function isRemovableNode(jodit, node, current, allow, deny) {
22268
22290
  return false;
22269
22291
  }
22270
22292
  const liveCaret = jodit.s.isCollapsed() ? jodit.s.range.startContainer : null;
22271
- return Dom.isElement(node) && node.nodeName.match(IS_INLINE) != null && !Dom.isTemporary(node) && trimInv(node.innerHTML).length === 0 && (current == null || !Dom.isOrContains(node, current)) && (liveCaret == null || !Dom.isOrContains(node, liveCaret));
22293
+ return Dom.isElement(node) && node.nodeName.match(IS_INLINE) != null && !Dom.isTemporary(node) && !isFragmentTarget(node) && trimInv(node.innerHTML).length === 0 && (current == null || !Dom.isOrContains(node, current)) && (liveCaret == null || !Dom.isOrContains(node, liveCaret));
22294
+ }
22295
+ function isFragmentTarget(element) {
22296
+ return element.hasAttribute("id") || element.nodeName === "A" && element.hasAttribute("name");
22272
22297
  }
22273
22298
 
22274
22299
  // node_modules/jodit/esm/plugins/clean-html/helpers/visitor/visit-node-walker.js
@@ -27577,8 +27602,10 @@ function media(editor) {
27577
27602
  pluginSystem.add("media", media);
27578
27603
 
27579
27604
  // node_modules/jodit/esm/plugins/mobile/mobile.js
27605
+ init_dom();
27580
27606
  init_global2();
27581
27607
  init_helpers();
27608
+ init_is_string();
27582
27609
 
27583
27610
  // node_modules/jodit/esm/plugins/mobile/config.js
27584
27611
  init_constants();
@@ -27765,6 +27792,17 @@ function fitToButtons(list, editor) {
27765
27792
  }
27766
27793
  return cleaned;
27767
27794
  }
27795
+ function adaptiveWidth(editor) {
27796
+ var _a2;
27797
+ const { toolbar } = editor.o;
27798
+ if (isString(toolbar) || Dom.isHTMLElement(toolbar)) {
27799
+ const width = editor.toolbarContainer.offsetWidth;
27800
+ if (width) {
27801
+ return width;
27802
+ }
27803
+ }
27804
+ return ((_a2 = editor.container.parentElement) !== null && _a2 !== void 0 ? _a2 : editor.container).offsetWidth;
27805
+ }
27768
27806
  function mobile(editor) {
27769
27807
  let timeout = 0, store2 = splitArray(editor.o.buttons);
27770
27808
  if (editor.o.mobileTapTimeout) {
@@ -27793,13 +27831,16 @@ function mobile(editor) {
27793
27831
  });
27794
27832
  if (editor.o.toolbarAdaptive) {
27795
27833
  editor.e.on("resize afterInit recalcAdaptive changePlace afterAddPlace", () => {
27796
- var _a2, _b;
27834
+ var _a2;
27797
27835
  if (!editor.o.toolbar) {
27798
27836
  return;
27799
27837
  }
27800
- const width = ((_a2 = editor.container.parentElement) !== null && _a2 !== void 0 ? _a2 : editor.container).offsetWidth;
27801
27838
  const newStore = (() => {
27802
- if (editor.isFullSize || width >= editor.o.sizeLG) {
27839
+ if (editor.isFullSize) {
27840
+ return splitArray(editor.o.buttons);
27841
+ }
27842
+ const width = adaptiveWidth(editor);
27843
+ if (width >= editor.o.sizeLG) {
27803
27844
  return splitArray(editor.o.buttons);
27804
27845
  }
27805
27846
  if (width >= editor.o.sizeMD) {
@@ -27813,7 +27854,7 @@ function mobile(editor) {
27813
27854
  if (newStore.toString() !== store2.toString()) {
27814
27855
  store2 = newStore;
27815
27856
  editor.e.fire("closeAllPopups");
27816
- (_b = editor.toolbar) === null || _b === void 0 ? void 0 : _b.setRemoveButtons(editor.o.removeButtons).build(store2.concat(editor.o.extraButtons));
27857
+ (_a2 = editor.toolbar) === null || _a2 === void 0 ? void 0 : _a2.setRemoveButtons(editor.o.removeButtons).build(store2.concat(editor.o.extraButtons));
27817
27858
  }
27818
27859
  }).on(editor.ow, "load resize", () => editor.e.fire("recalcAdaptive"));
27819
27860
  }
@@ -34239,13 +34280,20 @@ var Jodit2 = Jodit_1 = class Jodit3 extends ViewWithToolbar {
34239
34280
  * Return source element value
34240
34281
  */
34241
34282
  getElementValue() {
34283
+ if (this.element === this.container && this.__inlineElementValue !== void 0) {
34284
+ return this.__inlineElementValue;
34285
+ }
34242
34286
  return this.element.value !== void 0 ? this.element.value : this.element.innerHTML;
34243
34287
  }
34244
34288
  __setElementValue(value) {
34245
34289
  if (!isString(value)) {
34246
34290
  throw error("value must be string");
34247
34291
  }
34248
- if (this.element !== this.container && value !== this.getElementValue()) {
34292
+ if (this.element === this.container) {
34293
+ this.__inlineElementValue = value;
34294
+ return;
34295
+ }
34296
+ if (value !== this.getElementValue()) {
34249
34297
  const data = { value };
34250
34298
  const res = this.e.fire("beforeSetElementValue", data);
34251
34299
  callPromise(res, () => {
@@ -2,7 +2,7 @@ import {
2
2
  Config,
3
3
  JoditEditor_default,
4
4
  n
5
- } from "./chunk-X776F2QN.mjs";
5
+ } from "./chunk-VWIIE462.mjs";
6
6
 
7
7
  // src/index.ts
8
8
  var index_default = JoditEditor_default;