jodit 4.4.7 → 4.4.8

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 (62) 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 +71 -35
  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.css +1 -1
  13. package/es2018/jodit.fat.min.js +2 -2
  14. package/es2018/jodit.js +71 -35
  15. package/es2018/jodit.min.js +2 -2
  16. package/es2018/plugins/debug/debug.css +1 -1
  17. package/es2018/plugins/debug/debug.js +1 -1
  18. package/es2018/plugins/debug/debug.min.js +1 -1
  19. package/es2018/plugins/speech-recognize/speech-recognize.css +1 -1
  20. package/es2018/plugins/speech-recognize/speech-recognize.js +1 -1
  21. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  22. package/es2021/jodit.css +1 -1
  23. package/es2021/jodit.fat.min.js +2 -2
  24. package/es2021/jodit.js +71 -35
  25. package/es2021/jodit.min.js +2 -2
  26. package/es2021/plugins/debug/debug.css +1 -1
  27. package/es2021/plugins/debug/debug.js +1 -1
  28. package/es2021/plugins/debug/debug.min.js +1 -1
  29. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  30. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  31. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  32. package/es2021.en/jodit.css +1 -1
  33. package/es2021.en/jodit.fat.min.js +2 -2
  34. package/es2021.en/jodit.js +71 -35
  35. package/es2021.en/jodit.min.js +2 -2
  36. package/es2021.en/plugins/debug/debug.css +1 -1
  37. package/es2021.en/plugins/debug/debug.js +1 -1
  38. package/es2021.en/plugins/debug/debug.min.js +1 -1
  39. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  40. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  41. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  42. package/es5/5.fat.min.js +1 -1
  43. package/es5/5.min.js +1 -1
  44. package/es5/975.fat.min.js +1 -1
  45. package/es5/975.min.js +1 -1
  46. package/es5/jodit.css +2 -2
  47. package/es5/jodit.fat.min.js +2 -2
  48. package/es5/jodit.js +71 -35
  49. package/es5/jodit.min.css +2 -2
  50. package/es5/jodit.min.js +2 -2
  51. package/es5/plugins/debug/debug.css +1 -1
  52. package/es5/plugins/debug/debug.js +1 -1
  53. package/es5/plugins/debug/debug.min.js +1 -1
  54. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  55. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  56. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  57. package/esm/core/constants.js +1 -1
  58. package/esm/core/dom/dom.d.ts +5 -0
  59. package/esm/core/dom/dom.js +36 -12
  60. package/esm/plugins/indent/indent.js +34 -22
  61. package/package.json +1 -1
  62. package/types/core/dom/dom.d.ts +5 -0
@@ -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.4.7
4
+ * Version: v4.4.8
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1743,7 +1743,7 @@ __webpack_require__.r(__webpack_exports__);
1743
1743
  * Released under MIT see LICENSE.txt in the project root for license information.
1744
1744
  * Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
1745
1745
  */
1746
- const APP_VERSION = "4.4.7";
1746
+ const APP_VERSION = "4.4.8";
1747
1747
  // prettier-ignore
1748
1748
  const ES = "es2021";
1749
1749
  const IS_ES_MODERN = true;
@@ -2884,28 +2884,25 @@ class Dom {
2884
2884
  }
2885
2885
  }
2886
2886
  /**
2887
- * Wrap all inline siblings
2887
+ * Wrap all inline next siblings
2888
2888
  */
2889
- static wrapInline(current, tag, editor) {
2890
- let tmp, first = current, last = current;
2889
+ static wrapNextInline(current, tag, editor) {
2890
+ let tmp;
2891
+ const first = current;
2892
+ let last = current;
2891
2893
  editor.s.save();
2892
2894
  let needFindNext = false;
2893
- do {
2894
- needFindNext = false;
2895
- tmp = first.previousSibling;
2896
- if (tmp && !Dom.isBlock(tmp)) {
2897
- needFindNext = true;
2898
- first = tmp;
2899
- }
2900
- } while (needFindNext);
2901
2895
  do {
2902
2896
  needFindNext = false;
2903
2897
  tmp = last.nextSibling;
2904
- if (tmp && !Dom.isBlock(tmp)) {
2898
+ if (tmp && !Dom.isBlock(tmp) && !Dom.isTag(tmp, 'br')) {
2905
2899
  needFindNext = true;
2906
2900
  last = tmp;
2907
2901
  }
2908
2902
  } while (needFindNext);
2903
+ return Dom.__wrapElements(tag, editor, first, last);
2904
+ }
2905
+ static __wrapElements(tag, editor, first, last) {
2909
2906
  const wrapper = (0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_2__/* .isString */ .Kg)(tag) ? editor.createInside.element(tag) : tag;
2910
2907
  if (first.parentNode) {
2911
2908
  first.parentNode.insertBefore(wrapper, first);
@@ -2922,6 +2919,33 @@ class Dom {
2922
2919
  editor.s.restore();
2923
2920
  return wrapper;
2924
2921
  }
2922
+ /**
2923
+ * Wrap all inline siblings
2924
+ */
2925
+ static wrapInline(current, tag, editor) {
2926
+ let tmp;
2927
+ let first = current;
2928
+ let last = current;
2929
+ editor.s.save();
2930
+ let needFindNext = false;
2931
+ do {
2932
+ needFindNext = false;
2933
+ tmp = first.previousSibling;
2934
+ if (tmp && !Dom.isBlock(tmp)) {
2935
+ needFindNext = true;
2936
+ first = tmp;
2937
+ }
2938
+ } while (needFindNext);
2939
+ do {
2940
+ needFindNext = false;
2941
+ tmp = last.nextSibling;
2942
+ if (tmp && !Dom.isBlock(tmp)) {
2943
+ needFindNext = true;
2944
+ last = tmp;
2945
+ }
2946
+ } while (needFindNext);
2947
+ return Dom.__wrapElements(tag, editor, first, last);
2948
+ }
2925
2949
  /**
2926
2950
  * Wrap node inside another node
2927
2951
  */
@@ -32682,7 +32706,7 @@ const getKey = (direction, box) => `${jodit_core_dom_dom__WEBPACK_IMPORTED_MODUL
32682
32706
  /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(17352);
32683
32707
  /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71842);
32684
32708
  /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(56298);
32685
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(65147);
32709
+ /* harmony import */ var jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(97369);
32686
32710
  /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(97767);
32687
32711
  /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(3392);
32688
32712
  /*!
@@ -32696,6 +32720,22 @@ const getKey = (direction, box) => `${jodit_core_dom_dom__WEBPACK_IMPORTED_MODUL
32696
32720
 
32697
32721
 
32698
32722
 
32723
+ const applyIndentToBox = (processedElements, currentBox, editor, command) => {
32724
+ if (!currentBox) {
32725
+ return;
32726
+ }
32727
+ if (processedElements.has(currentBox)) {
32728
+ return;
32729
+ }
32730
+ const key = (0,_helpers__WEBPACK_IMPORTED_MODULE_5__/* .getKey */ .i)(editor.o.direction, currentBox);
32731
+ processedElements.add(currentBox);
32732
+ let value = currentBox.style[key] ? parseInt(currentBox.style[key], 10) : 0;
32733
+ value += editor.o.indentMargin * (command === 'outdent' ? -1 : 1);
32734
+ currentBox.style[key] = value > 0 ? value + 'px' : '';
32735
+ if (!(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_3__.attr)(currentBox, 'style')) {
32736
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_3__.attr)(currentBox, 'style', null);
32737
+ }
32738
+ };
32699
32739
  /**
32700
32740
  * Indents the line containing the selection or insertion point.
32701
32741
  */
@@ -32709,46 +32749,42 @@ function indent(editor) {
32709
32749
  name: 'outdent',
32710
32750
  group: 'indent'
32711
32751
  });
32712
- const callback = (command) => {
32713
- const processedElements = [];
32752
+ const indentCommand = (command) => {
32753
+ const processedElements = new Set();
32754
+ const { enter, enterBlock } = editor.o;
32755
+ const isBrMode = enter.toLowerCase() === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.BR;
32756
+ const current = editor.s.current();
32757
+ if (isBrMode && editor.s.isCollapsed()) {
32758
+ if (current) {
32759
+ const box = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.wrapNextInline(current, enterBlock, editor);
32760
+ applyIndentToBox(processedElements, box, editor, command);
32761
+ return false;
32762
+ }
32763
+ }
32714
32764
  editor.s.eachSelection((current) => {
32715
32765
  editor.s.save();
32716
32766
  let currentBox = current
32717
32767
  ? jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.up(current, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isBlock, editor.editor)
32718
32768
  : false;
32719
- const { enter } = editor.o;
32720
32769
  if (!currentBox && current) {
32721
- currentBox = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.wrapInline(current, enter !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.BR ? enter : jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.PARAGRAPH, editor);
32770
+ currentBox = (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_3__.call)(!isBrMode ? jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.wrapInline : jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.wrapNextInline, current, !isBrMode ? enter.toLowerCase() : enterBlock, editor);
32722
32771
  }
32723
32772
  if (!currentBox) {
32724
32773
  editor.s.restore();
32725
32774
  return false;
32726
32775
  }
32727
- const alreadyIndented = processedElements.includes(currentBox);
32728
- if (currentBox && !alreadyIndented) {
32729
- const key = (0,_helpers__WEBPACK_IMPORTED_MODULE_5__/* .getKey */ .i)(editor.o.direction, currentBox);
32730
- processedElements.push(currentBox);
32731
- let value = currentBox.style[key]
32732
- ? parseInt(currentBox.style[key], 10)
32733
- : 0;
32734
- value +=
32735
- editor.o.indentMargin * (command === 'outdent' ? -1 : 1);
32736
- currentBox.style[key] = value > 0 ? value + 'px' : '';
32737
- if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.attr)(currentBox, 'style')) {
32738
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.attr)(currentBox, 'style', null);
32739
- }
32740
- }
32776
+ applyIndentToBox(processedElements, currentBox, editor, command);
32741
32777
  editor.s.restore();
32742
32778
  });
32743
32779
  editor.synchronizeValues();
32744
32780
  return false;
32745
32781
  };
32746
32782
  editor.registerCommand('indent', {
32747
- exec: callback,
32783
+ exec: indentCommand,
32748
32784
  hotkeys: ['ctrl+]', 'cmd+]']
32749
32785
  });
32750
32786
  editor.registerCommand('outdent', {
32751
- exec: callback,
32787
+ exec: indentCommand,
32752
32788
  hotkeys: ['ctrl+[', 'cmd+[']
32753
32789
  });
32754
32790
  }