jodit 4.11.6 → 4.11.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 +17 -0
- package/es2015/jodit.css +1 -6
- package/es2015/jodit.fat.min.css +1 -1
- package/es2015/jodit.fat.min.js +14 -14
- package/es2015/jodit.js +70 -11
- package/es2015/jodit.min.css +1 -1
- package/es2015/jodit.min.js +5 -5
- 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.css +1 -1
- package/es2018/jodit.fat.min.js +5 -5
- package/es2018/jodit.min.css +1 -1
- package/es2018/jodit.min.js +25 -25
- 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 -6
- package/es2021/jodit.fat.min.css +1 -1
- package/es2021/jodit.fat.min.js +6 -6
- package/es2021/jodit.js +70 -11
- package/es2021/jodit.min.css +1 -1
- package/es2021/jodit.min.js +6 -6
- 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 -6
- package/es2021.en/jodit.fat.min.css +1 -1
- package/es2021.en/jodit.fat.min.js +6 -6
- package/es2021.en/jodit.js +70 -11
- package/es2021.en/jodit.min.css +1 -1
- package/es2021.en/jodit.min.js +6 -6
- 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 -10
- package/es5/jodit.fat.min.css +1 -1
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +76 -13
- package/es5/jodit.min.css +3 -3
- 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/dom/dom.d.ts +4 -0
- package/esm/core/dom/dom.js +28 -0
- package/esm/core/selection/selection.js +3 -2
- package/esm/plugins/backspace/backspace.js +1 -0
- package/esm/plugins/focus/focus.js +11 -5
- package/esm/plugins/search/helpers/highlight-text-ranges.js +23 -0
- package/esm/plugins/wrap-nodes/wrap-nodes.js +5 -2
- package/package.json +1 -1
- package/types/core/dom/dom.d.ts +4 -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.11.
|
|
4
|
+
* Version: v4.11.7
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
@@ -1764,7 +1764,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1764
1764
|
* ```
|
|
1765
1765
|
* @packageDocumentation
|
|
1766
1766
|
* @module constants
|
|
1767
|
-
*/ const APP_VERSION = "4.11.
|
|
1767
|
+
*/ const APP_VERSION = "4.11.7";
|
|
1768
1768
|
// prettier-ignore
|
|
1769
1769
|
const ES = "es2015";
|
|
1770
1770
|
const IS_ES_MODERN = true;
|
|
@@ -3221,6 +3221,31 @@ function wait(condition) {
|
|
|
3221
3221
|
*/ static canSplitBlock(node) {
|
|
3222
3222
|
return !(0,jodit_core_helpers_checker_is_void__WEBPACK_IMPORTED_MODULE_7__.isVoid)(node) && Dom.isHTMLElement(node) && Dom.isBlock(node) && !/^(TD|TH|CAPTION|FORM)$/.test(node.nodeName) && node.style !== undefined && !/^(fixed|absolute)/i.test(node.style.position);
|
|
3223
3223
|
}
|
|
3224
|
+
/**
|
|
3225
|
+
* Get first matched node inside root
|
|
3226
|
+
*/ static first(root, condition) {
|
|
3227
|
+
let first = root === null || root === void 0 ? void 0 : root.firstChild;
|
|
3228
|
+
if (!first) {
|
|
3229
|
+
return null;
|
|
3230
|
+
}
|
|
3231
|
+
do {
|
|
3232
|
+
if (condition(first)) {
|
|
3233
|
+
return first;
|
|
3234
|
+
}
|
|
3235
|
+
let next = first.firstChild;
|
|
3236
|
+
if (!next) {
|
|
3237
|
+
next = first.nextSibling;
|
|
3238
|
+
}
|
|
3239
|
+
if (!next && first.parentNode !== root) {
|
|
3240
|
+
do {
|
|
3241
|
+
first = first.parentNode;
|
|
3242
|
+
}while (first && !(first === null || first === void 0 ? void 0 : first.nextSibling) && first.parentNode !== root)
|
|
3243
|
+
next = first === null || first === void 0 ? void 0 : first.nextSibling;
|
|
3244
|
+
}
|
|
3245
|
+
first = next;
|
|
3246
|
+
}while (first)
|
|
3247
|
+
return null;
|
|
3248
|
+
}
|
|
3224
3249
|
/**
|
|
3225
3250
|
* Get last matched node inside root
|
|
3226
3251
|
*/ static last(root, condition) {
|
|
@@ -10185,7 +10210,8 @@ class Selection {
|
|
|
10185
10210
|
*/ restore() {
|
|
10186
10211
|
let range = false;
|
|
10187
10212
|
const markAttr = (start)=>`span[data-${jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.MARKER_CLASS}=${start ? 'start' : 'end'}]`;
|
|
10188
|
-
const start = this.area.querySelector(markAttr(true))
|
|
10213
|
+
const start = this.area.querySelector(markAttr(true));
|
|
10214
|
+
const end = this.area.querySelector(markAttr(false));
|
|
10189
10215
|
if (!start) {
|
|
10190
10216
|
return;
|
|
10191
10217
|
}
|
|
@@ -10755,7 +10781,7 @@ class Selection {
|
|
|
10755
10781
|
* Set range selection
|
|
10756
10782
|
*/ selectRange(range, focus = true) {
|
|
10757
10783
|
const sel = this.sel;
|
|
10758
|
-
if (focus && !this.isFocused()) {
|
|
10784
|
+
if (focus && !this.isFocused() && this.j.e.current !== 'focus') {
|
|
10759
10785
|
this.focus();
|
|
10760
10786
|
}
|
|
10761
10787
|
if (sel) {
|
|
@@ -25764,6 +25790,7 @@ class backspace extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugin {
|
|
|
25764
25790
|
sel.focus();
|
|
25765
25791
|
}
|
|
25766
25792
|
if ((0,_cases_check_not_collapsed__WEBPACK_IMPORTED_MODULE_8__.checkNotCollapsed)(jodit)) {
|
|
25793
|
+
jodit.e.fire('backSpaceAfterDelete', backspace);
|
|
25767
25794
|
return false;
|
|
25768
25795
|
}
|
|
25769
25796
|
const range = sel.range;
|
|
@@ -30151,11 +30178,17 @@ function focus(editor) {
|
|
|
30151
30178
|
}
|
|
30152
30179
|
const focus = ()=>{
|
|
30153
30180
|
editor.s.focus();
|
|
30154
|
-
|
|
30155
|
-
|
|
30156
|
-
|
|
30157
|
-
|
|
30158
|
-
|
|
30181
|
+
let textNode = null;
|
|
30182
|
+
switch(editor.o.cursorAfterAutofocus){
|
|
30183
|
+
case 'start':
|
|
30184
|
+
textNode = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.first(editor.editor, (node)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isText(node));
|
|
30185
|
+
break;
|
|
30186
|
+
case 'end':
|
|
30187
|
+
textNode = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.last(editor.editor, (node)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isText(node));
|
|
30188
|
+
break;
|
|
30189
|
+
}
|
|
30190
|
+
if (textNode) {
|
|
30191
|
+
editor.s.setCursorIn(textNode, editor.o.cursorAfterAutofocus === 'start');
|
|
30159
30192
|
}
|
|
30160
30193
|
};
|
|
30161
30194
|
editor.e.on('afterInit', ()=>{
|
|
@@ -37879,6 +37912,27 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.find = {
|
|
|
37879
37912
|
/**
|
|
37880
37913
|
* @private
|
|
37881
37914
|
*/ const TMP_ATTR = 'jd-tmp-selection';
|
|
37915
|
+
const HIGHLIGHT_CSS = 'background-color: var(--jd-color-background-selection); color: var(--jd-color-text-selection);';
|
|
37916
|
+
const injectedDocs = new WeakSet();
|
|
37917
|
+
function ensureHighlightStyle(doc, useHighlightAPI) {
|
|
37918
|
+
if (injectedDocs.has(doc)) {
|
|
37919
|
+
return;
|
|
37920
|
+
}
|
|
37921
|
+
injectedDocs.add(doc);
|
|
37922
|
+
const rule = useHighlightAPI ? `::highlight(jodit-search-result) { ${HIGHLIGHT_CSS} }` : `[${TMP_ATTR}] { ${HIGHLIGHT_CSS} }`;
|
|
37923
|
+
try {
|
|
37924
|
+
const sheet = new CSSStyleSheet();
|
|
37925
|
+
sheet.insertRule(rule);
|
|
37926
|
+
doc.adoptedStyleSheets = [
|
|
37927
|
+
...doc.adoptedStyleSheets,
|
|
37928
|
+
sheet
|
|
37929
|
+
];
|
|
37930
|
+
} catch (unused) {
|
|
37931
|
+
const style = doc.createElement('style');
|
|
37932
|
+
style.textContent = rule;
|
|
37933
|
+
doc.head.appendChild(style);
|
|
37934
|
+
}
|
|
37935
|
+
}
|
|
37882
37936
|
/**
|
|
37883
37937
|
* @private
|
|
37884
37938
|
*/ function highlightTextRanges(jodit, rng, restRanges, ci, root) {
|
|
@@ -37888,6 +37942,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.find = {
|
|
|
37888
37942
|
if (checkNativeSelectionMethod(jodit, rng, restRanges)) {
|
|
37889
37943
|
return;
|
|
37890
37944
|
}
|
|
37945
|
+
ensureHighlightStyle(jodit.ed, false);
|
|
37891
37946
|
const span = ci.element('span', {
|
|
37892
37947
|
[TMP_ATTR]: true
|
|
37893
37948
|
});
|
|
@@ -37947,6 +38002,7 @@ function checkNativeSelectionMethod(jodit, rng, restRanges) {
|
|
|
37947
38002
|
range.setEnd(rng.endContainer, rng.endOffset);
|
|
37948
38003
|
return range;
|
|
37949
38004
|
});
|
|
38005
|
+
ensureHighlightStyle(jodit.ed, true);
|
|
37950
38006
|
const searchHighlight = new Highlight(...ranges);
|
|
37951
38007
|
// @ts-ignore
|
|
37952
38008
|
CSS.highlights.clear();
|
|
@@ -42532,7 +42588,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
|
|
|
42532
42588
|
if (!jodit.isEditorMode()) {
|
|
42533
42589
|
return;
|
|
42534
42590
|
}
|
|
42535
|
-
let child = jodit.editor.firstChild
|
|
42591
|
+
let child = jodit.editor.firstChild;
|
|
42592
|
+
let isChanged = false;
|
|
42536
42593
|
while(child){
|
|
42537
42594
|
child = checkAloneListLeaf(child, jodit);
|
|
42538
42595
|
if (this.isSuitableStart(child)) {
|
|
@@ -42570,7 +42627,9 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
|
|
|
42570
42627
|
const br = jodit.createInside.element('br');
|
|
42571
42628
|
jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.append(box, br);
|
|
42572
42629
|
jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.append(jodit.editor, box);
|
|
42573
|
-
jodit.s.isFocused()
|
|
42630
|
+
if (jodit.s.isFocused() || jodit.e.current === 'backSpaceAfterDelete') {
|
|
42631
|
+
jodit.s.setCursorBefore(br);
|
|
42632
|
+
}
|
|
42574
42633
|
jodit.e.fire('internalChange');
|
|
42575
42634
|
}
|
|
42576
42635
|
constructor(...args){
|