jodit 4.18.9 → 4.18.10

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 (52) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +3 -3
  4. package/es2015/jodit.js +77 -2
  5. package/es2015/jodit.min.js +3 -3
  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 +3 -3
  13. package/es2018/jodit.min.js +3 -3
  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 +3 -3
  18. package/es2021/jodit.js +77 -2
  19. package/es2021/jodit.min.js +3 -3
  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 +3 -3
  28. package/es2021.en/jodit.js +77 -2
  29. package/es2021.en/jodit.min.js +3 -3
  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 +77 -2
  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 +1 -1
  48. package/es5/polyfills.js +1 -1
  49. package/es5/polyfills.min.js +1 -1
  50. package/esm/core/constants.js +1 -1
  51. package/esm/plugins/backspace/cases/check-join-neighbors.js +92 -0
  52. package/package.json +1 -1
package/es2015/jodit.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.18.9
4
+ * Version: v4.18.10
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1828,7 +1828,7 @@ __webpack_require__.r(__webpack_exports__);
1828
1828
  * ```
1829
1829
  * @packageDocumentation
1830
1830
  * @module constants
1831
- */ const APP_VERSION = "4.18.9";
1831
+ */ const APP_VERSION = "4.18.10";
1832
1832
  // prettier-ignore
1833
1833
  const ES = "es2015";
1834
1834
  const IS_ES_MODERN = true;
@@ -28523,6 +28523,11 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28523
28523
  * Check if two separate elements can be connected
28524
28524
  * @private
28525
28525
  */ function checkJoinNeighbors(jodit, fakeNode, backspace) {
28526
+ return joinNeighbors(jodit, fakeNode, backspace, false);
28527
+ }
28528
+ /**
28529
+ * `moved` is set on the one re-entrant pass after `moveToNextLine`
28530
+ */ function joinNeighbors(jodit, fakeNode, backspace, moved) {
28526
28531
  if (checkJoinBareText(jodit, fakeNode, backspace)) {
28527
28532
  return true;
28528
28533
  }
@@ -28553,6 +28558,14 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28553
28558
  return true;
28554
28559
  }
28555
28560
  const box = findCaretBox(fakeNode, mainClosestBox);
28561
+ // One pass only: the line now sits beside the next one, so the
28562
+ // cases below join them. The DOM has changed either way
28563
+ if (!moved && sibling && moveToNextLine(jodit, fakeNode, box, sibling, backspace)) {
28564
+ if (!joinNeighbors(jodit, fakeNode, backspace, true)) {
28565
+ jodit.s.setCursorBefore(fakeNode);
28566
+ }
28567
+ return true;
28568
+ }
28556
28569
  if (sibling && (checkPullNextLine(jodit, fakeNode, box, sibling, backspace) || checkMoveListContent(jodit, box, sibling, backspace) || checkJoinInlineSibling(jodit, box, sibling, backspace) || moveContentAndRemoveEmpty(jodit, box, findEdgeBlock(resolveTableSibling(sibling, backspace), backspace, jodit.editor), backspace))) {
28557
28570
  jodit.s.setCursorBefore(fakeNode);
28558
28571
  return true;
@@ -28604,6 +28617,68 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28604
28617
  });
28605
28618
  return cells.length ? cells[backspace ? cells.length - 1 : 0] : null;
28606
28619
  }
28620
+ /**
28621
+ * On Delete, Word joins two lines where the next one is, inside or outside
28622
+ * its box or quote, and the joined line keeps the caret line's kind, list item
28623
+ * or paragraph. Two paragraphs already join that way. When either line is a
28624
+ * list item, this moves the caret's line beside the next one, and the usual
28625
+ * cases then join them: `<p>one|</p><div><ul><li>two</li></ul></div>` becomes
28626
+ * `<div><p>one|</p><ul><li>two</li></ul></div>`
28627
+ * @private
28628
+ */ function moveToNextLine(jodit, fakeNode, box, sibling, backspace) {
28629
+ if (backspace || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(sibling, 'table') || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(sibling, jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.INSEPARABLE_TAGS) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isContentEditable(sibling, jodit.editor)) {
28630
+ return false;
28631
+ }
28632
+ const line = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.up(fakeNode, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock, box, true);
28633
+ const next = findEdgeBlock(sibling, false, jodit.editor);
28634
+ if (!line || !next || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isContentEditable(next, jodit.editor) || !(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(line) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(next)) || // A paragraph inside a list item is left as it is
28635
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(line.parentElement) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(next.parentElement) || boxOf(line) === boxOf(next)) {
28636
+ return false;
28637
+ }
28638
+ const from = line.parentElement;
28639
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(line) && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(next)) {
28640
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(next, line);
28641
+ } else if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(line)) {
28642
+ // A list item keeps its bullet, in a list of its own
28643
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(next, ownList(line));
28644
+ } else {
28645
+ // A paragraph can't go inside a list, so it goes in front of it
28646
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(next.parentElement, line);
28647
+ }
28648
+ let remove = from;
28649
+ while(remove && remove !== jodit.editor && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(remove)){
28650
+ const parent = remove.parentElement;
28651
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(remove);
28652
+ remove = parent;
28653
+ }
28654
+ return true;
28655
+ }
28656
+ /**
28657
+ * The box or quote a line is in, past its lists
28658
+ */ function boxOf(line) {
28659
+ let box = line.parentElement;
28660
+ while(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isList(box) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(box)){
28661
+ box = box.parentElement;
28662
+ }
28663
+ return box;
28664
+ }
28665
+ /**
28666
+ * Moves a list item into a list of its own, which carries on its numbering
28667
+ */ function ownList(item) {
28668
+ const list = item.parentElement;
28669
+ const own = list.cloneNode(false);
28670
+ const index = Array.from(list.children).indexOf(item);
28671
+ if (index) {
28672
+ // Two lists cannot share one id
28673
+ own.removeAttribute('id');
28674
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(list, 'ol')) {
28675
+ const start = parseInt(list.getAttribute('start') || '1', 10) || 1;
28676
+ own.setAttribute('start', String(start + index));
28677
+ }
28678
+ }
28679
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(own, item);
28680
+ return own;
28681
+ }
28607
28682
  /**
28608
28683
  * Delete at the edge of a list pulls the next line up to the caret, as the
28609
28684
  * browsers do, instead of moving the caret's line into the next block: