jodit 4.18.10 → 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 +15 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +5 -5
- package/es2015/jodit.js +256 -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 +253 -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 +253 -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 +303 -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 +69 -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/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
|
|
@@ -27381,12 +27393,13 @@ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__.Icon.set('about', (_about_svg__W
|
|
|
27381
27393
|
/* unused harmony export addNewLine */
|
|
27382
27394
|
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
|
|
27383
27395
|
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
|
|
27384
|
-
/* harmony import */ var
|
|
27385
|
-
/* harmony import */ var
|
|
27386
|
-
/* harmony import */ var
|
|
27387
|
-
/* harmony import */ var
|
|
27388
|
-
/* harmony import */ var
|
|
27389
|
-
/* harmony import */ var
|
|
27396
|
+
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
|
|
27397
|
+
/* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
|
|
27398
|
+
/* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(28077);
|
|
27399
|
+
/* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65946);
|
|
27400
|
+
/* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(80991);
|
|
27401
|
+
/* harmony import */ var jodit_modules__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(60936);
|
|
27402
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(10685);
|
|
27390
27403
|
/*!
|
|
27391
27404
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
27392
27405
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -27404,10 +27417,11 @@ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__.Icon.set('about', (_about_svg__W
|
|
|
27404
27417
|
|
|
27405
27418
|
|
|
27406
27419
|
|
|
27420
|
+
|
|
27407
27421
|
const ns = 'addnewline';
|
|
27408
27422
|
/**
|
|
27409
27423
|
* Create helper for adding new paragraph(Jodit.defaultOptions.enter tag) before iframe, table or image
|
|
27410
|
-
*/ class addNewLine extends
|
|
27424
|
+
*/ class addNewLine extends jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Plugin {
|
|
27411
27425
|
__show() {
|
|
27412
27426
|
if (this.j.o.readonly || this.j.isLocked) {
|
|
27413
27427
|
return;
|
|
@@ -27417,8 +27431,8 @@ const ns = 'addnewline';
|
|
|
27417
27431
|
return;
|
|
27418
27432
|
}
|
|
27419
27433
|
this.__isShown = true;
|
|
27420
|
-
|
|
27421
|
-
(0,
|
|
27434
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(this.j.container, this.__line);
|
|
27435
|
+
(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_6__.css)(this.__line, 'width', this.j.container.clientWidth);
|
|
27422
27436
|
}
|
|
27423
27437
|
onLock(isLocked) {
|
|
27424
27438
|
if (isLocked && this.__isShown) {
|
|
@@ -27456,16 +27470,43 @@ const ns = 'addnewline';
|
|
|
27456
27470
|
editor.editor
|
|
27457
27471
|
], '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);
|
|
27458
27472
|
}
|
|
27473
|
+
/**
|
|
27474
|
+
* A paragraph holding only an embed has no place for the caret, so the
|
|
27475
|
+
* arrow keys can't get past one that ends the content, or before one that
|
|
27476
|
+
* starts it. When an arrow key leaves the caret where it was and there is
|
|
27477
|
+
* content beyond it, a new line goes there, as when the line is clicked.
|
|
27478
|
+
*/ onArrowKey(e) {
|
|
27479
|
+
const editor = this.j;
|
|
27480
|
+
const forward = e.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_DOWN || e.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_RIGHT;
|
|
27481
|
+
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()) {
|
|
27482
|
+
return;
|
|
27483
|
+
}
|
|
27484
|
+
const { startContainer, startOffset } = editor.s.range;
|
|
27485
|
+
// Once the browser has moved the caret, if it could. With a 0 timeout
|
|
27486
|
+
// Jodit would run this at once, before the browser moves it
|
|
27487
|
+
editor.async.setTimeout(()=>{
|
|
27488
|
+
const { range } = editor.s;
|
|
27489
|
+
const block = jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.closest(startContainer, jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock, editor.editor);
|
|
27490
|
+
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)) {
|
|
27491
|
+
return;
|
|
27492
|
+
}
|
|
27493
|
+
const p = editor.createInside.element(editor.o.enter);
|
|
27494
|
+
forward ? jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(editor.editor, p) : jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.prepend(editor.editor, p);
|
|
27495
|
+
editor.s.setCursorIn(p);
|
|
27496
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.scrollIntoViewIfNeeded)(p, editor.editor, editor.ed);
|
|
27497
|
+
editor.synchronizeValues();
|
|
27498
|
+
}, 1);
|
|
27499
|
+
}
|
|
27459
27500
|
onDblClickEditor(e) {
|
|
27460
27501
|
const editor = this.j;
|
|
27461
27502
|
if (!editor.o.readonly && editor.o.addNewLineOnDBLClick && e.target === editor.editor && editor.s.isCollapsed()) {
|
|
27462
|
-
const editorBound = (0,
|
|
27503
|
+
const editorBound = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.offset)(editor.editor, editor, editor.ed);
|
|
27463
27504
|
const top = e.pageY - editor.ew.scrollX;
|
|
27464
27505
|
const p = editor.createInside.element(editor.o.enter);
|
|
27465
27506
|
if (Math.abs(top - editorBound.top) < Math.abs(top - (editorBound.height + editorBound.top)) && editor.editor.firstChild) {
|
|
27466
|
-
|
|
27507
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.prepend(editor.editor, p);
|
|
27467
27508
|
} else {
|
|
27468
|
-
|
|
27509
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(editor.editor, p);
|
|
27469
27510
|
}
|
|
27470
27511
|
editor.s.setCursorIn(p);
|
|
27471
27512
|
editor.synchronizeValues();
|
|
@@ -27478,27 +27519,27 @@ const ns = 'addnewline';
|
|
|
27478
27519
|
// Inside Shadow DOM `document.elementFromPoint` returns the shadow
|
|
27479
27520
|
// host, so the lookup must start from the shadow root
|
|
27480
27521
|
let currentElement = (editor.o.shadowRoot ?? editor.ed).elementFromPoint(e.clientX, e.clientY);
|
|
27481
|
-
if (!
|
|
27522
|
+
if (!jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isHTMLElement(currentElement) || !jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isOrContains(editor.editor, currentElement)) {
|
|
27482
27523
|
return;
|
|
27483
27524
|
}
|
|
27484
27525
|
if (editor.editor !== currentElement && !this.__isMatchedTag(currentElement)) {
|
|
27485
|
-
currentElement =
|
|
27526
|
+
currentElement = jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.closest(currentElement, this.__isMatchedTag, editor.editor);
|
|
27486
27527
|
}
|
|
27487
27528
|
if (!currentElement) {
|
|
27488
27529
|
this.__hide();
|
|
27489
27530
|
return;
|
|
27490
27531
|
}
|
|
27491
27532
|
if (this.__isMatchedTag(currentElement)) {
|
|
27492
|
-
const parentBox =
|
|
27533
|
+
const parentBox = jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.up(currentElement, jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock, editor.editor);
|
|
27493
27534
|
if (parentBox && parentBox !== editor.editor) {
|
|
27494
27535
|
currentElement = parentBox;
|
|
27495
27536
|
}
|
|
27496
27537
|
}
|
|
27497
|
-
const pos = (0,
|
|
27538
|
+
const pos = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.position)(currentElement, this.j);
|
|
27498
27539
|
let top = false;
|
|
27499
27540
|
let { clientY, clientX } = e;
|
|
27500
27541
|
if (this.j.iframe) {
|
|
27501
|
-
const { top, left } = (0,
|
|
27542
|
+
const { top, left } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.position)(this.j.iframe, this.j, true);
|
|
27502
27543
|
clientY += top;
|
|
27503
27544
|
clientX += left;
|
|
27504
27545
|
}
|
|
@@ -27511,8 +27552,8 @@ const ns = 'addnewline';
|
|
|
27511
27552
|
this.__isBeforeContent = false;
|
|
27512
27553
|
}
|
|
27513
27554
|
const isEditor = editor.editor === currentElement;
|
|
27514
|
-
if (top !== false && (isEditor && !this.__isBeforeContent || !isEditor && !(0,
|
|
27515
|
-
(0,
|
|
27555
|
+
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))) {
|
|
27556
|
+
(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_6__.css)(this.__line, 'top', top);
|
|
27516
27557
|
this.__current = currentElement;
|
|
27517
27558
|
this.__show();
|
|
27518
27559
|
this.__line.style.setProperty('--jd-anl-handle-offset', clientX - pos.left - 10 + 'px');
|
|
@@ -27524,7 +27565,7 @@ const ns = 'addnewline';
|
|
|
27524
27565
|
/** @override */ beforeDestruct() {
|
|
27525
27566
|
this.j.async.clearTimeout(this.__timeout);
|
|
27526
27567
|
this.j.e.off(this.__line).off('changePlace', this.__addEventListeners);
|
|
27527
|
-
|
|
27568
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.safeRemove(this.__line);
|
|
27528
27569
|
this.j.e.off([
|
|
27529
27570
|
this.j.ow,
|
|
27530
27571
|
this.j.ew,
|
|
@@ -27532,31 +27573,31 @@ const ns = 'addnewline';
|
|
|
27532
27573
|
], '.' + ns).off(this.j.container, '.' + ns).off('.' + ns);
|
|
27533
27574
|
}
|
|
27534
27575
|
constructor(...args){
|
|
27535
|
-
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>${
|
|
27576
|
+
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", ()=>{
|
|
27536
27577
|
if (!this.__isShown) {
|
|
27537
27578
|
return;
|
|
27538
27579
|
}
|
|
27539
27580
|
this.__isShown = false;
|
|
27540
27581
|
this.j.async.clearTimeout(this.__timeout);
|
|
27541
27582
|
this.__lineInFocus = false;
|
|
27542
|
-
|
|
27583
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.safeRemove(this.__line);
|
|
27543
27584
|
this.__line.style.setProperty('--jd-anl-handle-offset', '0');
|
|
27544
27585
|
}), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__canGetFocus", (elm)=>{
|
|
27545
|
-
return elm != null &&
|
|
27586
|
+
return elm != null && jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock(elm) && !/^(img|table|iframe|hr)$/i.test(elm.nodeName);
|
|
27546
27587
|
}), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__onClickLine", (e)=>{
|
|
27547
27588
|
const editor = this.j;
|
|
27548
27589
|
const p = editor.createInside.element(editor.o.enter);
|
|
27549
27590
|
if (this.__isBeforeContent && this.__current && this.__current.parentNode) {
|
|
27550
27591
|
if (this.__current === editor.editor) {
|
|
27551
|
-
|
|
27592
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.prepend(editor.editor, p);
|
|
27552
27593
|
} else {
|
|
27553
|
-
|
|
27594
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.before(this.__current, p);
|
|
27554
27595
|
}
|
|
27555
27596
|
} else {
|
|
27556
|
-
|
|
27597
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(editor.editor, p);
|
|
27557
27598
|
}
|
|
27558
27599
|
editor.s.setCursorIn(p);
|
|
27559
|
-
(0,
|
|
27600
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.scrollIntoViewIfNeeded)(p, editor.editor, editor.ed);
|
|
27560
27601
|
editor.synchronizeValues();
|
|
27561
27602
|
this.__hideForce();
|
|
27562
27603
|
e.preventDefault();
|
|
@@ -27564,18 +27605,21 @@ const ns = 'addnewline';
|
|
|
27564
27605
|
}
|
|
27565
27606
|
}
|
|
27566
27607
|
;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
27567
|
-
(0,
|
|
27608
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':lock')
|
|
27568
27609
|
], addNewLine.prototype, "onLock", null);
|
|
27569
27610
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
27570
|
-
|
|
27611
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
27571
27612
|
], addNewLine.prototype, "__hide", null);
|
|
27572
27613
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
27573
|
-
(0,
|
|
27614
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':keydown')
|
|
27615
|
+
], addNewLine.prototype, "onArrowKey", null);
|
|
27616
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
27617
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':dblclick')
|
|
27574
27618
|
], addNewLine.prototype, "onDblClickEditor", null);
|
|
27575
27619
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
27576
|
-
(0,
|
|
27620
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.throttle)((ctx)=>ctx.defaultTimeout)
|
|
27577
27621
|
], addNewLine.prototype, "__onMouseMove", null);
|
|
27578
|
-
|
|
27622
|
+
jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('addNewLine', addNewLine);
|
|
27579
27623
|
|
|
27580
27624
|
|
|
27581
27625
|
/***/ }),
|
|
@@ -28143,6 +28187,7 @@ UiAiAssistant = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decor
|
|
|
28143
28187
|
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(33831);
|
|
28144
28188
|
/* harmony import */ var _cases_check_not_collapsed__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(89827);
|
|
28145
28189
|
/* harmony import */ var _cases__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(17523);
|
|
28190
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(15200);
|
|
28146
28191
|
/*!
|
|
28147
28192
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
28148
28193
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -28161,6 +28206,7 @@ UiAiAssistant = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decor
|
|
|
28161
28206
|
|
|
28162
28207
|
|
|
28163
28208
|
|
|
28209
|
+
|
|
28164
28210
|
class backspace extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugin {
|
|
28165
28211
|
afterInit(jodit) {
|
|
28166
28212
|
jodit.registerCommand('deleteButton', {
|
|
@@ -28238,14 +28284,47 @@ class backspace extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugin {
|
|
|
28238
28284
|
throw e;
|
|
28239
28285
|
} finally{
|
|
28240
28286
|
jodit.e.fire('backSpaceAfterDelete', backspace, fakeNode);
|
|
28287
|
+
this.moveCaretToTextBefore(fakeNode);
|
|
28241
28288
|
this.safeRemoveEmptyNode(fakeNode);
|
|
28242
28289
|
}
|
|
28243
28290
|
return false;
|
|
28244
28291
|
}
|
|
28292
|
+
/**
|
|
28293
|
+
* The browser types at the end of the text before the caret on its line,
|
|
28294
|
+
* in that text's formatting, but not inside a link. Moving the caret there
|
|
28295
|
+
* too makes a paste and the toolbar agree with what's typed:
|
|
28296
|
+
* `<p>one</p><p><b>|two</b></p>` joins to `<p>one|<b>two</b></p>`
|
|
28297
|
+
*/ moveCaretToTextBefore(fakeNode) {
|
|
28298
|
+
const { jodit } = this;
|
|
28299
|
+
const { range } = jodit.s;
|
|
28300
|
+
// A case may have merged the fake node away (#1722)
|
|
28301
|
+
if (!fakeNode.parentNode) {
|
|
28302
|
+
return;
|
|
28303
|
+
}
|
|
28304
|
+
const around = jodit.ed.createRange();
|
|
28305
|
+
around.selectNode(fakeNode);
|
|
28306
|
+
if (!range.collapsed || !around.isPointInRange(range.startContainer, range.startOffset)) {
|
|
28307
|
+
return;
|
|
28308
|
+
}
|
|
28309
|
+
const text = (0,_helpers__WEBPACK_IMPORTED_MODULE_10__.findMostNestedNeighbor)(fakeNode, false, jodit.editor, true);
|
|
28310
|
+
const link = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(text, 'a', jodit.editor);
|
|
28311
|
+
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)) {
|
|
28312
|
+
return;
|
|
28313
|
+
}
|
|
28314
|
+
range.setStart(text, text.nodeValue?.length ?? 0);
|
|
28315
|
+
range.collapse(true);
|
|
28316
|
+
jodit.s.selectRange(range);
|
|
28317
|
+
}
|
|
28245
28318
|
/**
|
|
28246
28319
|
* Remove node and replace cursor position out of it
|
|
28247
28320
|
*/ safeRemoveEmptyNode(fakeNode) {
|
|
28248
28321
|
const { range } = this.j.s;
|
|
28322
|
+
// wrap-nodes normalizes the line it wraps, which can merge the text
|
|
28323
|
+
// after the fake node into it: remove only the fake node's own space
|
|
28324
|
+
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)) {
|
|
28325
|
+
fakeNode.deleteData(0, jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.INVISIBLE_SPACE.length);
|
|
28326
|
+
return;
|
|
28327
|
+
}
|
|
28249
28328
|
if (range.startContainer === fakeNode) {
|
|
28250
28329
|
if (fakeNode.previousSibling) {
|
|
28251
28330
|
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(fakeNode.previousSibling)) {
|
|
@@ -28317,6 +28396,9 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
|
|
|
28317
28396
|
return false;
|
|
28318
28397
|
}
|
|
28319
28398
|
const sibling = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(mainClosestBox, backspace);
|
|
28399
|
+
if (moveInlinesInside(jodit, fakeNode, sibling)) {
|
|
28400
|
+
return joinNeighbors(jodit, fakeNode, backspace, moved);
|
|
28401
|
+
}
|
|
28320
28402
|
// A line break before the cursor is a single unit: remove it instead of
|
|
28321
28403
|
// merging the current element into the (void) `<br>`, which used to move
|
|
28322
28404
|
// the whole element's content into the `<br>` and delete it (#1282).
|
|
@@ -28331,6 +28413,10 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
|
|
|
28331
28413
|
jodit.s.setCursorBefore(fakeNode);
|
|
28332
28414
|
return true;
|
|
28333
28415
|
}
|
|
28416
|
+
// A non-editable sibling is removed by remove-not-editable, never joined
|
|
28417
|
+
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)) {
|
|
28418
|
+
return false;
|
|
28419
|
+
}
|
|
28334
28420
|
const box = findCaretBox(fakeNode, mainClosestBox);
|
|
28335
28421
|
// One pass only: the line now sits beside the next one, so the
|
|
28336
28422
|
// cases below join them. The DOM has changed either way
|
|
@@ -28359,6 +28445,60 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
|
|
|
28359
28445
|
}
|
|
28360
28446
|
return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(block) && block.parentElement ? block.parentElement : block;
|
|
28361
28447
|
}
|
|
28448
|
+
/**
|
|
28449
|
+
* With an inline element round the caret's line or the one it joins moved
|
|
28450
|
+
* inside its blocks, the cases join the lines as they join any two, and its
|
|
28451
|
+
* styles stay with its text. One round both lines is left as it is.
|
|
28452
|
+
*/ function moveInlinesInside(jodit, fakeNode, sibling) {
|
|
28453
|
+
if (!sibling) {
|
|
28454
|
+
return false;
|
|
28455
|
+
}
|
|
28456
|
+
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);
|
|
28457
|
+
return moveInlineInside(around, jodit.editor) || moveInlineInside(sibling, jodit.editor);
|
|
28458
|
+
}
|
|
28459
|
+
/**
|
|
28460
|
+
* Old content can have an inline element round blocks. This moves it inside
|
|
28461
|
+
* them, and gives the text, images and line breaks beside them a copy of
|
|
28462
|
+
* their own: `<span style="…"><p>one</p><br><p>two</p></span>` becomes
|
|
28463
|
+
* `<p><span style="…">one</span></p><span style="…"><br></span><p><span style="…">two</span></p>`
|
|
28464
|
+
*/ function moveInlineInside(node, root) {
|
|
28465
|
+
if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(node) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(node)) {
|
|
28466
|
+
return false;
|
|
28467
|
+
}
|
|
28468
|
+
// Embedded content, such as the `<iframe>` in a video's wrapper, counts
|
|
28469
|
+
// as a block in `Dom.isBlock`, but stays with the text beside it
|
|
28470
|
+
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);
|
|
28471
|
+
// The inner one first: `<span><strong><p>one</p></strong></span>`
|
|
28472
|
+
Array.from(node.childNodes).forEach((child)=>moveInlineInside(child, root));
|
|
28473
|
+
const children = Array.from(node.childNodes);
|
|
28474
|
+
if (!children.some(isBlock)) {
|
|
28475
|
+
return false;
|
|
28476
|
+
}
|
|
28477
|
+
let run = null;
|
|
28478
|
+
for (const child of children){
|
|
28479
|
+
if (!isBlock(child)) {
|
|
28480
|
+
// Blank text between blocks stays where it is
|
|
28481
|
+
if (!run && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmptyTextNode(child)) {
|
|
28482
|
+
run = node.cloneNode(false);
|
|
28483
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(child, run);
|
|
28484
|
+
}
|
|
28485
|
+
run && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(run, child);
|
|
28486
|
+
continue;
|
|
28487
|
+
}
|
|
28488
|
+
run = null;
|
|
28489
|
+
// Nothing goes inside a rule or a non-editable block
|
|
28490
|
+
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)) {
|
|
28491
|
+
continue;
|
|
28492
|
+
}
|
|
28493
|
+
const inner = node.cloneNode(false);
|
|
28494
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.moveContent(child, inner);
|
|
28495
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(child, inner);
|
|
28496
|
+
// A list or a table: on down to its items or cells
|
|
28497
|
+
moveInlineInside(inner, root);
|
|
28498
|
+
}
|
|
28499
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.unwrap(node);
|
|
28500
|
+
return true;
|
|
28501
|
+
}
|
|
28362
28502
|
/**
|
|
28363
28503
|
* The innermost block on the sibling's edge facing the caret, so the
|
|
28364
28504
|
* content is joined to text: `<div><p>one</p></div><p>|two</p>` gives
|
|
@@ -28718,7 +28858,9 @@ function checkRemoveChar(jodit, fakeNode, backspace, mode, stopBeforeSpace = fal
|
|
|
28718
28858
|
while(jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isInlineBlock(sibling)){
|
|
28719
28859
|
sibling = backspace ? sibling?.lastChild : sibling?.firstChild;
|
|
28720
28860
|
}
|
|
28721
|
-
|
|
28861
|
+
// A block inside an inline element, such as the `<p>` in
|
|
28862
|
+
// `<span><p>…</p></span>`, isn't a char: the join cases handle it
|
|
28863
|
+
if (!sibling || jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(sibling)) {
|
|
28722
28864
|
break;
|
|
28723
28865
|
}
|
|
28724
28866
|
if (sibling.nodeValue?.length) {
|
|
@@ -28866,6 +29008,7 @@ function isSpace(char) {
|
|
|
28866
29008
|
/* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27795);
|
|
28867
29009
|
/* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(65946);
|
|
28868
29010
|
/* harmony import */ var jodit_core_selection_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(42259);
|
|
29011
|
+
/* harmony import */ var _check_join_neighbors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(26106);
|
|
28869
29012
|
/*!
|
|
28870
29013
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
28871
29014
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -28875,23 +29018,48 @@ function isSpace(char) {
|
|
|
28875
29018
|
*/
|
|
28876
29019
|
|
|
28877
29020
|
|
|
29021
|
+
|
|
28878
29022
|
/**
|
|
28879
|
-
* Checks if a non-editable element can be deleted
|
|
29023
|
+
* Checks if a non-editable element can be deleted. A non-editable block goes
|
|
29024
|
+
* whole, and the lines either side of it then join, as the spec's tests do:
|
|
29025
|
+
* `<ul><li>one|</li></ul><div contenteditable="false">x</div><p>two</p>`
|
|
29026
|
+
* gives `<ul><li>one|two</li></ul>`
|
|
28880
29027
|
* @private
|
|
28881
29028
|
*/ function checkRemoveContentNotEditable(jodit, fakeNode, backspace) {
|
|
28882
|
-
let
|
|
28883
|
-
|
|
28884
|
-
|
|
28885
|
-
|
|
28886
|
-
|
|
28887
|
-
|
|
28888
|
-
|
|
28889
|
-
|
|
28890
|
-
(
|
|
29029
|
+
let node = fakeNode;
|
|
29030
|
+
let neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.findSibling(node, backspace);
|
|
29031
|
+
// Past the edges of the blocks the caret is at, but not into a table cell
|
|
29032
|
+
while(!neighbor && node.parentElement && node.parentElement !== jodit.editor && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isCell(node.parentElement)){
|
|
29033
|
+
node = node.parentElement;
|
|
29034
|
+
neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.findSibling(node, backspace);
|
|
29035
|
+
// At the start of a list item, Backspace takes the bullet off first,
|
|
29036
|
+
// unless the item before it is a non-editable one to remove
|
|
29037
|
+
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))) {
|
|
29038
|
+
return false;
|
|
29039
|
+
}
|
|
29040
|
+
}
|
|
29041
|
+
if (isNotEditable(jodit, neighbor)) {
|
|
29042
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isBlock(neighbor)) {
|
|
29043
|
+
// Backspace after a removed list item leaves the items apart: the
|
|
29044
|
+
// next press takes the bullet off, as for any later item
|
|
29045
|
+
const joinLines = !(backspace && jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isLeaf(neighbor));
|
|
29046
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.safeRemove(neighbor);
|
|
29047
|
+
if (joinLines) {
|
|
29048
|
+
(0,_check_join_neighbors__WEBPACK_IMPORTED_MODULE_3__.checkJoinNeighbors)(jodit, fakeNode, backspace);
|
|
29049
|
+
}
|
|
29050
|
+
} else {
|
|
29051
|
+
(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);
|
|
29052
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.safeRemove(neighbor);
|
|
29053
|
+
(0,jodit_core_selection_helpers__WEBPACK_IMPORTED_MODULE_2__.moveNodeInsideStart)(jodit, fakeNode, backspace);
|
|
29054
|
+
}
|
|
29055
|
+
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.call)(backspace ? jodit.s.setCursorBefore : jodit.s.setCursorAfter, fakeNode);
|
|
28891
29056
|
return true;
|
|
28892
29057
|
}
|
|
28893
29058
|
return false;
|
|
28894
29059
|
}
|
|
29060
|
+
function isNotEditable(jodit, node) {
|
|
29061
|
+
return jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isElement(node) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isContentEditable(node, jodit.editor);
|
|
29062
|
+
}
|
|
28895
29063
|
|
|
28896
29064
|
|
|
28897
29065
|
/***/ }),
|
|
@@ -48502,12 +48670,13 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
|
|
|
48502
48670
|
"use strict";
|
|
48503
48671
|
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
|
|
48504
48672
|
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
|
|
48505
|
-
/* harmony import */ var
|
|
48506
|
-
/* harmony import */ var
|
|
48507
|
-
/* harmony import */ var
|
|
48508
|
-
/* harmony import */ var
|
|
48509
|
-
/* harmony import */ var
|
|
48510
|
-
/* harmony import */ var
|
|
48673
|
+
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
|
|
48674
|
+
/* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
|
|
48675
|
+
/* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(27795);
|
|
48676
|
+
/* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
|
|
48677
|
+
/* harmony import */ var jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(85932);
|
|
48678
|
+
/* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
|
|
48679
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(86038);
|
|
48511
48680
|
/*!
|
|
48512
48681
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
48513
48682
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -48524,9 +48693,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
|
|
|
48524
48693
|
|
|
48525
48694
|
|
|
48526
48695
|
|
|
48696
|
+
|
|
48527
48697
|
/**
|
|
48528
48698
|
* Wrap single text nodes in block wrapper
|
|
48529
|
-
*/ class wrapNodes extends
|
|
48699
|
+
*/ class wrapNodes extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
|
|
48530
48700
|
/** @override **/ afterInit(jodit) {
|
|
48531
48701
|
if (jodit.o.enter.toLowerCase() === 'br') {
|
|
48532
48702
|
return;
|
|
@@ -48555,10 +48725,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
|
|
|
48555
48725
|
}
|
|
48556
48726
|
isChanged = true;
|
|
48557
48727
|
const box = jodit.createInside.element(jodit.o.enter);
|
|
48558
|
-
|
|
48559
|
-
|
|
48728
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.before(child, box);
|
|
48729
|
+
// `exclude` keeps a <br> from starting a box, but one between loose lines stays with them
|
|
48730
|
+
while(child && (this.isSuitable(child) || jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(child, 'br'))){
|
|
48560
48731
|
const next = child.nextSibling;
|
|
48561
|
-
|
|
48732
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(box, child);
|
|
48562
48733
|
child = next;
|
|
48563
48734
|
}
|
|
48564
48735
|
box.normalize();
|
|
@@ -48582,8 +48753,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
|
|
|
48582
48753
|
}
|
|
48583
48754
|
const box = jodit.createInside.element(jodit.o.enter);
|
|
48584
48755
|
const br = jodit.createInside.element('br');
|
|
48585
|
-
|
|
48586
|
-
|
|
48756
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(box, br);
|
|
48757
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(jodit.editor, box);
|
|
48587
48758
|
if (jodit.s.isFocused() || jodit.e.current === 'backSpaceAfterDelete') {
|
|
48588
48759
|
jodit.s.setCursorBefore(br);
|
|
48589
48760
|
}
|
|
@@ -48592,29 +48763,40 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
|
|
|
48592
48763
|
constructor(...args){
|
|
48593
48764
|
super(...args), /**
|
|
48594
48765
|
* Found Node which should be wrapped
|
|
48595
|
-
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isSuitableStart", (n)=>
|
|
48766
|
+
*/ (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)), /**
|
|
48596
48767
|
* Node should add in a block element
|
|
48597
|
-
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isSuitable", (n)=>
|
|
48768
|
+
*/ (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)), /**
|
|
48598
48769
|
* Some element which needs to append in block
|
|
48599
|
-
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isNotWrapped", (n)=>
|
|
48770
|
+
*/ (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)));
|
|
48600
48771
|
}
|
|
48601
48772
|
}
|
|
48602
48773
|
;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
48603
|
-
|
|
48774
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
48604
48775
|
], wrapNodes.prototype, "postProcessSetEditorValue", null);
|
|
48605
48776
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
48606
|
-
|
|
48777
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
48607
48778
|
], wrapNodes.prototype, "preprocessInput", null);
|
|
48779
|
+
/**
|
|
48780
|
+
* A block can't go in a paragraph, so neither can an element that holds one,
|
|
48781
|
+
* such as a `<span>` round a `<p>`. Embedded content such as an `<iframe>` can.
|
|
48782
|
+
*/ function holdsBlock(elm) {
|
|
48783
|
+
for (const node of jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.eachGen(elm)){
|
|
48784
|
+
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)) {
|
|
48785
|
+
return true;
|
|
48786
|
+
}
|
|
48787
|
+
}
|
|
48788
|
+
return false;
|
|
48789
|
+
}
|
|
48608
48790
|
function checkAloneListLeaf(child, jodit) {
|
|
48609
48791
|
let result = child;
|
|
48610
48792
|
let next = child;
|
|
48611
48793
|
do {
|
|
48612
|
-
if (
|
|
48613
|
-
const nextChild =
|
|
48614
|
-
if (
|
|
48615
|
-
|
|
48794
|
+
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)) {
|
|
48795
|
+
const nextChild = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.findNotEmptySibling(next, false);
|
|
48796
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(result, 'ul')) {
|
|
48797
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(result, next);
|
|
48616
48798
|
} else {
|
|
48617
|
-
result =
|
|
48799
|
+
result = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.wrap(next, 'ul', jodit.createInside);
|
|
48618
48800
|
}
|
|
48619
48801
|
next = nextChild;
|
|
48620
48802
|
} else {
|
|
@@ -48623,7 +48805,7 @@ function checkAloneListLeaf(child, jodit) {
|
|
|
48623
48805
|
}while (next)
|
|
48624
48806
|
return result;
|
|
48625
48807
|
}
|
|
48626
|
-
|
|
48808
|
+
jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('wrapNodes', wrapNodes);
|
|
48627
48809
|
|
|
48628
48810
|
|
|
48629
48811
|
/***/ }),
|