jodit 4.18.10 → 4.18.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +5 -5
  4. package/es2015/jodit.js +281 -76
  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 +7 -7
  18. package/es2021/jodit.js +278 -76
  19. package/es2021/jodit.min.js +7 -7
  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 +7 -7
  28. package/es2021.en/jodit.js +278 -76
  29. package/es2021.en/jodit.min.js +7 -7
  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 +353 -77
  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/core/selection/style/api/list/toggle-ordered-list.d.ts +1 -1
  55. package/esm/core/selection/style/api/list/toggle-ordered-list.js +30 -4
  56. package/esm/core/selection/style/transactions.js +1 -1
  57. package/esm/plugins/add-new-line/add-new-line.d.ts +7 -0
  58. package/esm/plugins/add-new-line/add-new-line.js +45 -0
  59. package/esm/plugins/backspace/backspace.d.ts +7 -0
  60. package/esm/plugins/backspace/backspace.js +45 -2
  61. package/esm/plugins/backspace/cases/check-join-neighbors.js +69 -1
  62. package/esm/plugins/backspace/cases/check-remove-char.js +3 -1
  63. package/esm/plugins/backspace/cases/check-remove-content-not-editable.d.ts +4 -1
  64. package/esm/plugins/backspace/cases/check-remove-content-not-editable.js +39 -11
  65. package/esm/plugins/wrap-nodes/wrap-nodes.js +19 -2
  66. package/esm/types/async.d.ts +7 -0
  67. package/package.json +1 -1
  68. package/types/core/helpers/size/get-fixed-position-offset.d.ts +4 -2
  69. package/types/core/selection/style/api/list/toggle-ordered-list.d.ts +1 -1
  70. package/types/plugins/add-new-line/add-new-line.d.ts +7 -0
  71. package/types/plugins/backspace/backspace.d.ts +7 -0
  72. package/types/plugins/backspace/cases/check-remove-content-not-editable.d.ts +4 -1
  73. 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.12
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1443,7 +1443,8 @@ class Async {
1443
1443
  this.__requestsIdle.forEach((key)=>this.cancelIdleCallback(key));
1444
1444
  this.__requestsRaf.forEach((key)=>this.cancelAnimationFrame(key));
1445
1445
  this.__controllers.forEach((controller)=>controller.abort());
1446
- 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.12";
1826
1827
  // prettier-ignore
1827
1828
  const ES = "es2021";
1828
1829
  const IS_ES_MODERN = true;
@@ -7188,8 +7189,10 @@ function normalizeCssValue(key, value) {
7188
7189
  * ancestor's top-left corner. The returned offset should be subtracted from
7189
7190
  * the desired viewport coordinates before applying them.
7190
7191
  *
7191
- * 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
@@ -13191,7 +13203,7 @@ function elementsEqualAttributes(elm1, elm2) {
13191
13203
  /**
13192
13204
  * Replaces `ul->ol` or `ol->ul`, apply styles to the list, or remove a list item from it
13193
13205
  * @private
13194
- */ function toggleOrderedList(commitStyle, li, jodit, mode) {
13206
+ */ function toggleOrderedList(commitStyle, li, jodit, mode, collapsed = false) {
13195
13207
  if (!li) {
13196
13208
  return mode;
13197
13209
  }
@@ -13220,16 +13232,36 @@ function elementsEqualAttributes(elm1, elm2) {
13220
13232
  }
13221
13233
  // ul => ol, ol => ul or ul => ul.class1
13222
13234
  if (mode === jodit_core_selection_style_constants__WEBPACK_IMPORTED_MODULE_6__.REPLACE || isChangeMode || !isSameList) {
13223
- const wrapper = unwrapList(jodit_core_selection_style_constants__WEBPACK_IMPORTED_MODULE_6__.REPLACE, list, li, jodit, commitStyle);
13224
- const newList = (0,_wrap_list__WEBPACK_IMPORTED_MODULE_7__.wrapList)(commitStyle, wrapper, jodit);
13235
+ // With just a caret, Word converts the whole list
13236
+ const items = collapsed && !isSameList ? Array.from(list.children).filter((item)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isLeaf(item)) : [
13237
+ li
13238
+ ];
13239
+ let newList;
13240
+ for (const item of items){
13241
+ newList = keepNumbering(item, (itemList)=>(0,_wrap_list__WEBPACK_IMPORTED_MODULE_7__.wrapList)(commitStyle, unwrapList(jodit_core_selection_style_constants__WEBPACK_IMPORTED_MODULE_6__.REPLACE, itemList, item, jodit, commitStyle), jodit));
13242
+ }
13225
13243
  hook(jodit_core_selection_style_constants__WEBPACK_IMPORTED_MODULE_6__.REPLACE, newList, commitStyle);
13226
13244
  return jodit_core_selection_style_constants__WEBPACK_IMPORTED_MODULE_6__.REPLACE;
13227
13245
  }
13228
13246
  }
13229
- const wrapper = unwrapList((/* inlined export .UNWRAP */"unwrap"), list, li, jodit, commitStyle);
13247
+ const wrapper = keepNumbering(li, (itemList)=>unwrapList((/* inlined export .UNWRAP */"unwrap"), itemList, li, jodit, commitStyle));
13230
13248
  hook((/* inlined export .UNWRAP */"unwrap"), wrapper, commitStyle);
13231
13249
  return (/* inlined export .UNWRAP */"unwrap");
13232
13250
  }
13251
+ /**
13252
+ * Takes `item` out of its list with `takeOut`, and carries a numbered list's
13253
+ * count on past it, as Word does: 1, a bullet, then 2
13254
+ */ function keepNumbering(item, takeOut) {
13255
+ const list = item.parentElement;
13256
+ const rest = item.nextElementSibling;
13257
+ const next = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(list, 'ol') ? (parseInt(list.getAttribute('start') || '1', 10) || 1) + Array.from(list.children).indexOf(item) : 0;
13258
+ const result = takeOut(list);
13259
+ const restList = rest?.parentElement;
13260
+ if (next && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(restList, 'ol')) {
13261
+ next > 1 ? restList.setAttribute('start', String(next)) : restList.removeAttribute('start');
13262
+ }
13263
+ return result;
13264
+ }
13233
13265
  /**
13234
13266
  * Other attributes, such as a class, still move the items into a new list,
13235
13267
  * where the `beforeWrapList` hook can add markup to each of them
@@ -14005,7 +14037,7 @@ const transactions = {
14005
14037
  exec (value) {
14006
14038
  return {
14007
14039
  ...value,
14008
- mode: (0,jodit_core_selection_style_api__WEBPACK_IMPORTED_MODULE_3__.toggleOrderedList)(value.style, value.element, value.jodit, value.mode),
14040
+ mode: (0,jodit_core_selection_style_api__WEBPACK_IMPORTED_MODULE_3__.toggleOrderedList)(value.style, value.element, value.jodit, value.mode, value.collapsed),
14009
14041
  next: states.END
14010
14042
  };
14011
14043
  }
@@ -27357,12 +27389,13 @@ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__.Icon.set('about', (_about_svg__W
27357
27389
  /* unused harmony export addNewLine */
27358
27390
  /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
27359
27391
  /* 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);
27392
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
27393
+ /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
27394
+ /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(28077);
27395
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65946);
27396
+ /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(80991);
27397
+ /* harmony import */ var jodit_modules__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(60936);
27398
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(10685);
27366
27399
  /*!
27367
27400
  * Jodit Editor (https://xdsoft.net/jodit/)
27368
27401
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -27380,10 +27413,11 @@ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__.Icon.set('about', (_about_svg__W
27380
27413
 
27381
27414
 
27382
27415
 
27416
+
27383
27417
  const ns = 'addnewline';
27384
27418
  /**
27385
27419
  * 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 {
27420
+ */ class addNewLine extends jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Plugin {
27387
27421
  __show() {
27388
27422
  if (this.j.o.readonly || this.j.isLocked) {
27389
27423
  return;
@@ -27393,8 +27427,8 @@ const ns = 'addnewline';
27393
27427
  return;
27394
27428
  }
27395
27429
  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);
27430
+ jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(this.j.container, this.__line);
27431
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_6__.css)(this.__line, 'width', this.j.container.clientWidth);
27398
27432
  }
27399
27433
  onLock(isLocked) {
27400
27434
  if (isLocked && this.__isShown) {
@@ -27432,16 +27466,43 @@ const ns = 'addnewline';
27432
27466
  editor.editor
27433
27467
  ], '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
27468
  }
27469
+ /**
27470
+ * A paragraph holding only an embed has no place for the caret, so the
27471
+ * arrow keys can't get past one that ends the content, or before one that
27472
+ * starts it. When an arrow key leaves the caret where it was and there is
27473
+ * content beyond it, a new line goes there, as when the line is clicked.
27474
+ */ onArrowKey(e) {
27475
+ const editor = this.j;
27476
+ const forward = e.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_DOWN || e.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_RIGHT;
27477
+ 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()) {
27478
+ return;
27479
+ }
27480
+ const { startContainer, startOffset } = editor.s.range;
27481
+ // Once the browser has moved the caret, if it could. With a 0 timeout
27482
+ // Jodit would run this at once, before the browser moves it
27483
+ editor.async.setTimeout(()=>{
27484
+ const { range } = editor.s;
27485
+ const block = jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.closest(startContainer, jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock, editor.editor);
27486
+ 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)) {
27487
+ return;
27488
+ }
27489
+ const p = editor.createInside.element(editor.o.enter);
27490
+ forward ? jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(editor.editor, p) : jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.prepend(editor.editor, p);
27491
+ editor.s.setCursorIn(p);
27492
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.scrollIntoViewIfNeeded)(p, editor.editor, editor.ed);
27493
+ editor.synchronizeValues();
27494
+ }, 1);
27495
+ }
27435
27496
  onDblClickEditor(e) {
27436
27497
  const editor = this.j;
27437
27498
  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);
27499
+ const editorBound = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.offset)(editor.editor, editor, editor.ed);
27439
27500
  const top = e.pageY - editor.ew.scrollX;
27440
27501
  const p = editor.createInside.element(editor.o.enter);
27441
27502
  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);
27503
+ jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.prepend(editor.editor, p);
27443
27504
  } else {
27444
- jodit_modules__WEBPACK_IMPORTED_MODULE_6__.Dom.append(editor.editor, p);
27505
+ jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(editor.editor, p);
27445
27506
  }
27446
27507
  editor.s.setCursorIn(p);
27447
27508
  editor.synchronizeValues();
@@ -27454,27 +27515,27 @@ const ns = 'addnewline';
27454
27515
  // Inside Shadow DOM `document.elementFromPoint` returns the shadow
27455
27516
  // host, so the lookup must start from the shadow root
27456
27517
  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)) {
27518
+ if (!jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isHTMLElement(currentElement) || !jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isOrContains(editor.editor, currentElement)) {
27458
27519
  return;
27459
27520
  }
27460
27521
  if (editor.editor !== currentElement && !this.__isMatchedTag(currentElement)) {
27461
- currentElement = jodit_modules__WEBPACK_IMPORTED_MODULE_6__.Dom.closest(currentElement, this.__isMatchedTag, editor.editor);
27522
+ currentElement = jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.closest(currentElement, this.__isMatchedTag, editor.editor);
27462
27523
  }
27463
27524
  if (!currentElement) {
27464
27525
  this.__hide();
27465
27526
  return;
27466
27527
  }
27467
27528
  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);
27529
+ const parentBox = jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.up(currentElement, jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock, editor.editor);
27469
27530
  if (parentBox && parentBox !== editor.editor) {
27470
27531
  currentElement = parentBox;
27471
27532
  }
27472
27533
  }
27473
- const pos = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.position)(currentElement, this.j);
27534
+ const pos = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.position)(currentElement, this.j);
27474
27535
  let top = false;
27475
27536
  let { clientY, clientX } = e;
27476
27537
  if (this.j.iframe) {
27477
- const { top, left } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.position)(this.j.iframe, this.j, true);
27538
+ const { top, left } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.position)(this.j.iframe, this.j, true);
27478
27539
  clientY += top;
27479
27540
  clientX += left;
27480
27541
  }
@@ -27487,8 +27548,8 @@ const ns = 'addnewline';
27487
27548
  this.__isBeforeContent = false;
27488
27549
  }
27489
27550
  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);
27551
+ 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))) {
27552
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_6__.css)(this.__line, 'top', top);
27492
27553
  this.__current = currentElement;
27493
27554
  this.__show();
27494
27555
  this.__line.style.setProperty('--jd-anl-handle-offset', clientX - pos.left - 10 + 'px');
@@ -27500,7 +27561,7 @@ const ns = 'addnewline';
27500
27561
  /** @override */ beforeDestruct() {
27501
27562
  this.j.async.clearTimeout(this.__timeout);
27502
27563
  this.j.e.off(this.__line).off('changePlace', this.__addEventListeners);
27503
- jodit_modules__WEBPACK_IMPORTED_MODULE_6__.Dom.safeRemove(this.__line);
27564
+ jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.safeRemove(this.__line);
27504
27565
  this.j.e.off([
27505
27566
  this.j.ow,
27506
27567
  this.j.ew,
@@ -27508,31 +27569,31 @@ const ns = 'addnewline';
27508
27569
  ], '.' + ns).off(this.j.container, '.' + ns).off('.' + ns);
27509
27570
  }
27510
27571
  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", ()=>{
27572
+ 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
27573
  if (!this.__isShown) {
27513
27574
  return;
27514
27575
  }
27515
27576
  this.__isShown = false;
27516
27577
  this.j.async.clearTimeout(this.__timeout);
27517
27578
  this.__lineInFocus = false;
27518
- jodit_modules__WEBPACK_IMPORTED_MODULE_6__.Dom.safeRemove(this.__line);
27579
+ jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.safeRemove(this.__line);
27519
27580
  this.__line.style.setProperty('--jd-anl-handle-offset', '0');
27520
27581
  }), (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);
27582
+ return elm != null && jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock(elm) && !/^(img|table|iframe|hr)$/i.test(elm.nodeName);
27522
27583
  }), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__onClickLine", (e)=>{
27523
27584
  const editor = this.j;
27524
27585
  const p = editor.createInside.element(editor.o.enter);
27525
27586
  if (this.__isBeforeContent && this.__current && this.__current.parentNode) {
27526
27587
  if (this.__current === editor.editor) {
27527
- jodit_modules__WEBPACK_IMPORTED_MODULE_6__.Dom.prepend(editor.editor, p);
27588
+ jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.prepend(editor.editor, p);
27528
27589
  } else {
27529
- jodit_modules__WEBPACK_IMPORTED_MODULE_6__.Dom.before(this.__current, p);
27590
+ jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.before(this.__current, p);
27530
27591
  }
27531
27592
  } else {
27532
- jodit_modules__WEBPACK_IMPORTED_MODULE_6__.Dom.append(editor.editor, p);
27593
+ jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(editor.editor, p);
27533
27594
  }
27534
27595
  editor.s.setCursorIn(p);
27535
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.scrollIntoViewIfNeeded)(p, editor.editor, editor.ed);
27596
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.scrollIntoViewIfNeeded)(p, editor.editor, editor.ed);
27536
27597
  editor.synchronizeValues();
27537
27598
  this.__hideForce();
27538
27599
  e.preventDefault();
@@ -27540,18 +27601,21 @@ const ns = 'addnewline';
27540
27601
  }
27541
27602
  }
27542
27603
  ;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
27543
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)(':lock')
27604
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':lock')
27544
27605
  ], addNewLine.prototype, "onLock", null);
27545
27606
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
27546
- jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
27607
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
27547
27608
  ], addNewLine.prototype, "__hide", null);
27548
27609
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
27549
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)(':dblclick')
27610
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':keydown')
27611
+ ], addNewLine.prototype, "onArrowKey", null);
27612
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
27613
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':dblclick')
27550
27614
  ], addNewLine.prototype, "onDblClickEditor", null);
27551
27615
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
27552
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.throttle)((ctx)=>ctx.defaultTimeout)
27616
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.throttle)((ctx)=>ctx.defaultTimeout)
27553
27617
  ], addNewLine.prototype, "__onMouseMove", null);
27554
- jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('addNewLine', addNewLine);
27618
+ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('addNewLine', addNewLine);
27555
27619
 
27556
27620
 
27557
27621
  /***/ }),
@@ -28069,6 +28133,7 @@ UiAiAssistant = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decor
28069
28133
  /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(33831);
28070
28134
  /* harmony import */ var _cases_check_not_collapsed__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(89827);
28071
28135
  /* harmony import */ var _cases__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(17523);
28136
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(15200);
28072
28137
  /*!
28073
28138
  * Jodit Editor (https://xdsoft.net/jodit/)
28074
28139
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -28087,6 +28152,7 @@ UiAiAssistant = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decor
28087
28152
 
28088
28153
 
28089
28154
 
28155
+
28090
28156
  class backspace extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugin {
28091
28157
  afterInit(jodit) {
28092
28158
  jodit.registerCommand('deleteButton', {
@@ -28164,14 +28230,47 @@ class backspace extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugin {
28164
28230
  throw e;
28165
28231
  } finally{
28166
28232
  jodit.e.fire('backSpaceAfterDelete', backspace, fakeNode);
28233
+ this.moveCaretToTextBefore(fakeNode);
28167
28234
  this.safeRemoveEmptyNode(fakeNode);
28168
28235
  }
28169
28236
  return false;
28170
28237
  }
28238
+ /**
28239
+ * The browser types at the end of the text before the caret on its line,
28240
+ * in that text's formatting, but not inside a link. Moving the caret there
28241
+ * too makes a paste and the toolbar agree with what's typed:
28242
+ * `<p>one</p><p><b>|two</b></p>` joins to `<p>one|<b>two</b></p>`
28243
+ */ moveCaretToTextBefore(fakeNode) {
28244
+ const { jodit } = this;
28245
+ const { range } = jodit.s;
28246
+ // A case may have merged the fake node away (#1722)
28247
+ if (!fakeNode.parentNode) {
28248
+ return;
28249
+ }
28250
+ const around = jodit.ed.createRange();
28251
+ around.selectNode(fakeNode);
28252
+ if (!range.collapsed || !around.isPointInRange(range.startContainer, range.startOffset)) {
28253
+ return;
28254
+ }
28255
+ const text = (0,_helpers__WEBPACK_IMPORTED_MODULE_10__.findMostNestedNeighbor)(fakeNode, false, jodit.editor, true);
28256
+ const link = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(text, 'a', jodit.editor);
28257
+ 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)) {
28258
+ return;
28259
+ }
28260
+ range.setStart(text, text.nodeValue?.length ?? 0);
28261
+ range.collapse(true);
28262
+ jodit.s.selectRange(range);
28263
+ }
28171
28264
  /**
28172
28265
  * Remove node and replace cursor position out of it
28173
28266
  */ safeRemoveEmptyNode(fakeNode) {
28174
28267
  const { range } = this.j.s;
28268
+ // wrap-nodes normalizes the line it wraps, which can merge the text
28269
+ // after the fake node into it: remove only the fake node's own space
28270
+ 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)) {
28271
+ fakeNode.deleteData(0, jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.INVISIBLE_SPACE.length);
28272
+ return;
28273
+ }
28175
28274
  if (range.startContainer === fakeNode) {
28176
28275
  if (fakeNode.previousSibling) {
28177
28276
  if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(fakeNode.previousSibling)) {
@@ -28243,6 +28342,9 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28243
28342
  return false;
28244
28343
  }
28245
28344
  const sibling = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(mainClosestBox, backspace);
28345
+ if (moveInlinesInside(jodit, fakeNode, sibling)) {
28346
+ return joinNeighbors(jodit, fakeNode, backspace, moved);
28347
+ }
28246
28348
  // A line break before the cursor is a single unit: remove it instead of
28247
28349
  // merging the current element into the (void) `<br>`, which used to move
28248
28350
  // the whole element's content into the `<br>` and delete it (#1282).
@@ -28257,6 +28359,10 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28257
28359
  jodit.s.setCursorBefore(fakeNode);
28258
28360
  return true;
28259
28361
  }
28362
+ // A non-editable sibling is removed by remove-not-editable, never joined
28363
+ 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)) {
28364
+ return false;
28365
+ }
28260
28366
  const box = findCaretBox(fakeNode, mainClosestBox);
28261
28367
  // One pass only: the line now sits beside the next one, so the
28262
28368
  // cases below join them. The DOM has changed either way
@@ -28285,6 +28391,60 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28285
28391
  }
28286
28392
  return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(block) && block.parentElement ? block.parentElement : block;
28287
28393
  }
28394
+ /**
28395
+ * With an inline element round the caret's line or the one it joins moved
28396
+ * inside its blocks, the cases join the lines as they join any two, and its
28397
+ * styles stay with its text. One round both lines is left as it is.
28398
+ */ function moveInlinesInside(jodit, fakeNode, sibling) {
28399
+ if (!sibling) {
28400
+ return false;
28401
+ }
28402
+ 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);
28403
+ return moveInlineInside(around, jodit.editor) || moveInlineInside(sibling, jodit.editor);
28404
+ }
28405
+ /**
28406
+ * Old content can have an inline element round blocks. This moves it inside
28407
+ * them, and gives the text, images and line breaks beside them a copy of
28408
+ * their own: `<span style="…"><p>one</p><br><p>two</p></span>` becomes
28409
+ * `<p><span style="…">one</span></p><span style="…"><br></span><p><span style="…">two</span></p>`
28410
+ */ function moveInlineInside(node, root) {
28411
+ if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(node) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(node)) {
28412
+ return false;
28413
+ }
28414
+ // Embedded content, such as the `<iframe>` in a video's wrapper, counts
28415
+ // as a block in `Dom.isBlock`, but stays with the text beside it
28416
+ 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);
28417
+ // The inner one first: `<span><strong><p>one</p></strong></span>`
28418
+ Array.from(node.childNodes).forEach((child)=>moveInlineInside(child, root));
28419
+ const children = Array.from(node.childNodes);
28420
+ if (!children.some(isBlock)) {
28421
+ return false;
28422
+ }
28423
+ let run = null;
28424
+ for (const child of children){
28425
+ if (!isBlock(child)) {
28426
+ // Blank text between blocks stays where it is
28427
+ if (!run && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmptyTextNode(child)) {
28428
+ run = node.cloneNode(false);
28429
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(child, run);
28430
+ }
28431
+ run && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(run, child);
28432
+ continue;
28433
+ }
28434
+ run = null;
28435
+ // Nothing goes inside a rule or a non-editable block
28436
+ 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)) {
28437
+ continue;
28438
+ }
28439
+ const inner = node.cloneNode(false);
28440
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.moveContent(child, inner);
28441
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(child, inner);
28442
+ // A list or a table: on down to its items or cells
28443
+ moveInlineInside(inner, root);
28444
+ }
28445
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.unwrap(node);
28446
+ return true;
28447
+ }
28288
28448
  /**
28289
28449
  * The innermost block on the sibling's edge facing the caret, so the
28290
28450
  * content is joined to text: `<div><p>one</p></div><p>|two</p>` gives
@@ -28644,7 +28804,9 @@ function checkRemoveChar(jodit, fakeNode, backspace, mode, stopBeforeSpace = fal
28644
28804
  while(jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isInlineBlock(sibling)){
28645
28805
  sibling = backspace ? sibling?.lastChild : sibling?.firstChild;
28646
28806
  }
28647
- if (!sibling) {
28807
+ // A block inside an inline element, such as the `<p>` in
28808
+ // `<span><p>…</p></span>`, isn't a char: the join cases handle it
28809
+ if (!sibling || jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(sibling)) {
28648
28810
  break;
28649
28811
  }
28650
28812
  if (sibling.nodeValue?.length) {
@@ -28792,6 +28954,7 @@ function isSpace(char) {
28792
28954
  /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27795);
28793
28955
  /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(65946);
28794
28956
  /* harmony import */ var jodit_core_selection_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(42259);
28957
+ /* harmony import */ var _check_join_neighbors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(26106);
28795
28958
  /*!
28796
28959
  * Jodit Editor (https://xdsoft.net/jodit/)
28797
28960
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -28801,23 +28964,48 @@ function isSpace(char) {
28801
28964
  */
28802
28965
 
28803
28966
 
28967
+
28804
28968
  /**
28805
- * Checks if a non-editable element can be deleted
28969
+ * Checks if a non-editable element can be deleted. A non-editable block goes
28970
+ * whole, and the lines either side of it then join, as the spec's tests do:
28971
+ * `<ul><li>one|</li></ul><div contenteditable="false">x</div><p>two</p>`
28972
+ * gives `<ul><li>one|two</li></ul>`
28806
28973
  * @private
28807
28974
  */ 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);
28975
+ let node = fakeNode;
28976
+ let neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.findSibling(node, backspace);
28977
+ // Past the edges of the blocks the caret is at, but not into a table cell
28978
+ while(!neighbor && node.parentElement && node.parentElement !== jodit.editor && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isCell(node.parentElement)){
28979
+ node = node.parentElement;
28980
+ neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.findSibling(node, backspace);
28981
+ // At the start of a list item, Backspace takes the bullet off first,
28982
+ // unless the item before it is a non-editable one to remove
28983
+ 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))) {
28984
+ return false;
28985
+ }
28986
+ }
28987
+ if (isNotEditable(jodit, neighbor)) {
28988
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isBlock(neighbor)) {
28989
+ // Backspace after a removed list item leaves the items apart: the
28990
+ // next press takes the bullet off, as for any later item
28991
+ const joinLines = !(backspace && jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isLeaf(neighbor));
28992
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.safeRemove(neighbor);
28993
+ if (joinLines) {
28994
+ (0,_check_join_neighbors__WEBPACK_IMPORTED_MODULE_3__.checkJoinNeighbors)(jodit, fakeNode, backspace);
28995
+ }
28996
+ } else {
28997
+ (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);
28998
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.safeRemove(neighbor);
28999
+ (0,jodit_core_selection_helpers__WEBPACK_IMPORTED_MODULE_2__.moveNodeInsideStart)(jodit, fakeNode, backspace);
29000
+ }
29001
+ ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.call)(backspace ? jodit.s.setCursorBefore : jodit.s.setCursorAfter, fakeNode);
28817
29002
  return true;
28818
29003
  }
28819
29004
  return false;
28820
29005
  }
29006
+ function isNotEditable(jodit, node) {
29007
+ return jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isElement(node) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isContentEditable(node, jodit.editor);
29008
+ }
28821
29009
 
28822
29010
 
28823
29011
  /***/ }),
@@ -47017,12 +47205,13 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
47017
47205
  "use strict";
47018
47206
  /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
47019
47207
  /* 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);
47208
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
47209
+ /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
47210
+ /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(27795);
47211
+ /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
47212
+ /* harmony import */ var jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(85932);
47213
+ /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
47214
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(86038);
47026
47215
  /*!
47027
47216
  * Jodit Editor (https://xdsoft.net/jodit/)
47028
47217
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -47039,9 +47228,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
47039
47228
 
47040
47229
 
47041
47230
 
47231
+
47042
47232
  /**
47043
47233
  * Wrap single text nodes in block wrapper
47044
- */ class wrapNodes extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugin {
47234
+ */ class wrapNodes extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
47045
47235
  /** @override **/ afterInit(jodit) {
47046
47236
  if (jodit.o.enter.toLowerCase() === 'br') {
47047
47237
  return;
@@ -47070,10 +47260,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
47070
47260
  }
47071
47261
  isChanged = true;
47072
47262
  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)){
47263
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.before(child, box);
47264
+ // `exclude` keeps a <br> from starting a box, but one between loose lines stays with them
47265
+ while(child && (this.isSuitable(child) || jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(child, 'br'))){
47075
47266
  const next = child.nextSibling;
47076
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.append(box, child);
47267
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(box, child);
47077
47268
  child = next;
47078
47269
  }
47079
47270
  box.normalize();
@@ -47097,8 +47288,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
47097
47288
  }
47098
47289
  const box = jodit.createInside.element(jodit.o.enter);
47099
47290
  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);
47291
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(box, br);
47292
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(jodit.editor, box);
47102
47293
  if (jodit.s.isFocused() || jodit.e.current === 'backSpaceAfterDelete') {
47103
47294
  jodit.s.setCursorBefore(br);
47104
47295
  }
@@ -47107,29 +47298,40 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.wrapNodes = {
47107
47298
  constructor(...args){
47108
47299
  super(...args), /**
47109
47300
  * 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)), /**
47301
+ */ (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
47302
  * 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)), /**
47303
+ */ (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
47304
  * 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)));
47305
+ */ (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
47306
  }
47116
47307
  }
47117
47308
  ;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
47118
- jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
47309
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
47119
47310
  ], wrapNodes.prototype, "postProcessSetEditorValue", null);
47120
47311
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
47121
- jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
47312
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
47122
47313
  ], wrapNodes.prototype, "preprocessInput", null);
47314
+ /**
47315
+ * A block can't go in a paragraph, so neither can an element that holds one,
47316
+ * such as a `<span>` round a `<p>`. Embedded content such as an `<iframe>` can.
47317
+ */ function holdsBlock(elm) {
47318
+ for (const node of jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.eachGen(elm)){
47319
+ 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)) {
47320
+ return true;
47321
+ }
47322
+ }
47323
+ return false;
47324
+ }
47123
47325
  function checkAloneListLeaf(child, jodit) {
47124
47326
  let result = child;
47125
47327
  let next = child;
47126
47328
  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);
47329
+ 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)) {
47330
+ const nextChild = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.findNotEmptySibling(next, false);
47331
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(result, 'ul')) {
47332
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(result, next);
47131
47333
  } else {
47132
- result = jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.wrap(next, 'ul', jodit.createInside);
47334
+ result = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.wrap(next, 'ul', jodit.createInside);
47133
47335
  }
47134
47336
  next = nextChild;
47135
47337
  } else {
@@ -47138,7 +47340,7 @@ function checkAloneListLeaf(child, jodit) {
47138
47340
  }while (next)
47139
47341
  return result;
47140
47342
  }
47141
- jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('wrapNodes', wrapNodes);
47343
+ jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('wrapNodes', wrapNodes);
47142
47344
 
47143
47345
 
47144
47346
  /***/ }),