jodit 4.18.10 → 4.18.12
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 +281 -76
- 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 +7 -7
- package/es2021/jodit.js +278 -76
- package/es2021/jodit.min.js +7 -7
- 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 +7 -7
- package/es2021.en/jodit.js +278 -76
- package/es2021.en/jodit.min.js +7 -7
- 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 +353 -77
- 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/core/selection/style/api/list/toggle-ordered-list.d.ts +1 -1
- package/esm/core/selection/style/api/list/toggle-ordered-list.js +30 -4
- package/esm/core/selection/style/transactions.js +1 -1
- 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/core/selection/style/api/list/toggle-ordered-list.d.ts +1 -1
- 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.12
|
|
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.12";
|
|
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
|
|
@@ -13191,7 +13203,7 @@ function elementsEqualAttributes(elm1, elm2) {
|
|
|
13191
13203
|
/**
|
|
13192
13204
|
* Replaces `ul->ol` or `ol->ul`, apply styles to the list, or remove a list item from it
|
|
13193
13205
|
* @private
|
|
13194
|
-
*/ function toggleOrderedList(commitStyle, li, jodit, mode) {
|
|
13206
|
+
*/ function toggleOrderedList(commitStyle, li, jodit, mode, collapsed = false) {
|
|
13195
13207
|
if (!li) {
|
|
13196
13208
|
return mode;
|
|
13197
13209
|
}
|
|
@@ -13220,16 +13232,36 @@ function elementsEqualAttributes(elm1, elm2) {
|
|
|
13220
13232
|
}
|
|
13221
13233
|
// ul => ol, ol => ul or ul => ul.class1
|
|
13222
13234
|
if (mode === jodit_core_selection_style_constants__WEBPACK_IMPORTED_MODULE_6__.REPLACE || isChangeMode || !isSameList) {
|
|
13223
|
-
|
|
13224
|
-
const
|
|
13235
|
+
// With just a caret, Word converts the whole list
|
|
13236
|
+
const items = collapsed && !isSameList ? Array.from(list.children).filter((item)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isLeaf(item)) : [
|
|
13237
|
+
li
|
|
13238
|
+
];
|
|
13239
|
+
let newList;
|
|
13240
|
+
for (const item of items){
|
|
13241
|
+
newList = keepNumbering(item, (itemList)=>(0,_wrap_list__WEBPACK_IMPORTED_MODULE_7__.wrapList)(commitStyle, unwrapList(jodit_core_selection_style_constants__WEBPACK_IMPORTED_MODULE_6__.REPLACE, itemList, item, jodit, commitStyle), jodit));
|
|
13242
|
+
}
|
|
13225
13243
|
hook(jodit_core_selection_style_constants__WEBPACK_IMPORTED_MODULE_6__.REPLACE, newList, commitStyle);
|
|
13226
13244
|
return jodit_core_selection_style_constants__WEBPACK_IMPORTED_MODULE_6__.REPLACE;
|
|
13227
13245
|
}
|
|
13228
13246
|
}
|
|
13229
|
-
const wrapper = unwrapList((/* inlined export .UNWRAP */"unwrap"),
|
|
13247
|
+
const wrapper = keepNumbering(li, (itemList)=>unwrapList((/* inlined export .UNWRAP */"unwrap"), itemList, li, jodit, commitStyle));
|
|
13230
13248
|
hook((/* inlined export .UNWRAP */"unwrap"), wrapper, commitStyle);
|
|
13231
13249
|
return (/* inlined export .UNWRAP */"unwrap");
|
|
13232
13250
|
}
|
|
13251
|
+
/**
|
|
13252
|
+
* Takes `item` out of its list with `takeOut`, and carries a numbered list's
|
|
13253
|
+
* count on past it, as Word does: 1, a bullet, then 2
|
|
13254
|
+
*/ function keepNumbering(item, takeOut) {
|
|
13255
|
+
const list = item.parentElement;
|
|
13256
|
+
const rest = item.nextElementSibling;
|
|
13257
|
+
const next = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(list, 'ol') ? (parseInt(list.getAttribute('start') || '1', 10) || 1) + Array.from(list.children).indexOf(item) : 0;
|
|
13258
|
+
const result = takeOut(list);
|
|
13259
|
+
const restList = rest?.parentElement;
|
|
13260
|
+
if (next && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(restList, 'ol')) {
|
|
13261
|
+
next > 1 ? restList.setAttribute('start', String(next)) : restList.removeAttribute('start');
|
|
13262
|
+
}
|
|
13263
|
+
return result;
|
|
13264
|
+
}
|
|
13233
13265
|
/**
|
|
13234
13266
|
* Other attributes, such as a class, still move the items into a new list,
|
|
13235
13267
|
* where the `beforeWrapList` hook can add markup to each of them
|
|
@@ -14005,7 +14037,7 @@ const transactions = {
|
|
|
14005
14037
|
exec (value) {
|
|
14006
14038
|
return {
|
|
14007
14039
|
...value,
|
|
14008
|
-
mode: (0,jodit_core_selection_style_api__WEBPACK_IMPORTED_MODULE_3__.toggleOrderedList)(value.style, value.element, value.jodit, value.mode),
|
|
14040
|
+
mode: (0,jodit_core_selection_style_api__WEBPACK_IMPORTED_MODULE_3__.toggleOrderedList)(value.style, value.element, value.jodit, value.mode, value.collapsed),
|
|
14009
14041
|
next: states.END
|
|
14010
14042
|
};
|
|
14011
14043
|
}
|
|
@@ -27381,12 +27413,13 @@ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__.Icon.set('about', (_about_svg__W
|
|
|
27381
27413
|
/* unused harmony export addNewLine */
|
|
27382
27414
|
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
|
|
27383
27415
|
/* 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
|
|
27416
|
+
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
|
|
27417
|
+
/* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
|
|
27418
|
+
/* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(28077);
|
|
27419
|
+
/* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65946);
|
|
27420
|
+
/* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(80991);
|
|
27421
|
+
/* harmony import */ var jodit_modules__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(60936);
|
|
27422
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(10685);
|
|
27390
27423
|
/*!
|
|
27391
27424
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
27392
27425
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -27404,10 +27437,11 @@ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__.Icon.set('about', (_about_svg__W
|
|
|
27404
27437
|
|
|
27405
27438
|
|
|
27406
27439
|
|
|
27440
|
+
|
|
27407
27441
|
const ns = 'addnewline';
|
|
27408
27442
|
/**
|
|
27409
27443
|
* Create helper for adding new paragraph(Jodit.defaultOptions.enter tag) before iframe, table or image
|
|
27410
|
-
*/ class addNewLine extends
|
|
27444
|
+
*/ class addNewLine extends jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Plugin {
|
|
27411
27445
|
__show() {
|
|
27412
27446
|
if (this.j.o.readonly || this.j.isLocked) {
|
|
27413
27447
|
return;
|
|
@@ -27417,8 +27451,8 @@ const ns = 'addnewline';
|
|
|
27417
27451
|
return;
|
|
27418
27452
|
}
|
|
27419
27453
|
this.__isShown = true;
|
|
27420
|
-
|
|
27421
|
-
(0,
|
|
27454
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(this.j.container, this.__line);
|
|
27455
|
+
(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_6__.css)(this.__line, 'width', this.j.container.clientWidth);
|
|
27422
27456
|
}
|
|
27423
27457
|
onLock(isLocked) {
|
|
27424
27458
|
if (isLocked && this.__isShown) {
|
|
@@ -27456,16 +27490,43 @@ const ns = 'addnewline';
|
|
|
27456
27490
|
editor.editor
|
|
27457
27491
|
], '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
27492
|
}
|
|
27493
|
+
/**
|
|
27494
|
+
* A paragraph holding only an embed has no place for the caret, so the
|
|
27495
|
+
* arrow keys can't get past one that ends the content, or before one that
|
|
27496
|
+
* starts it. When an arrow key leaves the caret where it was and there is
|
|
27497
|
+
* content beyond it, a new line goes there, as when the line is clicked.
|
|
27498
|
+
*/ onArrowKey(e) {
|
|
27499
|
+
const editor = this.j;
|
|
27500
|
+
const forward = e.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_DOWN || e.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_RIGHT;
|
|
27501
|
+
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()) {
|
|
27502
|
+
return;
|
|
27503
|
+
}
|
|
27504
|
+
const { startContainer, startOffset } = editor.s.range;
|
|
27505
|
+
// Once the browser has moved the caret, if it could. With a 0 timeout
|
|
27506
|
+
// Jodit would run this at once, before the browser moves it
|
|
27507
|
+
editor.async.setTimeout(()=>{
|
|
27508
|
+
const { range } = editor.s;
|
|
27509
|
+
const block = jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.closest(startContainer, jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock, editor.editor);
|
|
27510
|
+
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)) {
|
|
27511
|
+
return;
|
|
27512
|
+
}
|
|
27513
|
+
const p = editor.createInside.element(editor.o.enter);
|
|
27514
|
+
forward ? jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(editor.editor, p) : jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.prepend(editor.editor, p);
|
|
27515
|
+
editor.s.setCursorIn(p);
|
|
27516
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.scrollIntoViewIfNeeded)(p, editor.editor, editor.ed);
|
|
27517
|
+
editor.synchronizeValues();
|
|
27518
|
+
}, 1);
|
|
27519
|
+
}
|
|
27459
27520
|
onDblClickEditor(e) {
|
|
27460
27521
|
const editor = this.j;
|
|
27461
27522
|
if (!editor.o.readonly && editor.o.addNewLineOnDBLClick && e.target === editor.editor && editor.s.isCollapsed()) {
|
|
27462
|
-
const editorBound = (0,
|
|
27523
|
+
const editorBound = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.offset)(editor.editor, editor, editor.ed);
|
|
27463
27524
|
const top = e.pageY - editor.ew.scrollX;
|
|
27464
27525
|
const p = editor.createInside.element(editor.o.enter);
|
|
27465
27526
|
if (Math.abs(top - editorBound.top) < Math.abs(top - (editorBound.height + editorBound.top)) && editor.editor.firstChild) {
|
|
27466
|
-
|
|
27527
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.prepend(editor.editor, p);
|
|
27467
27528
|
} else {
|
|
27468
|
-
|
|
27529
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(editor.editor, p);
|
|
27469
27530
|
}
|
|
27470
27531
|
editor.s.setCursorIn(p);
|
|
27471
27532
|
editor.synchronizeValues();
|
|
@@ -27478,27 +27539,27 @@ const ns = 'addnewline';
|
|
|
27478
27539
|
// Inside Shadow DOM `document.elementFromPoint` returns the shadow
|
|
27479
27540
|
// host, so the lookup must start from the shadow root
|
|
27480
27541
|
let currentElement = (editor.o.shadowRoot ?? editor.ed).elementFromPoint(e.clientX, e.clientY);
|
|
27481
|
-
if (!
|
|
27542
|
+
if (!jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isHTMLElement(currentElement) || !jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isOrContains(editor.editor, currentElement)) {
|
|
27482
27543
|
return;
|
|
27483
27544
|
}
|
|
27484
27545
|
if (editor.editor !== currentElement && !this.__isMatchedTag(currentElement)) {
|
|
27485
|
-
currentElement =
|
|
27546
|
+
currentElement = jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.closest(currentElement, this.__isMatchedTag, editor.editor);
|
|
27486
27547
|
}
|
|
27487
27548
|
if (!currentElement) {
|
|
27488
27549
|
this.__hide();
|
|
27489
27550
|
return;
|
|
27490
27551
|
}
|
|
27491
27552
|
if (this.__isMatchedTag(currentElement)) {
|
|
27492
|
-
const parentBox =
|
|
27553
|
+
const parentBox = jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.up(currentElement, jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock, editor.editor);
|
|
27493
27554
|
if (parentBox && parentBox !== editor.editor) {
|
|
27494
27555
|
currentElement = parentBox;
|
|
27495
27556
|
}
|
|
27496
27557
|
}
|
|
27497
|
-
const pos = (0,
|
|
27558
|
+
const pos = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.position)(currentElement, this.j);
|
|
27498
27559
|
let top = false;
|
|
27499
27560
|
let { clientY, clientX } = e;
|
|
27500
27561
|
if (this.j.iframe) {
|
|
27501
|
-
const { top, left } = (0,
|
|
27562
|
+
const { top, left } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.position)(this.j.iframe, this.j, true);
|
|
27502
27563
|
clientY += top;
|
|
27503
27564
|
clientX += left;
|
|
27504
27565
|
}
|
|
@@ -27511,8 +27572,8 @@ const ns = 'addnewline';
|
|
|
27511
27572
|
this.__isBeforeContent = false;
|
|
27512
27573
|
}
|
|
27513
27574
|
const isEditor = editor.editor === currentElement;
|
|
27514
|
-
if (top !== false && (isEditor && !this.__isBeforeContent || !isEditor && !(0,
|
|
27515
|
-
(0,
|
|
27575
|
+
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))) {
|
|
27576
|
+
(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_6__.css)(this.__line, 'top', top);
|
|
27516
27577
|
this.__current = currentElement;
|
|
27517
27578
|
this.__show();
|
|
27518
27579
|
this.__line.style.setProperty('--jd-anl-handle-offset', clientX - pos.left - 10 + 'px');
|
|
@@ -27524,7 +27585,7 @@ const ns = 'addnewline';
|
|
|
27524
27585
|
/** @override */ beforeDestruct() {
|
|
27525
27586
|
this.j.async.clearTimeout(this.__timeout);
|
|
27526
27587
|
this.j.e.off(this.__line).off('changePlace', this.__addEventListeners);
|
|
27527
|
-
|
|
27588
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.safeRemove(this.__line);
|
|
27528
27589
|
this.j.e.off([
|
|
27529
27590
|
this.j.ow,
|
|
27530
27591
|
this.j.ew,
|
|
@@ -27532,31 +27593,31 @@ const ns = 'addnewline';
|
|
|
27532
27593
|
], '.' + ns).off(this.j.container, '.' + ns).off('.' + ns);
|
|
27533
27594
|
}
|
|
27534
27595
|
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>${
|
|
27596
|
+
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
27597
|
if (!this.__isShown) {
|
|
27537
27598
|
return;
|
|
27538
27599
|
}
|
|
27539
27600
|
this.__isShown = false;
|
|
27540
27601
|
this.j.async.clearTimeout(this.__timeout);
|
|
27541
27602
|
this.__lineInFocus = false;
|
|
27542
|
-
|
|
27603
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.safeRemove(this.__line);
|
|
27543
27604
|
this.__line.style.setProperty('--jd-anl-handle-offset', '0');
|
|
27544
27605
|
}), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__canGetFocus", (elm)=>{
|
|
27545
|
-
return elm != null &&
|
|
27606
|
+
return elm != null && jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock(elm) && !/^(img|table|iframe|hr)$/i.test(elm.nodeName);
|
|
27546
27607
|
}), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__onClickLine", (e)=>{
|
|
27547
27608
|
const editor = this.j;
|
|
27548
27609
|
const p = editor.createInside.element(editor.o.enter);
|
|
27549
27610
|
if (this.__isBeforeContent && this.__current && this.__current.parentNode) {
|
|
27550
27611
|
if (this.__current === editor.editor) {
|
|
27551
|
-
|
|
27612
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.prepend(editor.editor, p);
|
|
27552
27613
|
} else {
|
|
27553
|
-
|
|
27614
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.before(this.__current, p);
|
|
27554
27615
|
}
|
|
27555
27616
|
} else {
|
|
27556
|
-
|
|
27617
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(editor.editor, p);
|
|
27557
27618
|
}
|
|
27558
27619
|
editor.s.setCursorIn(p);
|
|
27559
|
-
(0,
|
|
27620
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.scrollIntoViewIfNeeded)(p, editor.editor, editor.ed);
|
|
27560
27621
|
editor.synchronizeValues();
|
|
27561
27622
|
this.__hideForce();
|
|
27562
27623
|
e.preventDefault();
|
|
@@ -27564,18 +27625,21 @@ const ns = 'addnewline';
|
|
|
27564
27625
|
}
|
|
27565
27626
|
}
|
|
27566
27627
|
;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
27567
|
-
(0,
|
|
27628
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':lock')
|
|
27568
27629
|
], addNewLine.prototype, "onLock", null);
|
|
27569
27630
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
27570
|
-
|
|
27631
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
27571
27632
|
], addNewLine.prototype, "__hide", null);
|
|
27572
27633
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
27573
|
-
(0,
|
|
27634
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':keydown')
|
|
27635
|
+
], addNewLine.prototype, "onArrowKey", null);
|
|
27636
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
27637
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':dblclick')
|
|
27574
27638
|
], addNewLine.prototype, "onDblClickEditor", null);
|
|
27575
27639
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
27576
|
-
(0,
|
|
27640
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.throttle)((ctx)=>ctx.defaultTimeout)
|
|
27577
27641
|
], addNewLine.prototype, "__onMouseMove", null);
|
|
27578
|
-
|
|
27642
|
+
jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('addNewLine', addNewLine);
|
|
27579
27643
|
|
|
27580
27644
|
|
|
27581
27645
|
/***/ }),
|
|
@@ -28143,6 +28207,7 @@ UiAiAssistant = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decor
|
|
|
28143
28207
|
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(33831);
|
|
28144
28208
|
/* harmony import */ var _cases_check_not_collapsed__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(89827);
|
|
28145
28209
|
/* harmony import */ var _cases__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(17523);
|
|
28210
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(15200);
|
|
28146
28211
|
/*!
|
|
28147
28212
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
28148
28213
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -28161,6 +28226,7 @@ UiAiAssistant = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decor
|
|
|
28161
28226
|
|
|
28162
28227
|
|
|
28163
28228
|
|
|
28229
|
+
|
|
28164
28230
|
class backspace extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugin {
|
|
28165
28231
|
afterInit(jodit) {
|
|
28166
28232
|
jodit.registerCommand('deleteButton', {
|
|
@@ -28238,14 +28304,47 @@ class backspace extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugin {
|
|
|
28238
28304
|
throw e;
|
|
28239
28305
|
} finally{
|
|
28240
28306
|
jodit.e.fire('backSpaceAfterDelete', backspace, fakeNode);
|
|
28307
|
+
this.moveCaretToTextBefore(fakeNode);
|
|
28241
28308
|
this.safeRemoveEmptyNode(fakeNode);
|
|
28242
28309
|
}
|
|
28243
28310
|
return false;
|
|
28244
28311
|
}
|
|
28312
|
+
/**
|
|
28313
|
+
* The browser types at the end of the text before the caret on its line,
|
|
28314
|
+
* in that text's formatting, but not inside a link. Moving the caret there
|
|
28315
|
+
* too makes a paste and the toolbar agree with what's typed:
|
|
28316
|
+
* `<p>one</p><p><b>|two</b></p>` joins to `<p>one|<b>two</b></p>`
|
|
28317
|
+
*/ moveCaretToTextBefore(fakeNode) {
|
|
28318
|
+
const { jodit } = this;
|
|
28319
|
+
const { range } = jodit.s;
|
|
28320
|
+
// A case may have merged the fake node away (#1722)
|
|
28321
|
+
if (!fakeNode.parentNode) {
|
|
28322
|
+
return;
|
|
28323
|
+
}
|
|
28324
|
+
const around = jodit.ed.createRange();
|
|
28325
|
+
around.selectNode(fakeNode);
|
|
28326
|
+
if (!range.collapsed || !around.isPointInRange(range.startContainer, range.startOffset)) {
|
|
28327
|
+
return;
|
|
28328
|
+
}
|
|
28329
|
+
const text = (0,_helpers__WEBPACK_IMPORTED_MODULE_10__.findMostNestedNeighbor)(fakeNode, false, jodit.editor, true);
|
|
28330
|
+
const link = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(text, 'a', jodit.editor);
|
|
28331
|
+
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)) {
|
|
28332
|
+
return;
|
|
28333
|
+
}
|
|
28334
|
+
range.setStart(text, text.nodeValue?.length ?? 0);
|
|
28335
|
+
range.collapse(true);
|
|
28336
|
+
jodit.s.selectRange(range);
|
|
28337
|
+
}
|
|
28245
28338
|
/**
|
|
28246
28339
|
* Remove node and replace cursor position out of it
|
|
28247
28340
|
*/ safeRemoveEmptyNode(fakeNode) {
|
|
28248
28341
|
const { range } = this.j.s;
|
|
28342
|
+
// wrap-nodes normalizes the line it wraps, which can merge the text
|
|
28343
|
+
// after the fake node into it: remove only the fake node's own space
|
|
28344
|
+
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)) {
|
|
28345
|
+
fakeNode.deleteData(0, jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.INVISIBLE_SPACE.length);
|
|
28346
|
+
return;
|
|
28347
|
+
}
|
|
28249
28348
|
if (range.startContainer === fakeNode) {
|
|
28250
28349
|
if (fakeNode.previousSibling) {
|
|
28251
28350
|
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(fakeNode.previousSibling)) {
|
|
@@ -28317,6 +28416,9 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
|
|
|
28317
28416
|
return false;
|
|
28318
28417
|
}
|
|
28319
28418
|
const sibling = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(mainClosestBox, backspace);
|
|
28419
|
+
if (moveInlinesInside(jodit, fakeNode, sibling)) {
|
|
28420
|
+
return joinNeighbors(jodit, fakeNode, backspace, moved);
|
|
28421
|
+
}
|
|
28320
28422
|
// A line break before the cursor is a single unit: remove it instead of
|
|
28321
28423
|
// merging the current element into the (void) `<br>`, which used to move
|
|
28322
28424
|
// the whole element's content into the `<br>` and delete it (#1282).
|
|
@@ -28331,6 +28433,10 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
|
|
|
28331
28433
|
jodit.s.setCursorBefore(fakeNode);
|
|
28332
28434
|
return true;
|
|
28333
28435
|
}
|
|
28436
|
+
// A non-editable sibling is removed by remove-not-editable, never joined
|
|
28437
|
+
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)) {
|
|
28438
|
+
return false;
|
|
28439
|
+
}
|
|
28334
28440
|
const box = findCaretBox(fakeNode, mainClosestBox);
|
|
28335
28441
|
// One pass only: the line now sits beside the next one, so the
|
|
28336
28442
|
// cases below join them. The DOM has changed either way
|
|
@@ -28359,6 +28465,60 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
|
|
|
28359
28465
|
}
|
|
28360
28466
|
return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(block) && block.parentElement ? block.parentElement : block;
|
|
28361
28467
|
}
|
|
28468
|
+
/**
|
|
28469
|
+
* With an inline element round the caret's line or the one it joins moved
|
|
28470
|
+
* inside its blocks, the cases join the lines as they join any two, and its
|
|
28471
|
+
* styles stay with its text. One round both lines is left as it is.
|
|
28472
|
+
*/ function moveInlinesInside(jodit, fakeNode, sibling) {
|
|
28473
|
+
if (!sibling) {
|
|
28474
|
+
return false;
|
|
28475
|
+
}
|
|
28476
|
+
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);
|
|
28477
|
+
return moveInlineInside(around, jodit.editor) || moveInlineInside(sibling, jodit.editor);
|
|
28478
|
+
}
|
|
28479
|
+
/**
|
|
28480
|
+
* Old content can have an inline element round blocks. This moves it inside
|
|
28481
|
+
* them, and gives the text, images and line breaks beside them a copy of
|
|
28482
|
+
* their own: `<span style="…"><p>one</p><br><p>two</p></span>` becomes
|
|
28483
|
+
* `<p><span style="…">one</span></p><span style="…"><br></span><p><span style="…">two</span></p>`
|
|
28484
|
+
*/ function moveInlineInside(node, root) {
|
|
28485
|
+
if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(node) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(node)) {
|
|
28486
|
+
return false;
|
|
28487
|
+
}
|
|
28488
|
+
// Embedded content, such as the `<iframe>` in a video's wrapper, counts
|
|
28489
|
+
// as a block in `Dom.isBlock`, but stays with the text beside it
|
|
28490
|
+
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);
|
|
28491
|
+
// The inner one first: `<span><strong><p>one</p></strong></span>`
|
|
28492
|
+
Array.from(node.childNodes).forEach((child)=>moveInlineInside(child, root));
|
|
28493
|
+
const children = Array.from(node.childNodes);
|
|
28494
|
+
if (!children.some(isBlock)) {
|
|
28495
|
+
return false;
|
|
28496
|
+
}
|
|
28497
|
+
let run = null;
|
|
28498
|
+
for (const child of children){
|
|
28499
|
+
if (!isBlock(child)) {
|
|
28500
|
+
// Blank text between blocks stays where it is
|
|
28501
|
+
if (!run && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmptyTextNode(child)) {
|
|
28502
|
+
run = node.cloneNode(false);
|
|
28503
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(child, run);
|
|
28504
|
+
}
|
|
28505
|
+
run && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(run, child);
|
|
28506
|
+
continue;
|
|
28507
|
+
}
|
|
28508
|
+
run = null;
|
|
28509
|
+
// Nothing goes inside a rule or a non-editable block
|
|
28510
|
+
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)) {
|
|
28511
|
+
continue;
|
|
28512
|
+
}
|
|
28513
|
+
const inner = node.cloneNode(false);
|
|
28514
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.moveContent(child, inner);
|
|
28515
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(child, inner);
|
|
28516
|
+
// A list or a table: on down to its items or cells
|
|
28517
|
+
moveInlineInside(inner, root);
|
|
28518
|
+
}
|
|
28519
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.unwrap(node);
|
|
28520
|
+
return true;
|
|
28521
|
+
}
|
|
28362
28522
|
/**
|
|
28363
28523
|
* The innermost block on the sibling's edge facing the caret, so the
|
|
28364
28524
|
* content is joined to text: `<div><p>one</p></div><p>|two</p>` gives
|
|
@@ -28718,7 +28878,9 @@ function checkRemoveChar(jodit, fakeNode, backspace, mode, stopBeforeSpace = fal
|
|
|
28718
28878
|
while(jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isInlineBlock(sibling)){
|
|
28719
28879
|
sibling = backspace ? sibling?.lastChild : sibling?.firstChild;
|
|
28720
28880
|
}
|
|
28721
|
-
|
|
28881
|
+
// A block inside an inline element, such as the `<p>` in
|
|
28882
|
+
// `<span><p>…</p></span>`, isn't a char: the join cases handle it
|
|
28883
|
+
if (!sibling || jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(sibling)) {
|
|
28722
28884
|
break;
|
|
28723
28885
|
}
|
|
28724
28886
|
if (sibling.nodeValue?.length) {
|
|
@@ -28866,6 +29028,7 @@ function isSpace(char) {
|
|
|
28866
29028
|
/* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27795);
|
|
28867
29029
|
/* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(65946);
|
|
28868
29030
|
/* harmony import */ var jodit_core_selection_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(42259);
|
|
29031
|
+
/* harmony import */ var _check_join_neighbors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(26106);
|
|
28869
29032
|
/*!
|
|
28870
29033
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
28871
29034
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -28875,23 +29038,48 @@ function isSpace(char) {
|
|
|
28875
29038
|
*/
|
|
28876
29039
|
|
|
28877
29040
|
|
|
29041
|
+
|
|
28878
29042
|
/**
|
|
28879
|
-
* Checks if a non-editable element can be deleted
|
|
29043
|
+
* Checks if a non-editable element can be deleted. A non-editable block goes
|
|
29044
|
+
* whole, and the lines either side of it then join, as the spec's tests do:
|
|
29045
|
+
* `<ul><li>one|</li></ul><div contenteditable="false">x</div><p>two</p>`
|
|
29046
|
+
* gives `<ul><li>one|two</li></ul>`
|
|
28880
29047
|
* @private
|
|
28881
29048
|
*/ function checkRemoveContentNotEditable(jodit, fakeNode, backspace) {
|
|
28882
|
-
let
|
|
28883
|
-
|
|
28884
|
-
|
|
28885
|
-
|
|
28886
|
-
|
|
28887
|
-
|
|
28888
|
-
|
|
28889
|
-
|
|
28890
|
-
(
|
|
29049
|
+
let node = fakeNode;
|
|
29050
|
+
let neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.findSibling(node, backspace);
|
|
29051
|
+
// Past the edges of the blocks the caret is at, but not into a table cell
|
|
29052
|
+
while(!neighbor && node.parentElement && node.parentElement !== jodit.editor && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isCell(node.parentElement)){
|
|
29053
|
+
node = node.parentElement;
|
|
29054
|
+
neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.findSibling(node, backspace);
|
|
29055
|
+
// At the start of a list item, Backspace takes the bullet off first,
|
|
29056
|
+
// unless the item before it is a non-editable one to remove
|
|
29057
|
+
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))) {
|
|
29058
|
+
return false;
|
|
29059
|
+
}
|
|
29060
|
+
}
|
|
29061
|
+
if (isNotEditable(jodit, neighbor)) {
|
|
29062
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isBlock(neighbor)) {
|
|
29063
|
+
// Backspace after a removed list item leaves the items apart: the
|
|
29064
|
+
// next press takes the bullet off, as for any later item
|
|
29065
|
+
const joinLines = !(backspace && jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isLeaf(neighbor));
|
|
29066
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.safeRemove(neighbor);
|
|
29067
|
+
if (joinLines) {
|
|
29068
|
+
(0,_check_join_neighbors__WEBPACK_IMPORTED_MODULE_3__.checkJoinNeighbors)(jodit, fakeNode, backspace);
|
|
29069
|
+
}
|
|
29070
|
+
} else {
|
|
29071
|
+
(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);
|
|
29072
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.safeRemove(neighbor);
|
|
29073
|
+
(0,jodit_core_selection_helpers__WEBPACK_IMPORTED_MODULE_2__.moveNodeInsideStart)(jodit, fakeNode, backspace);
|
|
29074
|
+
}
|
|
29075
|
+
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.call)(backspace ? jodit.s.setCursorBefore : jodit.s.setCursorAfter, fakeNode);
|
|
28891
29076
|
return true;
|
|
28892
29077
|
}
|
|
28893
29078
|
return false;
|
|
28894
29079
|
}
|
|
29080
|
+
function isNotEditable(jodit, node) {
|
|
29081
|
+
return jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isElement(node) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isContentEditable(node, jodit.editor);
|
|
29082
|
+
}
|
|
28895
29083
|
|
|
28896
29084
|
|
|
28897
29085
|
/***/ }),
|
|
@@ -48502,12 +48690,13 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
|
|
|
48502
48690
|
"use strict";
|
|
48503
48691
|
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
|
|
48504
48692
|
/* 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
|
|
48693
|
+
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
|
|
48694
|
+
/* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
|
|
48695
|
+
/* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(27795);
|
|
48696
|
+
/* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
|
|
48697
|
+
/* harmony import */ var jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(85932);
|
|
48698
|
+
/* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
|
|
48699
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(86038);
|
|
48511
48700
|
/*!
|
|
48512
48701
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
48513
48702
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -48524,9 +48713,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
|
|
|
48524
48713
|
|
|
48525
48714
|
|
|
48526
48715
|
|
|
48716
|
+
|
|
48527
48717
|
/**
|
|
48528
48718
|
* Wrap single text nodes in block wrapper
|
|
48529
|
-
*/ class wrapNodes extends
|
|
48719
|
+
*/ class wrapNodes extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
|
|
48530
48720
|
/** @override **/ afterInit(jodit) {
|
|
48531
48721
|
if (jodit.o.enter.toLowerCase() === 'br') {
|
|
48532
48722
|
return;
|
|
@@ -48555,10 +48745,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
|
|
|
48555
48745
|
}
|
|
48556
48746
|
isChanged = true;
|
|
48557
48747
|
const box = jodit.createInside.element(jodit.o.enter);
|
|
48558
|
-
|
|
48559
|
-
|
|
48748
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.before(child, box);
|
|
48749
|
+
// `exclude` keeps a <br> from starting a box, but one between loose lines stays with them
|
|
48750
|
+
while(child && (this.isSuitable(child) || jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(child, 'br'))){
|
|
48560
48751
|
const next = child.nextSibling;
|
|
48561
|
-
|
|
48752
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(box, child);
|
|
48562
48753
|
child = next;
|
|
48563
48754
|
}
|
|
48564
48755
|
box.normalize();
|
|
@@ -48582,8 +48773,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
|
|
|
48582
48773
|
}
|
|
48583
48774
|
const box = jodit.createInside.element(jodit.o.enter);
|
|
48584
48775
|
const br = jodit.createInside.element('br');
|
|
48585
|
-
|
|
48586
|
-
|
|
48776
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(box, br);
|
|
48777
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(jodit.editor, box);
|
|
48587
48778
|
if (jodit.s.isFocused() || jodit.e.current === 'backSpaceAfterDelete') {
|
|
48588
48779
|
jodit.s.setCursorBefore(br);
|
|
48589
48780
|
}
|
|
@@ -48592,29 +48783,40 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
|
|
|
48592
48783
|
constructor(...args){
|
|
48593
48784
|
super(...args), /**
|
|
48594
48785
|
* Found Node which should be wrapped
|
|
48595
|
-
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isSuitableStart", (n)=>
|
|
48786
|
+
*/ (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
48787
|
* Node should add in a block element
|
|
48597
|
-
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isSuitable", (n)=>
|
|
48788
|
+
*/ (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
48789
|
* Some element which needs to append in block
|
|
48599
|
-
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isNotWrapped", (n)=>
|
|
48790
|
+
*/ (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
48791
|
}
|
|
48601
48792
|
}
|
|
48602
48793
|
;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
48603
|
-
|
|
48794
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
48604
48795
|
], wrapNodes.prototype, "postProcessSetEditorValue", null);
|
|
48605
48796
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
48606
|
-
|
|
48797
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
48607
48798
|
], wrapNodes.prototype, "preprocessInput", null);
|
|
48799
|
+
/**
|
|
48800
|
+
* A block can't go in a paragraph, so neither can an element that holds one,
|
|
48801
|
+
* such as a `<span>` round a `<p>`. Embedded content such as an `<iframe>` can.
|
|
48802
|
+
*/ function holdsBlock(elm) {
|
|
48803
|
+
for (const node of jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.eachGen(elm)){
|
|
48804
|
+
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)) {
|
|
48805
|
+
return true;
|
|
48806
|
+
}
|
|
48807
|
+
}
|
|
48808
|
+
return false;
|
|
48809
|
+
}
|
|
48608
48810
|
function checkAloneListLeaf(child, jodit) {
|
|
48609
48811
|
let result = child;
|
|
48610
48812
|
let next = child;
|
|
48611
48813
|
do {
|
|
48612
|
-
if (
|
|
48613
|
-
const nextChild =
|
|
48614
|
-
if (
|
|
48615
|
-
|
|
48814
|
+
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)) {
|
|
48815
|
+
const nextChild = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.findNotEmptySibling(next, false);
|
|
48816
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(result, 'ul')) {
|
|
48817
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(result, next);
|
|
48616
48818
|
} else {
|
|
48617
|
-
result =
|
|
48819
|
+
result = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.wrap(next, 'ul', jodit.createInside);
|
|
48618
48820
|
}
|
|
48619
48821
|
next = nextChild;
|
|
48620
48822
|
} else {
|
|
@@ -48623,7 +48825,7 @@ function checkAloneListLeaf(child, jodit) {
|
|
|
48623
48825
|
}while (next)
|
|
48624
48826
|
return result;
|
|
48625
48827
|
}
|
|
48626
|
-
|
|
48828
|
+
jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('wrapNodes', wrapNodes);
|
|
48627
48829
|
|
|
48628
48830
|
|
|
48629
48831
|
/***/ }),
|