jodit 4.4.7 → 4.5.1

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 (63) hide show
  1. package/CHANGELOG.md +25 -3
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +2 -2
  4. package/es2015/jodit.js +82 -40
  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 +82 -40
  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 +82 -40
  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 +82 -40
  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 +82 -40
  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/clean-html/helpers/visitor/filters/try-remove-node.js +11 -5
  61. package/esm/plugins/indent/indent.js +34 -22
  62. package/package.json +1 -1
  63. 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.5.1
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.5.1";
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
  */
@@ -29128,12 +29152,18 @@ function tryRemoveNode(jodit, nodeElm, hadEffect, allowTags, denyTags, currentSe
29128
29152
  * @private
29129
29153
  */
29130
29154
  function isRemovableNode(jodit, node, current, allow, deny) {
29131
- if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isText(node) &&
29132
- ((allow && !allow[node.nodeName]) || (deny && deny[node.nodeName]))) {
29133
- return true;
29155
+ if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isText(node)) {
29156
+ if (allow && !allow[node.nodeName]) {
29157
+ return true;
29158
+ }
29159
+ if (!allow && deny && deny[node.nodeName]) {
29160
+ return true;
29161
+ }
29134
29162
  }
29135
- return (jodit.o.cleanHTML.removeEmptyElements &&
29136
- jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isElement(node) &&
29163
+ if (!jodit.o.cleanHTML.removeEmptyElements) {
29164
+ return false;
29165
+ }
29166
+ return (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isElement(node) &&
29137
29167
  node.nodeName.match(jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.IS_INLINE) != null &&
29138
29168
  !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isTemporary(node) &&
29139
29169
  (0,jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_2__/* .trim */ .Bq)(node.innerHTML).length === 0 &&
@@ -34566,7 +34596,7 @@ var getKey = function (direction, box) {
34566
34596
  /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(17352);
34567
34597
  /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71842);
34568
34598
  /* 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);
34599
+ /* harmony import */ var jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(97369);
34570
34600
  /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(97767);
34571
34601
  /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(3392);
34572
34602
  /*!
@@ -34580,6 +34610,22 @@ var getKey = function (direction, box) {
34580
34610
 
34581
34611
 
34582
34612
 
34613
+ var applyIndentToBox = function (processedElements, currentBox, editor, command) {
34614
+ if (!currentBox) {
34615
+ return;
34616
+ }
34617
+ if (processedElements.has(currentBox)) {
34618
+ return;
34619
+ }
34620
+ var key = (0,_helpers__WEBPACK_IMPORTED_MODULE_5__/* .getKey */ .i)(editor.o.direction, currentBox);
34621
+ processedElements.add(currentBox);
34622
+ var value = currentBox.style[key] ? parseInt(currentBox.style[key], 10) : 0;
34623
+ value += editor.o.indentMargin * (command === 'outdent' ? -1 : 1);
34624
+ currentBox.style[key] = value > 0 ? value + 'px' : '';
34625
+ if (!(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_3__.attr)(currentBox, 'style')) {
34626
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_3__.attr)(currentBox, 'style', null);
34627
+ }
34628
+ };
34583
34629
  /**
34584
34630
  * Indents the line containing the selection or insertion point.
34585
34631
  */
@@ -34593,46 +34639,42 @@ function indent(editor) {
34593
34639
  name: 'outdent',
34594
34640
  group: 'indent'
34595
34641
  });
34596
- var callback = function (command) {
34597
- var processedElements = [];
34642
+ var indentCommand = function (command) {
34643
+ var processedElements = new Set();
34644
+ var _a = editor.o, enter = _a.enter, enterBlock = _a.enterBlock;
34645
+ var isBrMode = enter.toLowerCase() === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.BR;
34646
+ var current = editor.s.current();
34647
+ if (isBrMode && editor.s.isCollapsed()) {
34648
+ if (current) {
34649
+ var box = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.wrapNextInline(current, enterBlock, editor);
34650
+ applyIndentToBox(processedElements, box, editor, command);
34651
+ return false;
34652
+ }
34653
+ }
34598
34654
  editor.s.eachSelection(function (current) {
34599
34655
  editor.s.save();
34600
34656
  var currentBox = current
34601
34657
  ? jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.up(current, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isBlock, editor.editor)
34602
34658
  : false;
34603
- var enter = editor.o.enter;
34604
34659
  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);
34660
+ 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
34661
  }
34607
34662
  if (!currentBox) {
34608
34663
  editor.s.restore();
34609
34664
  return false;
34610
34665
  }
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
- }
34666
+ applyIndentToBox(processedElements, currentBox, editor, command);
34625
34667
  editor.s.restore();
34626
34668
  });
34627
34669
  editor.synchronizeValues();
34628
34670
  return false;
34629
34671
  };
34630
34672
  editor.registerCommand('indent', {
34631
- exec: callback,
34673
+ exec: indentCommand,
34632
34674
  hotkeys: ['ctrl+]', 'cmd+]']
34633
34675
  });
34634
34676
  editor.registerCommand('outdent', {
34635
- exec: callback,
34677
+ exec: indentCommand,
34636
34678
  hotkeys: ['ctrl+[', 'cmd+[']
34637
34679
  });
34638
34680
  }
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.5.1
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.5.1
12
12
  * Url: https://xdsoft.net/jodit/
13
13
  * License(s): MIT
14
14
  */