jodit 4.13.22 → 4.13.24

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 (57) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +3 -3
  4. package/es2015/jodit.js +34 -7
  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 +4 -4
  18. package/es2021/jodit.js +35 -7
  19. package/es2021/jodit.min.js +4 -4
  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 +4 -4
  28. package/es2021.en/jodit.js +35 -7
  29. package/es2021.en/jodit.min.js +4 -4
  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 +36 -7
  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/core/selection/style/api/wrap.d.ts +2 -1
  52. package/esm/core/selection/style/api/wrap.js +12 -2
  53. package/esm/core/selection/style/transactions.js +18 -4
  54. package/esm/plugins/clean-html/helpers/visitor/filters/remove-empty-text-node.js +7 -1
  55. package/esm/plugins/clean-html/helpers/visitor/filters/remove-inv-text-nodes.js +4 -1
  56. package/package.json +1 -1
  57. package/types/core/selection/style/api/wrap.d.ts +2 -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.13.22
4
+ * Version: v4.13.24
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -2107,7 +2107,7 @@ __webpack_require__.r(__webpack_exports__);
2107
2107
  * @packageDocumentation
2108
2108
  * @module constants
2109
2109
  */
2110
- var APP_VERSION = "4.13.22";
2110
+ var APP_VERSION = "4.13.24";
2111
2111
  // prettier-ignore
2112
2112
  var ES = "es5";
2113
2113
  var IS_ES_MODERN = false;
@@ -13804,6 +13804,7 @@ if (jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.globalDocument) {
13804
13804
  "use strict";
13805
13805
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13806
13806
  /* harmony export */ FiniteStateMachine: function() { return /* reexport safe */ _finite_state_machine__WEBPACK_IMPORTED_MODULE_1__.FiniteStateMachine; },
13807
+ /* harmony export */ WRAP_NODES: function() { return /* reexport safe */ _wrap__WEBPACK_IMPORTED_MODULE_13__.WRAP_NODES; },
13807
13808
  /* harmony export */ extractSelectedPart: function() { return /* reexport safe */ _extract__WEBPACK_IMPORTED_MODULE_0__.extractSelectedPart; },
13808
13809
  /* harmony export */ getSuitChild: function() { return /* reexport safe */ _get_suit_child__WEBPACK_IMPORTED_MODULE_2__.getSuitChild; },
13809
13810
  /* harmony export */ getSuitParent: function() { return /* reexport safe */ _get_suit_parent__WEBPACK_IMPORTED_MODULE_3__.getSuitParent; },
@@ -14480,6 +14481,7 @@ function toggleAttribute(jodit, value, elm, key, dry, mode) {
14480
14481
 
14481
14482
  "use strict";
14482
14483
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
14484
+ /* harmony export */ WRAP_NODES: function() { return /* binding */ WRAP_NODES; },
14483
14485
  /* harmony export */ wrap: function() { return /* binding */ wrap; }
14484
14486
  /* harmony export */ });
14485
14487
  /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27795);
@@ -14535,7 +14537,7 @@ var WRAP_NODES = new Set([
14535
14537
  */ function findOrCreateWrapper(commitStyle, font, jodit) {
14536
14538
  if (commitStyle.elementIsBlock) {
14537
14539
  var box = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.up(font, function(node) {
14538
- return jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isBlock(node) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(node, WRAP_NODES);
14540
+ return jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isBlock(node) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(node, WRAP_NODES) && !hasBlockChildren(node);
14539
14541
  }, jodit.editor);
14540
14542
  if (box) {
14541
14543
  return box;
@@ -14545,6 +14547,15 @@ var WRAP_NODES = new Set([
14545
14547
  (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(font, 'size', null);
14546
14548
  return font;
14547
14549
  }
14550
+ /**
14551
+ * A block that itself contains block-level children is a layout container:
14552
+ * replacing it wholesale would merge all its blocks into the new element,
14553
+ * so the selection must be wrapped in a new block inside it instead.
14554
+ */ function hasBlockChildren(node) {
14555
+ return Array.from(node.childNodes).some(function(child) {
14556
+ return jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isBlock(child);
14557
+ });
14558
+ }
14548
14559
 
14549
14560
 
14550
14561
  /***/ }),
@@ -14948,12 +14959,23 @@ var transactions = (_obj = {}, (0,_swc_helpers_define_property__WEBPACK_IMPORTED
14948
14959
  }
14949
14960
  }), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(_obj, states.UNWRAP, {
14950
14961
  exec: function exec(value) {
14951
- if (value.element.attributes.length && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(value.element, value.style.element)) {
14962
+ var element = value.element, style = value.style, jodit = value.jodit;
14963
+ if (element.attributes.length && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(element, style.element)) {
14964
+ return (0,_swc_helpers_object_spread_props__WEBPACK_IMPORTED_MODULE_2__._)((0,_swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_1__._)({}, value), {
14965
+ next: states.REPLACE_DEFAULT
14966
+ });
14967
+ }
14968
+ // Unwrapping a block inside a container (e.g. an h3 inside a div)
14969
+ // leaves bare inline content there: the wrapNodes plugin restores
14970
+ // paragraphs only at the editor root. Replace such a block with
14971
+ // the default tag instead.
14972
+ var parent = element.parentElement;
14973
+ if (style.elementIsBlock && !style.elementIsDefault && parent && parent !== jodit.editor && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isBlock(parent) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(parent, jodit_core_selection_style_api__WEBPACK_IMPORTED_MODULE_6__.WRAP_NODES)) {
14952
14974
  return (0,_swc_helpers_object_spread_props__WEBPACK_IMPORTED_MODULE_2__._)((0,_swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_1__._)({}, value), {
14953
14975
  next: states.REPLACE_DEFAULT
14954
14976
  });
14955
14977
  }
14956
- jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.unwrap(value.element);
14978
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.unwrap(element);
14957
14979
  return (0,_swc_helpers_object_spread_props__WEBPACK_IMPORTED_MODULE_2__._)((0,_swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_1__._)({}, value), {
14958
14980
  mode: jodit_core_selection_style_constants__WEBPACK_IMPORTED_MODULE_7__.UNWRAP,
14959
14981
  next: states.END
@@ -34145,7 +34167,11 @@ __webpack_require__.r(__webpack_exports__);
34145
34167
  * @private
34146
34168
  */ function removeEmptyTextNode(jodit, node, hadEffect, arg, argi, currentNode) {
34147
34169
  if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isText(node) && !node.nodeValue) {
34148
- if (node === currentNode && jodit.s.isCollapsed()) {
34170
+ // Restore the caret only while the editor owns focus. The walker runs
34171
+ // asynchronously, so the user may have already tabbed away — moving the
34172
+ // selection here would call `focus()` and steal focus back from the
34173
+ // element the user navigated to (e.g. Shift+Tab accessibility flow).
34174
+ if (node === currentNode && jodit.s.isFocused() && jodit.s.isCollapsed()) {
34149
34175
  jodit.s.setCursorAfter(node);
34150
34176
  }
34151
34177
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.safeRemove(node);
@@ -34188,7 +34214,10 @@ __webpack_require__.r(__webpack_exports__);
34188
34214
  return hadEffect;
34189
34215
  }
34190
34216
  node.nodeValue = node.nodeValue.replace((0,jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.INVISIBLE_SPACE_REG_EXP)(), '');
34191
- if (node === currentNode && jodit.s.isCollapsed()) {
34217
+ // Same guard as in `removeEmptyTextNode`: the walker is asynchronous, so
34218
+ // never move the selection (it re-focuses the editor) once the user has
34219
+ // moved focus elsewhere.
34220
+ if (node === currentNode && jodit.s.isFocused() && jodit.s.isCollapsed()) {
34192
34221
  jodit.s.setCursorAfter(node);
34193
34222
  }
34194
34223
  if (!node.nodeValue) {
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.13.22
4
+ * Version: v4.13.24
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.13.22
11
+ * Version: v4.13.24
12
12
  * Url: https://xdsoft.net/jodit/
13
13
  * License(s): MIT
14
14
  */