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
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.4.7
4
+ * Version: v4.4.8
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1849,7 +1849,7 @@ __webpack_require__.r(__webpack_exports__);
1849
1849
  * Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
1850
1850
  */
1851
1851
 
1852
- var APP_VERSION = "4.4.7";
1852
+ var APP_VERSION = "4.4.8";
1853
1853
  // prettier-ignore
1854
1854
  var ES = "es5";
1855
1855
  var IS_ES_MODERN = false;
@@ -3055,28 +3055,25 @@ var Dom = /** @class */ (function () {
3055
3055
  }
3056
3056
  };
3057
3057
  /**
3058
- * Wrap all inline siblings
3058
+ * Wrap all inline next siblings
3059
3059
  */
3060
- Dom.wrapInline = function (current, tag, editor) {
3061
- var tmp, first = current, last = current;
3060
+ Dom.wrapNextInline = function (current, tag, editor) {
3061
+ var tmp;
3062
+ var first = current;
3063
+ var last = current;
3062
3064
  editor.s.save();
3063
3065
  var needFindNext = false;
3064
- do {
3065
- needFindNext = false;
3066
- tmp = first.previousSibling;
3067
- if (tmp && !Dom.isBlock(tmp)) {
3068
- needFindNext = true;
3069
- first = tmp;
3070
- }
3071
- } while (needFindNext);
3072
3066
  do {
3073
3067
  needFindNext = false;
3074
3068
  tmp = last.nextSibling;
3075
- if (tmp && !Dom.isBlock(tmp)) {
3069
+ if (tmp && !Dom.isBlock(tmp) && !Dom.isTag(tmp, 'br')) {
3076
3070
  needFindNext = true;
3077
3071
  last = tmp;
3078
3072
  }
3079
3073
  } while (needFindNext);
3074
+ return Dom.__wrapElements(tag, editor, first, last);
3075
+ };
3076
+ Dom.__wrapElements = function (tag, editor, first, last) {
3080
3077
  var wrapper = (0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_2__/* .isString */ .Kg)(tag) ? editor.createInside.element(tag) : tag;
3081
3078
  if (first.parentNode) {
3082
3079
  first.parentNode.insertBefore(wrapper, first);
@@ -3093,6 +3090,33 @@ var Dom = /** @class */ (function () {
3093
3090
  editor.s.restore();
3094
3091
  return wrapper;
3095
3092
  };
3093
+ /**
3094
+ * Wrap all inline siblings
3095
+ */
3096
+ Dom.wrapInline = function (current, tag, editor) {
3097
+ var tmp;
3098
+ var first = current;
3099
+ var last = current;
3100
+ editor.s.save();
3101
+ var needFindNext = false;
3102
+ do {
3103
+ needFindNext = false;
3104
+ tmp = first.previousSibling;
3105
+ if (tmp && !Dom.isBlock(tmp)) {
3106
+ needFindNext = true;
3107
+ first = tmp;
3108
+ }
3109
+ } while (needFindNext);
3110
+ do {
3111
+ needFindNext = false;
3112
+ tmp = last.nextSibling;
3113
+ if (tmp && !Dom.isBlock(tmp)) {
3114
+ needFindNext = true;
3115
+ last = tmp;
3116
+ }
3117
+ } while (needFindNext);
3118
+ return Dom.__wrapElements(tag, editor, first, last);
3119
+ };
3096
3120
  /**
3097
3121
  * Wrap node inside another node
3098
3122
  */
@@ -34566,7 +34590,7 @@ var getKey = function (direction, box) {
34566
34590
  /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(17352);
34567
34591
  /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71842);
34568
34592
  /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(56298);
34569
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(65147);
34593
+ /* harmony import */ var jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(97369);
34570
34594
  /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(97767);
34571
34595
  /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(3392);
34572
34596
  /*!
@@ -34580,6 +34604,22 @@ var getKey = function (direction, box) {
34580
34604
 
34581
34605
 
34582
34606
 
34607
+ var applyIndentToBox = function (processedElements, currentBox, editor, command) {
34608
+ if (!currentBox) {
34609
+ return;
34610
+ }
34611
+ if (processedElements.has(currentBox)) {
34612
+ return;
34613
+ }
34614
+ var key = (0,_helpers__WEBPACK_IMPORTED_MODULE_5__/* .getKey */ .i)(editor.o.direction, currentBox);
34615
+ processedElements.add(currentBox);
34616
+ var value = currentBox.style[key] ? parseInt(currentBox.style[key], 10) : 0;
34617
+ value += editor.o.indentMargin * (command === 'outdent' ? -1 : 1);
34618
+ currentBox.style[key] = value > 0 ? value + 'px' : '';
34619
+ if (!(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_3__.attr)(currentBox, 'style')) {
34620
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_3__.attr)(currentBox, 'style', null);
34621
+ }
34622
+ };
34583
34623
  /**
34584
34624
  * Indents the line containing the selection or insertion point.
34585
34625
  */
@@ -34593,46 +34633,42 @@ function indent(editor) {
34593
34633
  name: 'outdent',
34594
34634
  group: 'indent'
34595
34635
  });
34596
- var callback = function (command) {
34597
- var processedElements = [];
34636
+ var indentCommand = function (command) {
34637
+ var processedElements = new Set();
34638
+ var _a = editor.o, enter = _a.enter, enterBlock = _a.enterBlock;
34639
+ var isBrMode = enter.toLowerCase() === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.BR;
34640
+ var current = editor.s.current();
34641
+ if (isBrMode && editor.s.isCollapsed()) {
34642
+ if (current) {
34643
+ var box = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.wrapNextInline(current, enterBlock, editor);
34644
+ applyIndentToBox(processedElements, box, editor, command);
34645
+ return false;
34646
+ }
34647
+ }
34598
34648
  editor.s.eachSelection(function (current) {
34599
34649
  editor.s.save();
34600
34650
  var currentBox = current
34601
34651
  ? jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.up(current, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isBlock, editor.editor)
34602
34652
  : false;
34603
- var enter = editor.o.enter;
34604
34653
  if (!currentBox && current) {
34605
- 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);
34654
+ 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);
34606
34655
  }
34607
34656
  if (!currentBox) {
34608
34657
  editor.s.restore();
34609
34658
  return false;
34610
34659
  }
34611
- var alreadyIndented = processedElements.includes(currentBox);
34612
- if (currentBox && !alreadyIndented) {
34613
- var key = (0,_helpers__WEBPACK_IMPORTED_MODULE_5__/* .getKey */ .i)(editor.o.direction, currentBox);
34614
- processedElements.push(currentBox);
34615
- var value = currentBox.style[key]
34616
- ? parseInt(currentBox.style[key], 10)
34617
- : 0;
34618
- value +=
34619
- editor.o.indentMargin * (command === 'outdent' ? -1 : 1);
34620
- currentBox.style[key] = value > 0 ? value + 'px' : '';
34621
- if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.attr)(currentBox, 'style')) {
34622
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.attr)(currentBox, 'style', null);
34623
- }
34624
- }
34660
+ applyIndentToBox(processedElements, currentBox, editor, command);
34625
34661
  editor.s.restore();
34626
34662
  });
34627
34663
  editor.synchronizeValues();
34628
34664
  return false;
34629
34665
  };
34630
34666
  editor.registerCommand('indent', {
34631
- exec: callback,
34667
+ exec: indentCommand,
34632
34668
  hotkeys: ['ctrl+]', 'cmd+]']
34633
34669
  });
34634
34670
  editor.registerCommand('outdent', {
34635
- exec: callback,
34671
+ exec: indentCommand,
34636
34672
  hotkeys: ['ctrl+[', 'cmd+[']
34637
34673
  });
34638
34674
  }
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.4.7
4
+ * Version: v4.4.8
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.4.7
11
+ * Version: v4.4.8
12
12
  * Url: https://xdsoft.net/jodit/
13
13
  * License(s): MIT
14
14
  */