jodit-pro-react 5.6.15 → 5.6.16

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-WUAETI7F.mjs";
3
+ } from "./chunk-X776F2QN.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.5";
196
+ APP_VERSION = "4.15.7";
197
197
  ES = "es2020";
198
198
  IS_ES_MODERN = true;
199
199
  IS_ES_NEXT = true;
@@ -21814,6 +21814,7 @@ Config.prototype.cleanHTML = {
21814
21814
  fillEmptyParagraph: true,
21815
21815
  collapseEmptyValueToEmptyString: false,
21816
21816
  singleQuotesInFontFamily: true,
21817
+ removeTrailingBr: false,
21817
21818
  replaceNBSP: true,
21818
21819
  replaceOldTags: {
21819
21820
  i: "em",
@@ -22303,6 +22304,7 @@ var __decorate39 = function(decorators, target, key3, desc) {
22303
22304
  r71 = (c69 < 3 ? d55(r71) : c69 > 3 ? d55(target, key3, r71) : d55(target, key3)) || r71;
22304
22305
  return c69 > 3 && r71 && Object.defineProperty(target, key3, r71), r71;
22305
22306
  };
22307
+ var TRAILING_BR_BLOCKS = "p, div, li, td, th, h1, h2, h3, h4, h5, h6, blockquote";
22306
22308
  var cleanHtml = class extends Plugin {
22307
22309
  constructor() {
22308
22310
  super(...arguments);
@@ -22377,6 +22379,7 @@ var cleanHtml = class extends Plugin {
22377
22379
  */
22378
22380
  onAfterGetValueFromEditor(data) {
22379
22381
  this.__singleQuotesInFontFamily(data);
22382
+ this.__removeTrailingBr(data);
22380
22383
  if (!this.j.o.cleanHTML.collapseEmptyValueToEmptyString) {
22381
22384
  return;
22382
22385
  }
@@ -22392,6 +22395,39 @@ var cleanHtml = class extends Plugin {
22392
22395
  * survive that round trip. Names that already contain an apostrophe are
22393
22396
  * left alone.
22394
22397
  */
22398
+ /**
22399
+ * Drop a `<br>` that is the last node of a block (or of the value) and
22400
+ * follows other content — the caret placeholder browsers leave behind
22401
+ * after typing into an empty block. An empty block (`<p><br></p>`) and a
22402
+ * deliberate empty line (`text<br><br>`) are kept.
22403
+ */
22404
+ __removeTrailingBr(data) {
22405
+ if (!this.j.o.cleanHTML.removeTrailingBr || !/<br/i.test(data.value)) {
22406
+ return;
22407
+ }
22408
+ const box = this.j.c.div();
22409
+ box.innerHTML = data.value;
22410
+ const blocks = [
22411
+ box,
22412
+ ...box.querySelectorAll(TRAILING_BR_BLOCKS)
22413
+ ];
22414
+ blocks.forEach((block) => {
22415
+ var _a2;
22416
+ const last = block.lastChild;
22417
+ if (!Dom.isTag(last, "br")) {
22418
+ return;
22419
+ }
22420
+ const prev = last.previousSibling;
22421
+ if (!prev || Dom.isTag(prev, "br")) {
22422
+ return;
22423
+ }
22424
+ if (Dom.isText(prev) && !((_a2 = prev.nodeValue) === null || _a2 === void 0 ? void 0 : _a2.trim()) && !prev.previousSibling) {
22425
+ return;
22426
+ }
22427
+ Dom.safeRemove(last);
22428
+ });
22429
+ data.value = box.innerHTML;
22430
+ }
22395
22431
  __singleQuotesInFontFamily(data) {
22396
22432
  if (!this.j.o.cleanHTML.singleQuotesInFontFamily || !data.value.includes("&quot;")) {
22397
22433
  return;
@@ -23441,6 +23477,7 @@ var dragAndDropElement = class _dragAndDropElement extends Plugin {
23441
23477
  this.state = DragState.DRAGGING;
23442
23478
  }
23443
23479
  this.j.e.fire("hidePopup hideResizer");
23480
+ const offset2 = this.__ghostOffset();
23444
23481
  if (!this.draggable.parentNode) {
23445
23482
  const target = dataBind(this.draggable, "target");
23446
23483
  css(this.draggable, {
@@ -23450,19 +23487,27 @@ var dragAndDropElement = class _dragAndDropElement extends Plugin {
23450
23487
  position: "fixed",
23451
23488
  opacity: 0.7,
23452
23489
  display: "inline-block",
23453
- left: event.clientX,
23454
- top: event.clientY,
23490
+ left: event.clientX + offset2.left,
23491
+ top: event.clientY + offset2.top,
23455
23492
  width: (_a2 = target === null || target === void 0 ? void 0 : target.offsetWidth) !== null && _a2 !== void 0 ? _a2 : 100,
23456
23493
  height: (_b = target === null || target === void 0 ? void 0 : target.offsetHeight) !== null && _b !== void 0 ? _b : 100
23457
23494
  });
23458
23495
  Dom.append(getContainer(this.j, _dragAndDropElement), this.draggable);
23459
23496
  }
23460
23497
  css(this.draggable, {
23461
- left: event.clientX,
23462
- top: event.clientY
23498
+ left: event.clientX + offset2.left,
23499
+ top: event.clientY + offset2.top
23463
23500
  });
23464
23501
  this.j.s.insertCursorAtPoint(event.clientX, event.clientY);
23465
23502
  }
23503
+ __ghostOffset() {
23504
+ const iframe2 = this.j.iframe;
23505
+ if (!iframe2) {
23506
+ return { left: 0, top: 0 };
23507
+ }
23508
+ const rect = iframe2.getBoundingClientRect();
23509
+ return { left: rect.left, top: rect.top };
23510
+ }
23466
23511
  /**
23467
23512
  * Mouseup handler in any place
23468
23513
  */
@@ -27295,6 +27340,7 @@ var link = class extends Plugin {
27295
27340
  jodit.history.snapshot.restore(snapshot);
27296
27341
  const textWasChanged = getSelectionText() !== content_input.value.trim();
27297
27342
  const ci = jodit.createInside;
27343
+ let caretAfter = null;
27298
27344
  if (!link2 || !Dom.isOrContains(jodit.editor, link2)) {
27299
27345
  if (!jodit.s.isCollapsed()) {
27300
27346
  const node = jodit.s.current();
@@ -27307,6 +27353,7 @@ var link = class extends Plugin {
27307
27353
  const a76 = ci.element("a");
27308
27354
  jodit.s.insertNode(a76, false, false);
27309
27355
  links = [a76];
27356
+ caretAfter = a76;
27310
27357
  }
27311
27358
  links.forEach((link3) => jodit.s.select(link3));
27312
27359
  } else {
@@ -27337,6 +27384,9 @@ var link = class extends Plugin {
27337
27384
  }
27338
27385
  jodit.e.fire("applyLink", jodit, a76, form2);
27339
27386
  });
27387
+ if (caretAfter) {
27388
+ jodit.s.setCursorAfter(caretAfter);
27389
+ }
27340
27390
  jodit.synchronizeValues();
27341
27391
  close();
27342
27392
  return false;
@@ -2,7 +2,7 @@ import {
2
2
  Config,
3
3
  JoditEditor_default,
4
4
  n
5
- } from "./chunk-WUAETI7F.mjs";
5
+ } from "./chunk-X776F2QN.mjs";
6
6
 
7
7
  // src/index.ts
8
8
  var index_default = JoditEditor_default;