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/es2015/jodit.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
|
|
3
3
|
* Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
|
|
4
|
-
* Version: v4.18.
|
|
4
|
+
* Version: v4.18.12
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
@@ -1446,7 +1446,8 @@ class Async {
|
|
|
1446
1446
|
this.__requestsIdle.forEach((key)=>this.cancelIdleCallback(key));
|
|
1447
1447
|
this.__requestsRaf.forEach((key)=>this.cancelAnimationFrame(key));
|
|
1448
1448
|
this.__controllers.forEach((controller)=>controller.abort());
|
|
1449
|
-
|
|
1449
|
+
// A labelled timer is kept under its label, so clear by the value
|
|
1450
|
+
this.timers.forEach((timer)=>(0,jodit_core_helpers_async__WEBPACK_IMPORTED_MODULE_4__.clearTimeout)(timer));
|
|
1450
1451
|
this.timers.clear();
|
|
1451
1452
|
this.promisesRejections.forEach((reject)=>reject());
|
|
1452
1453
|
this.promisesRejections.clear();
|
|
@@ -1828,7 +1829,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1828
1829
|
* ```
|
|
1829
1830
|
* @packageDocumentation
|
|
1830
1831
|
* @module constants
|
|
1831
|
-
*/ const APP_VERSION = "4.18.
|
|
1832
|
+
*/ const APP_VERSION = "4.18.12";
|
|
1832
1833
|
// prettier-ignore
|
|
1833
1834
|
const ES = "es2015";
|
|
1834
1835
|
const IS_ES_MODERN = true;
|
|
@@ -7214,8 +7215,10 @@ function normalizeCssValue(key, value) {
|
|
|
7214
7215
|
* ancestor's top-left corner. The returned offset should be subtracted from
|
|
7215
7216
|
* the desired viewport coordinates before applying them.
|
|
7216
7217
|
*
|
|
7217
|
-
*
|
|
7218
|
-
*
|
|
7218
|
+
* Without such an ancestor the containing block is the layout viewport. Its
|
|
7219
|
+
* offset is `{ x: 0, y: 0 }` in most browsers, but WebKit measures client
|
|
7220
|
+
* rects from the visual viewport, so once the page is pinch-zoomed and panned
|
|
7221
|
+
* the layout viewport starts above and to the left of the client origin.
|
|
7219
7222
|
*/ function getFixedPositionOffset(elm) {
|
|
7220
7223
|
var _elm_ownerDocument;
|
|
7221
7224
|
const win = (_elm_ownerDocument = elm.ownerDocument) === null || _elm_ownerDocument === void 0 ? void 0 : _elm_ownerDocument.defaultView;
|
|
@@ -7230,6 +7233,15 @@ function normalizeCssValue(key, value) {
|
|
|
7230
7233
|
}
|
|
7231
7234
|
node = node.parentElement;
|
|
7232
7235
|
}
|
|
7236
|
+
const vv = win === null || win === void 0 ? void 0 : win.visualViewport;
|
|
7237
|
+
// WebKit's `scrollX`/`scrollY` follow the visual viewport too (truncated),
|
|
7238
|
+
// where Blink's and Gecko's follow the layout viewport
|
|
7239
|
+
if (win && vv && (vv.offsetLeft || vv.offsetTop) && Math.abs(vv.pageLeft - win.scrollX) < 1 && Math.abs(vv.pageTop - win.scrollY) < 1) {
|
|
7240
|
+
return {
|
|
7241
|
+
x: -Math.round(vv.offsetLeft),
|
|
7242
|
+
y: -Math.round(vv.offsetTop)
|
|
7243
|
+
};
|
|
7244
|
+
}
|
|
7233
7245
|
return {
|
|
7234
7246
|
x: 0,
|
|
7235
7247
|
y: 0
|
|
@@ -13282,7 +13294,7 @@ function elementsEqualAttributes(elm1, elm2) {
|
|
|
13282
13294
|
/**
|
|
13283
13295
|
* Replaces `ul->ol` or `ol->ul`, apply styles to the list, or remove a list item from it
|
|
13284
13296
|
* @private
|
|
13285
|
-
*/ function toggleOrderedList(commitStyle, li, jodit, mode) {
|
|
13297
|
+
*/ function toggleOrderedList(commitStyle, li, jodit, mode, collapsed = false) {
|
|
13286
13298
|
if (!li) {
|
|
13287
13299
|
return mode;
|
|
13288
13300
|
}
|
|
@@ -13311,16 +13323,36 @@ function elementsEqualAttributes(elm1, elm2) {
|
|
|
13311
13323
|
}
|
|
13312
13324
|
// ul => ol, ol => ul or ul => ul.class1
|
|
13313
13325
|
if (mode === jodit_core_selection_style_constants__WEBPACK_IMPORTED_MODULE_6__.REPLACE || isChangeMode || !isSameList) {
|
|
13314
|
-
|
|
13315
|
-
const
|
|
13326
|
+
// With just a caret, Word converts the whole list
|
|
13327
|
+
const items = collapsed && !isSameList ? Array.from(list.children).filter((item)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isLeaf(item)) : [
|
|
13328
|
+
li
|
|
13329
|
+
];
|
|
13330
|
+
let newList;
|
|
13331
|
+
for (const item of items){
|
|
13332
|
+
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));
|
|
13333
|
+
}
|
|
13316
13334
|
hook(jodit_core_selection_style_constants__WEBPACK_IMPORTED_MODULE_6__.REPLACE, newList, commitStyle);
|
|
13317
13335
|
return jodit_core_selection_style_constants__WEBPACK_IMPORTED_MODULE_6__.REPLACE;
|
|
13318
13336
|
}
|
|
13319
13337
|
}
|
|
13320
|
-
const wrapper = unwrapList((/* inlined export .UNWRAP */"unwrap"),
|
|
13338
|
+
const wrapper = keepNumbering(li, (itemList)=>unwrapList((/* inlined export .UNWRAP */"unwrap"), itemList, li, jodit, commitStyle));
|
|
13321
13339
|
hook((/* inlined export .UNWRAP */"unwrap"), wrapper, commitStyle);
|
|
13322
13340
|
return (/* inlined export .UNWRAP */"unwrap");
|
|
13323
13341
|
}
|
|
13342
|
+
/**
|
|
13343
|
+
* Takes `item` out of its list with `takeOut`, and carries a numbered list's
|
|
13344
|
+
* count on past it, as Word does: 1, a bullet, then 2
|
|
13345
|
+
*/ function keepNumbering(item, takeOut) {
|
|
13346
|
+
const list = item.parentElement;
|
|
13347
|
+
const rest = item.nextElementSibling;
|
|
13348
|
+
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;
|
|
13349
|
+
const result = takeOut(list);
|
|
13350
|
+
const restList = rest === null || rest === void 0 ? void 0 : rest.parentElement;
|
|
13351
|
+
if (next && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(restList, 'ol')) {
|
|
13352
|
+
next > 1 ? restList.setAttribute('start', String(next)) : restList.removeAttribute('start');
|
|
13353
|
+
}
|
|
13354
|
+
return result;
|
|
13355
|
+
}
|
|
13324
13356
|
/**
|
|
13325
13357
|
* Other attributes, such as a class, still move the items into a new list,
|
|
13326
13358
|
* where the `beforeWrapList` hook can add markup to each of them
|
|
@@ -14095,7 +14127,7 @@ const transactions = {
|
|
|
14095
14127
|
[states.TOGGLE_LIST]: {
|
|
14096
14128
|
exec (value) {
|
|
14097
14129
|
return (0,_swc_helpers_object_spread_props__WEBPACK_IMPORTED_MODULE_1__._)((0,_swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_0__._)({}, value), {
|
|
14098
|
-
mode: (0,jodit_core_selection_style_api__WEBPACK_IMPORTED_MODULE_5__.toggleOrderedList)(value.style, value.element, value.jodit, value.mode),
|
|
14130
|
+
mode: (0,jodit_core_selection_style_api__WEBPACK_IMPORTED_MODULE_5__.toggleOrderedList)(value.style, value.element, value.jodit, value.mode, value.collapsed),
|
|
14099
14131
|
next: states.END
|
|
14100
14132
|
});
|
|
14101
14133
|
}
|
|
@@ -27601,12 +27633,13 @@ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__.Icon.set('about', (_about_svg__W
|
|
|
27601
27633
|
/* unused harmony export addNewLine */
|
|
27602
27634
|
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
|
|
27603
27635
|
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
|
|
27604
|
-
/* harmony import */ var
|
|
27605
|
-
/* harmony import */ var
|
|
27606
|
-
/* harmony import */ var
|
|
27607
|
-
/* harmony import */ var
|
|
27608
|
-
/* harmony import */ var
|
|
27609
|
-
/* harmony import */ var
|
|
27636
|
+
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
|
|
27637
|
+
/* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
|
|
27638
|
+
/* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(28077);
|
|
27639
|
+
/* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65946);
|
|
27640
|
+
/* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(80991);
|
|
27641
|
+
/* harmony import */ var jodit_modules__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(60936);
|
|
27642
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(10685);
|
|
27610
27643
|
/*!
|
|
27611
27644
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
27612
27645
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -27624,10 +27657,11 @@ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__.Icon.set('about', (_about_svg__W
|
|
|
27624
27657
|
|
|
27625
27658
|
|
|
27626
27659
|
|
|
27660
|
+
|
|
27627
27661
|
const ns = 'addnewline';
|
|
27628
27662
|
/**
|
|
27629
27663
|
* Create helper for adding new paragraph(Jodit.defaultOptions.enter tag) before iframe, table or image
|
|
27630
|
-
*/ class addNewLine extends
|
|
27664
|
+
*/ class addNewLine extends jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Plugin {
|
|
27631
27665
|
__show() {
|
|
27632
27666
|
if (this.j.o.readonly || this.j.isLocked) {
|
|
27633
27667
|
return;
|
|
@@ -27637,8 +27671,8 @@ const ns = 'addnewline';
|
|
|
27637
27671
|
return;
|
|
27638
27672
|
}
|
|
27639
27673
|
this.__isShown = true;
|
|
27640
|
-
|
|
27641
|
-
(0,
|
|
27674
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(this.j.container, this.__line);
|
|
27675
|
+
(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_6__.css)(this.__line, 'width', this.j.container.clientWidth);
|
|
27642
27676
|
}
|
|
27643
27677
|
onLock(isLocked) {
|
|
27644
27678
|
if (isLocked && this.__isShown) {
|
|
@@ -27676,16 +27710,43 @@ const ns = 'addnewline';
|
|
|
27676
27710
|
editor.editor
|
|
27677
27711
|
], '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);
|
|
27678
27712
|
}
|
|
27713
|
+
/**
|
|
27714
|
+
* A paragraph holding only an embed has no place for the caret, so the
|
|
27715
|
+
* arrow keys can't get past one that ends the content, or before one that
|
|
27716
|
+
* starts it. When an arrow key leaves the caret where it was and there is
|
|
27717
|
+
* content beyond it, a new line goes there, as when the line is clicked.
|
|
27718
|
+
*/ onArrowKey(e) {
|
|
27719
|
+
const editor = this.j;
|
|
27720
|
+
const forward = e.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_DOWN || e.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_RIGHT;
|
|
27721
|
+
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()) {
|
|
27722
|
+
return;
|
|
27723
|
+
}
|
|
27724
|
+
const { startContainer, startOffset } = editor.s.range;
|
|
27725
|
+
// Once the browser has moved the caret, if it could. With a 0 timeout
|
|
27726
|
+
// Jodit would run this at once, before the browser moves it
|
|
27727
|
+
editor.async.setTimeout(()=>{
|
|
27728
|
+
const { range } = editor.s;
|
|
27729
|
+
const block = jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.closest(startContainer, jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock, editor.editor);
|
|
27730
|
+
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)) {
|
|
27731
|
+
return;
|
|
27732
|
+
}
|
|
27733
|
+
const p = editor.createInside.element(editor.o.enter);
|
|
27734
|
+
forward ? jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(editor.editor, p) : jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.prepend(editor.editor, p);
|
|
27735
|
+
editor.s.setCursorIn(p);
|
|
27736
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.scrollIntoViewIfNeeded)(p, editor.editor, editor.ed);
|
|
27737
|
+
editor.synchronizeValues();
|
|
27738
|
+
}, 1);
|
|
27739
|
+
}
|
|
27679
27740
|
onDblClickEditor(e) {
|
|
27680
27741
|
const editor = this.j;
|
|
27681
27742
|
if (!editor.o.readonly && editor.o.addNewLineOnDBLClick && e.target === editor.editor && editor.s.isCollapsed()) {
|
|
27682
|
-
const editorBound = (0,
|
|
27743
|
+
const editorBound = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.offset)(editor.editor, editor, editor.ed);
|
|
27683
27744
|
const top = e.pageY - editor.ew.scrollX;
|
|
27684
27745
|
const p = editor.createInside.element(editor.o.enter);
|
|
27685
27746
|
if (Math.abs(top - editorBound.top) < Math.abs(top - (editorBound.height + editorBound.top)) && editor.editor.firstChild) {
|
|
27686
|
-
|
|
27747
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.prepend(editor.editor, p);
|
|
27687
27748
|
} else {
|
|
27688
|
-
|
|
27749
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(editor.editor, p);
|
|
27689
27750
|
}
|
|
27690
27751
|
editor.s.setCursorIn(p);
|
|
27691
27752
|
editor.synchronizeValues();
|
|
@@ -27699,27 +27760,27 @@ const ns = 'addnewline';
|
|
|
27699
27760
|
// Inside Shadow DOM `document.elementFromPoint` returns the shadow
|
|
27700
27761
|
// host, so the lookup must start from the shadow root
|
|
27701
27762
|
let currentElement = ((_editor_o_shadowRoot = editor.o.shadowRoot) !== null && _editor_o_shadowRoot !== void 0 ? _editor_o_shadowRoot : editor.ed).elementFromPoint(e.clientX, e.clientY);
|
|
27702
|
-
if (!
|
|
27763
|
+
if (!jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isHTMLElement(currentElement) || !jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isOrContains(editor.editor, currentElement)) {
|
|
27703
27764
|
return;
|
|
27704
27765
|
}
|
|
27705
27766
|
if (editor.editor !== currentElement && !this.__isMatchedTag(currentElement)) {
|
|
27706
|
-
currentElement =
|
|
27767
|
+
currentElement = jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.closest(currentElement, this.__isMatchedTag, editor.editor);
|
|
27707
27768
|
}
|
|
27708
27769
|
if (!currentElement) {
|
|
27709
27770
|
this.__hide();
|
|
27710
27771
|
return;
|
|
27711
27772
|
}
|
|
27712
27773
|
if (this.__isMatchedTag(currentElement)) {
|
|
27713
|
-
const parentBox =
|
|
27774
|
+
const parentBox = jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.up(currentElement, jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock, editor.editor);
|
|
27714
27775
|
if (parentBox && parentBox !== editor.editor) {
|
|
27715
27776
|
currentElement = parentBox;
|
|
27716
27777
|
}
|
|
27717
27778
|
}
|
|
27718
|
-
const pos = (0,
|
|
27779
|
+
const pos = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.position)(currentElement, this.j);
|
|
27719
27780
|
let top = false;
|
|
27720
27781
|
let { clientY, clientX } = e;
|
|
27721
27782
|
if (this.j.iframe) {
|
|
27722
|
-
const { top, left } = (0,
|
|
27783
|
+
const { top, left } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.position)(this.j.iframe, this.j, true);
|
|
27723
27784
|
clientY += top;
|
|
27724
27785
|
clientX += left;
|
|
27725
27786
|
}
|
|
@@ -27732,8 +27793,8 @@ const ns = 'addnewline';
|
|
|
27732
27793
|
this.__isBeforeContent = false;
|
|
27733
27794
|
}
|
|
27734
27795
|
const isEditor = editor.editor === currentElement;
|
|
27735
|
-
if (top !== false && (isEditor && !this.__isBeforeContent || !isEditor && !(0,
|
|
27736
|
-
(0,
|
|
27796
|
+
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))) {
|
|
27797
|
+
(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_6__.css)(this.__line, 'top', top);
|
|
27737
27798
|
this.__current = currentElement;
|
|
27738
27799
|
this.__show();
|
|
27739
27800
|
this.__line.style.setProperty('--jd-anl-handle-offset', clientX - pos.left - 10 + 'px');
|
|
@@ -27745,7 +27806,7 @@ const ns = 'addnewline';
|
|
|
27745
27806
|
/** @override */ beforeDestruct() {
|
|
27746
27807
|
this.j.async.clearTimeout(this.__timeout);
|
|
27747
27808
|
this.j.e.off(this.__line).off('changePlace', this.__addEventListeners);
|
|
27748
|
-
|
|
27809
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.safeRemove(this.__line);
|
|
27749
27810
|
this.j.e.off([
|
|
27750
27811
|
this.j.ow,
|
|
27751
27812
|
this.j.ew,
|
|
@@ -27753,31 +27814,31 @@ const ns = 'addnewline';
|
|
|
27753
27814
|
], '.' + ns).off(this.j.container, '.' + ns).off('.' + ns);
|
|
27754
27815
|
}
|
|
27755
27816
|
constructor(...args){
|
|
27756
|
-
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>${
|
|
27817
|
+
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", ()=>{
|
|
27757
27818
|
if (!this.__isShown) {
|
|
27758
27819
|
return;
|
|
27759
27820
|
}
|
|
27760
27821
|
this.__isShown = false;
|
|
27761
27822
|
this.j.async.clearTimeout(this.__timeout);
|
|
27762
27823
|
this.__lineInFocus = false;
|
|
27763
|
-
|
|
27824
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.safeRemove(this.__line);
|
|
27764
27825
|
this.__line.style.setProperty('--jd-anl-handle-offset', '0');
|
|
27765
27826
|
}), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__canGetFocus", (elm)=>{
|
|
27766
|
-
return elm != null &&
|
|
27827
|
+
return elm != null && jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock(elm) && !/^(img|table|iframe|hr)$/i.test(elm.nodeName);
|
|
27767
27828
|
}), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__onClickLine", (e)=>{
|
|
27768
27829
|
const editor = this.j;
|
|
27769
27830
|
const p = editor.createInside.element(editor.o.enter);
|
|
27770
27831
|
if (this.__isBeforeContent && this.__current && this.__current.parentNode) {
|
|
27771
27832
|
if (this.__current === editor.editor) {
|
|
27772
|
-
|
|
27833
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.prepend(editor.editor, p);
|
|
27773
27834
|
} else {
|
|
27774
|
-
|
|
27835
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.before(this.__current, p);
|
|
27775
27836
|
}
|
|
27776
27837
|
} else {
|
|
27777
|
-
|
|
27838
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(editor.editor, p);
|
|
27778
27839
|
}
|
|
27779
27840
|
editor.s.setCursorIn(p);
|
|
27780
|
-
(0,
|
|
27841
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.scrollIntoViewIfNeeded)(p, editor.editor, editor.ed);
|
|
27781
27842
|
editor.synchronizeValues();
|
|
27782
27843
|
this.__hideForce();
|
|
27783
27844
|
e.preventDefault();
|
|
@@ -27785,18 +27846,21 @@ const ns = 'addnewline';
|
|
|
27785
27846
|
}
|
|
27786
27847
|
}
|
|
27787
27848
|
;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
27788
|
-
(0,
|
|
27849
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':lock')
|
|
27789
27850
|
], addNewLine.prototype, "onLock", null);
|
|
27790
27851
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
27791
|
-
|
|
27852
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
27792
27853
|
], addNewLine.prototype, "__hide", null);
|
|
27793
27854
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
27794
|
-
(0,
|
|
27855
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':keydown')
|
|
27856
|
+
], addNewLine.prototype, "onArrowKey", null);
|
|
27857
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
27858
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':dblclick')
|
|
27795
27859
|
], addNewLine.prototype, "onDblClickEditor", null);
|
|
27796
27860
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
27797
|
-
(0,
|
|
27861
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.throttle)((ctx)=>ctx.defaultTimeout)
|
|
27798
27862
|
], addNewLine.prototype, "__onMouseMove", null);
|
|
27799
|
-
|
|
27863
|
+
jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('addNewLine', addNewLine);
|
|
27800
27864
|
|
|
27801
27865
|
|
|
27802
27866
|
/***/ }),
|
|
@@ -28367,6 +28431,7 @@ UiAiAssistant = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decor
|
|
|
28367
28431
|
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(33831);
|
|
28368
28432
|
/* harmony import */ var _cases_check_not_collapsed__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(89827);
|
|
28369
28433
|
/* harmony import */ var _cases__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(17523);
|
|
28434
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(15200);
|
|
28370
28435
|
/*!
|
|
28371
28436
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
28372
28437
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -28385,6 +28450,7 @@ UiAiAssistant = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decor
|
|
|
28385
28450
|
|
|
28386
28451
|
|
|
28387
28452
|
|
|
28453
|
+
|
|
28388
28454
|
class backspace extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugin {
|
|
28389
28455
|
afterInit(jodit) {
|
|
28390
28456
|
jodit.registerCommand('deleteButton', {
|
|
@@ -28462,14 +28528,50 @@ class backspace extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugin {
|
|
|
28462
28528
|
throw e;
|
|
28463
28529
|
} finally{
|
|
28464
28530
|
jodit.e.fire('backSpaceAfterDelete', backspace, fakeNode);
|
|
28531
|
+
this.moveCaretToTextBefore(fakeNode);
|
|
28465
28532
|
this.safeRemoveEmptyNode(fakeNode);
|
|
28466
28533
|
}
|
|
28467
28534
|
return false;
|
|
28468
28535
|
}
|
|
28536
|
+
/**
|
|
28537
|
+
* The browser types at the end of the text before the caret on its line,
|
|
28538
|
+
* in that text's formatting, but not inside a link. Moving the caret there
|
|
28539
|
+
* too makes a paste and the toolbar agree with what's typed:
|
|
28540
|
+
* `<p>one</p><p><b>|two</b></p>` joins to `<p>one|<b>two</b></p>`
|
|
28541
|
+
*/ moveCaretToTextBefore(fakeNode) {
|
|
28542
|
+
var _ref;
|
|
28543
|
+
var _text_nodeValue;
|
|
28544
|
+
const { jodit } = this;
|
|
28545
|
+
const { range } = jodit.s;
|
|
28546
|
+
// A case may have merged the fake node away (#1722)
|
|
28547
|
+
if (!fakeNode.parentNode) {
|
|
28548
|
+
return;
|
|
28549
|
+
}
|
|
28550
|
+
const around = jodit.ed.createRange();
|
|
28551
|
+
around.selectNode(fakeNode);
|
|
28552
|
+
if (!range.collapsed || !around.isPointInRange(range.startContainer, range.startOffset)) {
|
|
28553
|
+
return;
|
|
28554
|
+
}
|
|
28555
|
+
const text = (0,_helpers__WEBPACK_IMPORTED_MODULE_10__.findMostNestedNeighbor)(fakeNode, false, jodit.editor, true);
|
|
28556
|
+
const link = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(text, 'a', jodit.editor);
|
|
28557
|
+
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)) {
|
|
28558
|
+
return;
|
|
28559
|
+
}
|
|
28560
|
+
range.setStart(text, (_ref = (_text_nodeValue = text.nodeValue) === null || _text_nodeValue === void 0 ? void 0 : _text_nodeValue.length) !== null && _ref !== void 0 ? _ref : 0);
|
|
28561
|
+
range.collapse(true);
|
|
28562
|
+
jodit.s.selectRange(range);
|
|
28563
|
+
}
|
|
28469
28564
|
/**
|
|
28470
28565
|
* Remove node and replace cursor position out of it
|
|
28471
28566
|
*/ safeRemoveEmptyNode(fakeNode) {
|
|
28567
|
+
var _fakeNode_nodeValue;
|
|
28472
28568
|
const { range } = this.j.s;
|
|
28569
|
+
// wrap-nodes normalizes the line it wraps, which can merge the text
|
|
28570
|
+
// after the fake node into it: remove only the fake node's own space
|
|
28571
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(fakeNode) && fakeNode.nodeValue !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.INVISIBLE_SPACE && ((_fakeNode_nodeValue = fakeNode.nodeValue) === null || _fakeNode_nodeValue === void 0 ? void 0 : _fakeNode_nodeValue.startsWith(jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.INVISIBLE_SPACE))) {
|
|
28572
|
+
fakeNode.deleteData(0, jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.INVISIBLE_SPACE.length);
|
|
28573
|
+
return;
|
|
28574
|
+
}
|
|
28473
28575
|
if (range.startContainer === fakeNode) {
|
|
28474
28576
|
if (fakeNode.previousSibling) {
|
|
28475
28577
|
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(fakeNode.previousSibling)) {
|
|
@@ -28543,6 +28645,9 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
|
|
|
28543
28645
|
return false;
|
|
28544
28646
|
}
|
|
28545
28647
|
const sibling = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(mainClosestBox, backspace);
|
|
28648
|
+
if (moveInlinesInside(jodit, fakeNode, sibling)) {
|
|
28649
|
+
return joinNeighbors(jodit, fakeNode, backspace, moved);
|
|
28650
|
+
}
|
|
28546
28651
|
// A line break before the cursor is a single unit: remove it instead of
|
|
28547
28652
|
// merging the current element into the (void) `<br>`, which used to move
|
|
28548
28653
|
// the whole element's content into the `<br>` and delete it (#1282).
|
|
@@ -28557,6 +28662,10 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
|
|
|
28557
28662
|
jodit.s.setCursorBefore(fakeNode);
|
|
28558
28663
|
return true;
|
|
28559
28664
|
}
|
|
28665
|
+
// A non-editable sibling is removed by remove-not-editable, never joined
|
|
28666
|
+
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)) {
|
|
28667
|
+
return false;
|
|
28668
|
+
}
|
|
28560
28669
|
const box = findCaretBox(fakeNode, mainClosestBox);
|
|
28561
28670
|
// One pass only: the line now sits beside the next one, so the
|
|
28562
28671
|
// cases below join them. The DOM has changed either way
|
|
@@ -28585,6 +28694,60 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
|
|
|
28585
28694
|
}
|
|
28586
28695
|
return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(block) && block.parentElement ? block.parentElement : block;
|
|
28587
28696
|
}
|
|
28697
|
+
/**
|
|
28698
|
+
* With an inline element round the caret's line or the one it joins moved
|
|
28699
|
+
* inside its blocks, the cases join the lines as they join any two, and its
|
|
28700
|
+
* styles stay with its text. One round both lines is left as it is.
|
|
28701
|
+
*/ function moveInlinesInside(jodit, fakeNode, sibling) {
|
|
28702
|
+
if (!sibling) {
|
|
28703
|
+
return false;
|
|
28704
|
+
}
|
|
28705
|
+
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);
|
|
28706
|
+
return moveInlineInside(around, jodit.editor) || moveInlineInside(sibling, jodit.editor);
|
|
28707
|
+
}
|
|
28708
|
+
/**
|
|
28709
|
+
* Old content can have an inline element round blocks. This moves it inside
|
|
28710
|
+
* them, and gives the text, images and line breaks beside them a copy of
|
|
28711
|
+
* their own: `<span style="…"><p>one</p><br><p>two</p></span>` becomes
|
|
28712
|
+
* `<p><span style="…">one</span></p><span style="…"><br></span><p><span style="…">two</span></p>`
|
|
28713
|
+
*/ function moveInlineInside(node, root) {
|
|
28714
|
+
if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(node) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(node)) {
|
|
28715
|
+
return false;
|
|
28716
|
+
}
|
|
28717
|
+
// Embedded content, such as the `<iframe>` in a video's wrapper, counts
|
|
28718
|
+
// as a block in `Dom.isBlock`, but stays with the text beside it
|
|
28719
|
+
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);
|
|
28720
|
+
// The inner one first: `<span><strong><p>one</p></strong></span>`
|
|
28721
|
+
Array.from(node.childNodes).forEach((child)=>moveInlineInside(child, root));
|
|
28722
|
+
const children = Array.from(node.childNodes);
|
|
28723
|
+
if (!children.some(isBlock)) {
|
|
28724
|
+
return false;
|
|
28725
|
+
}
|
|
28726
|
+
let run = null;
|
|
28727
|
+
for (const child of children){
|
|
28728
|
+
if (!isBlock(child)) {
|
|
28729
|
+
// Blank text between blocks stays where it is
|
|
28730
|
+
if (!run && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmptyTextNode(child)) {
|
|
28731
|
+
run = node.cloneNode(false);
|
|
28732
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(child, run);
|
|
28733
|
+
}
|
|
28734
|
+
run && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(run, child);
|
|
28735
|
+
continue;
|
|
28736
|
+
}
|
|
28737
|
+
run = null;
|
|
28738
|
+
// Nothing goes inside a rule or a non-editable block
|
|
28739
|
+
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)) {
|
|
28740
|
+
continue;
|
|
28741
|
+
}
|
|
28742
|
+
const inner = node.cloneNode(false);
|
|
28743
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.moveContent(child, inner);
|
|
28744
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(child, inner);
|
|
28745
|
+
// A list or a table: on down to its items or cells
|
|
28746
|
+
moveInlineInside(inner, root);
|
|
28747
|
+
}
|
|
28748
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.unwrap(node);
|
|
28749
|
+
return true;
|
|
28750
|
+
}
|
|
28588
28751
|
/**
|
|
28589
28752
|
* The innermost block on the sibling's edge facing the caret, so the
|
|
28590
28753
|
* content is joined to text: `<div><p>one</p></div><p>|two</p>` gives
|
|
@@ -28945,7 +29108,9 @@ function checkRemoveChar(jodit, fakeNode, backspace, mode, stopBeforeSpace = fal
|
|
|
28945
29108
|
while(jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isInlineBlock(sibling)){
|
|
28946
29109
|
sibling = backspace ? sibling === null || sibling === void 0 ? void 0 : sibling.lastChild : sibling === null || sibling === void 0 ? void 0 : sibling.firstChild;
|
|
28947
29110
|
}
|
|
28948
|
-
|
|
29111
|
+
// A block inside an inline element, such as the `<p>` in
|
|
29112
|
+
// `<span><p>…</p></span>`, isn't a char: the join cases handle it
|
|
29113
|
+
if (!sibling || jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(sibling)) {
|
|
28949
29114
|
break;
|
|
28950
29115
|
}
|
|
28951
29116
|
if ((_sibling_nodeValue = sibling.nodeValue) === null || _sibling_nodeValue === void 0 ? void 0 : _sibling_nodeValue.length) {
|
|
@@ -29094,6 +29259,7 @@ function isSpace(char) {
|
|
|
29094
29259
|
/* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27795);
|
|
29095
29260
|
/* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(65946);
|
|
29096
29261
|
/* harmony import */ var jodit_core_selection_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(42259);
|
|
29262
|
+
/* harmony import */ var _check_join_neighbors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(26106);
|
|
29097
29263
|
/*!
|
|
29098
29264
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
29099
29265
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -29103,23 +29269,48 @@ function isSpace(char) {
|
|
|
29103
29269
|
*/
|
|
29104
29270
|
|
|
29105
29271
|
|
|
29272
|
+
|
|
29106
29273
|
/**
|
|
29107
|
-
* Checks if a non-editable element can be deleted
|
|
29274
|
+
* Checks if a non-editable element can be deleted. A non-editable block goes
|
|
29275
|
+
* whole, and the lines either side of it then join, as the spec's tests do:
|
|
29276
|
+
* `<ul><li>one|</li></ul><div contenteditable="false">x</div><p>two</p>`
|
|
29277
|
+
* gives `<ul><li>one|two</li></ul>`
|
|
29108
29278
|
* @private
|
|
29109
29279
|
*/ function checkRemoveContentNotEditable(jodit, fakeNode, backspace) {
|
|
29110
|
-
let
|
|
29111
|
-
|
|
29112
|
-
|
|
29113
|
-
|
|
29114
|
-
|
|
29115
|
-
|
|
29116
|
-
|
|
29117
|
-
|
|
29118
|
-
(
|
|
29280
|
+
let node = fakeNode;
|
|
29281
|
+
let neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.findSibling(node, backspace);
|
|
29282
|
+
// Past the edges of the blocks the caret is at, but not into a table cell
|
|
29283
|
+
while(!neighbor && node.parentElement && node.parentElement !== jodit.editor && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isCell(node.parentElement)){
|
|
29284
|
+
node = node.parentElement;
|
|
29285
|
+
neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.findSibling(node, backspace);
|
|
29286
|
+
// At the start of a list item, Backspace takes the bullet off first,
|
|
29287
|
+
// unless the item before it is a non-editable one to remove
|
|
29288
|
+
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))) {
|
|
29289
|
+
return false;
|
|
29290
|
+
}
|
|
29291
|
+
}
|
|
29292
|
+
if (isNotEditable(jodit, neighbor)) {
|
|
29293
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isBlock(neighbor)) {
|
|
29294
|
+
// Backspace after a removed list item leaves the items apart: the
|
|
29295
|
+
// next press takes the bullet off, as for any later item
|
|
29296
|
+
const joinLines = !(backspace && jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isLeaf(neighbor));
|
|
29297
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.safeRemove(neighbor);
|
|
29298
|
+
if (joinLines) {
|
|
29299
|
+
(0,_check_join_neighbors__WEBPACK_IMPORTED_MODULE_3__.checkJoinNeighbors)(jodit, fakeNode, backspace);
|
|
29300
|
+
}
|
|
29301
|
+
} else {
|
|
29302
|
+
(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);
|
|
29303
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.safeRemove(neighbor);
|
|
29304
|
+
(0,jodit_core_selection_helpers__WEBPACK_IMPORTED_MODULE_2__.moveNodeInsideStart)(jodit, fakeNode, backspace);
|
|
29305
|
+
}
|
|
29306
|
+
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.call)(backspace ? jodit.s.setCursorBefore : jodit.s.setCursorAfter, fakeNode);
|
|
29119
29307
|
return true;
|
|
29120
29308
|
}
|
|
29121
29309
|
return false;
|
|
29122
29310
|
}
|
|
29311
|
+
function isNotEditable(jodit, node) {
|
|
29312
|
+
return jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isElement(node) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isContentEditable(node, jodit.editor);
|
|
29313
|
+
}
|
|
29123
29314
|
|
|
29124
29315
|
|
|
29125
29316
|
/***/ }),
|
|
@@ -48896,12 +49087,13 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
|
|
|
48896
49087
|
"use strict";
|
|
48897
49088
|
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
|
|
48898
49089
|
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
|
|
48899
|
-
/* harmony import */ var
|
|
48900
|
-
/* harmony import */ var
|
|
48901
|
-
/* harmony import */ var
|
|
48902
|
-
/* harmony import */ var
|
|
48903
|
-
/* harmony import */ var
|
|
48904
|
-
/* harmony import */ var
|
|
49090
|
+
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
|
|
49091
|
+
/* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
|
|
49092
|
+
/* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(27795);
|
|
49093
|
+
/* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
|
|
49094
|
+
/* harmony import */ var jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(85932);
|
|
49095
|
+
/* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
|
|
49096
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(86038);
|
|
48905
49097
|
/*!
|
|
48906
49098
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
48907
49099
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -48918,9 +49110,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
|
|
|
48918
49110
|
|
|
48919
49111
|
|
|
48920
49112
|
|
|
49113
|
+
|
|
48921
49114
|
/**
|
|
48922
49115
|
* Wrap single text nodes in block wrapper
|
|
48923
|
-
*/ class wrapNodes extends
|
|
49116
|
+
*/ class wrapNodes extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
|
|
48924
49117
|
/** @override **/ afterInit(jodit) {
|
|
48925
49118
|
if (jodit.o.enter.toLowerCase() === 'br') {
|
|
48926
49119
|
return;
|
|
@@ -48949,10 +49142,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
|
|
|
48949
49142
|
}
|
|
48950
49143
|
isChanged = true;
|
|
48951
49144
|
const box = jodit.createInside.element(jodit.o.enter);
|
|
48952
|
-
|
|
48953
|
-
|
|
49145
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.before(child, box);
|
|
49146
|
+
// `exclude` keeps a <br> from starting a box, but one between loose lines stays with them
|
|
49147
|
+
while(child && (this.isSuitable(child) || jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(child, 'br'))){
|
|
48954
49148
|
const next = child.nextSibling;
|
|
48955
|
-
|
|
49149
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(box, child);
|
|
48956
49150
|
child = next;
|
|
48957
49151
|
}
|
|
48958
49152
|
box.normalize();
|
|
@@ -48976,8 +49170,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
|
|
|
48976
49170
|
}
|
|
48977
49171
|
const box = jodit.createInside.element(jodit.o.enter);
|
|
48978
49172
|
const br = jodit.createInside.element('br');
|
|
48979
|
-
|
|
48980
|
-
|
|
49173
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(box, br);
|
|
49174
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(jodit.editor, box);
|
|
48981
49175
|
if (jodit.s.isFocused() || jodit.e.current === 'backSpaceAfterDelete') {
|
|
48982
49176
|
jodit.s.setCursorBefore(br);
|
|
48983
49177
|
}
|
|
@@ -48988,30 +49182,41 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
|
|
|
48988
49182
|
* Found Node which should be wrapped
|
|
48989
49183
|
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isSuitableStart", (n)=>{
|
|
48990
49184
|
var _n_parentNode;
|
|
48991
|
-
return
|
|
49185
|
+
return 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 = n.parentNode) === null || _n_parentNode === void 0 ? void 0 : _n_parentNode.firstChild) === n && this.isSuitable(n.nextSibling)) || this.isNotWrapped(n) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTemporary(n);
|
|
48992
49186
|
}), /**
|
|
48993
49187
|
* Node should add in a block element
|
|
48994
|
-
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isSuitable", (n)=>
|
|
49188
|
+
*/ (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)), /**
|
|
48995
49189
|
* Some element which needs to append in block
|
|
48996
|
-
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isNotWrapped", (n)=>
|
|
49190
|
+
*/ (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)));
|
|
48997
49191
|
}
|
|
48998
49192
|
}
|
|
48999
49193
|
;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
49000
|
-
|
|
49194
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
49001
49195
|
], wrapNodes.prototype, "postProcessSetEditorValue", null);
|
|
49002
49196
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
49003
|
-
|
|
49197
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
49004
49198
|
], wrapNodes.prototype, "preprocessInput", null);
|
|
49199
|
+
/**
|
|
49200
|
+
* A block can't go in a paragraph, so neither can an element that holds one,
|
|
49201
|
+
* such as a `<span>` round a `<p>`. Embedded content such as an `<iframe>` can.
|
|
49202
|
+
*/ function holdsBlock(elm) {
|
|
49203
|
+
for (const node of jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.eachGen(elm)){
|
|
49204
|
+
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)) {
|
|
49205
|
+
return true;
|
|
49206
|
+
}
|
|
49207
|
+
}
|
|
49208
|
+
return false;
|
|
49209
|
+
}
|
|
49005
49210
|
function checkAloneListLeaf(child, jodit) {
|
|
49006
49211
|
let result = child;
|
|
49007
49212
|
let next = child;
|
|
49008
49213
|
do {
|
|
49009
|
-
if (
|
|
49010
|
-
const nextChild =
|
|
49011
|
-
if (
|
|
49012
|
-
|
|
49214
|
+
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)) {
|
|
49215
|
+
const nextChild = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.findNotEmptySibling(next, false);
|
|
49216
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(result, 'ul')) {
|
|
49217
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(result, next);
|
|
49013
49218
|
} else {
|
|
49014
|
-
result =
|
|
49219
|
+
result = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.wrap(next, 'ul', jodit.createInside);
|
|
49015
49220
|
}
|
|
49016
49221
|
next = nextChild;
|
|
49017
49222
|
} else {
|
|
@@ -49020,7 +49225,7 @@ function checkAloneListLeaf(child, jodit) {
|
|
|
49020
49225
|
}while (next)
|
|
49021
49226
|
return result;
|
|
49022
49227
|
}
|
|
49023
|
-
|
|
49228
|
+
jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('wrapNodes', wrapNodes);
|
|
49024
49229
|
|
|
49025
49230
|
|
|
49026
49231
|
/***/ }),
|