jodit 4.18.9 → 4.18.11
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 +21 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +5 -5
- package/es2015/jodit.js +331 -71
- 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.js +5 -5
- package/es2018/jodit.min.js +5 -5
- 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 +6 -6
- package/es2021/jodit.js +328 -71
- 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 -1
- package/es2021.en/jodit.fat.min.js +6 -6
- package/es2021.en/jodit.js +328 -71
- 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 -2
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +378 -72
- 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 +2 -2
- package/es5/polyfills.js +3 -3
- package/es5/polyfills.min.js +2 -2
- package/esm/core/async/async.js +2 -1
- package/esm/core/constants.js +1 -1
- package/esm/core/helpers/size/get-fixed-position-offset.d.ts +4 -2
- package/esm/core/helpers/size/get-fixed-position-offset.js +14 -2
- package/esm/plugins/add-new-line/add-new-line.d.ts +7 -0
- package/esm/plugins/add-new-line/add-new-line.js +45 -0
- package/esm/plugins/backspace/backspace.d.ts +7 -0
- package/esm/plugins/backspace/backspace.js +45 -2
- package/esm/plugins/backspace/cases/check-join-neighbors.js +161 -1
- package/esm/plugins/backspace/cases/check-remove-char.js +3 -1
- package/esm/plugins/backspace/cases/check-remove-content-not-editable.d.ts +4 -1
- package/esm/plugins/backspace/cases/check-remove-content-not-editable.js +39 -11
- package/esm/plugins/wrap-nodes/wrap-nodes.js +19 -2
- package/esm/types/async.d.ts +7 -0
- package/package.json +1 -1
- package/types/core/helpers/size/get-fixed-position-offset.d.ts +4 -2
- package/types/plugins/add-new-line/add-new-line.d.ts +7 -0
- package/types/plugins/backspace/backspace.d.ts +7 -0
- package/types/plugins/backspace/cases/check-remove-content-not-editable.d.ts +4 -1
- package/types/types/async.d.ts +7 -0
package/es2021.en/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.18.
|
|
4
|
+
* Version: v4.18.11
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
@@ -1443,7 +1443,8 @@ class Async {
|
|
|
1443
1443
|
this.__requestsIdle.forEach((key)=>this.cancelIdleCallback(key));
|
|
1444
1444
|
this.__requestsRaf.forEach((key)=>this.cancelAnimationFrame(key));
|
|
1445
1445
|
this.__controllers.forEach((controller)=>controller.abort());
|
|
1446
|
-
|
|
1446
|
+
// A labelled timer is kept under its label, so clear by the value
|
|
1447
|
+
this.timers.forEach((timer)=>(0,jodit_core_helpers_async__WEBPACK_IMPORTED_MODULE_2__.clearTimeout)(timer));
|
|
1447
1448
|
this.timers.clear();
|
|
1448
1449
|
this.promisesRejections.forEach((reject)=>reject());
|
|
1449
1450
|
this.promisesRejections.clear();
|
|
@@ -1822,7 +1823,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1822
1823
|
* ```
|
|
1823
1824
|
* @packageDocumentation
|
|
1824
1825
|
* @module constants
|
|
1825
|
-
*/ const APP_VERSION = "4.18.
|
|
1826
|
+
*/ const APP_VERSION = "4.18.11";
|
|
1826
1827
|
// prettier-ignore
|
|
1827
1828
|
const ES = "es2021";
|
|
1828
1829
|
const IS_ES_MODERN = true;
|
|
@@ -7188,8 +7189,10 @@ function normalizeCssValue(key, value) {
|
|
|
7188
7189
|
* ancestor's top-left corner. The returned offset should be subtracted from
|
|
7189
7190
|
* the desired viewport coordinates before applying them.
|
|
7190
7191
|
*
|
|
7191
|
-
*
|
|
7192
|
-
*
|
|
7192
|
+
* Without such an ancestor the containing block is the layout viewport. Its
|
|
7193
|
+
* offset is `{ x: 0, y: 0 }` in most browsers, but WebKit measures client
|
|
7194
|
+
* rects from the visual viewport, so once the page is pinch-zoomed and panned
|
|
7195
|
+
* the layout viewport starts above and to the left of the client origin.
|
|
7193
7196
|
*/ function getFixedPositionOffset(elm) {
|
|
7194
7197
|
const win = elm.ownerDocument?.defaultView;
|
|
7195
7198
|
let node = elm.parentElement;
|
|
@@ -7203,6 +7206,15 @@ function normalizeCssValue(key, value) {
|
|
|
7203
7206
|
}
|
|
7204
7207
|
node = node.parentElement;
|
|
7205
7208
|
}
|
|
7209
|
+
const vv = win?.visualViewport;
|
|
7210
|
+
// WebKit's `scrollX`/`scrollY` follow the visual viewport too (truncated),
|
|
7211
|
+
// where Blink's and Gecko's follow the layout viewport
|
|
7212
|
+
if (win && vv && (vv.offsetLeft || vv.offsetTop) && Math.abs(vv.pageLeft - win.scrollX) < 1 && Math.abs(vv.pageTop - win.scrollY) < 1) {
|
|
7213
|
+
return {
|
|
7214
|
+
x: -Math.round(vv.offsetLeft),
|
|
7215
|
+
y: -Math.round(vv.offsetTop)
|
|
7216
|
+
};
|
|
7217
|
+
}
|
|
7206
7218
|
return {
|
|
7207
7219
|
x: 0,
|
|
7208
7220
|
y: 0
|
|
@@ -27357,12 +27369,13 @@ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__.Icon.set('about', (_about_svg__W
|
|
|
27357
27369
|
/* unused harmony export addNewLine */
|
|
27358
27370
|
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
|
|
27359
27371
|
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
|
|
27360
|
-
/* harmony import */ var
|
|
27361
|
-
/* harmony import */ var
|
|
27362
|
-
/* harmony import */ var
|
|
27363
|
-
/* harmony import */ var
|
|
27364
|
-
/* harmony import */ var
|
|
27365
|
-
/* harmony import */ var
|
|
27372
|
+
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
|
|
27373
|
+
/* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
|
|
27374
|
+
/* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(28077);
|
|
27375
|
+
/* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65946);
|
|
27376
|
+
/* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(80991);
|
|
27377
|
+
/* harmony import */ var jodit_modules__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(60936);
|
|
27378
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(10685);
|
|
27366
27379
|
/*!
|
|
27367
27380
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
27368
27381
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -27380,10 +27393,11 @@ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__.Icon.set('about', (_about_svg__W
|
|
|
27380
27393
|
|
|
27381
27394
|
|
|
27382
27395
|
|
|
27396
|
+
|
|
27383
27397
|
const ns = 'addnewline';
|
|
27384
27398
|
/**
|
|
27385
27399
|
* Create helper for adding new paragraph(Jodit.defaultOptions.enter tag) before iframe, table or image
|
|
27386
|
-
*/ class addNewLine extends
|
|
27400
|
+
*/ class addNewLine extends jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Plugin {
|
|
27387
27401
|
__show() {
|
|
27388
27402
|
if (this.j.o.readonly || this.j.isLocked) {
|
|
27389
27403
|
return;
|
|
@@ -27393,8 +27407,8 @@ const ns = 'addnewline';
|
|
|
27393
27407
|
return;
|
|
27394
27408
|
}
|
|
27395
27409
|
this.__isShown = true;
|
|
27396
|
-
|
|
27397
|
-
(0,
|
|
27410
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(this.j.container, this.__line);
|
|
27411
|
+
(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_6__.css)(this.__line, 'width', this.j.container.clientWidth);
|
|
27398
27412
|
}
|
|
27399
27413
|
onLock(isLocked) {
|
|
27400
27414
|
if (isLocked && this.__isShown) {
|
|
@@ -27432,16 +27446,43 @@ const ns = 'addnewline';
|
|
|
27432
27446
|
editor.editor
|
|
27433
27447
|
], 'scroll' + '.' + ns, this.__hideForce).on('finishedCleanHTMLWorker' + '.' + ns, this.__hideForce).on(editor.editor, 'click' + '.' + ns, this.__hide).on(editor.container, 'mouseleave' + '.' + ns, this.__hide).on(editor.editor, 'mousemove' + '.' + ns, this.__onMouseMove);
|
|
27434
27448
|
}
|
|
27449
|
+
/**
|
|
27450
|
+
* A paragraph holding only an embed has no place for the caret, so the
|
|
27451
|
+
* arrow keys can't get past one that ends the content, or before one that
|
|
27452
|
+
* starts it. When an arrow key leaves the caret where it was and there is
|
|
27453
|
+
* content beyond it, a new line goes there, as when the line is clicked.
|
|
27454
|
+
*/ onArrowKey(e) {
|
|
27455
|
+
const editor = this.j;
|
|
27456
|
+
const forward = e.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_DOWN || e.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_RIGHT;
|
|
27457
|
+
if (!editor.o.addNewLine || editor.o.readonly || editor.isLocked || e.shiftKey || !(forward || e.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_UP || e.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_LEFT) || !editor.s.isCollapsed()) {
|
|
27458
|
+
return;
|
|
27459
|
+
}
|
|
27460
|
+
const { startContainer, startOffset } = editor.s.range;
|
|
27461
|
+
// Once the browser has moved the caret, if it could. With a 0 timeout
|
|
27462
|
+
// Jodit would run this at once, before the browser moves it
|
|
27463
|
+
editor.async.setTimeout(()=>{
|
|
27464
|
+
const { range } = editor.s;
|
|
27465
|
+
const block = jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.closest(startContainer, jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock, editor.editor);
|
|
27466
|
+
if (e.defaultPrevented || !editor.s.isInsideArea || !range.collapsed || range.startContainer !== startContainer || range.startOffset !== startOffset || !block || !jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.findNotEmptyNeighbor(block, !forward, editor.editor)) {
|
|
27467
|
+
return;
|
|
27468
|
+
}
|
|
27469
|
+
const p = editor.createInside.element(editor.o.enter);
|
|
27470
|
+
forward ? jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(editor.editor, p) : jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.prepend(editor.editor, p);
|
|
27471
|
+
editor.s.setCursorIn(p);
|
|
27472
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.scrollIntoViewIfNeeded)(p, editor.editor, editor.ed);
|
|
27473
|
+
editor.synchronizeValues();
|
|
27474
|
+
}, 1);
|
|
27475
|
+
}
|
|
27435
27476
|
onDblClickEditor(e) {
|
|
27436
27477
|
const editor = this.j;
|
|
27437
27478
|
if (!editor.o.readonly && editor.o.addNewLineOnDBLClick && e.target === editor.editor && editor.s.isCollapsed()) {
|
|
27438
|
-
const editorBound = (0,
|
|
27479
|
+
const editorBound = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.offset)(editor.editor, editor, editor.ed);
|
|
27439
27480
|
const top = e.pageY - editor.ew.scrollX;
|
|
27440
27481
|
const p = editor.createInside.element(editor.o.enter);
|
|
27441
27482
|
if (Math.abs(top - editorBound.top) < Math.abs(top - (editorBound.height + editorBound.top)) && editor.editor.firstChild) {
|
|
27442
|
-
|
|
27483
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.prepend(editor.editor, p);
|
|
27443
27484
|
} else {
|
|
27444
|
-
|
|
27485
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(editor.editor, p);
|
|
27445
27486
|
}
|
|
27446
27487
|
editor.s.setCursorIn(p);
|
|
27447
27488
|
editor.synchronizeValues();
|
|
@@ -27454,27 +27495,27 @@ const ns = 'addnewline';
|
|
|
27454
27495
|
// Inside Shadow DOM `document.elementFromPoint` returns the shadow
|
|
27455
27496
|
// host, so the lookup must start from the shadow root
|
|
27456
27497
|
let currentElement = (editor.o.shadowRoot ?? editor.ed).elementFromPoint(e.clientX, e.clientY);
|
|
27457
|
-
if (!
|
|
27498
|
+
if (!jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isHTMLElement(currentElement) || !jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isOrContains(editor.editor, currentElement)) {
|
|
27458
27499
|
return;
|
|
27459
27500
|
}
|
|
27460
27501
|
if (editor.editor !== currentElement && !this.__isMatchedTag(currentElement)) {
|
|
27461
|
-
currentElement =
|
|
27502
|
+
currentElement = jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.closest(currentElement, this.__isMatchedTag, editor.editor);
|
|
27462
27503
|
}
|
|
27463
27504
|
if (!currentElement) {
|
|
27464
27505
|
this.__hide();
|
|
27465
27506
|
return;
|
|
27466
27507
|
}
|
|
27467
27508
|
if (this.__isMatchedTag(currentElement)) {
|
|
27468
|
-
const parentBox =
|
|
27509
|
+
const parentBox = jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.up(currentElement, jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock, editor.editor);
|
|
27469
27510
|
if (parentBox && parentBox !== editor.editor) {
|
|
27470
27511
|
currentElement = parentBox;
|
|
27471
27512
|
}
|
|
27472
27513
|
}
|
|
27473
|
-
const pos = (0,
|
|
27514
|
+
const pos = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.position)(currentElement, this.j);
|
|
27474
27515
|
let top = false;
|
|
27475
27516
|
let { clientY, clientX } = e;
|
|
27476
27517
|
if (this.j.iframe) {
|
|
27477
|
-
const { top, left } = (0,
|
|
27518
|
+
const { top, left } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.position)(this.j.iframe, this.j, true);
|
|
27478
27519
|
clientY += top;
|
|
27479
27520
|
clientX += left;
|
|
27480
27521
|
}
|
|
@@ -27487,8 +27528,8 @@ const ns = 'addnewline';
|
|
|
27487
27528
|
this.__isBeforeContent = false;
|
|
27488
27529
|
}
|
|
27489
27530
|
const isEditor = editor.editor === currentElement;
|
|
27490
|
-
if (top !== false && (isEditor && !this.__isBeforeContent || !isEditor && !(0,
|
|
27491
|
-
(0,
|
|
27531
|
+
if (top !== false && (isEditor && !this.__isBeforeContent || !isEditor && !(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.call)(this.__isBeforeContent ? jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.prev : jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.next, currentElement, this.__canGetFocus, editor.editor))) {
|
|
27532
|
+
(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_6__.css)(this.__line, 'top', top);
|
|
27492
27533
|
this.__current = currentElement;
|
|
27493
27534
|
this.__show();
|
|
27494
27535
|
this.__line.style.setProperty('--jd-anl-handle-offset', clientX - pos.left - 10 + 'px');
|
|
@@ -27500,7 +27541,7 @@ const ns = 'addnewline';
|
|
|
27500
27541
|
/** @override */ beforeDestruct() {
|
|
27501
27542
|
this.j.async.clearTimeout(this.__timeout);
|
|
27502
27543
|
this.j.e.off(this.__line).off('changePlace', this.__addEventListeners);
|
|
27503
|
-
|
|
27544
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.safeRemove(this.__line);
|
|
27504
27545
|
this.j.e.off([
|
|
27505
27546
|
this.j.ow,
|
|
27506
27547
|
this.j.ew,
|
|
@@ -27508,31 +27549,31 @@ const ns = 'addnewline';
|
|
|
27508
27549
|
], '.' + ns).off(this.j.container, '.' + ns).off('.' + ns);
|
|
27509
27550
|
}
|
|
27510
27551
|
constructor(...args){
|
|
27511
|
-
super(...args), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__line", this.j.c.fromHTML(`<div role="button" tabindex="-1" title="${this.j.i18n('Break')}" class="jodit-add-new-line"><span>${
|
|
27552
|
+
super(...args), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__line", this.j.c.fromHTML(`<div role="button" tabindex="-1" title="${this.j.i18n('Break')}" class="jodit-add-new-line"><span>${jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Icon.get('enter')}</span></div>`)), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__isMatchedTag", (node)=>Boolean(node && this.j.o.addNewLineTagsTriggers.includes(node.nodeName.toLowerCase()))), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__timeout", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__isBeforeContent", false), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__current", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__lineInFocus", false), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__isShown", false), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__hideForce", ()=>{
|
|
27512
27553
|
if (!this.__isShown) {
|
|
27513
27554
|
return;
|
|
27514
27555
|
}
|
|
27515
27556
|
this.__isShown = false;
|
|
27516
27557
|
this.j.async.clearTimeout(this.__timeout);
|
|
27517
27558
|
this.__lineInFocus = false;
|
|
27518
|
-
|
|
27559
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.safeRemove(this.__line);
|
|
27519
27560
|
this.__line.style.setProperty('--jd-anl-handle-offset', '0');
|
|
27520
27561
|
}), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__canGetFocus", (elm)=>{
|
|
27521
|
-
return elm != null &&
|
|
27562
|
+
return elm != null && jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock(elm) && !/^(img|table|iframe|hr)$/i.test(elm.nodeName);
|
|
27522
27563
|
}), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__onClickLine", (e)=>{
|
|
27523
27564
|
const editor = this.j;
|
|
27524
27565
|
const p = editor.createInside.element(editor.o.enter);
|
|
27525
27566
|
if (this.__isBeforeContent && this.__current && this.__current.parentNode) {
|
|
27526
27567
|
if (this.__current === editor.editor) {
|
|
27527
|
-
|
|
27568
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.prepend(editor.editor, p);
|
|
27528
27569
|
} else {
|
|
27529
|
-
|
|
27570
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.before(this.__current, p);
|
|
27530
27571
|
}
|
|
27531
27572
|
} else {
|
|
27532
|
-
|
|
27573
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(editor.editor, p);
|
|
27533
27574
|
}
|
|
27534
27575
|
editor.s.setCursorIn(p);
|
|
27535
|
-
(0,
|
|
27576
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.scrollIntoViewIfNeeded)(p, editor.editor, editor.ed);
|
|
27536
27577
|
editor.synchronizeValues();
|
|
27537
27578
|
this.__hideForce();
|
|
27538
27579
|
e.preventDefault();
|
|
@@ -27540,18 +27581,21 @@ const ns = 'addnewline';
|
|
|
27540
27581
|
}
|
|
27541
27582
|
}
|
|
27542
27583
|
;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
27543
|
-
(0,
|
|
27584
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':lock')
|
|
27544
27585
|
], addNewLine.prototype, "onLock", null);
|
|
27545
27586
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
27546
|
-
|
|
27587
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
27547
27588
|
], addNewLine.prototype, "__hide", null);
|
|
27548
27589
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
27549
|
-
(0,
|
|
27590
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':keydown')
|
|
27591
|
+
], addNewLine.prototype, "onArrowKey", null);
|
|
27592
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
27593
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':dblclick')
|
|
27550
27594
|
], addNewLine.prototype, "onDblClickEditor", null);
|
|
27551
27595
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
27552
|
-
(0,
|
|
27596
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.throttle)((ctx)=>ctx.defaultTimeout)
|
|
27553
27597
|
], addNewLine.prototype, "__onMouseMove", null);
|
|
27554
|
-
|
|
27598
|
+
jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('addNewLine', addNewLine);
|
|
27555
27599
|
|
|
27556
27600
|
|
|
27557
27601
|
/***/ }),
|
|
@@ -28069,6 +28113,7 @@ UiAiAssistant = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decor
|
|
|
28069
28113
|
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(33831);
|
|
28070
28114
|
/* harmony import */ var _cases_check_not_collapsed__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(89827);
|
|
28071
28115
|
/* harmony import */ var _cases__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(17523);
|
|
28116
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(15200);
|
|
28072
28117
|
/*!
|
|
28073
28118
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
28074
28119
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -28087,6 +28132,7 @@ UiAiAssistant = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decor
|
|
|
28087
28132
|
|
|
28088
28133
|
|
|
28089
28134
|
|
|
28135
|
+
|
|
28090
28136
|
class backspace extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugin {
|
|
28091
28137
|
afterInit(jodit) {
|
|
28092
28138
|
jodit.registerCommand('deleteButton', {
|
|
@@ -28164,14 +28210,47 @@ class backspace extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugin {
|
|
|
28164
28210
|
throw e;
|
|
28165
28211
|
} finally{
|
|
28166
28212
|
jodit.e.fire('backSpaceAfterDelete', backspace, fakeNode);
|
|
28213
|
+
this.moveCaretToTextBefore(fakeNode);
|
|
28167
28214
|
this.safeRemoveEmptyNode(fakeNode);
|
|
28168
28215
|
}
|
|
28169
28216
|
return false;
|
|
28170
28217
|
}
|
|
28218
|
+
/**
|
|
28219
|
+
* The browser types at the end of the text before the caret on its line,
|
|
28220
|
+
* in that text's formatting, but not inside a link. Moving the caret there
|
|
28221
|
+
* too makes a paste and the toolbar agree with what's typed:
|
|
28222
|
+
* `<p>one</p><p><b>|two</b></p>` joins to `<p>one|<b>two</b></p>`
|
|
28223
|
+
*/ moveCaretToTextBefore(fakeNode) {
|
|
28224
|
+
const { jodit } = this;
|
|
28225
|
+
const { range } = jodit.s;
|
|
28226
|
+
// A case may have merged the fake node away (#1722)
|
|
28227
|
+
if (!fakeNode.parentNode) {
|
|
28228
|
+
return;
|
|
28229
|
+
}
|
|
28230
|
+
const around = jodit.ed.createRange();
|
|
28231
|
+
around.selectNode(fakeNode);
|
|
28232
|
+
if (!range.collapsed || !around.isPointInRange(range.startContainer, range.startOffset)) {
|
|
28233
|
+
return;
|
|
28234
|
+
}
|
|
28235
|
+
const text = (0,_helpers__WEBPACK_IMPORTED_MODULE_10__.findMostNestedNeighbor)(fakeNode, false, jodit.editor, true);
|
|
28236
|
+
const link = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(text, 'a', jodit.editor);
|
|
28237
|
+
if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(text) || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isContentEditable(text, jodit.editor) || link && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isOrContains(link, fakeNode) || jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(text, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock, jodit.editor) !== jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(fakeNode, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock, jodit.editor)) {
|
|
28238
|
+
return;
|
|
28239
|
+
}
|
|
28240
|
+
range.setStart(text, text.nodeValue?.length ?? 0);
|
|
28241
|
+
range.collapse(true);
|
|
28242
|
+
jodit.s.selectRange(range);
|
|
28243
|
+
}
|
|
28171
28244
|
/**
|
|
28172
28245
|
* Remove node and replace cursor position out of it
|
|
28173
28246
|
*/ safeRemoveEmptyNode(fakeNode) {
|
|
28174
28247
|
const { range } = this.j.s;
|
|
28248
|
+
// wrap-nodes normalizes the line it wraps, which can merge the text
|
|
28249
|
+
// after the fake node into it: remove only the fake node's own space
|
|
28250
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(fakeNode) && fakeNode.nodeValue !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.INVISIBLE_SPACE && fakeNode.nodeValue?.startsWith(jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.INVISIBLE_SPACE)) {
|
|
28251
|
+
fakeNode.deleteData(0, jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.INVISIBLE_SPACE.length);
|
|
28252
|
+
return;
|
|
28253
|
+
}
|
|
28175
28254
|
if (range.startContainer === fakeNode) {
|
|
28176
28255
|
if (fakeNode.previousSibling) {
|
|
28177
28256
|
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(fakeNode.previousSibling)) {
|
|
@@ -28223,6 +28302,11 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
|
|
|
28223
28302
|
* Check if two separate elements can be connected
|
|
28224
28303
|
* @private
|
|
28225
28304
|
*/ function checkJoinNeighbors(jodit, fakeNode, backspace) {
|
|
28305
|
+
return joinNeighbors(jodit, fakeNode, backspace, false);
|
|
28306
|
+
}
|
|
28307
|
+
/**
|
|
28308
|
+
* `moved` is set on the one re-entrant pass after `moveToNextLine`
|
|
28309
|
+
*/ function joinNeighbors(jodit, fakeNode, backspace, moved) {
|
|
28226
28310
|
if (checkJoinBareText(jodit, fakeNode, backspace)) {
|
|
28227
28311
|
return true;
|
|
28228
28312
|
}
|
|
@@ -28238,6 +28322,9 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
|
|
|
28238
28322
|
return false;
|
|
28239
28323
|
}
|
|
28240
28324
|
const sibling = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(mainClosestBox, backspace);
|
|
28325
|
+
if (moveInlinesInside(jodit, fakeNode, sibling)) {
|
|
28326
|
+
return joinNeighbors(jodit, fakeNode, backspace, moved);
|
|
28327
|
+
}
|
|
28241
28328
|
// A line break before the cursor is a single unit: remove it instead of
|
|
28242
28329
|
// merging the current element into the (void) `<br>`, which used to move
|
|
28243
28330
|
// the whole element's content into the `<br>` and delete it (#1282).
|
|
@@ -28252,7 +28339,19 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
|
|
|
28252
28339
|
jodit.s.setCursorBefore(fakeNode);
|
|
28253
28340
|
return true;
|
|
28254
28341
|
}
|
|
28342
|
+
// A non-editable sibling is removed by remove-not-editable, never joined
|
|
28343
|
+
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(sibling) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isContentEditable(sibling, jodit.editor)) {
|
|
28344
|
+
return false;
|
|
28345
|
+
}
|
|
28255
28346
|
const box = findCaretBox(fakeNode, mainClosestBox);
|
|
28347
|
+
// One pass only: the line now sits beside the next one, so the
|
|
28348
|
+
// cases below join them. The DOM has changed either way
|
|
28349
|
+
if (!moved && sibling && moveToNextLine(jodit, fakeNode, box, sibling, backspace)) {
|
|
28350
|
+
if (!joinNeighbors(jodit, fakeNode, backspace, true)) {
|
|
28351
|
+
jodit.s.setCursorBefore(fakeNode);
|
|
28352
|
+
}
|
|
28353
|
+
return true;
|
|
28354
|
+
}
|
|
28256
28355
|
if (sibling && (checkPullNextLine(jodit, fakeNode, box, sibling, backspace) || checkMoveListContent(jodit, box, sibling, backspace) || checkJoinInlineSibling(jodit, box, sibling, backspace) || moveContentAndRemoveEmpty(jodit, box, findEdgeBlock(resolveTableSibling(sibling, backspace), backspace, jodit.editor), backspace))) {
|
|
28257
28356
|
jodit.s.setCursorBefore(fakeNode);
|
|
28258
28357
|
return true;
|
|
@@ -28272,6 +28371,60 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
|
|
|
28272
28371
|
}
|
|
28273
28372
|
return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(block) && block.parentElement ? block.parentElement : block;
|
|
28274
28373
|
}
|
|
28374
|
+
/**
|
|
28375
|
+
* With an inline element round the caret's line or the one it joins moved
|
|
28376
|
+
* inside its blocks, the cases join the lines as they join any two, and its
|
|
28377
|
+
* styles stay with its text. One round both lines is left as it is.
|
|
28378
|
+
*/ function moveInlinesInside(jodit, fakeNode, sibling) {
|
|
28379
|
+
if (!sibling) {
|
|
28380
|
+
return false;
|
|
28381
|
+
}
|
|
28382
|
+
const around = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.furthest(fakeNode, (node)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(node) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(node) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isOrContains(node, sibling), jodit.editor);
|
|
28383
|
+
return moveInlineInside(around, jodit.editor) || moveInlineInside(sibling, jodit.editor);
|
|
28384
|
+
}
|
|
28385
|
+
/**
|
|
28386
|
+
* Old content can have an inline element round blocks. This moves it inside
|
|
28387
|
+
* them, and gives the text, images and line breaks beside them a copy of
|
|
28388
|
+
* their own: `<span style="…"><p>one</p><br><p>two</p></span>` becomes
|
|
28389
|
+
* `<p><span style="…">one</span></p><span style="…"><br></span><p><span style="…">two</span></p>`
|
|
28390
|
+
*/ function moveInlineInside(node, root) {
|
|
28391
|
+
if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(node) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(node)) {
|
|
28392
|
+
return false;
|
|
28393
|
+
}
|
|
28394
|
+
// Embedded content, such as the `<iframe>` in a video's wrapper, counts
|
|
28395
|
+
// as a block in `Dom.isBlock`, but stays with the text beside it
|
|
28396
|
+
const isBlock = (child)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(child) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(child, jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.NO_EMPTY_TAGS);
|
|
28397
|
+
// The inner one first: `<span><strong><p>one</p></strong></span>`
|
|
28398
|
+
Array.from(node.childNodes).forEach((child)=>moveInlineInside(child, root));
|
|
28399
|
+
const children = Array.from(node.childNodes);
|
|
28400
|
+
if (!children.some(isBlock)) {
|
|
28401
|
+
return false;
|
|
28402
|
+
}
|
|
28403
|
+
let run = null;
|
|
28404
|
+
for (const child of children){
|
|
28405
|
+
if (!isBlock(child)) {
|
|
28406
|
+
// Blank text between blocks stays where it is
|
|
28407
|
+
if (!run && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmptyTextNode(child)) {
|
|
28408
|
+
run = node.cloneNode(false);
|
|
28409
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(child, run);
|
|
28410
|
+
}
|
|
28411
|
+
run && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(run, child);
|
|
28412
|
+
continue;
|
|
28413
|
+
}
|
|
28414
|
+
run = null;
|
|
28415
|
+
// Nothing goes inside a rule or a non-editable block
|
|
28416
|
+
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(child, jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.INSEPARABLE_TAGS) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isContentEditable(child, root)) {
|
|
28417
|
+
continue;
|
|
28418
|
+
}
|
|
28419
|
+
const inner = node.cloneNode(false);
|
|
28420
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.moveContent(child, inner);
|
|
28421
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(child, inner);
|
|
28422
|
+
// A list or a table: on down to its items or cells
|
|
28423
|
+
moveInlineInside(inner, root);
|
|
28424
|
+
}
|
|
28425
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.unwrap(node);
|
|
28426
|
+
return true;
|
|
28427
|
+
}
|
|
28275
28428
|
/**
|
|
28276
28429
|
* The innermost block on the sibling's edge facing the caret, so the
|
|
28277
28430
|
* content is joined to text: `<div><p>one</p></div><p>|two</p>` gives
|
|
@@ -28304,6 +28457,68 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
|
|
|
28304
28457
|
});
|
|
28305
28458
|
return cells.length ? cells[backspace ? cells.length - 1 : 0] : null;
|
|
28306
28459
|
}
|
|
28460
|
+
/**
|
|
28461
|
+
* On Delete, Word joins two lines where the next one is, inside or outside
|
|
28462
|
+
* its box or quote, and the joined line keeps the caret line's kind, list item
|
|
28463
|
+
* or paragraph. Two paragraphs already join that way. When either line is a
|
|
28464
|
+
* list item, this moves the caret's line beside the next one, and the usual
|
|
28465
|
+
* cases then join them: `<p>one|</p><div><ul><li>two</li></ul></div>` becomes
|
|
28466
|
+
* `<div><p>one|</p><ul><li>two</li></ul></div>`
|
|
28467
|
+
* @private
|
|
28468
|
+
*/ function moveToNextLine(jodit, fakeNode, box, sibling, backspace) {
|
|
28469
|
+
if (backspace || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(sibling, 'table') || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(sibling, jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.INSEPARABLE_TAGS) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isContentEditable(sibling, jodit.editor)) {
|
|
28470
|
+
return false;
|
|
28471
|
+
}
|
|
28472
|
+
const line = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.up(fakeNode, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock, box, true);
|
|
28473
|
+
const next = findEdgeBlock(sibling, false, jodit.editor);
|
|
28474
|
+
if (!line || !next || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isContentEditable(next, jodit.editor) || !(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(line) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(next)) || // A paragraph inside a list item is left as it is
|
|
28475
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(line.parentElement) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(next.parentElement) || boxOf(line) === boxOf(next)) {
|
|
28476
|
+
return false;
|
|
28477
|
+
}
|
|
28478
|
+
const from = line.parentElement;
|
|
28479
|
+
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(line) && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(next)) {
|
|
28480
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(next, line);
|
|
28481
|
+
} else if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(line)) {
|
|
28482
|
+
// A list item keeps its bullet, in a list of its own
|
|
28483
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(next, ownList(line));
|
|
28484
|
+
} else {
|
|
28485
|
+
// A paragraph can't go inside a list, so it goes in front of it
|
|
28486
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(next.parentElement, line);
|
|
28487
|
+
}
|
|
28488
|
+
let remove = from;
|
|
28489
|
+
while(remove && remove !== jodit.editor && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(remove)){
|
|
28490
|
+
const parent = remove.parentElement;
|
|
28491
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(remove);
|
|
28492
|
+
remove = parent;
|
|
28493
|
+
}
|
|
28494
|
+
return true;
|
|
28495
|
+
}
|
|
28496
|
+
/**
|
|
28497
|
+
* The box or quote a line is in, past its lists
|
|
28498
|
+
*/ function boxOf(line) {
|
|
28499
|
+
let box = line.parentElement;
|
|
28500
|
+
while(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isList(box) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(box)){
|
|
28501
|
+
box = box.parentElement;
|
|
28502
|
+
}
|
|
28503
|
+
return box;
|
|
28504
|
+
}
|
|
28505
|
+
/**
|
|
28506
|
+
* Moves a list item into a list of its own, which carries on its numbering
|
|
28507
|
+
*/ function ownList(item) {
|
|
28508
|
+
const list = item.parentElement;
|
|
28509
|
+
const own = list.cloneNode(false);
|
|
28510
|
+
const index = Array.from(list.children).indexOf(item);
|
|
28511
|
+
if (index) {
|
|
28512
|
+
// Two lists cannot share one id
|
|
28513
|
+
own.removeAttribute('id');
|
|
28514
|
+
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(list, 'ol')) {
|
|
28515
|
+
const start = parseInt(list.getAttribute('start') || '1', 10) || 1;
|
|
28516
|
+
own.setAttribute('start', String(start + index));
|
|
28517
|
+
}
|
|
28518
|
+
}
|
|
28519
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(own, item);
|
|
28520
|
+
return own;
|
|
28521
|
+
}
|
|
28307
28522
|
/**
|
|
28308
28523
|
* Delete at the edge of a list pulls the next line up to the caret, as the
|
|
28309
28524
|
* browsers do, instead of moving the caret's line into the next block:
|
|
@@ -28569,7 +28784,9 @@ function checkRemoveChar(jodit, fakeNode, backspace, mode, stopBeforeSpace = fal
|
|
|
28569
28784
|
while(jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isInlineBlock(sibling)){
|
|
28570
28785
|
sibling = backspace ? sibling?.lastChild : sibling?.firstChild;
|
|
28571
28786
|
}
|
|
28572
|
-
|
|
28787
|
+
// A block inside an inline element, such as the `<p>` in
|
|
28788
|
+
// `<span><p>…</p></span>`, isn't a char: the join cases handle it
|
|
28789
|
+
if (!sibling || jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(sibling)) {
|
|
28573
28790
|
break;
|
|
28574
28791
|
}
|
|
28575
28792
|
if (sibling.nodeValue?.length) {
|
|
@@ -28717,6 +28934,7 @@ function isSpace(char) {
|
|
|
28717
28934
|
/* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27795);
|
|
28718
28935
|
/* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(65946);
|
|
28719
28936
|
/* harmony import */ var jodit_core_selection_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(42259);
|
|
28937
|
+
/* harmony import */ var _check_join_neighbors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(26106);
|
|
28720
28938
|
/*!
|
|
28721
28939
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
28722
28940
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -28726,23 +28944,48 @@ function isSpace(char) {
|
|
|
28726
28944
|
*/
|
|
28727
28945
|
|
|
28728
28946
|
|
|
28947
|
+
|
|
28729
28948
|
/**
|
|
28730
|
-
* Checks if a non-editable element can be deleted
|
|
28949
|
+
* Checks if a non-editable element can be deleted. A non-editable block goes
|
|
28950
|
+
* whole, and the lines either side of it then join, as the spec's tests do:
|
|
28951
|
+
* `<ul><li>one|</li></ul><div contenteditable="false">x</div><p>two</p>`
|
|
28952
|
+
* gives `<ul><li>one|two</li></ul>`
|
|
28731
28953
|
* @private
|
|
28732
28954
|
*/ function checkRemoveContentNotEditable(jodit, fakeNode, backspace) {
|
|
28733
|
-
let
|
|
28734
|
-
|
|
28735
|
-
|
|
28736
|
-
|
|
28737
|
-
|
|
28738
|
-
|
|
28739
|
-
|
|
28740
|
-
|
|
28741
|
-
(
|
|
28955
|
+
let node = fakeNode;
|
|
28956
|
+
let neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.findSibling(node, backspace);
|
|
28957
|
+
// Past the edges of the blocks the caret is at, but not into a table cell
|
|
28958
|
+
while(!neighbor && node.parentElement && node.parentElement !== jodit.editor && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isCell(node.parentElement)){
|
|
28959
|
+
node = node.parentElement;
|
|
28960
|
+
neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.findSibling(node, backspace);
|
|
28961
|
+
// At the start of a list item, Backspace takes the bullet off first,
|
|
28962
|
+
// unless the item before it is a non-editable one to remove
|
|
28963
|
+
if (backspace && jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isLeaf(node) && !(jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isLeaf(neighbor) && isNotEditable(jodit, neighbor))) {
|
|
28964
|
+
return false;
|
|
28965
|
+
}
|
|
28966
|
+
}
|
|
28967
|
+
if (isNotEditable(jodit, neighbor)) {
|
|
28968
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isBlock(neighbor)) {
|
|
28969
|
+
// Backspace after a removed list item leaves the items apart: the
|
|
28970
|
+
// next press takes the bullet off, as for any later item
|
|
28971
|
+
const joinLines = !(backspace && jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isLeaf(neighbor));
|
|
28972
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.safeRemove(neighbor);
|
|
28973
|
+
if (joinLines) {
|
|
28974
|
+
(0,_check_join_neighbors__WEBPACK_IMPORTED_MODULE_3__.checkJoinNeighbors)(jodit, fakeNode, backspace);
|
|
28975
|
+
}
|
|
28976
|
+
} else {
|
|
28977
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.call)(backspace ? jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.before : jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.after, neighbor, fakeNode);
|
|
28978
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.safeRemove(neighbor);
|
|
28979
|
+
(0,jodit_core_selection_helpers__WEBPACK_IMPORTED_MODULE_2__.moveNodeInsideStart)(jodit, fakeNode, backspace);
|
|
28980
|
+
}
|
|
28981
|
+
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.call)(backspace ? jodit.s.setCursorBefore : jodit.s.setCursorAfter, fakeNode);
|
|
28742
28982
|
return true;
|
|
28743
28983
|
}
|
|
28744
28984
|
return false;
|
|
28745
28985
|
}
|
|
28986
|
+
function isNotEditable(jodit, node) {
|
|
28987
|
+
return jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isElement(node) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isContentEditable(node, jodit.editor);
|
|
28988
|
+
}
|
|
28746
28989
|
|
|
28747
28990
|
|
|
28748
28991
|
/***/ }),
|
|
@@ -46942,12 +47185,13 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
|
|
|
46942
47185
|
"use strict";
|
|
46943
47186
|
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
|
|
46944
47187
|
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
|
|
46945
|
-
/* harmony import */ var
|
|
46946
|
-
/* harmony import */ var
|
|
46947
|
-
/* harmony import */ var
|
|
46948
|
-
/* harmony import */ var
|
|
46949
|
-
/* harmony import */ var
|
|
46950
|
-
/* harmony import */ var
|
|
47188
|
+
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
|
|
47189
|
+
/* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
|
|
47190
|
+
/* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(27795);
|
|
47191
|
+
/* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
|
|
47192
|
+
/* harmony import */ var jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(85932);
|
|
47193
|
+
/* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
|
|
47194
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(86038);
|
|
46951
47195
|
/*!
|
|
46952
47196
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
46953
47197
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -46964,9 +47208,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
|
|
|
46964
47208
|
|
|
46965
47209
|
|
|
46966
47210
|
|
|
47211
|
+
|
|
46967
47212
|
/**
|
|
46968
47213
|
* Wrap single text nodes in block wrapper
|
|
46969
|
-
*/ class wrapNodes extends
|
|
47214
|
+
*/ class wrapNodes extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
|
|
46970
47215
|
/** @override **/ afterInit(jodit) {
|
|
46971
47216
|
if (jodit.o.enter.toLowerCase() === 'br') {
|
|
46972
47217
|
return;
|
|
@@ -46995,10 +47240,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
|
|
|
46995
47240
|
}
|
|
46996
47241
|
isChanged = true;
|
|
46997
47242
|
const box = jodit.createInside.element(jodit.o.enter);
|
|
46998
|
-
|
|
46999
|
-
|
|
47243
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.before(child, box);
|
|
47244
|
+
// `exclude` keeps a <br> from starting a box, but one between loose lines stays with them
|
|
47245
|
+
while(child && (this.isSuitable(child) || jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(child, 'br'))){
|
|
47000
47246
|
const next = child.nextSibling;
|
|
47001
|
-
|
|
47247
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(box, child);
|
|
47002
47248
|
child = next;
|
|
47003
47249
|
}
|
|
47004
47250
|
box.normalize();
|
|
@@ -47022,8 +47268,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
|
|
|
47022
47268
|
}
|
|
47023
47269
|
const box = jodit.createInside.element(jodit.o.enter);
|
|
47024
47270
|
const br = jodit.createInside.element('br');
|
|
47025
|
-
|
|
47026
|
-
|
|
47271
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(box, br);
|
|
47272
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(jodit.editor, box);
|
|
47027
47273
|
if (jodit.s.isFocused() || jodit.e.current === 'backSpaceAfterDelete') {
|
|
47028
47274
|
jodit.s.setCursorBefore(br);
|
|
47029
47275
|
}
|
|
@@ -47032,29 +47278,40 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
|
|
|
47032
47278
|
constructor(...args){
|
|
47033
47279
|
super(...args), /**
|
|
47034
47280
|
* Found Node which should be wrapped
|
|
47035
|
-
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isSuitableStart", (n)=>
|
|
47281
|
+
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isSuitableStart", (n)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(n) && (0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_6__.isString)(n.nodeValue) && (/[^\s]/.test(n.nodeValue) || n.parentNode?.firstChild === n && this.isSuitable(n.nextSibling)) || this.isNotWrapped(n) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTemporary(n)), /**
|
|
47036
47282
|
* Node should add in a block element
|
|
47037
|
-
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isSuitable", (n)=>
|
|
47283
|
+
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isSuitable", (n)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(n) || this.isNotWrapped(n)), /**
|
|
47038
47284
|
* Some element which needs to append in block
|
|
47039
|
-
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isNotWrapped", (n)=>
|
|
47285
|
+
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isNotWrapped", (n)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(n) && !(jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isBlock(n) || jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(n, this.j.o.wrapNodes.exclude) || holdsBlock(n)));
|
|
47040
47286
|
}
|
|
47041
47287
|
}
|
|
47042
47288
|
;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
47043
|
-
|
|
47289
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
47044
47290
|
], wrapNodes.prototype, "postProcessSetEditorValue", null);
|
|
47045
47291
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
47046
|
-
|
|
47292
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
47047
47293
|
], wrapNodes.prototype, "preprocessInput", null);
|
|
47294
|
+
/**
|
|
47295
|
+
* A block can't go in a paragraph, so neither can an element that holds one,
|
|
47296
|
+
* such as a `<span>` round a `<p>`. Embedded content such as an `<iframe>` can.
|
|
47297
|
+
*/ function holdsBlock(elm) {
|
|
47298
|
+
for (const node of jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.eachGen(elm)){
|
|
47299
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isBlock(node) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(node, jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.NO_EMPTY_TAGS)) {
|
|
47300
|
+
return true;
|
|
47301
|
+
}
|
|
47302
|
+
}
|
|
47303
|
+
return false;
|
|
47304
|
+
}
|
|
47048
47305
|
function checkAloneListLeaf(child, jodit) {
|
|
47049
47306
|
let result = child;
|
|
47050
47307
|
let next = child;
|
|
47051
47308
|
do {
|
|
47052
|
-
if (
|
|
47053
|
-
const nextChild =
|
|
47054
|
-
if (
|
|
47055
|
-
|
|
47309
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(next) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isLeaf(next) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isList(next.parentElement)) {
|
|
47310
|
+
const nextChild = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.findNotEmptySibling(next, false);
|
|
47311
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(result, 'ul')) {
|
|
47312
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(result, next);
|
|
47056
47313
|
} else {
|
|
47057
|
-
result =
|
|
47314
|
+
result = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.wrap(next, 'ul', jodit.createInside);
|
|
47058
47315
|
}
|
|
47059
47316
|
next = nextChild;
|
|
47060
47317
|
} else {
|
|
@@ -47063,7 +47320,7 @@ function checkAloneListLeaf(child, jodit) {
|
|
|
47063
47320
|
}while (next)
|
|
47064
47321
|
return result;
|
|
47065
47322
|
}
|
|
47066
|
-
|
|
47323
|
+
jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('wrapNodes', wrapNodes);
|
|
47067
47324
|
|
|
47068
47325
|
|
|
47069
47326
|
/***/ }),
|