jodit 4.12.17 → 4.12.20
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 +36 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +7 -7
- package/es2015/jodit.js +338 -79
- package/es2015/jodit.min.js +7 -7
- 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 +7 -7
- package/es2018/jodit.min.js +7 -7
- 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 +9 -9
- package/es2021/jodit.js +335 -79
- package/es2021/jodit.min.js +9 -9
- 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 +10 -10
- package/es2021.en/jodit.js +335 -79
- package/es2021.en/jodit.min.js +9 -9
- 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 +367 -85
- 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/core/constants.js +1 -1
- package/esm/core/helpers/html/apply-styles.js +11 -0
- package/esm/core/helpers/html/clean-from-word.js +9 -0
- package/esm/core/helpers/html/safe-html.js +71 -19
- package/esm/core/helpers/html/strip-tags.d.ts +1 -1
- package/esm/core/helpers/html/strip-tags.js +7 -3
- package/esm/core/helpers/utils/config-proto.js +15 -0
- package/esm/core/helpers/utils/convert-media-url-to-video-embed.js +41 -19
- package/esm/jodit.js +20 -0
- package/esm/modules/uploader/config.js +11 -1
- package/esm/plugins/clean-html/helpers/visitor/filters/try-remove-node.js +8 -1
- package/esm/plugins/color/config.js +12 -3
- package/esm/plugins/drag-and-drop-element/drag-and-drop-element.d.ts +21 -0
- package/esm/plugins/drag-and-drop-element/drag-and-drop-element.js +48 -3
- package/esm/plugins/enter/enter.js +11 -6
- package/esm/plugins/hotkeys/config.js +1 -1
- package/esm/plugins/indent/config.js +20 -6
- package/esm/plugins/paste/paste.js +6 -1
- package/esm/plugins/paste-from-word/paste-from-word.js +1 -1
- package/esm/plugins/select/select.d.ts +8 -0
- package/esm/plugins/select/select.js +37 -0
- package/package.json +1 -1
- package/types/core/helpers/html/strip-tags.d.ts +1 -1
- package/types/plugins/drag-and-drop-element/drag-and-drop-element.d.ts +21 -0
- package/types/plugins/select/select.d.ts +8 -0
|
@@ -45,12 +45,17 @@ export class enter extends Plugin {
|
|
|
45
45
|
if (beforeEnter !== undefined) {
|
|
46
46
|
return beforeEnter;
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
editor.
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
// Delete-of-selection + new block must be a single history step,
|
|
49
|
+
// otherwise pressing Enter over a selection needs two Ctrl+Z to undo
|
|
50
|
+
// (the first only reverts to the intermediate empty state). #1292
|
|
51
|
+
editor.history.snapshot.transaction(() => {
|
|
52
|
+
if (!editor.s.isCollapsed()) {
|
|
53
|
+
editor.execCommand('Delete');
|
|
54
|
+
}
|
|
55
|
+
editor.s.focus();
|
|
56
|
+
this.onEnter(event);
|
|
57
|
+
editor.e.fire('afterEnter', event);
|
|
58
|
+
});
|
|
54
59
|
editor.synchronizeValues(); // fire change
|
|
55
60
|
return false;
|
|
56
61
|
}
|
|
@@ -7,6 +7,6 @@ import { Config } from "../../config.js";
|
|
|
7
7
|
Config.prototype.commandToHotkeys = {
|
|
8
8
|
removeFormat: ['ctrl+shift+m', 'cmd+shift+m'],
|
|
9
9
|
insertOrderedList: ['ctrl+shift+7', 'cmd+shift+7'],
|
|
10
|
-
insertUnorderedList: ['ctrl+shift+8, cmd+shift+8'],
|
|
10
|
+
insertUnorderedList: ['ctrl+shift+8', 'cmd+shift+8'],
|
|
11
11
|
selectall: ['ctrl+a', 'cmd+a']
|
|
12
12
|
};
|
|
@@ -15,15 +15,29 @@ Config.prototype.controls.indent = {
|
|
|
15
15
|
};
|
|
16
16
|
Config.prototype.controls.outdent = {
|
|
17
17
|
isDisabled: (editor) => {
|
|
18
|
+
var _a;
|
|
18
19
|
const current = editor.s.current();
|
|
19
|
-
if (current) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
if (!current) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
// A list item whose list is nested inside another list item can be
|
|
24
|
+
// outdented (un-nested) by the `tab` plugin, even without an inline
|
|
25
|
+
// indent margin. Keep the button enabled in that case. See #1247
|
|
26
|
+
if ((_a = editor.o.tab) === null || _a === void 0 ? void 0 : _a.tabInsideLiInsertNewList) {
|
|
27
|
+
const li = Dom.closest(current, 'li', editor.editor);
|
|
28
|
+
if (li) {
|
|
29
|
+
const list = Dom.closest(li, ['ul', 'ol'], editor.editor);
|
|
30
|
+
if (list && Dom.closest(list, 'li', editor.editor)) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
25
33
|
}
|
|
26
34
|
}
|
|
35
|
+
const currentBox = Dom.closest(current, Dom.isBlock, editor.editor);
|
|
36
|
+
if (currentBox) {
|
|
37
|
+
const arrow = getKey(editor.o.direction, currentBox);
|
|
38
|
+
return (!currentBox.style[arrow] ||
|
|
39
|
+
parseInt(currentBox.style[arrow], 10) <= 0);
|
|
40
|
+
}
|
|
27
41
|
return true;
|
|
28
42
|
},
|
|
29
43
|
tooltip: 'Decrease Indent'
|
|
@@ -148,10 +148,15 @@ export class paste extends Plugin {
|
|
|
148
148
|
html = cleanFromWord(html);
|
|
149
149
|
break;
|
|
150
150
|
case INSERT_ONLY_TEXT:
|
|
151
|
-
html = stripTags(html, this.j.ed, new Set(this.j.o.pasteExcludeStripTags));
|
|
151
|
+
html = stripTags(html, this.j.ed, new Set(this.j.o.pasteExcludeStripTags), this.j.o.nl2brInPlainText);
|
|
152
152
|
break;
|
|
153
153
|
case INSERT_AS_TEXT:
|
|
154
154
|
html = htmlspecialchars(html);
|
|
155
|
+
// Keep the source line breaks instead of letting the raw
|
|
156
|
+
// newlines collapse into spaces when rendered. See #1093
|
|
157
|
+
if (this.j.o.nl2brInPlainText) {
|
|
158
|
+
html = nl2br(html);
|
|
159
|
+
}
|
|
155
160
|
break;
|
|
156
161
|
default: {
|
|
157
162
|
const newHTML = this.j.e.fire('onCustomPasteHTMLOption', action, html, e);
|
|
@@ -61,7 +61,7 @@ export class pasteFromWord extends Plugin {
|
|
|
61
61
|
break;
|
|
62
62
|
}
|
|
63
63
|
case INSERT_ONLY_TEXT: {
|
|
64
|
-
html = stripTags(cleanFromWord(html));
|
|
64
|
+
html = stripTags(cleanFromWord(html), this.j.ed, new Set(this.j.o.pasteExcludeStripTags), this.j.o.nl2brInPlainText);
|
|
65
65
|
break;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -39,6 +39,14 @@ export declare class select extends Plugin {
|
|
|
39
39
|
* of the end (#1296); move it to the end of the item's own text.
|
|
40
40
|
*/
|
|
41
41
|
protected onClickRightOfNestedListItem(e: MouseEvent): void;
|
|
42
|
+
/**
|
|
43
|
+
* Keep pending inline formatting after a click. Toggling Bold/Italic/etc. on
|
|
44
|
+
* a collapsed cursor leaves empty marker elements with the caret inside; a
|
|
45
|
+
* click puts the caret right before them (outside), so they get cleaned up
|
|
46
|
+
* and the formatting is lost. Move the caret back into the innermost marker
|
|
47
|
+
* so the next typed character keeps every pending format (#1291).
|
|
48
|
+
*/
|
|
49
|
+
protected onClickKeepPendingFormat(): void;
|
|
42
50
|
/**
|
|
43
51
|
* Normalize selection after triple click
|
|
44
52
|
*/
|
|
@@ -13,6 +13,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
13
13
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14
14
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
15
|
};
|
|
16
|
+
import { IS_INLINE } from "../../core/constants.js";
|
|
16
17
|
import { autobind, watch } from "../../core/decorators/index.js";
|
|
17
18
|
import { Dom } from "../../core/dom/dom.js";
|
|
18
19
|
import { pluginSystem } from "../../core/global.js";
|
|
@@ -121,6 +122,39 @@ export class select extends Plugin {
|
|
|
121
122
|
s.setCursorAfter(text);
|
|
122
123
|
}
|
|
123
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* Keep pending inline formatting after a click. Toggling Bold/Italic/etc. on
|
|
127
|
+
* a collapsed cursor leaves empty marker elements with the caret inside; a
|
|
128
|
+
* click puts the caret right before them (outside), so they get cleaned up
|
|
129
|
+
* and the formatting is lost. Move the caret back into the innermost marker
|
|
130
|
+
* so the next typed character keeps every pending format (#1291).
|
|
131
|
+
*/
|
|
132
|
+
onClickKeepPendingFormat() {
|
|
133
|
+
var _a, _b;
|
|
134
|
+
const { s } = this.j;
|
|
135
|
+
const range = s.range;
|
|
136
|
+
if (!range.collapsed || !Dom.isText(range.startContainer)) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const text = range.startContainer;
|
|
140
|
+
// Caret must sit at the very end of the text, right before the markers.
|
|
141
|
+
if (range.startOffset !== ((_b = (_a = text.nodeValue) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0)) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const marker = text.nextSibling;
|
|
145
|
+
if (!Dom.isElement(marker) ||
|
|
146
|
+
!marker.nodeName.match(IS_INLINE) ||
|
|
147
|
+
!Dom.isEmpty(marker)) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
let inner = marker;
|
|
151
|
+
// Descend into the innermost empty formatting marker.
|
|
152
|
+
while (Dom.isElement(inner.firstElementChild) &&
|
|
153
|
+
inner.firstElementChild.nodeName.match(IS_INLINE)) {
|
|
154
|
+
inner = inner.firstElementChild;
|
|
155
|
+
}
|
|
156
|
+
s.setCursorIn(inner);
|
|
157
|
+
}
|
|
124
158
|
/**
|
|
125
159
|
* Normalize selection after triple click
|
|
126
160
|
*/
|
|
@@ -164,6 +198,9 @@ __decorate([
|
|
|
164
198
|
__decorate([
|
|
165
199
|
watch([':click'])
|
|
166
200
|
], select.prototype, "onClickRightOfNestedListItem", null);
|
|
201
|
+
__decorate([
|
|
202
|
+
watch([':click'])
|
|
203
|
+
], select.prototype, "onClickKeepPendingFormat", null);
|
|
167
204
|
__decorate([
|
|
168
205
|
watch([':click'])
|
|
169
206
|
], select.prototype, "onTripleClickNormalizeSelection", null);
|
package/package.json
CHANGED
|
@@ -10,4 +10,4 @@ import type { HTMLTagNames, Nullable } from "../../../types/index";
|
|
|
10
10
|
/**
|
|
11
11
|
* Extract plain text from HTML text
|
|
12
12
|
*/
|
|
13
|
-
export declare function stripTags(html: string | Node, doc?: Document, exclude?: Nullable<Set<HTMLTagNames
|
|
13
|
+
export declare function stripTags(html: string | Node, doc?: Document, exclude?: Nullable<Set<HTMLTagNames>>, blockBr?: boolean): string;
|
|
@@ -21,10 +21,31 @@ export declare class dragAndDropElement extends Plugin {
|
|
|
21
21
|
private state;
|
|
22
22
|
/** @override */
|
|
23
23
|
protected afterInit(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Start dragging a specific element programmatically.
|
|
26
|
+
*
|
|
27
|
+
* Allows a separate UI element (for example a drag handle/anchor shown next
|
|
28
|
+
* to a block) to initiate the drag without the user pressing directly on the
|
|
29
|
+
* draggable element itself.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```js
|
|
33
|
+
* handle.addEventListener('mousedown', e => {
|
|
34
|
+
* editor.e.fire('startDragElement', preBlock, e);
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
private onStartDragElement;
|
|
24
39
|
/**
|
|
25
40
|
* Drag start handler
|
|
26
41
|
*/
|
|
27
42
|
private onDragStart;
|
|
43
|
+
/**
|
|
44
|
+
* Prepare the ghost element and switch to the waiting state.
|
|
45
|
+
* Shared by the native mousedown handler and the programmatic
|
|
46
|
+
* `startDragElement` event handler.
|
|
47
|
+
*/
|
|
48
|
+
private startDragging;
|
|
28
49
|
/**
|
|
29
50
|
* Mouse move handler handler
|
|
30
51
|
*/
|
|
@@ -39,6 +39,14 @@ export declare class select extends Plugin {
|
|
|
39
39
|
* of the end (#1296); move it to the end of the item's own text.
|
|
40
40
|
*/
|
|
41
41
|
protected onClickRightOfNestedListItem(e: MouseEvent): void;
|
|
42
|
+
/**
|
|
43
|
+
* Keep pending inline formatting after a click. Toggling Bold/Italic/etc. on
|
|
44
|
+
* a collapsed cursor leaves empty marker elements with the caret inside; a
|
|
45
|
+
* click puts the caret right before them (outside), so they get cleaned up
|
|
46
|
+
* and the formatting is lost. Move the caret back into the innermost marker
|
|
47
|
+
* so the next typed character keeps every pending format (#1291).
|
|
48
|
+
*/
|
|
49
|
+
protected onClickKeepPendingFormat(): void;
|
|
42
50
|
/**
|
|
43
51
|
* Normalize selection after triple click
|
|
44
52
|
*/
|