jodit 4.15.6 → 4.15.7
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.
- package/CHANGELOG.md +10 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +3 -3
- package/es2015/jodit.js +64 -8
- package/es2015/jodit.min.js +3 -3
- package/es2015/plugins/debug/debug.css +1 -1
- package/es2015/plugins/debug/debug.js +1 -1
- package/es2015/plugins/debug/debug.min.js +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2018/jodit.fat.min.js +3 -3
- package/es2018/jodit.min.js +3 -3
- package/es2018/plugins/debug/debug.min.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021/jodit.css +1 -1
- package/es2021/jodit.fat.min.js +3 -3
- package/es2021/jodit.js +63 -8
- package/es2021/jodit.min.js +3 -3
- package/es2021/plugins/debug/debug.css +1 -1
- package/es2021/plugins/debug/debug.js +1 -1
- package/es2021/plugins/debug/debug.min.js +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021.en/jodit.css +1 -1
- package/es2021.en/jodit.fat.min.js +3 -3
- package/es2021.en/jodit.js +63 -8
- package/es2021.en/jodit.min.js +3 -3
- package/es2021.en/plugins/debug/debug.css +1 -1
- package/es2021.en/plugins/debug/debug.js +1 -1
- package/es2021.en/plugins/debug/debug.min.js +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es5/jodit.css +2 -2
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +105 -42
- package/es5/jodit.min.css +2 -2
- package/es5/jodit.min.js +2 -2
- package/es5/plugins/debug/debug.css +1 -1
- package/es5/plugins/debug/debug.js +1 -1
- package/es5/plugins/debug/debug.min.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es5/polyfills.fat.min.js +1 -1
- package/es5/polyfills.js +1 -1
- package/es5/polyfills.min.js +1 -1
- package/esm/config.d.ts +10 -0
- package/esm/core/constants.js +1 -1
- package/esm/plugins/clean-html/clean-html.d.ts +7 -3
- package/esm/plugins/clean-html/clean-html.js +37 -0
- package/esm/plugins/clean-html/config.d.ts +10 -0
- package/esm/plugins/clean-html/config.js +1 -0
- package/esm/plugins/drag-and-drop-element/drag-and-drop-element.d.ts +1 -0
- package/esm/plugins/drag-and-drop-element/drag-and-drop-element.js +19 -4
- package/package.json +1 -1
- package/types/config.d.ts +10 -0
- package/types/plugins/clean-html/clean-html.d.ts +7 -3
- package/types/plugins/clean-html/config.d.ts +10 -0
- package/types/plugins/drag-and-drop-element/drag-and-drop-element.d.ts +1 -0
package/es2021/jodit.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
|
|
3
3
|
* Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
|
|
4
|
-
* Version: v4.15.
|
|
4
|
+
* Version: v4.15.7
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
@@ -1779,7 +1779,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1779
1779
|
* ```
|
|
1780
1780
|
* @packageDocumentation
|
|
1781
1781
|
* @module constants
|
|
1782
|
-
*/ const APP_VERSION = "4.15.
|
|
1782
|
+
*/ const APP_VERSION = "4.15.7";
|
|
1783
1783
|
// prettier-ignore
|
|
1784
1784
|
const ES = "es2021";
|
|
1785
1785
|
const IS_ES_MODERN = true;
|
|
@@ -28329,7 +28329,8 @@ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_5__.Icon.set('class-span', (_class_s
|
|
|
28329
28329
|
|
|
28330
28330
|
/**
|
|
28331
28331
|
* Clean HTML after removeFormat and insertHorizontalRule command
|
|
28332
|
-
*/
|
|
28332
|
+
*/ const TRAILING_BR_BLOCKS = 'p, div, li, td, th, h1, h2, h3, h4, h5, h6, blockquote';
|
|
28333
|
+
class cleanHtml extends jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
|
|
28333
28334
|
/** @override */ afterInit(jodit) {}
|
|
28334
28335
|
get isEditMode() {
|
|
28335
28336
|
return !(this.j.isInDestruct || !this.j.isEditorMode() || this.j.getReadOnly());
|
|
@@ -28388,6 +28389,7 @@ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_5__.Icon.set('class-span', (_class_s
|
|
|
28388
28389
|
* opt-in via `cleanHTML.collapseEmptyValueToEmptyString`. See #1149
|
|
28389
28390
|
*/ onAfterGetValueFromEditor(data) {
|
|
28390
28391
|
this.__singleQuotesInFontFamily(data);
|
|
28392
|
+
this.__removeTrailingBr(data);
|
|
28391
28393
|
if (!this.j.o.cleanHTML.collapseEmptyValueToEmptyString) {
|
|
28392
28394
|
return;
|
|
28393
28395
|
}
|
|
@@ -28402,7 +28404,38 @@ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_5__.Icon.set('class-span', (_class_s
|
|
|
28402
28404
|
* `style="font-family: "Open Sans", …"` — broken markup. Single quotes
|
|
28403
28405
|
* survive that round trip. Names that already contain an apostrophe are
|
|
28404
28406
|
* left alone.
|
|
28405
|
-
*/
|
|
28407
|
+
*/ /**
|
|
28408
|
+
* Drop a `<br>` that is the last node of a block (or of the value) and
|
|
28409
|
+
* follows other content — the caret placeholder browsers leave behind
|
|
28410
|
+
* after typing into an empty block. An empty block (`<p><br></p>`) and a
|
|
28411
|
+
* deliberate empty line (`text<br><br>`) are kept.
|
|
28412
|
+
*/ __removeTrailingBr(data) {
|
|
28413
|
+
if (!this.j.o.cleanHTML.removeTrailingBr || !/<br/i.test(data.value)) {
|
|
28414
|
+
return;
|
|
28415
|
+
}
|
|
28416
|
+
const box = this.j.c.div();
|
|
28417
|
+
box.innerHTML = data.value;
|
|
28418
|
+
const blocks = [
|
|
28419
|
+
box,
|
|
28420
|
+
...box.querySelectorAll(TRAILING_BR_BLOCKS)
|
|
28421
|
+
];
|
|
28422
|
+
blocks.forEach((block)=>{
|
|
28423
|
+
const last = block.lastChild;
|
|
28424
|
+
if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isTag(last, 'br')) {
|
|
28425
|
+
return;
|
|
28426
|
+
}
|
|
28427
|
+
const prev = last.previousSibling;
|
|
28428
|
+
if (!prev || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isTag(prev, 'br')) {
|
|
28429
|
+
return;
|
|
28430
|
+
}
|
|
28431
|
+
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isText(prev) && !prev.nodeValue?.trim() && !prev.previousSibling) {
|
|
28432
|
+
return;
|
|
28433
|
+
}
|
|
28434
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.safeRemove(last);
|
|
28435
|
+
});
|
|
28436
|
+
data.value = box.innerHTML;
|
|
28437
|
+
}
|
|
28438
|
+
__singleQuotesInFontFamily(data) {
|
|
28406
28439
|
if (!this.j.o.cleanHTML.singleQuotesInFontFamily || !data.value.includes('"')) {
|
|
28407
28440
|
return;
|
|
28408
28441
|
}
|
|
@@ -28489,6 +28522,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_1__.Config.prototype.cleanHTML = {
|
|
|
28489
28522
|
fillEmptyParagraph: true,
|
|
28490
28523
|
collapseEmptyValueToEmptyString: false,
|
|
28491
28524
|
singleQuotesInFontFamily: true,
|
|
28525
|
+
removeTrailingBr: false,
|
|
28492
28526
|
replaceNBSP: true,
|
|
28493
28527
|
replaceOldTags: {
|
|
28494
28528
|
i: 'em',
|
|
@@ -30584,6 +30618,11 @@ var DragState = /*#__PURE__*/ (/* unused pure expression or super */ null && (fu
|
|
|
30584
30618
|
this.state = 2;
|
|
30585
30619
|
}
|
|
30586
30620
|
this.j.e.fire('hidePopup hideResizer');
|
|
30621
|
+
// The ghost lives in the top document (position: fixed), but the
|
|
30622
|
+
// mousemove comes from the editor document. In iframe mode those are
|
|
30623
|
+
// different viewports, so the iframe's own offset has to be added or
|
|
30624
|
+
// the ghost trails the pointer by exactly that distance (#1455).
|
|
30625
|
+
const offset = this.__ghostOffset();
|
|
30587
30626
|
if (!this.draggable.parentNode) {
|
|
30588
30627
|
const target = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.dataBind)(this.draggable, 'target');
|
|
30589
30628
|
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.css)(this.draggable, {
|
|
@@ -30593,19 +30632,35 @@ var DragState = /*#__PURE__*/ (/* unused pure expression or super */ null && (fu
|
|
|
30593
30632
|
position: 'fixed',
|
|
30594
30633
|
opacity: 0.7,
|
|
30595
30634
|
display: 'inline-block',
|
|
30596
|
-
left: event.clientX,
|
|
30597
|
-
top: event.clientY,
|
|
30635
|
+
left: event.clientX + offset.left,
|
|
30636
|
+
top: event.clientY + offset.top,
|
|
30598
30637
|
width: target?.offsetWidth ?? 100,
|
|
30599
30638
|
height: target?.offsetHeight ?? 100
|
|
30600
30639
|
});
|
|
30601
30640
|
jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.append((0,jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.getContainer)(this.j, dragAndDropElement), this.draggable);
|
|
30602
30641
|
}
|
|
30603
30642
|
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.css)(this.draggable, {
|
|
30604
|
-
left: event.clientX,
|
|
30605
|
-
top: event.clientY
|
|
30643
|
+
left: event.clientX + offset.left,
|
|
30644
|
+
top: event.clientY + offset.top
|
|
30606
30645
|
});
|
|
30646
|
+
// The caret goes into the editor document, so it keeps the raw
|
|
30647
|
+
// (iframe-relative) coordinates.
|
|
30607
30648
|
this.j.s.insertCursorAtPoint(event.clientX, event.clientY);
|
|
30608
30649
|
}
|
|
30650
|
+
__ghostOffset() {
|
|
30651
|
+
const iframe = this.j.iframe;
|
|
30652
|
+
if (!iframe) {
|
|
30653
|
+
return {
|
|
30654
|
+
left: 0,
|
|
30655
|
+
top: 0
|
|
30656
|
+
};
|
|
30657
|
+
}
|
|
30658
|
+
const rect = iframe.getBoundingClientRect();
|
|
30659
|
+
return {
|
|
30660
|
+
left: rect.left,
|
|
30661
|
+
top: rect.top
|
|
30662
|
+
};
|
|
30663
|
+
}
|
|
30609
30664
|
/**
|
|
30610
30665
|
* Mouseup handler in any place
|
|
30611
30666
|
*/ onDragEnd() {
|