jodit-pro-react 5.6.14 → 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.
|
@@ -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.
|
|
196
|
+
APP_VERSION = "4.15.7";
|
|
197
197
|
ES = "es2020";
|
|
198
198
|
IS_ES_MODERN = true;
|
|
199
199
|
IS_ES_NEXT = true;
|
|
@@ -21813,6 +21813,8 @@ Config.prototype.cleanHTML = {
|
|
|
21813
21813
|
removeEmptyElements: true,
|
|
21814
21814
|
fillEmptyParagraph: true,
|
|
21815
21815
|
collapseEmptyValueToEmptyString: false,
|
|
21816
|
+
singleQuotesInFontFamily: true,
|
|
21817
|
+
removeTrailingBr: false,
|
|
21816
21818
|
replaceNBSP: true,
|
|
21817
21819
|
replaceOldTags: {
|
|
21818
21820
|
i: "em",
|
|
@@ -22302,6 +22304,7 @@ var __decorate39 = function(decorators, target, key3, desc) {
|
|
|
22302
22304
|
r71 = (c69 < 3 ? d55(r71) : c69 > 3 ? d55(target, key3, r71) : d55(target, key3)) || r71;
|
|
22303
22305
|
return c69 > 3 && r71 && Object.defineProperty(target, key3, r71), r71;
|
|
22304
22306
|
};
|
|
22307
|
+
var TRAILING_BR_BLOCKS = "p, div, li, td, th, h1, h2, h3, h4, h5, h6, blockquote";
|
|
22305
22308
|
var cleanHtml = class extends Plugin {
|
|
22306
22309
|
constructor() {
|
|
22307
22310
|
super(...arguments);
|
|
@@ -22375,6 +22378,8 @@ var cleanHtml = class extends Plugin {
|
|
|
22375
22378
|
* opt-in via `cleanHTML.collapseEmptyValueToEmptyString`. See #1149
|
|
22376
22379
|
*/
|
|
22377
22380
|
onAfterGetValueFromEditor(data) {
|
|
22381
|
+
this.__singleQuotesInFontFamily(data);
|
|
22382
|
+
this.__removeTrailingBr(data);
|
|
22378
22383
|
if (!this.j.o.cleanHTML.collapseEmptyValueToEmptyString) {
|
|
22379
22384
|
return;
|
|
22380
22385
|
}
|
|
@@ -22382,6 +22387,64 @@ var cleanHtml = class extends Plugin {
|
|
|
22382
22387
|
data.value = "";
|
|
22383
22388
|
}
|
|
22384
22389
|
}
|
|
22390
|
+
/**
|
|
22391
|
+
* Rewrite double-quoted font names inside `style` attributes with single
|
|
22392
|
+
* quotes. The DOM always serialises them as `"…"`, and back ends
|
|
22393
|
+
* that HTML-decode the value before storing it then produce
|
|
22394
|
+
* `style="font-family: "Open Sans", …"` — broken markup. Single quotes
|
|
22395
|
+
* survive that round trip. Names that already contain an apostrophe are
|
|
22396
|
+
* left alone.
|
|
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
|
+
}
|
|
22431
|
+
__singleQuotesInFontFamily(data) {
|
|
22432
|
+
if (!this.j.o.cleanHTML.singleQuotesInFontFamily || !data.value.includes(""")) {
|
|
22433
|
+
return;
|
|
22434
|
+
}
|
|
22435
|
+
data.value = data.value.replace(/\sstyle="([^"]*)"/gi, (attribute, css2) => {
|
|
22436
|
+
if (!css2.includes(""") || !/font-family/i.test(css2)) {
|
|
22437
|
+
return attribute;
|
|
22438
|
+
}
|
|
22439
|
+
const normalized = css2.replace(
|
|
22440
|
+
// `"` itself ends with `;`, so the entity has to be
|
|
22441
|
+
// consumed as a unit or the declaration stops inside it.
|
|
22442
|
+
/font-family\s*:(?:"|[^;])*/gi,
|
|
22443
|
+
(declaration) => declaration.includes("'") ? declaration : declaration.replace(/"/g, "'")
|
|
22444
|
+
);
|
|
22445
|
+
return attribute.replace(css2, normalized);
|
|
22446
|
+
});
|
|
22447
|
+
}
|
|
22385
22448
|
onSafeHTML(sandBox) {
|
|
22386
22449
|
const sanitizer = this.j.o.cleanHTML.sanitizer;
|
|
22387
22450
|
if (sanitizer) {
|
|
@@ -23414,6 +23477,7 @@ var dragAndDropElement = class _dragAndDropElement extends Plugin {
|
|
|
23414
23477
|
this.state = DragState.DRAGGING;
|
|
23415
23478
|
}
|
|
23416
23479
|
this.j.e.fire("hidePopup hideResizer");
|
|
23480
|
+
const offset2 = this.__ghostOffset();
|
|
23417
23481
|
if (!this.draggable.parentNode) {
|
|
23418
23482
|
const target = dataBind(this.draggable, "target");
|
|
23419
23483
|
css(this.draggable, {
|
|
@@ -23423,19 +23487,27 @@ var dragAndDropElement = class _dragAndDropElement extends Plugin {
|
|
|
23423
23487
|
position: "fixed",
|
|
23424
23488
|
opacity: 0.7,
|
|
23425
23489
|
display: "inline-block",
|
|
23426
|
-
left: event.clientX,
|
|
23427
|
-
top: event.clientY,
|
|
23490
|
+
left: event.clientX + offset2.left,
|
|
23491
|
+
top: event.clientY + offset2.top,
|
|
23428
23492
|
width: (_a2 = target === null || target === void 0 ? void 0 : target.offsetWidth) !== null && _a2 !== void 0 ? _a2 : 100,
|
|
23429
23493
|
height: (_b = target === null || target === void 0 ? void 0 : target.offsetHeight) !== null && _b !== void 0 ? _b : 100
|
|
23430
23494
|
});
|
|
23431
23495
|
Dom.append(getContainer(this.j, _dragAndDropElement), this.draggable);
|
|
23432
23496
|
}
|
|
23433
23497
|
css(this.draggable, {
|
|
23434
|
-
left: event.clientX,
|
|
23435
|
-
top: event.clientY
|
|
23498
|
+
left: event.clientX + offset2.left,
|
|
23499
|
+
top: event.clientY + offset2.top
|
|
23436
23500
|
});
|
|
23437
23501
|
this.j.s.insertCursorAtPoint(event.clientX, event.clientY);
|
|
23438
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
|
+
}
|
|
23439
23511
|
/**
|
|
23440
23512
|
* Mouseup handler in any place
|
|
23441
23513
|
*/
|
|
@@ -27268,6 +27340,7 @@ var link = class extends Plugin {
|
|
|
27268
27340
|
jodit.history.snapshot.restore(snapshot);
|
|
27269
27341
|
const textWasChanged = getSelectionText() !== content_input.value.trim();
|
|
27270
27342
|
const ci = jodit.createInside;
|
|
27343
|
+
let caretAfter = null;
|
|
27271
27344
|
if (!link2 || !Dom.isOrContains(jodit.editor, link2)) {
|
|
27272
27345
|
if (!jodit.s.isCollapsed()) {
|
|
27273
27346
|
const node = jodit.s.current();
|
|
@@ -27280,6 +27353,7 @@ var link = class extends Plugin {
|
|
|
27280
27353
|
const a76 = ci.element("a");
|
|
27281
27354
|
jodit.s.insertNode(a76, false, false);
|
|
27282
27355
|
links = [a76];
|
|
27356
|
+
caretAfter = a76;
|
|
27283
27357
|
}
|
|
27284
27358
|
links.forEach((link3) => jodit.s.select(link3));
|
|
27285
27359
|
} else {
|
|
@@ -27310,6 +27384,9 @@ var link = class extends Plugin {
|
|
|
27310
27384
|
}
|
|
27311
27385
|
jodit.e.fire("applyLink", jodit, a76, form2);
|
|
27312
27386
|
});
|
|
27387
|
+
if (caretAfter) {
|
|
27388
|
+
jodit.s.setCursorAfter(caretAfter);
|
|
27389
|
+
}
|
|
27313
27390
|
jodit.synchronizeValues();
|
|
27314
27391
|
close();
|
|
27315
27392
|
return false;
|