jodit 4.15.5 → 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 +16 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +4 -4
- package/es2015/jodit.js +73 -8
- package/es2015/jodit.min.js +4 -4
- 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 +4 -4
- package/es2018/jodit.min.js +4 -4
- 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 +4 -4
- package/es2021/jodit.js +72 -8
- package/es2021/jodit.min.js +4 -4
- 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 +4 -4
- package/es2021.en/jodit.js +72 -8
- package/es2021.en/jodit.min.js +4 -4
- 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 +114 -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/esm/plugins/link/link.js +9 -0
- 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/es2015/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
|
*/
|
|
@@ -1785,7 +1785,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1785
1785
|
* ```
|
|
1786
1786
|
* @packageDocumentation
|
|
1787
1787
|
* @module constants
|
|
1788
|
-
*/ const APP_VERSION = "4.15.
|
|
1788
|
+
*/ const APP_VERSION = "4.15.7";
|
|
1789
1789
|
// prettier-ignore
|
|
1790
1790
|
const ES = "es2015";
|
|
1791
1791
|
const IS_ES_MODERN = true;
|
|
@@ -28540,7 +28540,8 @@ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_5__.Icon.set('class-span', (_class_s
|
|
|
28540
28540
|
|
|
28541
28541
|
/**
|
|
28542
28542
|
* Clean HTML after removeFormat and insertHorizontalRule command
|
|
28543
|
-
*/
|
|
28543
|
+
*/ const TRAILING_BR_BLOCKS = 'p, div, li, td, th, h1, h2, h3, h4, h5, h6, blockquote';
|
|
28544
|
+
class cleanHtml extends jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
|
|
28544
28545
|
/** @override */ afterInit(jodit) {}
|
|
28545
28546
|
get isEditMode() {
|
|
28546
28547
|
return !(this.j.isInDestruct || !this.j.isEditorMode() || this.j.getReadOnly());
|
|
@@ -28599,6 +28600,7 @@ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_5__.Icon.set('class-span', (_class_s
|
|
|
28599
28600
|
* opt-in via `cleanHTML.collapseEmptyValueToEmptyString`. See #1149
|
|
28600
28601
|
*/ onAfterGetValueFromEditor(data) {
|
|
28601
28602
|
this.__singleQuotesInFontFamily(data);
|
|
28603
|
+
this.__removeTrailingBr(data);
|
|
28602
28604
|
if (!this.j.o.cleanHTML.collapseEmptyValueToEmptyString) {
|
|
28603
28605
|
return;
|
|
28604
28606
|
}
|
|
@@ -28613,7 +28615,39 @@ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_5__.Icon.set('class-span', (_class_s
|
|
|
28613
28615
|
* `style="font-family: "Open Sans", …"` — broken markup. Single quotes
|
|
28614
28616
|
* survive that round trip. Names that already contain an apostrophe are
|
|
28615
28617
|
* left alone.
|
|
28616
|
-
*/
|
|
28618
|
+
*/ /**
|
|
28619
|
+
* Drop a `<br>` that is the last node of a block (or of the value) and
|
|
28620
|
+
* follows other content — the caret placeholder browsers leave behind
|
|
28621
|
+
* after typing into an empty block. An empty block (`<p><br></p>`) and a
|
|
28622
|
+
* deliberate empty line (`text<br><br>`) are kept.
|
|
28623
|
+
*/ __removeTrailingBr(data) {
|
|
28624
|
+
if (!this.j.o.cleanHTML.removeTrailingBr || !/<br/i.test(data.value)) {
|
|
28625
|
+
return;
|
|
28626
|
+
}
|
|
28627
|
+
const box = this.j.c.div();
|
|
28628
|
+
box.innerHTML = data.value;
|
|
28629
|
+
const blocks = [
|
|
28630
|
+
box,
|
|
28631
|
+
...box.querySelectorAll(TRAILING_BR_BLOCKS)
|
|
28632
|
+
];
|
|
28633
|
+
blocks.forEach((block)=>{
|
|
28634
|
+
var _prev_nodeValue;
|
|
28635
|
+
const last = block.lastChild;
|
|
28636
|
+
if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isTag(last, 'br')) {
|
|
28637
|
+
return;
|
|
28638
|
+
}
|
|
28639
|
+
const prev = last.previousSibling;
|
|
28640
|
+
if (!prev || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isTag(prev, 'br')) {
|
|
28641
|
+
return;
|
|
28642
|
+
}
|
|
28643
|
+
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isText(prev) && !((_prev_nodeValue = prev.nodeValue) === null || _prev_nodeValue === void 0 ? void 0 : _prev_nodeValue.trim()) && !prev.previousSibling) {
|
|
28644
|
+
return;
|
|
28645
|
+
}
|
|
28646
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.safeRemove(last);
|
|
28647
|
+
});
|
|
28648
|
+
data.value = box.innerHTML;
|
|
28649
|
+
}
|
|
28650
|
+
__singleQuotesInFontFamily(data) {
|
|
28617
28651
|
if (!this.j.o.cleanHTML.singleQuotesInFontFamily || !data.value.includes('"')) {
|
|
28618
28652
|
return;
|
|
28619
28653
|
}
|
|
@@ -28700,6 +28734,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_1__.Config.prototype.cleanHTML = {
|
|
|
28700
28734
|
fillEmptyParagraph: true,
|
|
28701
28735
|
collapseEmptyValueToEmptyString: false,
|
|
28702
28736
|
singleQuotesInFontFamily: true,
|
|
28737
|
+
removeTrailingBr: false,
|
|
28703
28738
|
replaceNBSP: true,
|
|
28704
28739
|
replaceOldTags: {
|
|
28705
28740
|
i: 'em',
|
|
@@ -30800,6 +30835,11 @@ var DragState = /*#__PURE__*/ (/* unused pure expression or super */ null && (fu
|
|
|
30800
30835
|
this.state = 2;
|
|
30801
30836
|
}
|
|
30802
30837
|
this.j.e.fire('hidePopup hideResizer');
|
|
30838
|
+
// The ghost lives in the top document (position: fixed), but the
|
|
30839
|
+
// mousemove comes from the editor document. In iframe mode those are
|
|
30840
|
+
// different viewports, so the iframe's own offset has to be added or
|
|
30841
|
+
// the ghost trails the pointer by exactly that distance (#1455).
|
|
30842
|
+
const offset = this.__ghostOffset();
|
|
30803
30843
|
if (!this.draggable.parentNode) {
|
|
30804
30844
|
var _ref, _ref1;
|
|
30805
30845
|
const target = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.dataBind)(this.draggable, 'target');
|
|
@@ -30810,19 +30850,35 @@ var DragState = /*#__PURE__*/ (/* unused pure expression or super */ null && (fu
|
|
|
30810
30850
|
position: 'fixed',
|
|
30811
30851
|
opacity: 0.7,
|
|
30812
30852
|
display: 'inline-block',
|
|
30813
|
-
left: event.clientX,
|
|
30814
|
-
top: event.clientY,
|
|
30853
|
+
left: event.clientX + offset.left,
|
|
30854
|
+
top: event.clientY + offset.top,
|
|
30815
30855
|
width: (_ref = target === null || target === void 0 ? void 0 : target.offsetWidth) !== null && _ref !== void 0 ? _ref : 100,
|
|
30816
30856
|
height: (_ref1 = target === null || target === void 0 ? void 0 : target.offsetHeight) !== null && _ref1 !== void 0 ? _ref1 : 100
|
|
30817
30857
|
});
|
|
30818
30858
|
jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.append((0,jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.getContainer)(this.j, dragAndDropElement), this.draggable);
|
|
30819
30859
|
}
|
|
30820
30860
|
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.css)(this.draggable, {
|
|
30821
|
-
left: event.clientX,
|
|
30822
|
-
top: event.clientY
|
|
30861
|
+
left: event.clientX + offset.left,
|
|
30862
|
+
top: event.clientY + offset.top
|
|
30823
30863
|
});
|
|
30864
|
+
// The caret goes into the editor document, so it keeps the raw
|
|
30865
|
+
// (iframe-relative) coordinates.
|
|
30824
30866
|
this.j.s.insertCursorAtPoint(event.clientX, event.clientY);
|
|
30825
30867
|
}
|
|
30868
|
+
__ghostOffset() {
|
|
30869
|
+
const iframe = this.j.iframe;
|
|
30870
|
+
if (!iframe) {
|
|
30871
|
+
return {
|
|
30872
|
+
left: 0,
|
|
30873
|
+
top: 0
|
|
30874
|
+
};
|
|
30875
|
+
}
|
|
30876
|
+
const rect = iframe.getBoundingClientRect();
|
|
30877
|
+
return {
|
|
30878
|
+
left: rect.left,
|
|
30879
|
+
top: rect.top
|
|
30880
|
+
};
|
|
30881
|
+
}
|
|
30826
30882
|
/**
|
|
30827
30883
|
* Mouseup handler in any place
|
|
30828
30884
|
*/ onDragEnd() {
|
|
@@ -37013,6 +37069,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
37013
37069
|
jodit.history.snapshot.restore(snapshot);
|
|
37014
37070
|
const textWasChanged = getSelectionText() !== content_input.value.trim();
|
|
37015
37071
|
const ci = jodit.createInside;
|
|
37072
|
+
let caretAfter = null;
|
|
37016
37073
|
if (!link || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isOrContains(jodit.editor, link)) {
|
|
37017
37074
|
if (!jodit.s.isCollapsed()) {
|
|
37018
37075
|
const node = jodit.s.current();
|
|
@@ -37029,6 +37086,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
37029
37086
|
links = [
|
|
37030
37087
|
a
|
|
37031
37088
|
];
|
|
37089
|
+
caretAfter = a;
|
|
37032
37090
|
}
|
|
37033
37091
|
links.forEach((link)=>jodit.s.select(link));
|
|
37034
37092
|
} else {
|
|
@@ -37061,6 +37119,13 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
37061
37119
|
}
|
|
37062
37120
|
jodit.e.fire('applyLink', jodit, a, form);
|
|
37063
37121
|
});
|
|
37122
|
+
// A brand-new link inserted at a collapsed caret used to stay
|
|
37123
|
+
// *selected*. Safari does not paint that selection, so the next
|
|
37124
|
+
// Enter silently replaced the link instead of starting a new line.
|
|
37125
|
+
// Put the caret right after the link instead.
|
|
37126
|
+
if (caretAfter) {
|
|
37127
|
+
jodit.s.setCursorAfter(caretAfter);
|
|
37128
|
+
}
|
|
37064
37129
|
jodit.synchronizeValues();
|
|
37065
37130
|
close();
|
|
37066
37131
|
return false;
|