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/es2021/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
  */
@@ -1822,7 +1822,7 @@ __webpack_require__.r(__webpack_exports__);
1822
1822
  * ```
1823
1823
  * @packageDocumentation
1824
1824
  * @module constants
1825
- */ const APP_VERSION = "4.18.9";
1825
+ */ const APP_VERSION = "4.18.10";
1826
1826
  // prettier-ignore
1827
1827
  const ES = "es2021";
1828
1828
  const IS_ES_MODERN = true;
@@ -28297,6 +28297,11 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28297
28297
  * Check if two separate elements can be connected
28298
28298
  * @private
28299
28299
  */ function checkJoinNeighbors(jodit, fakeNode, backspace) {
28300
+ return joinNeighbors(jodit, fakeNode, backspace, false);
28301
+ }
28302
+ /**
28303
+ * `moved` is set on the one re-entrant pass after `moveToNextLine`
28304
+ */ function joinNeighbors(jodit, fakeNode, backspace, moved) {
28300
28305
  if (checkJoinBareText(jodit, fakeNode, backspace)) {
28301
28306
  return true;
28302
28307
  }
@@ -28327,6 +28332,14 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28327
28332
  return true;
28328
28333
  }
28329
28334
  const box = findCaretBox(fakeNode, mainClosestBox);
28335
+ // One pass only: the line now sits beside the next one, so the
28336
+ // cases below join them. The DOM has changed either way
28337
+ if (!moved && sibling && moveToNextLine(jodit, fakeNode, box, sibling, backspace)) {
28338
+ if (!joinNeighbors(jodit, fakeNode, backspace, true)) {
28339
+ jodit.s.setCursorBefore(fakeNode);
28340
+ }
28341
+ return true;
28342
+ }
28330
28343
  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))) {
28331
28344
  jodit.s.setCursorBefore(fakeNode);
28332
28345
  return true;
@@ -28378,6 +28391,68 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28378
28391
  });
28379
28392
  return cells.length ? cells[backspace ? cells.length - 1 : 0] : null;
28380
28393
  }
28394
+ /**
28395
+ * On Delete, Word joins two lines where the next one is, inside or outside
28396
+ * its box or quote, and the joined line keeps the caret line's kind, list item
28397
+ * or paragraph. Two paragraphs already join that way. When either line is a
28398
+ * list item, this moves the caret's line beside the next one, and the usual
28399
+ * cases then join them: `<p>one|</p><div><ul><li>two</li></ul></div>` becomes
28400
+ * `<div><p>one|</p><ul><li>two</li></ul></div>`
28401
+ * @private
28402
+ */ function moveToNextLine(jodit, fakeNode, box, sibling, backspace) {
28403
+ 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)) {
28404
+ return false;
28405
+ }
28406
+ 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);
28407
+ const next = findEdgeBlock(sibling, false, jodit.editor);
28408
+ 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
28409
+ 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)) {
28410
+ return false;
28411
+ }
28412
+ const from = line.parentElement;
28413
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(line) && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(next)) {
28414
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(next, line);
28415
+ } else if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(line)) {
28416
+ // A list item keeps its bullet, in a list of its own
28417
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(next, ownList(line));
28418
+ } else {
28419
+ // A paragraph can't go inside a list, so it goes in front of it
28420
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(next.parentElement, line);
28421
+ }
28422
+ let remove = from;
28423
+ while(remove && remove !== jodit.editor && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(remove)){
28424
+ const parent = remove.parentElement;
28425
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(remove);
28426
+ remove = parent;
28427
+ }
28428
+ return true;
28429
+ }
28430
+ /**
28431
+ * The box or quote a line is in, past its lists
28432
+ */ function boxOf(line) {
28433
+ let box = line.parentElement;
28434
+ while(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isList(box) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(box)){
28435
+ box = box.parentElement;
28436
+ }
28437
+ return box;
28438
+ }
28439
+ /**
28440
+ * Moves a list item into a list of its own, which carries on its numbering
28441
+ */ function ownList(item) {
28442
+ const list = item.parentElement;
28443
+ const own = list.cloneNode(false);
28444
+ const index = Array.from(list.children).indexOf(item);
28445
+ if (index) {
28446
+ // Two lists cannot share one id
28447
+ own.removeAttribute('id');
28448
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(list, 'ol')) {
28449
+ const start = parseInt(list.getAttribute('start') || '1', 10) || 1;
28450
+ own.setAttribute('start', String(start + index));
28451
+ }
28452
+ }
28453
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(own, item);
28454
+ return own;
28455
+ }
28381
28456
  /**
28382
28457
  * Delete at the edge of a list pulls the next line up to the caret, as the
28383
28458
  * browsers do, instead of moving the caret's line into the next block: