jodit 4.18.11 → 4.18.12

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 (55) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +2 -2
  4. package/es2015/jodit.js +27 -7
  5. package/es2015/jodit.min.js +2 -2
  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 +2 -2
  13. package/es2018/jodit.min.js +2 -2
  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 +27 -7
  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 +27 -7
  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 +52 -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/list/toggle-ordered-list.d.ts +1 -1
  52. package/esm/core/selection/style/api/list/toggle-ordered-list.js +30 -4
  53. package/esm/core/selection/style/transactions.js +1 -1
  54. package/package.json +1 -1
  55. package/types/core/selection/style/api/list/toggle-ordered-list.d.ts +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.11
4
+ * Version: v4.18.12
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1823,7 +1823,7 @@ __webpack_require__.r(__webpack_exports__);
1823
1823
  * ```
1824
1824
  * @packageDocumentation
1825
1825
  * @module constants
1826
- */ const APP_VERSION = "4.18.11";
1826
+ */ const APP_VERSION = "4.18.12";
1827
1827
  // prettier-ignore
1828
1828
  const ES = "es2021";
1829
1829
  const IS_ES_MODERN = true;
@@ -13203,7 +13203,7 @@ function elementsEqualAttributes(elm1, elm2) {
13203
13203
  /**
13204
13204
  * Replaces `ul->ol` or `ol->ul`, apply styles to the list, or remove a list item from it
13205
13205
  * @private
13206
- */ function toggleOrderedList(commitStyle, li, jodit, mode) {
13206
+ */ function toggleOrderedList(commitStyle, li, jodit, mode, collapsed = false) {
13207
13207
  if (!li) {
13208
13208
  return mode;
13209
13209
  }
@@ -13232,16 +13232,36 @@ function elementsEqualAttributes(elm1, elm2) {
13232
13232
  }
13233
13233
  // ul => ol, ol => ul or ul => ul.class1
13234
13234
  if (mode === jodit_core_selection_style_constants__WEBPACK_IMPORTED_MODULE_6__.REPLACE || isChangeMode || !isSameList) {
13235
- const wrapper = unwrapList(jodit_core_selection_style_constants__WEBPACK_IMPORTED_MODULE_6__.REPLACE, list, li, jodit, commitStyle);
13236
- const newList = (0,_wrap_list__WEBPACK_IMPORTED_MODULE_7__.wrapList)(commitStyle, wrapper, jodit);
13235
+ // With just a caret, Word converts the whole list
13236
+ const items = collapsed && !isSameList ? Array.from(list.children).filter((item)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isLeaf(item)) : [
13237
+ li
13238
+ ];
13239
+ let newList;
13240
+ for (const item of items){
13241
+ newList = keepNumbering(item, (itemList)=>(0,_wrap_list__WEBPACK_IMPORTED_MODULE_7__.wrapList)(commitStyle, unwrapList(jodit_core_selection_style_constants__WEBPACK_IMPORTED_MODULE_6__.REPLACE, itemList, item, jodit, commitStyle), jodit));
13242
+ }
13237
13243
  hook(jodit_core_selection_style_constants__WEBPACK_IMPORTED_MODULE_6__.REPLACE, newList, commitStyle);
13238
13244
  return jodit_core_selection_style_constants__WEBPACK_IMPORTED_MODULE_6__.REPLACE;
13239
13245
  }
13240
13246
  }
13241
- const wrapper = unwrapList((/* inlined export .UNWRAP */"unwrap"), list, li, jodit, commitStyle);
13247
+ const wrapper = keepNumbering(li, (itemList)=>unwrapList((/* inlined export .UNWRAP */"unwrap"), itemList, li, jodit, commitStyle));
13242
13248
  hook((/* inlined export .UNWRAP */"unwrap"), wrapper, commitStyle);
13243
13249
  return (/* inlined export .UNWRAP */"unwrap");
13244
13250
  }
13251
+ /**
13252
+ * Takes `item` out of its list with `takeOut`, and carries a numbered list's
13253
+ * count on past it, as Word does: 1, a bullet, then 2
13254
+ */ function keepNumbering(item, takeOut) {
13255
+ const list = item.parentElement;
13256
+ const rest = item.nextElementSibling;
13257
+ const next = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(list, 'ol') ? (parseInt(list.getAttribute('start') || '1', 10) || 1) + Array.from(list.children).indexOf(item) : 0;
13258
+ const result = takeOut(list);
13259
+ const restList = rest?.parentElement;
13260
+ if (next && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(restList, 'ol')) {
13261
+ next > 1 ? restList.setAttribute('start', String(next)) : restList.removeAttribute('start');
13262
+ }
13263
+ return result;
13264
+ }
13245
13265
  /**
13246
13266
  * Other attributes, such as a class, still move the items into a new list,
13247
13267
  * where the `beforeWrapList` hook can add markup to each of them
@@ -14017,7 +14037,7 @@ const transactions = {
14017
14037
  exec (value) {
14018
14038
  return {
14019
14039
  ...value,
14020
- mode: (0,jodit_core_selection_style_api__WEBPACK_IMPORTED_MODULE_3__.toggleOrderedList)(value.style, value.element, value.jodit, value.mode),
14040
+ mode: (0,jodit_core_selection_style_api__WEBPACK_IMPORTED_MODULE_3__.toggleOrderedList)(value.style, value.element, value.jodit, value.mode, value.collapsed),
14021
14041
  next: states.END
14022
14042
  };
14023
14043
  }