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/es5/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
  */
@@ -2152,7 +2152,7 @@ __webpack_require__.r(__webpack_exports__);
2152
2152
  * @packageDocumentation
2153
2153
  * @module constants
2154
2154
  */
2155
- var APP_VERSION = "4.18.9";
2155
+ var APP_VERSION = "4.18.10";
2156
2156
  // prettier-ignore
2157
2157
  var ES = "es5";
2158
2158
  var IS_ES_MODERN = false;
@@ -34160,6 +34160,11 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_9__.pluginSystem.add('backspace', bac
34160
34160
  * Check if two separate elements can be connected
34161
34161
  * @private
34162
34162
  */ function checkJoinNeighbors(jodit, fakeNode, backspace) {
34163
+ return joinNeighbors(jodit, fakeNode, backspace, false);
34164
+ }
34165
+ /**
34166
+ * `moved` is set on the one re-entrant pass after `moveToNextLine`
34167
+ */ function joinNeighbors(jodit, fakeNode, backspace, moved) {
34163
34168
  if (checkJoinBareText(jodit, fakeNode, backspace)) {
34164
34169
  return true;
34165
34170
  }
@@ -34190,6 +34195,14 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_9__.pluginSystem.add('backspace', bac
34190
34195
  return true;
34191
34196
  }
34192
34197
  var box = findCaretBox(fakeNode, mainClosestBox);
34198
+ // One pass only: the line now sits beside the next one, so the
34199
+ // cases below join them. The DOM has changed either way
34200
+ if (!moved && sibling && moveToNextLine(jodit, fakeNode, box, sibling, backspace)) {
34201
+ if (!joinNeighbors(jodit, fakeNode, backspace, true)) {
34202
+ jodit.s.setCursorBefore(fakeNode);
34203
+ }
34204
+ return true;
34205
+ }
34193
34206
  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))) {
34194
34207
  jodit.s.setCursorBefore(fakeNode);
34195
34208
  return true;
@@ -34241,6 +34254,68 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_9__.pluginSystem.add('backspace', bac
34241
34254
  });
34242
34255
  return cells.length ? cells[backspace ? cells.length - 1 : 0] : null;
34243
34256
  }
34257
+ /**
34258
+ * On Delete, Word joins two lines where the next one is, inside or outside
34259
+ * its box or quote, and the joined line keeps the caret line's kind, list item
34260
+ * or paragraph. Two paragraphs already join that way. When either line is a
34261
+ * list item, this moves the caret's line beside the next one, and the usual
34262
+ * cases then join them: `<p>one|</p><div><ul><li>two</li></ul></div>` becomes
34263
+ * `<div><p>one|</p><ul><li>two</li></ul></div>`
34264
+ * @private
34265
+ */ function moveToNextLine(jodit, fakeNode, box, sibling, backspace) {
34266
+ 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)) {
34267
+ return false;
34268
+ }
34269
+ var line = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.up(fakeNode, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock, box, true);
34270
+ var next = findEdgeBlock(sibling, false, jodit.editor);
34271
+ 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
34272
+ 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)) {
34273
+ return false;
34274
+ }
34275
+ var from = line.parentElement;
34276
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(line) && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(next)) {
34277
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(next, line);
34278
+ } else if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(line)) {
34279
+ // A list item keeps its bullet, in a list of its own
34280
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(next, ownList(line));
34281
+ } else {
34282
+ // A paragraph can't go inside a list, so it goes in front of it
34283
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(next.parentElement, line);
34284
+ }
34285
+ var remove = from;
34286
+ while(remove && remove !== jodit.editor && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(remove)){
34287
+ var parent = remove.parentElement;
34288
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(remove);
34289
+ remove = parent;
34290
+ }
34291
+ return true;
34292
+ }
34293
+ /**
34294
+ * The box or quote a line is in, past its lists
34295
+ */ function boxOf(line) {
34296
+ var box = line.parentElement;
34297
+ while(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isList(box) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(box)){
34298
+ box = box.parentElement;
34299
+ }
34300
+ return box;
34301
+ }
34302
+ /**
34303
+ * Moves a list item into a list of its own, which carries on its numbering
34304
+ */ function ownList(item) {
34305
+ var list = item.parentElement;
34306
+ var own = list.cloneNode(false);
34307
+ var index = Array.from(list.children).indexOf(item);
34308
+ if (index) {
34309
+ // Two lists cannot share one id
34310
+ own.removeAttribute('id');
34311
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(list, 'ol')) {
34312
+ var start = parseInt(list.getAttribute('start') || '1', 10) || 1;
34313
+ own.setAttribute('start', String(start + index));
34314
+ }
34315
+ }
34316
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(own, item);
34317
+ return own;
34318
+ }
34244
34319
  /**
34245
34320
  * Delete at the edge of a list pulls the next line up to the caret, as the
34246
34321
  * browsers do, instead of moving the caret's line into the next block:
package/es5/jodit.min.css CHANGED
@@ -1,14 +1,14 @@
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
  */
8
8
  /*!
9
9
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
10
10
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
11
- * Version: v4.18.9
11
+ * Version: v4.18.10
12
12
  * Url: https://xdsoft.net/jodit/
13
13
  * License(s): MIT
14
14
  */