jodit 4.18.10 → 4.18.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +5 -5
  4. package/es2015/jodit.js +256 -71
  5. package/es2015/jodit.min.js +5 -5
  6. package/es2015/plugins/debug/debug.css +1 -1
  7. package/es2015/plugins/debug/debug.js +1 -1
  8. package/es2015/plugins/debug/debug.min.js +1 -1
  9. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  10. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  12. package/es2018/jodit.fat.min.js +5 -5
  13. package/es2018/jodit.min.js +5 -5
  14. package/es2018/plugins/debug/debug.min.js +1 -1
  15. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  16. package/es2021/jodit.css +1 -1
  17. package/es2021/jodit.fat.min.js +6 -6
  18. package/es2021/jodit.js +253 -71
  19. package/es2021/jodit.min.js +6 -6
  20. package/es2021/plugins/debug/debug.css +1 -1
  21. package/es2021/plugins/debug/debug.js +1 -1
  22. package/es2021/plugins/debug/debug.min.js +1 -1
  23. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  24. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  25. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  26. package/es2021.en/jodit.css +1 -1
  27. package/es2021.en/jodit.fat.min.js +6 -6
  28. package/es2021.en/jodit.js +253 -71
  29. package/es2021.en/jodit.min.js +6 -6
  30. package/es2021.en/plugins/debug/debug.css +1 -1
  31. package/es2021.en/plugins/debug/debug.js +1 -1
  32. package/es2021.en/plugins/debug/debug.min.js +1 -1
  33. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  34. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  35. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  36. package/es5/jodit.css +2 -2
  37. package/es5/jodit.fat.min.js +2 -2
  38. package/es5/jodit.js +303 -72
  39. package/es5/jodit.min.css +2 -2
  40. package/es5/jodit.min.js +2 -2
  41. package/es5/plugins/debug/debug.css +1 -1
  42. package/es5/plugins/debug/debug.js +1 -1
  43. package/es5/plugins/debug/debug.min.js +1 -1
  44. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  45. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  46. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  47. package/es5/polyfills.fat.min.js +2 -2
  48. package/es5/polyfills.js +3 -3
  49. package/es5/polyfills.min.js +2 -2
  50. package/esm/core/async/async.js +2 -1
  51. package/esm/core/constants.js +1 -1
  52. package/esm/core/helpers/size/get-fixed-position-offset.d.ts +4 -2
  53. package/esm/core/helpers/size/get-fixed-position-offset.js +14 -2
  54. package/esm/plugins/add-new-line/add-new-line.d.ts +7 -0
  55. package/esm/plugins/add-new-line/add-new-line.js +45 -0
  56. package/esm/plugins/backspace/backspace.d.ts +7 -0
  57. package/esm/plugins/backspace/backspace.js +45 -2
  58. package/esm/plugins/backspace/cases/check-join-neighbors.js +69 -1
  59. package/esm/plugins/backspace/cases/check-remove-char.js +3 -1
  60. package/esm/plugins/backspace/cases/check-remove-content-not-editable.d.ts +4 -1
  61. package/esm/plugins/backspace/cases/check-remove-content-not-editable.js +39 -11
  62. package/esm/plugins/wrap-nodes/wrap-nodes.js +19 -2
  63. package/esm/types/async.d.ts +7 -0
  64. package/package.json +1 -1
  65. package/types/core/helpers/size/get-fixed-position-offset.d.ts +4 -2
  66. package/types/plugins/add-new-line/add-new-line.d.ts +7 -0
  67. package/types/plugins/backspace/backspace.d.ts +7 -0
  68. package/types/plugins/backspace/cases/check-remove-content-not-editable.d.ts +4 -1
  69. package/types/types/async.d.ts +7 -0
@@ -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.10
4
+ * Version: v4.18.11
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1443,7 +1443,8 @@ class Async {
1443
1443
  this.__requestsIdle.forEach((key)=>this.cancelIdleCallback(key));
1444
1444
  this.__requestsRaf.forEach((key)=>this.cancelAnimationFrame(key));
1445
1445
  this.__controllers.forEach((controller)=>controller.abort());
1446
- this.timers.forEach((key)=>(0,jodit_core_helpers_async__WEBPACK_IMPORTED_MODULE_2__.clearTimeout)(this.timers.get(key)));
1446
+ // A labelled timer is kept under its label, so clear by the value
1447
+ this.timers.forEach((timer)=>(0,jodit_core_helpers_async__WEBPACK_IMPORTED_MODULE_2__.clearTimeout)(timer));
1447
1448
  this.timers.clear();
1448
1449
  this.promisesRejections.forEach((reject)=>reject());
1449
1450
  this.promisesRejections.clear();
@@ -1822,7 +1823,7 @@ __webpack_require__.r(__webpack_exports__);
1822
1823
  * ```
1823
1824
  * @packageDocumentation
1824
1825
  * @module constants
1825
- */ const APP_VERSION = "4.18.10";
1826
+ */ const APP_VERSION = "4.18.11";
1826
1827
  // prettier-ignore
1827
1828
  const ES = "es2021";
1828
1829
  const IS_ES_MODERN = true;
@@ -7188,8 +7189,10 @@ function normalizeCssValue(key, value) {
7188
7189
  * ancestor's top-left corner. The returned offset should be subtracted from
7189
7190
  * the desired viewport coordinates before applying them.
7190
7191
  *
7191
- * Returns `{ x: 0, y: 0 }` when no such ancestor exists (the common case), so
7192
- * call sites keep their previous behaviour unchanged.
7192
+ * Without such an ancestor the containing block is the layout viewport. Its
7193
+ * offset is `{ x: 0, y: 0 }` in most browsers, but WebKit measures client
7194
+ * rects from the visual viewport, so once the page is pinch-zoomed and panned
7195
+ * the layout viewport starts above and to the left of the client origin.
7193
7196
  */ function getFixedPositionOffset(elm) {
7194
7197
  const win = elm.ownerDocument?.defaultView;
7195
7198
  let node = elm.parentElement;
@@ -7203,6 +7206,15 @@ function normalizeCssValue(key, value) {
7203
7206
  }
7204
7207
  node = node.parentElement;
7205
7208
  }
7209
+ const vv = win?.visualViewport;
7210
+ // WebKit's `scrollX`/`scrollY` follow the visual viewport too (truncated),
7211
+ // where Blink's and Gecko's follow the layout viewport
7212
+ if (win && vv && (vv.offsetLeft || vv.offsetTop) && Math.abs(vv.pageLeft - win.scrollX) < 1 && Math.abs(vv.pageTop - win.scrollY) < 1) {
7213
+ return {
7214
+ x: -Math.round(vv.offsetLeft),
7215
+ y: -Math.round(vv.offsetTop)
7216
+ };
7217
+ }
7206
7218
  return {
7207
7219
  x: 0,
7208
7220
  y: 0
@@ -27357,12 +27369,13 @@ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__.Icon.set('about', (_about_svg__W
27357
27369
  /* unused harmony export addNewLine */
27358
27370
  /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
27359
27371
  /* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
27360
- /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(84839);
27361
- /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(28077);
27362
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(65946);
27363
- /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(80991);
27364
- /* harmony import */ var jodit_modules__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(60936);
27365
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(10685);
27372
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
27373
+ /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
27374
+ /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(28077);
27375
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65946);
27376
+ /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(80991);
27377
+ /* harmony import */ var jodit_modules__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(60936);
27378
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(10685);
27366
27379
  /*!
27367
27380
  * Jodit Editor (https://xdsoft.net/jodit/)
27368
27381
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -27380,10 +27393,11 @@ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__.Icon.set('about', (_about_svg__W
27380
27393
 
27381
27394
 
27382
27395
 
27396
+
27383
27397
  const ns = 'addnewline';
27384
27398
  /**
27385
27399
  * Create helper for adding new paragraph(Jodit.defaultOptions.enter tag) before iframe, table or image
27386
- */ class addNewLine extends jodit_modules__WEBPACK_IMPORTED_MODULE_6__.Plugin {
27400
+ */ class addNewLine extends jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Plugin {
27387
27401
  __show() {
27388
27402
  if (this.j.o.readonly || this.j.isLocked) {
27389
27403
  return;
@@ -27393,8 +27407,8 @@ const ns = 'addnewline';
27393
27407
  return;
27394
27408
  }
27395
27409
  this.__isShown = true;
27396
- jodit_modules__WEBPACK_IMPORTED_MODULE_6__.Dom.append(this.j.container, this.__line);
27397
- (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_5__.css)(this.__line, 'width', this.j.container.clientWidth);
27410
+ jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(this.j.container, this.__line);
27411
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_6__.css)(this.__line, 'width', this.j.container.clientWidth);
27398
27412
  }
27399
27413
  onLock(isLocked) {
27400
27414
  if (isLocked && this.__isShown) {
@@ -27432,16 +27446,43 @@ const ns = 'addnewline';
27432
27446
  editor.editor
27433
27447
  ], 'scroll' + '.' + ns, this.__hideForce).on('finishedCleanHTMLWorker' + '.' + ns, this.__hideForce).on(editor.editor, 'click' + '.' + ns, this.__hide).on(editor.container, 'mouseleave' + '.' + ns, this.__hide).on(editor.editor, 'mousemove' + '.' + ns, this.__onMouseMove);
27434
27448
  }
27449
+ /**
27450
+ * A paragraph holding only an embed has no place for the caret, so the
27451
+ * arrow keys can't get past one that ends the content, or before one that
27452
+ * starts it. When an arrow key leaves the caret where it was and there is
27453
+ * content beyond it, a new line goes there, as when the line is clicked.
27454
+ */ onArrowKey(e) {
27455
+ const editor = this.j;
27456
+ const forward = e.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_DOWN || e.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_RIGHT;
27457
+ if (!editor.o.addNewLine || editor.o.readonly || editor.isLocked || e.shiftKey || !(forward || e.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_UP || e.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_LEFT) || !editor.s.isCollapsed()) {
27458
+ return;
27459
+ }
27460
+ const { startContainer, startOffset } = editor.s.range;
27461
+ // Once the browser has moved the caret, if it could. With a 0 timeout
27462
+ // Jodit would run this at once, before the browser moves it
27463
+ editor.async.setTimeout(()=>{
27464
+ const { range } = editor.s;
27465
+ const block = jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.closest(startContainer, jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock, editor.editor);
27466
+ if (e.defaultPrevented || !editor.s.isInsideArea || !range.collapsed || range.startContainer !== startContainer || range.startOffset !== startOffset || !block || !jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.findNotEmptyNeighbor(block, !forward, editor.editor)) {
27467
+ return;
27468
+ }
27469
+ const p = editor.createInside.element(editor.o.enter);
27470
+ forward ? jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(editor.editor, p) : jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.prepend(editor.editor, p);
27471
+ editor.s.setCursorIn(p);
27472
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.scrollIntoViewIfNeeded)(p, editor.editor, editor.ed);
27473
+ editor.synchronizeValues();
27474
+ }, 1);
27475
+ }
27435
27476
  onDblClickEditor(e) {
27436
27477
  const editor = this.j;
27437
27478
  if (!editor.o.readonly && editor.o.addNewLineOnDBLClick && e.target === editor.editor && editor.s.isCollapsed()) {
27438
- const editorBound = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.offset)(editor.editor, editor, editor.ed);
27479
+ const editorBound = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.offset)(editor.editor, editor, editor.ed);
27439
27480
  const top = e.pageY - editor.ew.scrollX;
27440
27481
  const p = editor.createInside.element(editor.o.enter);
27441
27482
  if (Math.abs(top - editorBound.top) < Math.abs(top - (editorBound.height + editorBound.top)) && editor.editor.firstChild) {
27442
- jodit_modules__WEBPACK_IMPORTED_MODULE_6__.Dom.prepend(editor.editor, p);
27483
+ jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.prepend(editor.editor, p);
27443
27484
  } else {
27444
- jodit_modules__WEBPACK_IMPORTED_MODULE_6__.Dom.append(editor.editor, p);
27485
+ jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(editor.editor, p);
27445
27486
  }
27446
27487
  editor.s.setCursorIn(p);
27447
27488
  editor.synchronizeValues();
@@ -27454,27 +27495,27 @@ const ns = 'addnewline';
27454
27495
  // Inside Shadow DOM `document.elementFromPoint` returns the shadow
27455
27496
  // host, so the lookup must start from the shadow root
27456
27497
  let currentElement = (editor.o.shadowRoot ?? editor.ed).elementFromPoint(e.clientX, e.clientY);
27457
- if (!jodit_modules__WEBPACK_IMPORTED_MODULE_6__.Dom.isHTMLElement(currentElement) || !jodit_modules__WEBPACK_IMPORTED_MODULE_6__.Dom.isOrContains(editor.editor, currentElement)) {
27498
+ if (!jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isHTMLElement(currentElement) || !jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isOrContains(editor.editor, currentElement)) {
27458
27499
  return;
27459
27500
  }
27460
27501
  if (editor.editor !== currentElement && !this.__isMatchedTag(currentElement)) {
27461
- currentElement = jodit_modules__WEBPACK_IMPORTED_MODULE_6__.Dom.closest(currentElement, this.__isMatchedTag, editor.editor);
27502
+ currentElement = jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.closest(currentElement, this.__isMatchedTag, editor.editor);
27462
27503
  }
27463
27504
  if (!currentElement) {
27464
27505
  this.__hide();
27465
27506
  return;
27466
27507
  }
27467
27508
  if (this.__isMatchedTag(currentElement)) {
27468
- const parentBox = jodit_modules__WEBPACK_IMPORTED_MODULE_6__.Dom.up(currentElement, jodit_modules__WEBPACK_IMPORTED_MODULE_6__.Dom.isBlock, editor.editor);
27509
+ const parentBox = jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.up(currentElement, jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock, editor.editor);
27469
27510
  if (parentBox && parentBox !== editor.editor) {
27470
27511
  currentElement = parentBox;
27471
27512
  }
27472
27513
  }
27473
- const pos = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.position)(currentElement, this.j);
27514
+ const pos = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.position)(currentElement, this.j);
27474
27515
  let top = false;
27475
27516
  let { clientY, clientX } = e;
27476
27517
  if (this.j.iframe) {
27477
- const { top, left } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.position)(this.j.iframe, this.j, true);
27518
+ const { top, left } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.position)(this.j.iframe, this.j, true);
27478
27519
  clientY += top;
27479
27520
  clientX += left;
27480
27521
  }
@@ -27487,8 +27528,8 @@ const ns = 'addnewline';
27487
27528
  this.__isBeforeContent = false;
27488
27529
  }
27489
27530
  const isEditor = editor.editor === currentElement;
27490
- if (top !== false && (isEditor && !this.__isBeforeContent || !isEditor && !(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.call)(this.__isBeforeContent ? jodit_modules__WEBPACK_IMPORTED_MODULE_6__.Dom.prev : jodit_modules__WEBPACK_IMPORTED_MODULE_6__.Dom.next, currentElement, this.__canGetFocus, editor.editor))) {
27491
- (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_5__.css)(this.__line, 'top', top);
27531
+ if (top !== false && (isEditor && !this.__isBeforeContent || !isEditor && !(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.call)(this.__isBeforeContent ? jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.prev : jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.next, currentElement, this.__canGetFocus, editor.editor))) {
27532
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_6__.css)(this.__line, 'top', top);
27492
27533
  this.__current = currentElement;
27493
27534
  this.__show();
27494
27535
  this.__line.style.setProperty('--jd-anl-handle-offset', clientX - pos.left - 10 + 'px');
@@ -27500,7 +27541,7 @@ const ns = 'addnewline';
27500
27541
  /** @override */ beforeDestruct() {
27501
27542
  this.j.async.clearTimeout(this.__timeout);
27502
27543
  this.j.e.off(this.__line).off('changePlace', this.__addEventListeners);
27503
- jodit_modules__WEBPACK_IMPORTED_MODULE_6__.Dom.safeRemove(this.__line);
27544
+ jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.safeRemove(this.__line);
27504
27545
  this.j.e.off([
27505
27546
  this.j.ow,
27506
27547
  this.j.ew,
@@ -27508,31 +27549,31 @@ const ns = 'addnewline';
27508
27549
  ], '.' + ns).off(this.j.container, '.' + ns).off('.' + ns);
27509
27550
  }
27510
27551
  constructor(...args){
27511
- super(...args), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__line", this.j.c.fromHTML(`<div role="button" tabindex="-1" title="${this.j.i18n('Break')}" class="jodit-add-new-line"><span>${jodit_modules__WEBPACK_IMPORTED_MODULE_6__.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", ()=>{
27552
+ super(...args), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__line", this.j.c.fromHTML(`<div role="button" tabindex="-1" title="${this.j.i18n('Break')}" class="jodit-add-new-line"><span>${jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Icon.get('enter')}</span></div>`)), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__isMatchedTag", (node)=>Boolean(node && this.j.o.addNewLineTagsTriggers.includes(node.nodeName.toLowerCase()))), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__timeout", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__isBeforeContent", false), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__current", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__lineInFocus", false), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__isShown", false), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__hideForce", ()=>{
27512
27553
  if (!this.__isShown) {
27513
27554
  return;
27514
27555
  }
27515
27556
  this.__isShown = false;
27516
27557
  this.j.async.clearTimeout(this.__timeout);
27517
27558
  this.__lineInFocus = false;
27518
- jodit_modules__WEBPACK_IMPORTED_MODULE_6__.Dom.safeRemove(this.__line);
27559
+ jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.safeRemove(this.__line);
27519
27560
  this.__line.style.setProperty('--jd-anl-handle-offset', '0');
27520
27561
  }), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__canGetFocus", (elm)=>{
27521
- return elm != null && jodit_modules__WEBPACK_IMPORTED_MODULE_6__.Dom.isBlock(elm) && !/^(img|table|iframe|hr)$/i.test(elm.nodeName);
27562
+ return elm != null && jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock(elm) && !/^(img|table|iframe|hr)$/i.test(elm.nodeName);
27522
27563
  }), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__onClickLine", (e)=>{
27523
27564
  const editor = this.j;
27524
27565
  const p = editor.createInside.element(editor.o.enter);
27525
27566
  if (this.__isBeforeContent && this.__current && this.__current.parentNode) {
27526
27567
  if (this.__current === editor.editor) {
27527
- jodit_modules__WEBPACK_IMPORTED_MODULE_6__.Dom.prepend(editor.editor, p);
27568
+ jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.prepend(editor.editor, p);
27528
27569
  } else {
27529
- jodit_modules__WEBPACK_IMPORTED_MODULE_6__.Dom.before(this.__current, p);
27570
+ jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.before(this.__current, p);
27530
27571
  }
27531
27572
  } else {
27532
- jodit_modules__WEBPACK_IMPORTED_MODULE_6__.Dom.append(editor.editor, p);
27573
+ jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(editor.editor, p);
27533
27574
  }
27534
27575
  editor.s.setCursorIn(p);
27535
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.scrollIntoViewIfNeeded)(p, editor.editor, editor.ed);
27576
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.scrollIntoViewIfNeeded)(p, editor.editor, editor.ed);
27536
27577
  editor.synchronizeValues();
27537
27578
  this.__hideForce();
27538
27579
  e.preventDefault();
@@ -27540,18 +27581,21 @@ const ns = 'addnewline';
27540
27581
  }
27541
27582
  }
27542
27583
  ;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
27543
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)(':lock')
27584
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':lock')
27544
27585
  ], addNewLine.prototype, "onLock", null);
27545
27586
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
27546
- jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
27587
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
27547
27588
  ], addNewLine.prototype, "__hide", null);
27548
27589
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
27549
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)(':dblclick')
27590
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':keydown')
27591
+ ], addNewLine.prototype, "onArrowKey", null);
27592
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
27593
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':dblclick')
27550
27594
  ], addNewLine.prototype, "onDblClickEditor", null);
27551
27595
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
27552
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.throttle)((ctx)=>ctx.defaultTimeout)
27596
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.throttle)((ctx)=>ctx.defaultTimeout)
27553
27597
  ], addNewLine.prototype, "__onMouseMove", null);
27554
- jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('addNewLine', addNewLine);
27598
+ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('addNewLine', addNewLine);
27555
27599
 
27556
27600
 
27557
27601
  /***/ }),
@@ -28069,6 +28113,7 @@ UiAiAssistant = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decor
28069
28113
  /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(33831);
28070
28114
  /* harmony import */ var _cases_check_not_collapsed__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(89827);
28071
28115
  /* harmony import */ var _cases__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(17523);
28116
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(15200);
28072
28117
  /*!
28073
28118
  * Jodit Editor (https://xdsoft.net/jodit/)
28074
28119
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -28087,6 +28132,7 @@ UiAiAssistant = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decor
28087
28132
 
28088
28133
 
28089
28134
 
28135
+
28090
28136
  class backspace extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugin {
28091
28137
  afterInit(jodit) {
28092
28138
  jodit.registerCommand('deleteButton', {
@@ -28164,14 +28210,47 @@ class backspace extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugin {
28164
28210
  throw e;
28165
28211
  } finally{
28166
28212
  jodit.e.fire('backSpaceAfterDelete', backspace, fakeNode);
28213
+ this.moveCaretToTextBefore(fakeNode);
28167
28214
  this.safeRemoveEmptyNode(fakeNode);
28168
28215
  }
28169
28216
  return false;
28170
28217
  }
28218
+ /**
28219
+ * The browser types at the end of the text before the caret on its line,
28220
+ * in that text's formatting, but not inside a link. Moving the caret there
28221
+ * too makes a paste and the toolbar agree with what's typed:
28222
+ * `<p>one</p><p><b>|two</b></p>` joins to `<p>one|<b>two</b></p>`
28223
+ */ moveCaretToTextBefore(fakeNode) {
28224
+ const { jodit } = this;
28225
+ const { range } = jodit.s;
28226
+ // A case may have merged the fake node away (#1722)
28227
+ if (!fakeNode.parentNode) {
28228
+ return;
28229
+ }
28230
+ const around = jodit.ed.createRange();
28231
+ around.selectNode(fakeNode);
28232
+ if (!range.collapsed || !around.isPointInRange(range.startContainer, range.startOffset)) {
28233
+ return;
28234
+ }
28235
+ const text = (0,_helpers__WEBPACK_IMPORTED_MODULE_10__.findMostNestedNeighbor)(fakeNode, false, jodit.editor, true);
28236
+ const link = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(text, 'a', jodit.editor);
28237
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(text) || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isContentEditable(text, jodit.editor) || link && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isOrContains(link, fakeNode) || jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(text, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock, jodit.editor) !== jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(fakeNode, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock, jodit.editor)) {
28238
+ return;
28239
+ }
28240
+ range.setStart(text, text.nodeValue?.length ?? 0);
28241
+ range.collapse(true);
28242
+ jodit.s.selectRange(range);
28243
+ }
28171
28244
  /**
28172
28245
  * Remove node and replace cursor position out of it
28173
28246
  */ safeRemoveEmptyNode(fakeNode) {
28174
28247
  const { range } = this.j.s;
28248
+ // wrap-nodes normalizes the line it wraps, which can merge the text
28249
+ // after the fake node into it: remove only the fake node's own space
28250
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(fakeNode) && fakeNode.nodeValue !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.INVISIBLE_SPACE && fakeNode.nodeValue?.startsWith(jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.INVISIBLE_SPACE)) {
28251
+ fakeNode.deleteData(0, jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.INVISIBLE_SPACE.length);
28252
+ return;
28253
+ }
28175
28254
  if (range.startContainer === fakeNode) {
28176
28255
  if (fakeNode.previousSibling) {
28177
28256
  if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(fakeNode.previousSibling)) {
@@ -28243,6 +28322,9 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28243
28322
  return false;
28244
28323
  }
28245
28324
  const sibling = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(mainClosestBox, backspace);
28325
+ if (moveInlinesInside(jodit, fakeNode, sibling)) {
28326
+ return joinNeighbors(jodit, fakeNode, backspace, moved);
28327
+ }
28246
28328
  // A line break before the cursor is a single unit: remove it instead of
28247
28329
  // merging the current element into the (void) `<br>`, which used to move
28248
28330
  // the whole element's content into the `<br>` and delete it (#1282).
@@ -28257,6 +28339,10 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28257
28339
  jodit.s.setCursorBefore(fakeNode);
28258
28340
  return true;
28259
28341
  }
28342
+ // A non-editable sibling is removed by remove-not-editable, never joined
28343
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(sibling) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isContentEditable(sibling, jodit.editor)) {
28344
+ return false;
28345
+ }
28260
28346
  const box = findCaretBox(fakeNode, mainClosestBox);
28261
28347
  // One pass only: the line now sits beside the next one, so the
28262
28348
  // cases below join them. The DOM has changed either way
@@ -28285,6 +28371,60 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28285
28371
  }
28286
28372
  return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(block) && block.parentElement ? block.parentElement : block;
28287
28373
  }
28374
+ /**
28375
+ * With an inline element round the caret's line or the one it joins moved
28376
+ * inside its blocks, the cases join the lines as they join any two, and its
28377
+ * styles stay with its text. One round both lines is left as it is.
28378
+ */ function moveInlinesInside(jodit, fakeNode, sibling) {
28379
+ if (!sibling) {
28380
+ return false;
28381
+ }
28382
+ const around = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.furthest(fakeNode, (node)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(node) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(node) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isOrContains(node, sibling), jodit.editor);
28383
+ return moveInlineInside(around, jodit.editor) || moveInlineInside(sibling, jodit.editor);
28384
+ }
28385
+ /**
28386
+ * Old content can have an inline element round blocks. This moves it inside
28387
+ * them, and gives the text, images and line breaks beside them a copy of
28388
+ * their own: `<span style="…"><p>one</p><br><p>two</p></span>` becomes
28389
+ * `<p><span style="…">one</span></p><span style="…"><br></span><p><span style="…">two</span></p>`
28390
+ */ function moveInlineInside(node, root) {
28391
+ if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(node) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(node)) {
28392
+ return false;
28393
+ }
28394
+ // Embedded content, such as the `<iframe>` in a video's wrapper, counts
28395
+ // as a block in `Dom.isBlock`, but stays with the text beside it
28396
+ const isBlock = (child)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(child) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(child, jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.NO_EMPTY_TAGS);
28397
+ // The inner one first: `<span><strong><p>one</p></strong></span>`
28398
+ Array.from(node.childNodes).forEach((child)=>moveInlineInside(child, root));
28399
+ const children = Array.from(node.childNodes);
28400
+ if (!children.some(isBlock)) {
28401
+ return false;
28402
+ }
28403
+ let run = null;
28404
+ for (const child of children){
28405
+ if (!isBlock(child)) {
28406
+ // Blank text between blocks stays where it is
28407
+ if (!run && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmptyTextNode(child)) {
28408
+ run = node.cloneNode(false);
28409
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(child, run);
28410
+ }
28411
+ run && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(run, child);
28412
+ continue;
28413
+ }
28414
+ run = null;
28415
+ // Nothing goes inside a rule or a non-editable block
28416
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(child, jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.INSEPARABLE_TAGS) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isContentEditable(child, root)) {
28417
+ continue;
28418
+ }
28419
+ const inner = node.cloneNode(false);
28420
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.moveContent(child, inner);
28421
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(child, inner);
28422
+ // A list or a table: on down to its items or cells
28423
+ moveInlineInside(inner, root);
28424
+ }
28425
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.unwrap(node);
28426
+ return true;
28427
+ }
28288
28428
  /**
28289
28429
  * The innermost block on the sibling's edge facing the caret, so the
28290
28430
  * content is joined to text: `<div><p>one</p></div><p>|two</p>` gives
@@ -28644,7 +28784,9 @@ function checkRemoveChar(jodit, fakeNode, backspace, mode, stopBeforeSpace = fal
28644
28784
  while(jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isInlineBlock(sibling)){
28645
28785
  sibling = backspace ? sibling?.lastChild : sibling?.firstChild;
28646
28786
  }
28647
- if (!sibling) {
28787
+ // A block inside an inline element, such as the `<p>` in
28788
+ // `<span><p>…</p></span>`, isn't a char: the join cases handle it
28789
+ if (!sibling || jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(sibling)) {
28648
28790
  break;
28649
28791
  }
28650
28792
  if (sibling.nodeValue?.length) {
@@ -28792,6 +28934,7 @@ function isSpace(char) {
28792
28934
  /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27795);
28793
28935
  /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(65946);
28794
28936
  /* harmony import */ var jodit_core_selection_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(42259);
28937
+ /* harmony import */ var _check_join_neighbors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(26106);
28795
28938
  /*!
28796
28939
  * Jodit Editor (https://xdsoft.net/jodit/)
28797
28940
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -28801,23 +28944,48 @@ function isSpace(char) {
28801
28944
  */
28802
28945
 
28803
28946
 
28947
+
28804
28948
  /**
28805
- * Checks if a non-editable element can be deleted
28949
+ * Checks if a non-editable element can be deleted. A non-editable block goes
28950
+ * whole, and the lines either side of it then join, as the spec's tests do:
28951
+ * `<ul><li>one|</li></ul><div contenteditable="false">x</div><p>two</p>`
28952
+ * gives `<ul><li>one|two</li></ul>`
28806
28953
  * @private
28807
28954
  */ function checkRemoveContentNotEditable(jodit, fakeNode, backspace) {
28808
- let neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.findSibling(fakeNode, backspace);
28809
- if (!neighbor && fakeNode.parentElement && fakeNode.parentElement !== jodit.editor) {
28810
- neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.findSibling(fakeNode.parentElement, backspace);
28811
- }
28812
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isElement(neighbor) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isContentEditable(neighbor, jodit.editor)) {
28813
- (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);
28814
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.safeRemove(neighbor);
28815
- (0,jodit_core_selection_helpers__WEBPACK_IMPORTED_MODULE_2__.moveNodeInsideStart)(jodit, fakeNode, backspace);
28816
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.call)(backspace ? jodit.s.setCursorBefore : jodit.s.setCursorAfter, fakeNode);
28955
+ let node = fakeNode;
28956
+ let neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.findSibling(node, backspace);
28957
+ // Past the edges of the blocks the caret is at, but not into a table cell
28958
+ while(!neighbor && node.parentElement && node.parentElement !== jodit.editor && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isCell(node.parentElement)){
28959
+ node = node.parentElement;
28960
+ neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.findSibling(node, backspace);
28961
+ // At the start of a list item, Backspace takes the bullet off first,
28962
+ // unless the item before it is a non-editable one to remove
28963
+ if (backspace && jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isLeaf(node) && !(jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isLeaf(neighbor) && isNotEditable(jodit, neighbor))) {
28964
+ return false;
28965
+ }
28966
+ }
28967
+ if (isNotEditable(jodit, neighbor)) {
28968
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isBlock(neighbor)) {
28969
+ // Backspace after a removed list item leaves the items apart: the
28970
+ // next press takes the bullet off, as for any later item
28971
+ const joinLines = !(backspace && jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isLeaf(neighbor));
28972
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.safeRemove(neighbor);
28973
+ if (joinLines) {
28974
+ (0,_check_join_neighbors__WEBPACK_IMPORTED_MODULE_3__.checkJoinNeighbors)(jodit, fakeNode, backspace);
28975
+ }
28976
+ } else {
28977
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.call)(backspace ? jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.before : jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.after, neighbor, fakeNode);
28978
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.safeRemove(neighbor);
28979
+ (0,jodit_core_selection_helpers__WEBPACK_IMPORTED_MODULE_2__.moveNodeInsideStart)(jodit, fakeNode, backspace);
28980
+ }
28981
+ ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.call)(backspace ? jodit.s.setCursorBefore : jodit.s.setCursorAfter, fakeNode);
28817
28982
  return true;
28818
28983
  }
28819
28984
  return false;
28820
28985
  }
28986
+ function isNotEditable(jodit, node) {
28987
+ return jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isElement(node) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isContentEditable(node, jodit.editor);
28988
+ }
28821
28989
 
28822
28990
 
28823
28991
  /***/ }),
@@ -47017,12 +47185,13 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
47017
47185
  "use strict";
47018
47186
  /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
47019
47187
  /* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
47020
- /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(84839);
47021
- /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(27795);
47022
- /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(28077);
47023
- /* harmony import */ var jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(85932);
47024
- /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(91206);
47025
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(86038);
47188
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
47189
+ /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
47190
+ /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(27795);
47191
+ /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
47192
+ /* harmony import */ var jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(85932);
47193
+ /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
47194
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(86038);
47026
47195
  /*!
47027
47196
  * Jodit Editor (https://xdsoft.net/jodit/)
47028
47197
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -47039,9 +47208,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
47039
47208
 
47040
47209
 
47041
47210
 
47211
+
47042
47212
  /**
47043
47213
  * Wrap single text nodes in block wrapper
47044
- */ class wrapNodes extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugin {
47214
+ */ class wrapNodes extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
47045
47215
  /** @override **/ afterInit(jodit) {
47046
47216
  if (jodit.o.enter.toLowerCase() === 'br') {
47047
47217
  return;
@@ -47070,10 +47240,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
47070
47240
  }
47071
47241
  isChanged = true;
47072
47242
  const box = jodit.createInside.element(jodit.o.enter);
47073
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.before(child, box);
47074
- while(child && this.isSuitable(child)){
47243
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.before(child, box);
47244
+ // `exclude` keeps a <br> from starting a box, but one between loose lines stays with them
47245
+ while(child && (this.isSuitable(child) || jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(child, 'br'))){
47075
47246
  const next = child.nextSibling;
47076
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.append(box, child);
47247
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(box, child);
47077
47248
  child = next;
47078
47249
  }
47079
47250
  box.normalize();
@@ -47097,8 +47268,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
47097
47268
  }
47098
47269
  const box = jodit.createInside.element(jodit.o.enter);
47099
47270
  const br = jodit.createInside.element('br');
47100
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.append(box, br);
47101
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.append(jodit.editor, box);
47271
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(box, br);
47272
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(jodit.editor, box);
47102
47273
  if (jodit.s.isFocused() || jodit.e.current === 'backSpaceAfterDelete') {
47103
47274
  jodit.s.setCursorBefore(br);
47104
47275
  }
@@ -47107,29 +47278,40 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
47107
47278
  constructor(...args){
47108
47279
  super(...args), /**
47109
47280
  * Found Node which should be wrapped
47110
- */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isSuitableStart", (n)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isText(n) && (0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_5__.isString)(n.nodeValue) && (/[^\s]/.test(n.nodeValue) || n.parentNode?.firstChild === n && this.isSuitable(n.nextSibling)) || this.isNotWrapped(n) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isTemporary(n)), /**
47281
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isSuitableStart", (n)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(n) && (0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_6__.isString)(n.nodeValue) && (/[^\s]/.test(n.nodeValue) || n.parentNode?.firstChild === n && this.isSuitable(n.nextSibling)) || this.isNotWrapped(n) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTemporary(n)), /**
47111
47282
  * Node should add in a block element
47112
- */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isSuitable", (n)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isText(n) || this.isNotWrapped(n)), /**
47283
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isSuitable", (n)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(n) || this.isNotWrapped(n)), /**
47113
47284
  * Some element which needs to append in block
47114
- */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isNotWrapped", (n)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isElement(n) && !(jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isBlock(n) || jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isTag(n, this.j.o.wrapNodes.exclude)));
47285
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isNotWrapped", (n)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(n) && !(jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isBlock(n) || jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(n, this.j.o.wrapNodes.exclude) || holdsBlock(n)));
47115
47286
  }
47116
47287
  }
47117
47288
  ;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
47118
- jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
47289
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
47119
47290
  ], wrapNodes.prototype, "postProcessSetEditorValue", null);
47120
47291
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
47121
- jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
47292
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
47122
47293
  ], wrapNodes.prototype, "preprocessInput", null);
47294
+ /**
47295
+ * A block can't go in a paragraph, so neither can an element that holds one,
47296
+ * such as a `<span>` round a `<p>`. Embedded content such as an `<iframe>` can.
47297
+ */ function holdsBlock(elm) {
47298
+ for (const node of jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.eachGen(elm)){
47299
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isBlock(node) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(node, jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.NO_EMPTY_TAGS)) {
47300
+ return true;
47301
+ }
47302
+ }
47303
+ return false;
47304
+ }
47123
47305
  function checkAloneListLeaf(child, jodit) {
47124
47306
  let result = child;
47125
47307
  let next = child;
47126
47308
  do {
47127
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isElement(next) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isLeaf(next) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isList(next.parentElement)) {
47128
- const nextChild = jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.findNotEmptySibling(next, false);
47129
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isTag(result, 'ul')) {
47130
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.append(result, next);
47309
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(next) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isLeaf(next) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isList(next.parentElement)) {
47310
+ const nextChild = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.findNotEmptySibling(next, false);
47311
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(result, 'ul')) {
47312
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(result, next);
47131
47313
  } else {
47132
- result = jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.wrap(next, 'ul', jodit.createInside);
47314
+ result = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.wrap(next, 'ul', jodit.createInside);
47133
47315
  }
47134
47316
  next = nextChild;
47135
47317
  } else {
@@ -47138,7 +47320,7 @@ function checkAloneListLeaf(child, jodit) {
47138
47320
  }while (next)
47139
47321
  return result;
47140
47322
  }
47141
- jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('wrapNodes', wrapNodes);
47323
+ jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('wrapNodes', wrapNodes);
47142
47324
 
47143
47325
 
47144
47326
  /***/ }),