jodit 4.18.9 → 4.18.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +5 -5
- package/es2015/jodit.js +331 -71
- package/es2015/jodit.min.js +5 -5
- package/es2015/plugins/debug/debug.css +1 -1
- package/es2015/plugins/debug/debug.js +1 -1
- package/es2015/plugins/debug/debug.min.js +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2018/jodit.fat.min.js +5 -5
- package/es2018/jodit.min.js +5 -5
- package/es2018/plugins/debug/debug.min.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021/jodit.css +1 -1
- package/es2021/jodit.fat.min.js +6 -6
- package/es2021/jodit.js +328 -71
- package/es2021/jodit.min.js +6 -6
- package/es2021/plugins/debug/debug.css +1 -1
- package/es2021/plugins/debug/debug.js +1 -1
- package/es2021/plugins/debug/debug.min.js +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021.en/jodit.css +1 -1
- package/es2021.en/jodit.fat.min.js +6 -6
- package/es2021.en/jodit.js +328 -71
- package/es2021.en/jodit.min.js +6 -6
- package/es2021.en/plugins/debug/debug.css +1 -1
- package/es2021.en/plugins/debug/debug.js +1 -1
- package/es2021.en/plugins/debug/debug.min.js +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es5/jodit.css +2 -2
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +378 -72
- package/es5/jodit.min.css +2 -2
- package/es5/jodit.min.js +2 -2
- package/es5/plugins/debug/debug.css +1 -1
- package/es5/plugins/debug/debug.js +1 -1
- package/es5/plugins/debug/debug.min.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es5/polyfills.fat.min.js +2 -2
- package/es5/polyfills.js +3 -3
- package/es5/polyfills.min.js +2 -2
- package/esm/core/async/async.js +2 -1
- package/esm/core/constants.js +1 -1
- package/esm/core/helpers/size/get-fixed-position-offset.d.ts +4 -2
- package/esm/core/helpers/size/get-fixed-position-offset.js +14 -2
- package/esm/plugins/add-new-line/add-new-line.d.ts +7 -0
- package/esm/plugins/add-new-line/add-new-line.js +45 -0
- package/esm/plugins/backspace/backspace.d.ts +7 -0
- package/esm/plugins/backspace/backspace.js +45 -2
- package/esm/plugins/backspace/cases/check-join-neighbors.js +161 -1
- package/esm/plugins/backspace/cases/check-remove-char.js +3 -1
- package/esm/plugins/backspace/cases/check-remove-content-not-editable.d.ts +4 -1
- package/esm/plugins/backspace/cases/check-remove-content-not-editable.js +39 -11
- package/esm/plugins/wrap-nodes/wrap-nodes.js +19 -2
- package/esm/types/async.d.ts +7 -0
- package/package.json +1 -1
- package/types/core/helpers/size/get-fixed-position-offset.d.ts +4 -2
- package/types/plugins/add-new-line/add-new-line.d.ts +7 -0
- package/types/plugins/backspace/backspace.d.ts +7 -0
- package/types/plugins/backspace/cases/check-remove-content-not-editable.d.ts +4 -1
- package/types/types/async.d.ts +7 -0
package/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.11
|
|
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.11";
|
|
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
|
|
@@ -27601,12 +27613,13 @@ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__.Icon.set('about', (_about_svg__W
|
|
|
27601
27613
|
/* unused harmony export addNewLine */
|
|
27602
27614
|
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
|
|
27603
27615
|
/* 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
|
|
27616
|
+
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
|
|
27617
|
+
/* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
|
|
27618
|
+
/* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(28077);
|
|
27619
|
+
/* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65946);
|
|
27620
|
+
/* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(80991);
|
|
27621
|
+
/* harmony import */ var jodit_modules__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(60936);
|
|
27622
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(10685);
|
|
27610
27623
|
/*!
|
|
27611
27624
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
27612
27625
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -27624,10 +27637,11 @@ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__.Icon.set('about', (_about_svg__W
|
|
|
27624
27637
|
|
|
27625
27638
|
|
|
27626
27639
|
|
|
27640
|
+
|
|
27627
27641
|
const ns = 'addnewline';
|
|
27628
27642
|
/**
|
|
27629
27643
|
* Create helper for adding new paragraph(Jodit.defaultOptions.enter tag) before iframe, table or image
|
|
27630
|
-
*/ class addNewLine extends
|
|
27644
|
+
*/ class addNewLine extends jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Plugin {
|
|
27631
27645
|
__show() {
|
|
27632
27646
|
if (this.j.o.readonly || this.j.isLocked) {
|
|
27633
27647
|
return;
|
|
@@ -27637,8 +27651,8 @@ const ns = 'addnewline';
|
|
|
27637
27651
|
return;
|
|
27638
27652
|
}
|
|
27639
27653
|
this.__isShown = true;
|
|
27640
|
-
|
|
27641
|
-
(0,
|
|
27654
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(this.j.container, this.__line);
|
|
27655
|
+
(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_6__.css)(this.__line, 'width', this.j.container.clientWidth);
|
|
27642
27656
|
}
|
|
27643
27657
|
onLock(isLocked) {
|
|
27644
27658
|
if (isLocked && this.__isShown) {
|
|
@@ -27676,16 +27690,43 @@ const ns = 'addnewline';
|
|
|
27676
27690
|
editor.editor
|
|
27677
27691
|
], '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
27692
|
}
|
|
27693
|
+
/**
|
|
27694
|
+
* A paragraph holding only an embed has no place for the caret, so the
|
|
27695
|
+
* arrow keys can't get past one that ends the content, or before one that
|
|
27696
|
+
* starts it. When an arrow key leaves the caret where it was and there is
|
|
27697
|
+
* content beyond it, a new line goes there, as when the line is clicked.
|
|
27698
|
+
*/ onArrowKey(e) {
|
|
27699
|
+
const editor = this.j;
|
|
27700
|
+
const forward = e.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_DOWN || e.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_RIGHT;
|
|
27701
|
+
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()) {
|
|
27702
|
+
return;
|
|
27703
|
+
}
|
|
27704
|
+
const { startContainer, startOffset } = editor.s.range;
|
|
27705
|
+
// Once the browser has moved the caret, if it could. With a 0 timeout
|
|
27706
|
+
// Jodit would run this at once, before the browser moves it
|
|
27707
|
+
editor.async.setTimeout(()=>{
|
|
27708
|
+
const { range } = editor.s;
|
|
27709
|
+
const block = jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.closest(startContainer, jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock, editor.editor);
|
|
27710
|
+
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)) {
|
|
27711
|
+
return;
|
|
27712
|
+
}
|
|
27713
|
+
const p = editor.createInside.element(editor.o.enter);
|
|
27714
|
+
forward ? jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(editor.editor, p) : jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.prepend(editor.editor, p);
|
|
27715
|
+
editor.s.setCursorIn(p);
|
|
27716
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.scrollIntoViewIfNeeded)(p, editor.editor, editor.ed);
|
|
27717
|
+
editor.synchronizeValues();
|
|
27718
|
+
}, 1);
|
|
27719
|
+
}
|
|
27679
27720
|
onDblClickEditor(e) {
|
|
27680
27721
|
const editor = this.j;
|
|
27681
27722
|
if (!editor.o.readonly && editor.o.addNewLineOnDBLClick && e.target === editor.editor && editor.s.isCollapsed()) {
|
|
27682
|
-
const editorBound = (0,
|
|
27723
|
+
const editorBound = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.offset)(editor.editor, editor, editor.ed);
|
|
27683
27724
|
const top = e.pageY - editor.ew.scrollX;
|
|
27684
27725
|
const p = editor.createInside.element(editor.o.enter);
|
|
27685
27726
|
if (Math.abs(top - editorBound.top) < Math.abs(top - (editorBound.height + editorBound.top)) && editor.editor.firstChild) {
|
|
27686
|
-
|
|
27727
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.prepend(editor.editor, p);
|
|
27687
27728
|
} else {
|
|
27688
|
-
|
|
27729
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(editor.editor, p);
|
|
27689
27730
|
}
|
|
27690
27731
|
editor.s.setCursorIn(p);
|
|
27691
27732
|
editor.synchronizeValues();
|
|
@@ -27699,27 +27740,27 @@ const ns = 'addnewline';
|
|
|
27699
27740
|
// Inside Shadow DOM `document.elementFromPoint` returns the shadow
|
|
27700
27741
|
// host, so the lookup must start from the shadow root
|
|
27701
27742
|
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 (!
|
|
27743
|
+
if (!jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isHTMLElement(currentElement) || !jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isOrContains(editor.editor, currentElement)) {
|
|
27703
27744
|
return;
|
|
27704
27745
|
}
|
|
27705
27746
|
if (editor.editor !== currentElement && !this.__isMatchedTag(currentElement)) {
|
|
27706
|
-
currentElement =
|
|
27747
|
+
currentElement = jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.closest(currentElement, this.__isMatchedTag, editor.editor);
|
|
27707
27748
|
}
|
|
27708
27749
|
if (!currentElement) {
|
|
27709
27750
|
this.__hide();
|
|
27710
27751
|
return;
|
|
27711
27752
|
}
|
|
27712
27753
|
if (this.__isMatchedTag(currentElement)) {
|
|
27713
|
-
const parentBox =
|
|
27754
|
+
const parentBox = jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.up(currentElement, jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock, editor.editor);
|
|
27714
27755
|
if (parentBox && parentBox !== editor.editor) {
|
|
27715
27756
|
currentElement = parentBox;
|
|
27716
27757
|
}
|
|
27717
27758
|
}
|
|
27718
|
-
const pos = (0,
|
|
27759
|
+
const pos = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.position)(currentElement, this.j);
|
|
27719
27760
|
let top = false;
|
|
27720
27761
|
let { clientY, clientX } = e;
|
|
27721
27762
|
if (this.j.iframe) {
|
|
27722
|
-
const { top, left } = (0,
|
|
27763
|
+
const { top, left } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.position)(this.j.iframe, this.j, true);
|
|
27723
27764
|
clientY += top;
|
|
27724
27765
|
clientX += left;
|
|
27725
27766
|
}
|
|
@@ -27732,8 +27773,8 @@ const ns = 'addnewline';
|
|
|
27732
27773
|
this.__isBeforeContent = false;
|
|
27733
27774
|
}
|
|
27734
27775
|
const isEditor = editor.editor === currentElement;
|
|
27735
|
-
if (top !== false && (isEditor && !this.__isBeforeContent || !isEditor && !(0,
|
|
27736
|
-
(0,
|
|
27776
|
+
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))) {
|
|
27777
|
+
(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_6__.css)(this.__line, 'top', top);
|
|
27737
27778
|
this.__current = currentElement;
|
|
27738
27779
|
this.__show();
|
|
27739
27780
|
this.__line.style.setProperty('--jd-anl-handle-offset', clientX - pos.left - 10 + 'px');
|
|
@@ -27745,7 +27786,7 @@ const ns = 'addnewline';
|
|
|
27745
27786
|
/** @override */ beforeDestruct() {
|
|
27746
27787
|
this.j.async.clearTimeout(this.__timeout);
|
|
27747
27788
|
this.j.e.off(this.__line).off('changePlace', this.__addEventListeners);
|
|
27748
|
-
|
|
27789
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.safeRemove(this.__line);
|
|
27749
27790
|
this.j.e.off([
|
|
27750
27791
|
this.j.ow,
|
|
27751
27792
|
this.j.ew,
|
|
@@ -27753,31 +27794,31 @@ const ns = 'addnewline';
|
|
|
27753
27794
|
], '.' + ns).off(this.j.container, '.' + ns).off('.' + ns);
|
|
27754
27795
|
}
|
|
27755
27796
|
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>${
|
|
27797
|
+
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
27798
|
if (!this.__isShown) {
|
|
27758
27799
|
return;
|
|
27759
27800
|
}
|
|
27760
27801
|
this.__isShown = false;
|
|
27761
27802
|
this.j.async.clearTimeout(this.__timeout);
|
|
27762
27803
|
this.__lineInFocus = false;
|
|
27763
|
-
|
|
27804
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.safeRemove(this.__line);
|
|
27764
27805
|
this.__line.style.setProperty('--jd-anl-handle-offset', '0');
|
|
27765
27806
|
}), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__canGetFocus", (elm)=>{
|
|
27766
|
-
return elm != null &&
|
|
27807
|
+
return elm != null && jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock(elm) && !/^(img|table|iframe|hr)$/i.test(elm.nodeName);
|
|
27767
27808
|
}), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__onClickLine", (e)=>{
|
|
27768
27809
|
const editor = this.j;
|
|
27769
27810
|
const p = editor.createInside.element(editor.o.enter);
|
|
27770
27811
|
if (this.__isBeforeContent && this.__current && this.__current.parentNode) {
|
|
27771
27812
|
if (this.__current === editor.editor) {
|
|
27772
|
-
|
|
27813
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.prepend(editor.editor, p);
|
|
27773
27814
|
} else {
|
|
27774
|
-
|
|
27815
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.before(this.__current, p);
|
|
27775
27816
|
}
|
|
27776
27817
|
} else {
|
|
27777
|
-
|
|
27818
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(editor.editor, p);
|
|
27778
27819
|
}
|
|
27779
27820
|
editor.s.setCursorIn(p);
|
|
27780
|
-
(0,
|
|
27821
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.scrollIntoViewIfNeeded)(p, editor.editor, editor.ed);
|
|
27781
27822
|
editor.synchronizeValues();
|
|
27782
27823
|
this.__hideForce();
|
|
27783
27824
|
e.preventDefault();
|
|
@@ -27785,18 +27826,21 @@ const ns = 'addnewline';
|
|
|
27785
27826
|
}
|
|
27786
27827
|
}
|
|
27787
27828
|
;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
27788
|
-
(0,
|
|
27829
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':lock')
|
|
27789
27830
|
], addNewLine.prototype, "onLock", null);
|
|
27790
27831
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
27791
|
-
|
|
27832
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
27792
27833
|
], addNewLine.prototype, "__hide", null);
|
|
27793
27834
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
27794
|
-
(0,
|
|
27835
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':keydown')
|
|
27836
|
+
], addNewLine.prototype, "onArrowKey", null);
|
|
27837
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
27838
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':dblclick')
|
|
27795
27839
|
], addNewLine.prototype, "onDblClickEditor", null);
|
|
27796
27840
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
27797
|
-
(0,
|
|
27841
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.throttle)((ctx)=>ctx.defaultTimeout)
|
|
27798
27842
|
], addNewLine.prototype, "__onMouseMove", null);
|
|
27799
|
-
|
|
27843
|
+
jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('addNewLine', addNewLine);
|
|
27800
27844
|
|
|
27801
27845
|
|
|
27802
27846
|
/***/ }),
|
|
@@ -28367,6 +28411,7 @@ UiAiAssistant = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decor
|
|
|
28367
28411
|
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(33831);
|
|
28368
28412
|
/* harmony import */ var _cases_check_not_collapsed__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(89827);
|
|
28369
28413
|
/* harmony import */ var _cases__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(17523);
|
|
28414
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(15200);
|
|
28370
28415
|
/*!
|
|
28371
28416
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
28372
28417
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -28385,6 +28430,7 @@ UiAiAssistant = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decor
|
|
|
28385
28430
|
|
|
28386
28431
|
|
|
28387
28432
|
|
|
28433
|
+
|
|
28388
28434
|
class backspace extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugin {
|
|
28389
28435
|
afterInit(jodit) {
|
|
28390
28436
|
jodit.registerCommand('deleteButton', {
|
|
@@ -28462,14 +28508,50 @@ class backspace extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugin {
|
|
|
28462
28508
|
throw e;
|
|
28463
28509
|
} finally{
|
|
28464
28510
|
jodit.e.fire('backSpaceAfterDelete', backspace, fakeNode);
|
|
28511
|
+
this.moveCaretToTextBefore(fakeNode);
|
|
28465
28512
|
this.safeRemoveEmptyNode(fakeNode);
|
|
28466
28513
|
}
|
|
28467
28514
|
return false;
|
|
28468
28515
|
}
|
|
28516
|
+
/**
|
|
28517
|
+
* The browser types at the end of the text before the caret on its line,
|
|
28518
|
+
* in that text's formatting, but not inside a link. Moving the caret there
|
|
28519
|
+
* too makes a paste and the toolbar agree with what's typed:
|
|
28520
|
+
* `<p>one</p><p><b>|two</b></p>` joins to `<p>one|<b>two</b></p>`
|
|
28521
|
+
*/ moveCaretToTextBefore(fakeNode) {
|
|
28522
|
+
var _ref;
|
|
28523
|
+
var _text_nodeValue;
|
|
28524
|
+
const { jodit } = this;
|
|
28525
|
+
const { range } = jodit.s;
|
|
28526
|
+
// A case may have merged the fake node away (#1722)
|
|
28527
|
+
if (!fakeNode.parentNode) {
|
|
28528
|
+
return;
|
|
28529
|
+
}
|
|
28530
|
+
const around = jodit.ed.createRange();
|
|
28531
|
+
around.selectNode(fakeNode);
|
|
28532
|
+
if (!range.collapsed || !around.isPointInRange(range.startContainer, range.startOffset)) {
|
|
28533
|
+
return;
|
|
28534
|
+
}
|
|
28535
|
+
const text = (0,_helpers__WEBPACK_IMPORTED_MODULE_10__.findMostNestedNeighbor)(fakeNode, false, jodit.editor, true);
|
|
28536
|
+
const link = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(text, 'a', jodit.editor);
|
|
28537
|
+
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)) {
|
|
28538
|
+
return;
|
|
28539
|
+
}
|
|
28540
|
+
range.setStart(text, (_ref = (_text_nodeValue = text.nodeValue) === null || _text_nodeValue === void 0 ? void 0 : _text_nodeValue.length) !== null && _ref !== void 0 ? _ref : 0);
|
|
28541
|
+
range.collapse(true);
|
|
28542
|
+
jodit.s.selectRange(range);
|
|
28543
|
+
}
|
|
28469
28544
|
/**
|
|
28470
28545
|
* Remove node and replace cursor position out of it
|
|
28471
28546
|
*/ safeRemoveEmptyNode(fakeNode) {
|
|
28547
|
+
var _fakeNode_nodeValue;
|
|
28472
28548
|
const { range } = this.j.s;
|
|
28549
|
+
// wrap-nodes normalizes the line it wraps, which can merge the text
|
|
28550
|
+
// after the fake node into it: remove only the fake node's own space
|
|
28551
|
+
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))) {
|
|
28552
|
+
fakeNode.deleteData(0, jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.INVISIBLE_SPACE.length);
|
|
28553
|
+
return;
|
|
28554
|
+
}
|
|
28473
28555
|
if (range.startContainer === fakeNode) {
|
|
28474
28556
|
if (fakeNode.previousSibling) {
|
|
28475
28557
|
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(fakeNode.previousSibling)) {
|
|
@@ -28523,6 +28605,11 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
|
|
|
28523
28605
|
* Check if two separate elements can be connected
|
|
28524
28606
|
* @private
|
|
28525
28607
|
*/ function checkJoinNeighbors(jodit, fakeNode, backspace) {
|
|
28608
|
+
return joinNeighbors(jodit, fakeNode, backspace, false);
|
|
28609
|
+
}
|
|
28610
|
+
/**
|
|
28611
|
+
* `moved` is set on the one re-entrant pass after `moveToNextLine`
|
|
28612
|
+
*/ function joinNeighbors(jodit, fakeNode, backspace, moved) {
|
|
28526
28613
|
if (checkJoinBareText(jodit, fakeNode, backspace)) {
|
|
28527
28614
|
return true;
|
|
28528
28615
|
}
|
|
@@ -28538,6 +28625,9 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
|
|
|
28538
28625
|
return false;
|
|
28539
28626
|
}
|
|
28540
28627
|
const sibling = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(mainClosestBox, backspace);
|
|
28628
|
+
if (moveInlinesInside(jodit, fakeNode, sibling)) {
|
|
28629
|
+
return joinNeighbors(jodit, fakeNode, backspace, moved);
|
|
28630
|
+
}
|
|
28541
28631
|
// A line break before the cursor is a single unit: remove it instead of
|
|
28542
28632
|
// merging the current element into the (void) `<br>`, which used to move
|
|
28543
28633
|
// the whole element's content into the `<br>` and delete it (#1282).
|
|
@@ -28552,7 +28642,19 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
|
|
|
28552
28642
|
jodit.s.setCursorBefore(fakeNode);
|
|
28553
28643
|
return true;
|
|
28554
28644
|
}
|
|
28645
|
+
// A non-editable sibling is removed by remove-not-editable, never joined
|
|
28646
|
+
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)) {
|
|
28647
|
+
return false;
|
|
28648
|
+
}
|
|
28555
28649
|
const box = findCaretBox(fakeNode, mainClosestBox);
|
|
28650
|
+
// One pass only: the line now sits beside the next one, so the
|
|
28651
|
+
// cases below join them. The DOM has changed either way
|
|
28652
|
+
if (!moved && sibling && moveToNextLine(jodit, fakeNode, box, sibling, backspace)) {
|
|
28653
|
+
if (!joinNeighbors(jodit, fakeNode, backspace, true)) {
|
|
28654
|
+
jodit.s.setCursorBefore(fakeNode);
|
|
28655
|
+
}
|
|
28656
|
+
return true;
|
|
28657
|
+
}
|
|
28556
28658
|
if (sibling && (checkPullNextLine(jodit, fakeNode, box, sibling, backspace) || checkMoveListContent(jodit, box, sibling, backspace) || checkJoinInlineSibling(jodit, box, sibling, backspace) || moveContentAndRemoveEmpty(jodit, box, findEdgeBlock(resolveTableSibling(sibling, backspace), backspace, jodit.editor), backspace))) {
|
|
28557
28659
|
jodit.s.setCursorBefore(fakeNode);
|
|
28558
28660
|
return true;
|
|
@@ -28572,6 +28674,60 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
|
|
|
28572
28674
|
}
|
|
28573
28675
|
return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(block) && block.parentElement ? block.parentElement : block;
|
|
28574
28676
|
}
|
|
28677
|
+
/**
|
|
28678
|
+
* With an inline element round the caret's line or the one it joins moved
|
|
28679
|
+
* inside its blocks, the cases join the lines as they join any two, and its
|
|
28680
|
+
* styles stay with its text. One round both lines is left as it is.
|
|
28681
|
+
*/ function moveInlinesInside(jodit, fakeNode, sibling) {
|
|
28682
|
+
if (!sibling) {
|
|
28683
|
+
return false;
|
|
28684
|
+
}
|
|
28685
|
+
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);
|
|
28686
|
+
return moveInlineInside(around, jodit.editor) || moveInlineInside(sibling, jodit.editor);
|
|
28687
|
+
}
|
|
28688
|
+
/**
|
|
28689
|
+
* Old content can have an inline element round blocks. This moves it inside
|
|
28690
|
+
* them, and gives the text, images and line breaks beside them a copy of
|
|
28691
|
+
* their own: `<span style="…"><p>one</p><br><p>two</p></span>` becomes
|
|
28692
|
+
* `<p><span style="…">one</span></p><span style="…"><br></span><p><span style="…">two</span></p>`
|
|
28693
|
+
*/ function moveInlineInside(node, root) {
|
|
28694
|
+
if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(node) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(node)) {
|
|
28695
|
+
return false;
|
|
28696
|
+
}
|
|
28697
|
+
// Embedded content, such as the `<iframe>` in a video's wrapper, counts
|
|
28698
|
+
// as a block in `Dom.isBlock`, but stays with the text beside it
|
|
28699
|
+
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);
|
|
28700
|
+
// The inner one first: `<span><strong><p>one</p></strong></span>`
|
|
28701
|
+
Array.from(node.childNodes).forEach((child)=>moveInlineInside(child, root));
|
|
28702
|
+
const children = Array.from(node.childNodes);
|
|
28703
|
+
if (!children.some(isBlock)) {
|
|
28704
|
+
return false;
|
|
28705
|
+
}
|
|
28706
|
+
let run = null;
|
|
28707
|
+
for (const child of children){
|
|
28708
|
+
if (!isBlock(child)) {
|
|
28709
|
+
// Blank text between blocks stays where it is
|
|
28710
|
+
if (!run && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmptyTextNode(child)) {
|
|
28711
|
+
run = node.cloneNode(false);
|
|
28712
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(child, run);
|
|
28713
|
+
}
|
|
28714
|
+
run && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(run, child);
|
|
28715
|
+
continue;
|
|
28716
|
+
}
|
|
28717
|
+
run = null;
|
|
28718
|
+
// Nothing goes inside a rule or a non-editable block
|
|
28719
|
+
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)) {
|
|
28720
|
+
continue;
|
|
28721
|
+
}
|
|
28722
|
+
const inner = node.cloneNode(false);
|
|
28723
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.moveContent(child, inner);
|
|
28724
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(child, inner);
|
|
28725
|
+
// A list or a table: on down to its items or cells
|
|
28726
|
+
moveInlineInside(inner, root);
|
|
28727
|
+
}
|
|
28728
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.unwrap(node);
|
|
28729
|
+
return true;
|
|
28730
|
+
}
|
|
28575
28731
|
/**
|
|
28576
28732
|
* The innermost block on the sibling's edge facing the caret, so the
|
|
28577
28733
|
* content is joined to text: `<div><p>one</p></div><p>|two</p>` gives
|
|
@@ -28604,6 +28760,68 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
|
|
|
28604
28760
|
});
|
|
28605
28761
|
return cells.length ? cells[backspace ? cells.length - 1 : 0] : null;
|
|
28606
28762
|
}
|
|
28763
|
+
/**
|
|
28764
|
+
* On Delete, Word joins two lines where the next one is, inside or outside
|
|
28765
|
+
* its box or quote, and the joined line keeps the caret line's kind, list item
|
|
28766
|
+
* or paragraph. Two paragraphs already join that way. When either line is a
|
|
28767
|
+
* list item, this moves the caret's line beside the next one, and the usual
|
|
28768
|
+
* cases then join them: `<p>one|</p><div><ul><li>two</li></ul></div>` becomes
|
|
28769
|
+
* `<div><p>one|</p><ul><li>two</li></ul></div>`
|
|
28770
|
+
* @private
|
|
28771
|
+
*/ function moveToNextLine(jodit, fakeNode, box, sibling, backspace) {
|
|
28772
|
+
if (backspace || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(sibling, 'table') || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(sibling, jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.INSEPARABLE_TAGS) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isContentEditable(sibling, jodit.editor)) {
|
|
28773
|
+
return false;
|
|
28774
|
+
}
|
|
28775
|
+
const line = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.up(fakeNode, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock, box, true);
|
|
28776
|
+
const next = findEdgeBlock(sibling, false, jodit.editor);
|
|
28777
|
+
if (!line || !next || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isContentEditable(next, jodit.editor) || !(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(line) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(next)) || // A paragraph inside a list item is left as it is
|
|
28778
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(line.parentElement) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(next.parentElement) || boxOf(line) === boxOf(next)) {
|
|
28779
|
+
return false;
|
|
28780
|
+
}
|
|
28781
|
+
const from = line.parentElement;
|
|
28782
|
+
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(line) && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(next)) {
|
|
28783
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(next, line);
|
|
28784
|
+
} else if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(line)) {
|
|
28785
|
+
// A list item keeps its bullet, in a list of its own
|
|
28786
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(next, ownList(line));
|
|
28787
|
+
} else {
|
|
28788
|
+
// A paragraph can't go inside a list, so it goes in front of it
|
|
28789
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(next.parentElement, line);
|
|
28790
|
+
}
|
|
28791
|
+
let remove = from;
|
|
28792
|
+
while(remove && remove !== jodit.editor && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(remove)){
|
|
28793
|
+
const parent = remove.parentElement;
|
|
28794
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(remove);
|
|
28795
|
+
remove = parent;
|
|
28796
|
+
}
|
|
28797
|
+
return true;
|
|
28798
|
+
}
|
|
28799
|
+
/**
|
|
28800
|
+
* The box or quote a line is in, past its lists
|
|
28801
|
+
*/ function boxOf(line) {
|
|
28802
|
+
let box = line.parentElement;
|
|
28803
|
+
while(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isList(box) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(box)){
|
|
28804
|
+
box = box.parentElement;
|
|
28805
|
+
}
|
|
28806
|
+
return box;
|
|
28807
|
+
}
|
|
28808
|
+
/**
|
|
28809
|
+
* Moves a list item into a list of its own, which carries on its numbering
|
|
28810
|
+
*/ function ownList(item) {
|
|
28811
|
+
const list = item.parentElement;
|
|
28812
|
+
const own = list.cloneNode(false);
|
|
28813
|
+
const index = Array.from(list.children).indexOf(item);
|
|
28814
|
+
if (index) {
|
|
28815
|
+
// Two lists cannot share one id
|
|
28816
|
+
own.removeAttribute('id');
|
|
28817
|
+
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(list, 'ol')) {
|
|
28818
|
+
const start = parseInt(list.getAttribute('start') || '1', 10) || 1;
|
|
28819
|
+
own.setAttribute('start', String(start + index));
|
|
28820
|
+
}
|
|
28821
|
+
}
|
|
28822
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(own, item);
|
|
28823
|
+
return own;
|
|
28824
|
+
}
|
|
28607
28825
|
/**
|
|
28608
28826
|
* Delete at the edge of a list pulls the next line up to the caret, as the
|
|
28609
28827
|
* browsers do, instead of moving the caret's line into the next block:
|
|
@@ -28870,7 +29088,9 @@ function checkRemoveChar(jodit, fakeNode, backspace, mode, stopBeforeSpace = fal
|
|
|
28870
29088
|
while(jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isInlineBlock(sibling)){
|
|
28871
29089
|
sibling = backspace ? sibling === null || sibling === void 0 ? void 0 : sibling.lastChild : sibling === null || sibling === void 0 ? void 0 : sibling.firstChild;
|
|
28872
29090
|
}
|
|
28873
|
-
|
|
29091
|
+
// A block inside an inline element, such as the `<p>` in
|
|
29092
|
+
// `<span><p>…</p></span>`, isn't a char: the join cases handle it
|
|
29093
|
+
if (!sibling || jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(sibling)) {
|
|
28874
29094
|
break;
|
|
28875
29095
|
}
|
|
28876
29096
|
if ((_sibling_nodeValue = sibling.nodeValue) === null || _sibling_nodeValue === void 0 ? void 0 : _sibling_nodeValue.length) {
|
|
@@ -29019,6 +29239,7 @@ function isSpace(char) {
|
|
|
29019
29239
|
/* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27795);
|
|
29020
29240
|
/* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(65946);
|
|
29021
29241
|
/* harmony import */ var jodit_core_selection_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(42259);
|
|
29242
|
+
/* harmony import */ var _check_join_neighbors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(26106);
|
|
29022
29243
|
/*!
|
|
29023
29244
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
29024
29245
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -29028,23 +29249,48 @@ function isSpace(char) {
|
|
|
29028
29249
|
*/
|
|
29029
29250
|
|
|
29030
29251
|
|
|
29252
|
+
|
|
29031
29253
|
/**
|
|
29032
|
-
* Checks if a non-editable element can be deleted
|
|
29254
|
+
* Checks if a non-editable element can be deleted. A non-editable block goes
|
|
29255
|
+
* whole, and the lines either side of it then join, as the spec's tests do:
|
|
29256
|
+
* `<ul><li>one|</li></ul><div contenteditable="false">x</div><p>two</p>`
|
|
29257
|
+
* gives `<ul><li>one|two</li></ul>`
|
|
29033
29258
|
* @private
|
|
29034
29259
|
*/ function checkRemoveContentNotEditable(jodit, fakeNode, backspace) {
|
|
29035
|
-
let
|
|
29036
|
-
|
|
29037
|
-
|
|
29038
|
-
|
|
29039
|
-
|
|
29040
|
-
|
|
29041
|
-
|
|
29042
|
-
|
|
29043
|
-
(
|
|
29260
|
+
let node = fakeNode;
|
|
29261
|
+
let neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.findSibling(node, backspace);
|
|
29262
|
+
// Past the edges of the blocks the caret is at, but not into a table cell
|
|
29263
|
+
while(!neighbor && node.parentElement && node.parentElement !== jodit.editor && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isCell(node.parentElement)){
|
|
29264
|
+
node = node.parentElement;
|
|
29265
|
+
neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.findSibling(node, backspace);
|
|
29266
|
+
// At the start of a list item, Backspace takes the bullet off first,
|
|
29267
|
+
// unless the item before it is a non-editable one to remove
|
|
29268
|
+
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))) {
|
|
29269
|
+
return false;
|
|
29270
|
+
}
|
|
29271
|
+
}
|
|
29272
|
+
if (isNotEditable(jodit, neighbor)) {
|
|
29273
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isBlock(neighbor)) {
|
|
29274
|
+
// Backspace after a removed list item leaves the items apart: the
|
|
29275
|
+
// next press takes the bullet off, as for any later item
|
|
29276
|
+
const joinLines = !(backspace && jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isLeaf(neighbor));
|
|
29277
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.safeRemove(neighbor);
|
|
29278
|
+
if (joinLines) {
|
|
29279
|
+
(0,_check_join_neighbors__WEBPACK_IMPORTED_MODULE_3__.checkJoinNeighbors)(jodit, fakeNode, backspace);
|
|
29280
|
+
}
|
|
29281
|
+
} else {
|
|
29282
|
+
(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);
|
|
29283
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.safeRemove(neighbor);
|
|
29284
|
+
(0,jodit_core_selection_helpers__WEBPACK_IMPORTED_MODULE_2__.moveNodeInsideStart)(jodit, fakeNode, backspace);
|
|
29285
|
+
}
|
|
29286
|
+
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.call)(backspace ? jodit.s.setCursorBefore : jodit.s.setCursorAfter, fakeNode);
|
|
29044
29287
|
return true;
|
|
29045
29288
|
}
|
|
29046
29289
|
return false;
|
|
29047
29290
|
}
|
|
29291
|
+
function isNotEditable(jodit, node) {
|
|
29292
|
+
return jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isElement(node) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isContentEditable(node, jodit.editor);
|
|
29293
|
+
}
|
|
29048
29294
|
|
|
29049
29295
|
|
|
29050
29296
|
/***/ }),
|
|
@@ -48821,12 +49067,13 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
|
|
|
48821
49067
|
"use strict";
|
|
48822
49068
|
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
|
|
48823
49069
|
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
|
|
48824
|
-
/* harmony import */ var
|
|
48825
|
-
/* harmony import */ var
|
|
48826
|
-
/* harmony import */ var
|
|
48827
|
-
/* harmony import */ var
|
|
48828
|
-
/* harmony import */ var
|
|
48829
|
-
/* harmony import */ var
|
|
49070
|
+
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
|
|
49071
|
+
/* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
|
|
49072
|
+
/* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(27795);
|
|
49073
|
+
/* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
|
|
49074
|
+
/* harmony import */ var jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(85932);
|
|
49075
|
+
/* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
|
|
49076
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(86038);
|
|
48830
49077
|
/*!
|
|
48831
49078
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
48832
49079
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -48843,9 +49090,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
|
|
|
48843
49090
|
|
|
48844
49091
|
|
|
48845
49092
|
|
|
49093
|
+
|
|
48846
49094
|
/**
|
|
48847
49095
|
* Wrap single text nodes in block wrapper
|
|
48848
|
-
*/ class wrapNodes extends
|
|
49096
|
+
*/ class wrapNodes extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
|
|
48849
49097
|
/** @override **/ afterInit(jodit) {
|
|
48850
49098
|
if (jodit.o.enter.toLowerCase() === 'br') {
|
|
48851
49099
|
return;
|
|
@@ -48874,10 +49122,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
|
|
|
48874
49122
|
}
|
|
48875
49123
|
isChanged = true;
|
|
48876
49124
|
const box = jodit.createInside.element(jodit.o.enter);
|
|
48877
|
-
|
|
48878
|
-
|
|
49125
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.before(child, box);
|
|
49126
|
+
// `exclude` keeps a <br> from starting a box, but one between loose lines stays with them
|
|
49127
|
+
while(child && (this.isSuitable(child) || jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(child, 'br'))){
|
|
48879
49128
|
const next = child.nextSibling;
|
|
48880
|
-
|
|
49129
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(box, child);
|
|
48881
49130
|
child = next;
|
|
48882
49131
|
}
|
|
48883
49132
|
box.normalize();
|
|
@@ -48901,8 +49150,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
|
|
|
48901
49150
|
}
|
|
48902
49151
|
const box = jodit.createInside.element(jodit.o.enter);
|
|
48903
49152
|
const br = jodit.createInside.element('br');
|
|
48904
|
-
|
|
48905
|
-
|
|
49153
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(box, br);
|
|
49154
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(jodit.editor, box);
|
|
48906
49155
|
if (jodit.s.isFocused() || jodit.e.current === 'backSpaceAfterDelete') {
|
|
48907
49156
|
jodit.s.setCursorBefore(br);
|
|
48908
49157
|
}
|
|
@@ -48913,30 +49162,41 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
|
|
|
48913
49162
|
* Found Node which should be wrapped
|
|
48914
49163
|
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isSuitableStart", (n)=>{
|
|
48915
49164
|
var _n_parentNode;
|
|
48916
|
-
return
|
|
49165
|
+
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);
|
|
48917
49166
|
}), /**
|
|
48918
49167
|
* Node should add in a block element
|
|
48919
|
-
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isSuitable", (n)=>
|
|
49168
|
+
*/ (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)), /**
|
|
48920
49169
|
* Some element which needs to append in block
|
|
48921
|
-
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isNotWrapped", (n)=>
|
|
49170
|
+
*/ (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)));
|
|
48922
49171
|
}
|
|
48923
49172
|
}
|
|
48924
49173
|
;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
48925
|
-
|
|
49174
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
48926
49175
|
], wrapNodes.prototype, "postProcessSetEditorValue", null);
|
|
48927
49176
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
48928
|
-
|
|
49177
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
48929
49178
|
], wrapNodes.prototype, "preprocessInput", null);
|
|
49179
|
+
/**
|
|
49180
|
+
* A block can't go in a paragraph, so neither can an element that holds one,
|
|
49181
|
+
* such as a `<span>` round a `<p>`. Embedded content such as an `<iframe>` can.
|
|
49182
|
+
*/ function holdsBlock(elm) {
|
|
49183
|
+
for (const node of jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.eachGen(elm)){
|
|
49184
|
+
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)) {
|
|
49185
|
+
return true;
|
|
49186
|
+
}
|
|
49187
|
+
}
|
|
49188
|
+
return false;
|
|
49189
|
+
}
|
|
48930
49190
|
function checkAloneListLeaf(child, jodit) {
|
|
48931
49191
|
let result = child;
|
|
48932
49192
|
let next = child;
|
|
48933
49193
|
do {
|
|
48934
|
-
if (
|
|
48935
|
-
const nextChild =
|
|
48936
|
-
if (
|
|
48937
|
-
|
|
49194
|
+
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)) {
|
|
49195
|
+
const nextChild = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.findNotEmptySibling(next, false);
|
|
49196
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(result, 'ul')) {
|
|
49197
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(result, next);
|
|
48938
49198
|
} else {
|
|
48939
|
-
result =
|
|
49199
|
+
result = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.wrap(next, 'ul', jodit.createInside);
|
|
48940
49200
|
}
|
|
48941
49201
|
next = nextChild;
|
|
48942
49202
|
} else {
|
|
@@ -48945,7 +49205,7 @@ function checkAloneListLeaf(child, jodit) {
|
|
|
48945
49205
|
}while (next)
|
|
48946
49206
|
return result;
|
|
48947
49207
|
}
|
|
48948
|
-
|
|
49208
|
+
jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('wrapNodes', wrapNodes);
|
|
48949
49209
|
|
|
48950
49210
|
|
|
48951
49211
|
/***/ }),
|