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/es5/polyfills.fat.min.js
CHANGED
package/es5/polyfills.js
CHANGED
package/es5/polyfills.min.js
CHANGED
package/esm/config.d.ts
CHANGED
|
@@ -1042,6 +1042,16 @@ interface Config {
|
|
|
1042
1042
|
* names with single quotes: `font-family: 'Open Sans', sans-serif`.
|
|
1043
1043
|
*/
|
|
1044
1044
|
singleQuotesInFontFamily: boolean;
|
|
1045
|
+
/**
|
|
1046
|
+
* Browsers keep a trailing `<br>` inside a block after you type into an
|
|
1047
|
+
* empty one (`<p>test<br></p>`), and the same `<br>` ends up in the
|
|
1048
|
+
* editor value. It renders nothing, but confuses consumers that compare
|
|
1049
|
+
* or post-process the HTML. With this option the value getter drops a
|
|
1050
|
+
* `<br>` that is the last node of a block (or of the whole value)
|
|
1051
|
+
* and follows other content. `<p><br></p>` and `text<br><br>` — an empty
|
|
1052
|
+
* line — are kept.
|
|
1053
|
+
*/
|
|
1054
|
+
removeTrailingBr: boolean;
|
|
1045
1055
|
/**
|
|
1046
1056
|
* Replace old tags to new eg. <i> to <em>, <b> to <strong>
|
|
1047
1057
|
*/
|
package/esm/core/constants.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
4
|
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
|
-
export const APP_VERSION = "4.15.
|
|
6
|
+
export const APP_VERSION = "4.15.7";
|
|
7
7
|
// prettier-ignore
|
|
8
8
|
export const ES = "es2020";
|
|
9
9
|
export const IS_ES_MODERN = true;
|
|
@@ -11,9 +11,6 @@
|
|
|
11
11
|
import type { IJodit } from "../../types/index";
|
|
12
12
|
import { Plugin } from "../../core/plugin/plugin";
|
|
13
13
|
import "./config";
|
|
14
|
-
/**
|
|
15
|
-
* Clean HTML after removeFormat and insertHorizontalRule command
|
|
16
|
-
*/
|
|
17
14
|
export declare class cleanHtml extends Plugin {
|
|
18
15
|
/** @override */
|
|
19
16
|
buttons: Plugin['buttons'];
|
|
@@ -50,6 +47,13 @@ export declare class cleanHtml extends Plugin {
|
|
|
50
47
|
* survive that round trip. Names that already contain an apostrophe are
|
|
51
48
|
* left alone.
|
|
52
49
|
*/
|
|
50
|
+
/**
|
|
51
|
+
* Drop a `<br>` that is the last node of a block (or of the value) and
|
|
52
|
+
* follows other content — the caret placeholder browsers leave behind
|
|
53
|
+
* after typing into an empty block. An empty block (`<p><br></p>`) and a
|
|
54
|
+
* deliberate empty line (`text<br><br>`) are kept.
|
|
55
|
+
*/
|
|
56
|
+
private __removeTrailingBr;
|
|
53
57
|
private __singleQuotesInFontFamily;
|
|
54
58
|
protected onSafeHTML(sandBox: HTMLElement): void;
|
|
55
59
|
/** @override */
|
|
@@ -24,6 +24,7 @@ import { getHash, removeFormatForCollapsedSelection, removeFormatForSelection, v
|
|
|
24
24
|
/**
|
|
25
25
|
* Clean HTML after removeFormat and insertHorizontalRule command
|
|
26
26
|
*/
|
|
27
|
+
const TRAILING_BR_BLOCKS = 'p, div, li, td, th, h1, h2, h3, h4, h5, h6, blockquote';
|
|
27
28
|
export class cleanHtml extends Plugin {
|
|
28
29
|
constructor() {
|
|
29
30
|
super(...arguments);
|
|
@@ -107,6 +108,7 @@ export class cleanHtml extends Plugin {
|
|
|
107
108
|
*/
|
|
108
109
|
onAfterGetValueFromEditor(data) {
|
|
109
110
|
this.__singleQuotesInFontFamily(data);
|
|
111
|
+
this.__removeTrailingBr(data);
|
|
110
112
|
if (!this.j.o.cleanHTML.collapseEmptyValueToEmptyString) {
|
|
111
113
|
return;
|
|
112
114
|
}
|
|
@@ -122,6 +124,41 @@ export class cleanHtml extends Plugin {
|
|
|
122
124
|
* survive that round trip. Names that already contain an apostrophe are
|
|
123
125
|
* left alone.
|
|
124
126
|
*/
|
|
127
|
+
/**
|
|
128
|
+
* Drop a `<br>` that is the last node of a block (or of the value) and
|
|
129
|
+
* follows other content — the caret placeholder browsers leave behind
|
|
130
|
+
* after typing into an empty block. An empty block (`<p><br></p>`) and a
|
|
131
|
+
* deliberate empty line (`text<br><br>`) are kept.
|
|
132
|
+
*/
|
|
133
|
+
__removeTrailingBr(data) {
|
|
134
|
+
if (!this.j.o.cleanHTML.removeTrailingBr || !/<br/i.test(data.value)) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const box = this.j.c.div();
|
|
138
|
+
box.innerHTML = data.value;
|
|
139
|
+
const blocks = [
|
|
140
|
+
box,
|
|
141
|
+
...box.querySelectorAll(TRAILING_BR_BLOCKS)
|
|
142
|
+
];
|
|
143
|
+
blocks.forEach(block => {
|
|
144
|
+
var _a;
|
|
145
|
+
const last = block.lastChild;
|
|
146
|
+
if (!Dom.isTag(last, 'br')) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const prev = last.previousSibling;
|
|
150
|
+
if (!prev || Dom.isTag(prev, 'br')) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (Dom.isText(prev) &&
|
|
154
|
+
!((_a = prev.nodeValue) === null || _a === void 0 ? void 0 : _a.trim()) &&
|
|
155
|
+
!prev.previousSibling) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
Dom.safeRemove(last);
|
|
159
|
+
});
|
|
160
|
+
data.value = box.innerHTML;
|
|
161
|
+
}
|
|
125
162
|
__singleQuotesInFontFamily(data) {
|
|
126
163
|
if (!this.j.o.cleanHTML.singleQuotesInFontFamily ||
|
|
127
164
|
!data.value.includes('"')) {
|
|
@@ -41,6 +41,16 @@ declare module 'jodit/config' {
|
|
|
41
41
|
* names with single quotes: `font-family: 'Open Sans', sans-serif`.
|
|
42
42
|
*/
|
|
43
43
|
singleQuotesInFontFamily: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Browsers keep a trailing `<br>` inside a block after you type into an
|
|
46
|
+
* empty one (`<p>test<br></p>`), and the same `<br>` ends up in the
|
|
47
|
+
* editor value. It renders nothing, but confuses consumers that compare
|
|
48
|
+
* or post-process the HTML. With this option the value getter drops a
|
|
49
|
+
* `<br>` that is the last node of a block (or of the whole value)
|
|
50
|
+
* and follows other content. `<p><br></p>` and `text<br><br>` — an empty
|
|
51
|
+
* line — are kept.
|
|
52
|
+
*/
|
|
53
|
+
removeTrailingBr: boolean;
|
|
44
54
|
/**
|
|
45
55
|
* Replace old tags to new eg. <i> to <em>, <b> to <strong>
|
|
46
56
|
*/
|
|
@@ -136,6 +136,11 @@ export class dragAndDropElement extends Plugin {
|
|
|
136
136
|
this.state = DragState.DRAGGING;
|
|
137
137
|
}
|
|
138
138
|
this.j.e.fire('hidePopup hideResizer');
|
|
139
|
+
// The ghost lives in the top document (position: fixed), but the
|
|
140
|
+
// mousemove comes from the editor document. In iframe mode those are
|
|
141
|
+
// different viewports, so the iframe's own offset has to be added or
|
|
142
|
+
// the ghost trails the pointer by exactly that distance (#1455).
|
|
143
|
+
const offset = this.__ghostOffset();
|
|
139
144
|
if (!this.draggable.parentNode) {
|
|
140
145
|
const target = dataBind(this.draggable, 'target');
|
|
141
146
|
css(this.draggable, {
|
|
@@ -145,19 +150,29 @@ export class dragAndDropElement extends Plugin {
|
|
|
145
150
|
position: 'fixed',
|
|
146
151
|
opacity: 0.7,
|
|
147
152
|
display: 'inline-block',
|
|
148
|
-
left: event.clientX,
|
|
149
|
-
top: event.clientY,
|
|
153
|
+
left: event.clientX + offset.left,
|
|
154
|
+
top: event.clientY + offset.top,
|
|
150
155
|
width: (_a = target === null || target === void 0 ? void 0 : target.offsetWidth) !== null && _a !== void 0 ? _a : 100,
|
|
151
156
|
height: (_b = target === null || target === void 0 ? void 0 : target.offsetHeight) !== null && _b !== void 0 ? _b : 100
|
|
152
157
|
});
|
|
153
158
|
Dom.append(getContainer(this.j, dragAndDropElement), this.draggable);
|
|
154
159
|
}
|
|
155
160
|
css(this.draggable, {
|
|
156
|
-
left: event.clientX,
|
|
157
|
-
top: event.clientY
|
|
161
|
+
left: event.clientX + offset.left,
|
|
162
|
+
top: event.clientY + offset.top
|
|
158
163
|
});
|
|
164
|
+
// The caret goes into the editor document, so it keeps the raw
|
|
165
|
+
// (iframe-relative) coordinates.
|
|
159
166
|
this.j.s.insertCursorAtPoint(event.clientX, event.clientY);
|
|
160
167
|
}
|
|
168
|
+
__ghostOffset() {
|
|
169
|
+
const iframe = this.j.iframe;
|
|
170
|
+
if (!iframe) {
|
|
171
|
+
return { left: 0, top: 0 };
|
|
172
|
+
}
|
|
173
|
+
const rect = iframe.getBoundingClientRect();
|
|
174
|
+
return { left: rect.left, top: rect.top };
|
|
175
|
+
}
|
|
161
176
|
/**
|
|
162
177
|
* Mouseup handler in any place
|
|
163
178
|
*/
|
package/package.json
CHANGED
package/types/config.d.ts
CHANGED
|
@@ -1042,6 +1042,16 @@ interface Config {
|
|
|
1042
1042
|
* names with single quotes: `font-family: 'Open Sans', sans-serif`.
|
|
1043
1043
|
*/
|
|
1044
1044
|
singleQuotesInFontFamily: boolean;
|
|
1045
|
+
/**
|
|
1046
|
+
* Browsers keep a trailing `<br>` inside a block after you type into an
|
|
1047
|
+
* empty one (`<p>test<br></p>`), and the same `<br>` ends up in the
|
|
1048
|
+
* editor value. It renders nothing, but confuses consumers that compare
|
|
1049
|
+
* or post-process the HTML. With this option the value getter drops a
|
|
1050
|
+
* `<br>` that is the last node of a block (or of the whole value)
|
|
1051
|
+
* and follows other content. `<p><br></p>` and `text<br><br>` — an empty
|
|
1052
|
+
* line — are kept.
|
|
1053
|
+
*/
|
|
1054
|
+
removeTrailingBr: boolean;
|
|
1045
1055
|
/**
|
|
1046
1056
|
* Replace old tags to new eg. <i> to <em>, <b> to <strong>
|
|
1047
1057
|
*/
|
|
@@ -11,9 +11,6 @@
|
|
|
11
11
|
import type { IJodit } from "../../types/index";
|
|
12
12
|
import { Plugin } from "../../core/plugin/plugin";
|
|
13
13
|
import "./config";
|
|
14
|
-
/**
|
|
15
|
-
* Clean HTML after removeFormat and insertHorizontalRule command
|
|
16
|
-
*/
|
|
17
14
|
export declare class cleanHtml extends Plugin {
|
|
18
15
|
/** @override */
|
|
19
16
|
buttons: Plugin['buttons'];
|
|
@@ -50,6 +47,13 @@ export declare class cleanHtml extends Plugin {
|
|
|
50
47
|
* survive that round trip. Names that already contain an apostrophe are
|
|
51
48
|
* left alone.
|
|
52
49
|
*/
|
|
50
|
+
/**
|
|
51
|
+
* Drop a `<br>` that is the last node of a block (or of the value) and
|
|
52
|
+
* follows other content — the caret placeholder browsers leave behind
|
|
53
|
+
* after typing into an empty block. An empty block (`<p><br></p>`) and a
|
|
54
|
+
* deliberate empty line (`text<br><br>`) are kept.
|
|
55
|
+
*/
|
|
56
|
+
private __removeTrailingBr;
|
|
53
57
|
private __singleQuotesInFontFamily;
|
|
54
58
|
protected onSafeHTML(sandBox: HTMLElement): void;
|
|
55
59
|
/** @override */
|
|
@@ -41,6 +41,16 @@ declare module 'jodit/config' {
|
|
|
41
41
|
* names with single quotes: `font-family: 'Open Sans', sans-serif`.
|
|
42
42
|
*/
|
|
43
43
|
singleQuotesInFontFamily: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Browsers keep a trailing `<br>` inside a block after you type into an
|
|
46
|
+
* empty one (`<p>test<br></p>`), and the same `<br>` ends up in the
|
|
47
|
+
* editor value. It renders nothing, but confuses consumers that compare
|
|
48
|
+
* or post-process the HTML. With this option the value getter drops a
|
|
49
|
+
* `<br>` that is the last node of a block (or of the whole value)
|
|
50
|
+
* and follows other content. `<p><br></p>` and `text<br><br>` — an empty
|
|
51
|
+
* line — are kept.
|
|
52
|
+
*/
|
|
53
|
+
removeTrailingBr: boolean;
|
|
44
54
|
/**
|
|
45
55
|
* Replace old tags to new eg. <i> to <em>, <b> to <strong>
|
|
46
56
|
*/
|