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
@@ -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;
@@ -28223,6 +28223,11 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28223
28223
  * Check if two separate elements can be connected
28224
28224
  * @private
28225
28225
  */ function checkJoinNeighbors(jodit, fakeNode, backspace) {
28226
+ return joinNeighbors(jodit, fakeNode, backspace, false);
28227
+ }
28228
+ /**
28229
+ * `moved` is set on the one re-entrant pass after `moveToNextLine`
28230
+ */ function joinNeighbors(jodit, fakeNode, backspace, moved) {
28226
28231
  if (checkJoinBareText(jodit, fakeNode, backspace)) {
28227
28232
  return true;
28228
28233
  }
@@ -28253,6 +28258,14 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28253
28258
  return true;
28254
28259
  }
28255
28260
  const box = findCaretBox(fakeNode, mainClosestBox);
28261
+ // One pass only: the line now sits beside the next one, so the
28262
+ // cases below join them. The DOM has changed either way
28263
+ if (!moved && sibling && moveToNextLine(jodit, fakeNode, box, sibling, backspace)) {
28264
+ if (!joinNeighbors(jodit, fakeNode, backspace, true)) {
28265
+ jodit.s.setCursorBefore(fakeNode);
28266
+ }
28267
+ return true;
28268
+ }
28256
28269
  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))) {
28257
28270
  jodit.s.setCursorBefore(fakeNode);
28258
28271
  return true;
@@ -28304,6 +28317,68 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28304
28317
  });
28305
28318
  return cells.length ? cells[backspace ? cells.length - 1 : 0] : null;
28306
28319
  }
28320
+ /**
28321
+ * On Delete, Word joins two lines where the next one is, inside or outside
28322
+ * its box or quote, and the joined line keeps the caret line's kind, list item
28323
+ * or paragraph. Two paragraphs already join that way. When either line is a
28324
+ * list item, this moves the caret's line beside the next one, and the usual
28325
+ * cases then join them: `<p>one|</p><div><ul><li>two</li></ul></div>` becomes
28326
+ * `<div><p>one|</p><ul><li>two</li></ul></div>`
28327
+ * @private
28328
+ */ function moveToNextLine(jodit, fakeNode, box, sibling, backspace) {
28329
+ 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)) {
28330
+ return false;
28331
+ }
28332
+ 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);
28333
+ const next = findEdgeBlock(sibling, false, jodit.editor);
28334
+ 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
28335
+ 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)) {
28336
+ return false;
28337
+ }
28338
+ const from = line.parentElement;
28339
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(line) && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(next)) {
28340
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(next, line);
28341
+ } else if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(line)) {
28342
+ // A list item keeps its bullet, in a list of its own
28343
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(next, ownList(line));
28344
+ } else {
28345
+ // A paragraph can't go inside a list, so it goes in front of it
28346
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(next.parentElement, line);
28347
+ }
28348
+ let remove = from;
28349
+ while(remove && remove !== jodit.editor && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(remove)){
28350
+ const parent = remove.parentElement;
28351
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(remove);
28352
+ remove = parent;
28353
+ }
28354
+ return true;
28355
+ }
28356
+ /**
28357
+ * The box or quote a line is in, past its lists
28358
+ */ function boxOf(line) {
28359
+ let box = line.parentElement;
28360
+ while(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isList(box) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(box)){
28361
+ box = box.parentElement;
28362
+ }
28363
+ return box;
28364
+ }
28365
+ /**
28366
+ * Moves a list item into a list of its own, which carries on its numbering
28367
+ */ function ownList(item) {
28368
+ const list = item.parentElement;
28369
+ const own = list.cloneNode(false);
28370
+ const index = Array.from(list.children).indexOf(item);
28371
+ if (index) {
28372
+ // Two lists cannot share one id
28373
+ own.removeAttribute('id');
28374
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(list, 'ol')) {
28375
+ const start = parseInt(list.getAttribute('start') || '1', 10) || 1;
28376
+ own.setAttribute('start', String(start + index));
28377
+ }
28378
+ }
28379
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(own, item);
28380
+ return own;
28381
+ }
28307
28382
  /**
28308
28383
  * Delete at the edge of a list pulls the next line up to the caret, as the
28309
28384
  * browsers do, instead of moving the caret's line into the next block: