jodit 4.2.25 → 4.2.27

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 (74) hide show
  1. package/CHANGELOG.md +20 -5
  2. package/es2015/jodit.css +4 -2
  3. package/es2015/jodit.fat.min.css +1 -1
  4. package/es2015/jodit.fat.min.js +2 -2
  5. package/es2015/jodit.js +95 -57
  6. package/es2015/jodit.min.css +1 -1
  7. package/es2015/jodit.min.js +2 -2
  8. package/es2015/plugins/debug/debug.js +1 -1
  9. package/es2015/plugins/debug/debug.min.js +1 -1
  10. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  12. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  13. package/es2018/jodit.css +4 -2
  14. package/es2018/jodit.fat.min.css +1 -1
  15. package/es2018/jodit.fat.min.js +2 -2
  16. package/es2018/jodit.js +95 -57
  17. package/es2018/jodit.min.css +1 -1
  18. package/es2018/jodit.min.js +2 -2
  19. package/es2018/plugins/debug/debug.js +1 -1
  20. package/es2018/plugins/debug/debug.min.js +1 -1
  21. package/es2018/plugins/speech-recognize/speech-recognize.css +1 -1
  22. package/es2018/plugins/speech-recognize/speech-recognize.js +1 -1
  23. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  24. package/es2021/jodit.css +4 -2
  25. package/es2021/jodit.fat.min.css +1 -1
  26. package/es2021/jodit.fat.min.js +2 -2
  27. package/es2021/jodit.js +95 -57
  28. package/es2021/jodit.min.css +1 -1
  29. package/es2021/jodit.min.js +2 -2
  30. package/es2021/plugins/debug/debug.js +1 -1
  31. package/es2021/plugins/debug/debug.min.js +1 -1
  32. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  33. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  34. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  35. package/es2021.en/jodit.css +4 -2
  36. package/es2021.en/jodit.fat.min.css +1 -1
  37. package/es2021.en/jodit.fat.min.js +2 -2
  38. package/es2021.en/jodit.js +95 -57
  39. package/es2021.en/jodit.min.css +1 -1
  40. package/es2021.en/jodit.min.js +2 -2
  41. package/es2021.en/plugins/debug/debug.js +1 -1
  42. package/es2021.en/plugins/debug/debug.min.js +1 -1
  43. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  44. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  45. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  46. package/es5/jodit.css +11 -6
  47. package/es5/jodit.fat.min.css +1 -1
  48. package/es5/jodit.fat.min.js +2 -2
  49. package/es5/jodit.js +96 -57
  50. package/es5/jodit.min.css +3 -3
  51. package/es5/jodit.min.js +2 -2
  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 +3 -3
  58. package/esm/core/dom/dom.d.ts +2 -1
  59. package/esm/core/dom/dom.js +10 -4
  60. package/esm/core/global.js +4 -1
  61. package/esm/core/helpers/normalize/normalize-key-aliases.js +2 -1
  62. package/esm/core/ui/button/tooltip/tooltip.d.ts +1 -0
  63. package/esm/core/ui/button/tooltip/tooltip.js +11 -5
  64. package/esm/modules/table/table.d.ts +2 -3
  65. package/esm/modules/table/table.js +27 -34
  66. package/esm/plugins/add-new-line/add-new-line.js +4 -1
  67. package/esm/plugins/clean-html/helpers/visitor/filters/fill-empty-paragraph.js +9 -1
  68. package/esm/plugins/hotkeys/hotkeys.js +4 -2
  69. package/esm/plugins/select-cells/select-cells.js +1 -1
  70. package/esm/plugins/table/config.js +19 -3
  71. package/package.json +1 -1
  72. package/types/core/dom/dom.d.ts +2 -1
  73. package/types/core/ui/button/tooltip/tooltip.d.ts +1 -0
  74. package/types/modules/table/table.d.ts +2 -3
@@ -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.2.25
4
+ * Version: v4.2.27
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1737,7 +1737,7 @@ __webpack_require__.r(__webpack_exports__);
1737
1737
  * Released under MIT see LICENSE.txt in the project root for license information.
1738
1738
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
1739
1739
  */
1740
- const APP_VERSION = "4.2.25";
1740
+ const APP_VERSION = "4.2.27";
1741
1741
  // prettier-ignore
1742
1742
  const ES = "es2021";
1743
1743
  const IS_ES_MODERN = true;
@@ -1899,8 +1899,8 @@ const KEY_ALIASES = {
1899
1899
  option: 'alt',
1900
1900
  return: 'enter',
1901
1901
  right: 'arrowright',
1902
- space: ' ',
1903
- spacebar: ' ',
1902
+ space: 'space',
1903
+ spacebar: 'space',
1904
1904
  up: 'arrowup',
1905
1905
  win: 'meta',
1906
1906
  windows: 'meta'
@@ -2858,11 +2858,17 @@ class Dom {
2858
2858
  }
2859
2859
  static replace(elm, newTagName, create, withAttributes = false, notMoveContent = false) {
2860
2860
  if ((0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_2__/* .isHTML */ .AH)(newTagName)) {
2861
+ void 0;
2861
2862
  newTagName = create.fromHTML(newTagName);
2862
2863
  }
2863
- const tag = (0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_2__/* .isString */ .Kg)(newTagName)
2864
- ? create.element(newTagName)
2865
- : newTagName;
2864
+ let tag;
2865
+ if ((0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_2__/* .isString */ .Kg)(newTagName)) {
2866
+ void 0;
2867
+ tag = create.element(newTagName);
2868
+ }
2869
+ else {
2870
+ tag = newTagName;
2871
+ }
2866
2872
  if (!notMoveContent) {
2867
2873
  while (elm.firstChild) {
2868
2874
  tag.appendChild(elm.firstChild);
@@ -4503,7 +4509,8 @@ function getContainer(jodit, classFunc, tag = 'div', createInsideEditor = false)
4503
4509
  const data = boxes.get(jodit) || {}, key = name + tag;
4504
4510
  const view = (0,jodit_core_helpers_checker_is_view_object__WEBPACK_IMPORTED_MODULE_6__/* .isViewObject */ .h)(jodit) ? jodit : jodit.j;
4505
4511
  if (!data[key]) {
4506
- let c = view.c, body = (0,jodit_core_helpers_checker_is_jodit_object__WEBPACK_IMPORTED_MODULE_7__/* .isJoditObject */ .y)(jodit) && jodit.o.shadowRoot
4512
+ let c = view.c;
4513
+ let body = (0,jodit_core_helpers_checker_is_jodit_object__WEBPACK_IMPORTED_MODULE_7__/* .isJoditObject */ .y)(jodit) && jodit.o.shadowRoot
4507
4514
  ? jodit.o.shadowRoot
4508
4515
  : jodit.od.body;
4509
4516
  if (createInsideEditor &&
@@ -4523,6 +4530,7 @@ function getContainer(jodit, classFunc, tag = 'div', createInsideEditor = false)
4523
4530
  body.appendChild(box);
4524
4531
  data[key] = box;
4525
4532
  jodit.hookStatus('beforeDestruct', () => {
4533
+ view.events.off(box);
4526
4534
  _dom__WEBPACK_IMPORTED_MODULE_3__/* .Dom */ .J.safeRemove(box);
4527
4535
  delete data[key];
4528
4536
  if (Object.keys(data).length) {
@@ -4530,6 +4538,7 @@ function getContainer(jodit, classFunc, tag = 'div', createInsideEditor = false)
4530
4538
  }
4531
4539
  });
4532
4540
  boxes.set(jodit, data);
4541
+ view.events.fire('getContainer', box);
4533
4542
  }
4534
4543
  data[key].classList.remove('jodit_theme_default', 'jodit_theme_dark');
4535
4544
  data[key].classList.add(`jodit_theme_${view.o.theme || 'default'}`);
@@ -6329,7 +6338,8 @@ function normalizeKeyAliases(keys) {
6329
6338
  ctrl: 2,
6330
6339
  control: 2,
6331
6340
  alt: 3,
6332
- shift: 4
6341
+ shift: 4,
6342
+ space: 5
6333
6343
  };
6334
6344
  return keys
6335
6345
  .replace(/\+\+/g, '+add')
@@ -13380,15 +13390,21 @@ let UITooltip = UITooltip_1 = class UITooltip extends jodit_core_ui_element__WEB
13380
13390
  if (!view.o.textIcons &&
13381
13391
  view.o.showTooltip &&
13382
13392
  !view.o.useNativeTooltip) {
13393
+ this.j.e.on('getContainer', (box) => {
13394
+ this.__onAttach(box);
13395
+ });
13383
13396
  view.hookStatus(jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .STATUSES */ .f.ready, () => {
13384
- // TODO Move it inside __show method. Now it is here because testcase failed with capturing
13385
- (0,jodit_core_global__WEBPACK_IMPORTED_MODULE_3__/* .getContainer */ .My)(this.j, UITooltip_1).appendChild(this.container);
13386
- view.e.on(view.container, 'mouseenter.tooltip', this.__onMouseEnter, {
13387
- capture: true
13388
- });
13397
+ this.__onAttach(this.j.container);
13389
13398
  });
13390
13399
  }
13391
13400
  }
13401
+ __onAttach(container) {
13402
+ // TODO Move it inside __show method. Now it is here because testcase failed with capturing
13403
+ (0,jodit_core_global__WEBPACK_IMPORTED_MODULE_3__/* .getContainer */ .My)(this.j, UITooltip_1).appendChild(this.container);
13404
+ this.j.e.on(container, 'mouseenter.tooltip', this.__onMouseEnter, {
13405
+ capture: true
13406
+ });
13407
+ }
13392
13408
  __addListenersOnEnter() {
13393
13409
  if (this.__listenClose) {
13394
13410
  return;
@@ -22441,46 +22457,39 @@ class Table extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .ViewCom
22441
22457
  removeRow(table, rowIndex) {
22442
22458
  return Table.__removeRow(table, rowIndex);
22443
22459
  }
22444
- static __appendColumn(table, j, after, create) {
22460
+ /**
22461
+ * Insert column before / after all the columns containing the selected cells
22462
+ */
22463
+ appendColumn(table, selectedCell, insertAfter = true) {
22445
22464
  const box = Table.__formalMatrix(table);
22446
- let i;
22447
- if (j === undefined || j < 0) {
22448
- j = Table.__getColumnsCount(table) - 1;
22449
- }
22450
- for (i = 0; i < box.length; i += 1) {
22451
- const cell = create.element('td');
22452
- const td = box[i][j];
22453
- let added = false;
22454
- if (after) {
22455
- if ((box[i] && td && j + 1 >= box[i].length) ||
22456
- td !== box[i][j + 1]) {
22457
- if (td.nextSibling) {
22458
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__/* .Dom */ .J.before(td.nextSibling, cell);
22459
- }
22460
- else {
22461
- td.parentNode && td.parentNode.appendChild(cell);
22462
- }
22463
- added = true;
22465
+ if (!insertAfter && jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__/* .Dom */ .J.isCell(selectedCell.previousElementSibling)) {
22466
+ return this.appendColumn(table, selectedCell.previousElementSibling, true);
22467
+ }
22468
+ const columnIndex = insertAfter
22469
+ ? selectedCell.cellIndex + ((selectedCell.colSpan || 1) - 1)
22470
+ : selectedCell.cellIndex;
22471
+ const newColumnIndex = insertAfter ? columnIndex + 1 : columnIndex;
22472
+ for (let i = 0; i < box.length;) {
22473
+ const cells = box[i];
22474
+ if (cells[columnIndex] !== cells[newColumnIndex] ||
22475
+ columnIndex === newColumnIndex) {
22476
+ const cell = this.j.createInside.element('td');
22477
+ if (insertAfter) {
22478
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__/* .Dom */ .J.after(cells[columnIndex], cell);
22464
22479
  }
22465
- }
22466
- else {
22467
- if (j - 1 < 0 ||
22468
- (box[i][j] !== box[i][j - 1] && box[i][j].parentNode)) {
22469
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__/* .Dom */ .J.before(box[i][j], cell);
22470
- added = true;
22480
+ else {
22481
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__/* .Dom */ .J.before(cells[columnIndex], cell);
22482
+ }
22483
+ if (cells[columnIndex].rowSpan > 1) {
22484
+ cell.rowSpan = cells[columnIndex].rowSpan;
22471
22485
  }
22472
22486
  }
22473
- if (!added) {
22474
- (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_5__.attr)(box[i][j], 'colspan', parseInt((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_5__.attr)(box[i][j], 'colspan') || '1', 10) + 1);
22487
+ else {
22488
+ cells[columnIndex].colSpan += 1;
22475
22489
  }
22490
+ i += cells[columnIndex].rowSpan || 1;
22476
22491
  }
22477
22492
  }
22478
- /**
22479
- * Insert column before / after all the columns containing the selected cells
22480
- */
22481
- appendColumn(table, j, after) {
22482
- return Table.__appendColumn(table, j, after, this.j.createInside);
22483
- }
22484
22493
  static __removeColumn(table, j) {
22485
22494
  const box = Table.__formalMatrix(table);
22486
22495
  let dec;
@@ -22698,7 +22707,7 @@ class Table extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .ViewCom
22698
22707
  alreadyMerged.delete(first);
22699
22708
  Table.__unmark(__marked);
22700
22709
  Table.__normalizeTable(table);
22701
- (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_5__.toArray)(table.rows).forEach((tr, index) => {
22710
+ (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_5__.toArray)(table.rows).forEach(tr => {
22702
22711
  if (!tr.cells.length) {
22703
22712
  jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__/* .Dom */ .J.safeRemove(tr);
22704
22713
  }
@@ -22707,7 +22716,7 @@ class Table extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .ViewCom
22707
22716
  }
22708
22717
  }
22709
22718
  /**
22710
- * It combines all of the selected cells into one. The contents of the cells will also be combined
22719
+ * It combines all the selected cells into one. The contents of the cells will also be combined
22711
22720
  */
22712
22721
  mergeSelected(table) {
22713
22722
  return Table.__mergeSelected(table, this.j);
@@ -25049,7 +25058,9 @@ class addNewLine extends jodit_modules__WEBPACK_IMPORTED_MODULE_3__.Plugin {
25049
25058
  editor.e
25050
25059
  .off(editor.editor, '.' + ns)
25051
25060
  .off(editor.container, '.' + ns)
25061
+ .off('.' + ns)
25052
25062
  .on([editor.ow, editor.ew, editor.editor], 'scroll' + '.' + ns, this.__hideForce)
25063
+ .on('finishedCleanHTMLWorker' + '.' + ns, this.__hideForce)
25053
25064
  .on(editor.editor, 'click' + '.' + ns, this.__hide)
25054
25065
  .on(editor.container, 'mouseleave' + '.' + ns, this.__hide)
25055
25066
  .on(editor.editor, 'mousemove' + '.' + ns, this.__onMouseMove);
@@ -25137,7 +25148,8 @@ class addNewLine extends jodit_modules__WEBPACK_IMPORTED_MODULE_3__.Plugin {
25137
25148
  jodit_modules__WEBPACK_IMPORTED_MODULE_3__.Dom.safeRemove(this.__line);
25138
25149
  this.j.e
25139
25150
  .off([this.j.ow, this.j.ew, this.j.editor], '.' + ns)
25140
- .off(this.j.container, '.' + ns);
25151
+ .off(this.j.container, '.' + ns)
25152
+ .off('.' + ns);
25141
25153
  }
25142
25154
  }
25143
25155
  (0,tslib__WEBPACK_IMPORTED_MODULE_5__/* .__decorate */ .Cg)([
@@ -27266,13 +27278,21 @@ function allowAttributes(jodit, nodeElm, hadEffect, allow) {
27266
27278
  */
27267
27279
 
27268
27280
 
27281
+ const TABLE_CONTAINER_TAGS = new Set([
27282
+ 'table',
27283
+ 'tbody',
27284
+ 'thead',
27285
+ 'tfoot',
27286
+ 'tr'
27287
+ ]);
27269
27288
  /**
27270
27289
  * @private
27271
27290
  */
27272
27291
  function fillEmptyParagraph(jodit, nodeElm, hadEffect) {
27273
27292
  if (jodit.o.cleanHTML.fillEmptyParagraph &&
27274
27293
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isBlock(nodeElm) &&
27275
- jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isEmpty(nodeElm, jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.INSEPARABLE_TAGS)) {
27294
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isEmpty(nodeElm, jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.INSEPARABLE_TAGS) &&
27295
+ !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isTag(nodeElm, TABLE_CONTAINER_TAGS)) {
27276
27296
  const br = jodit.createInside.element('br');
27277
27297
  nodeElm.appendChild(br);
27278
27298
  return true;
@@ -30094,7 +30114,8 @@ class hotkeys extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_3__/* .Plugin *
30094
30114
  constructor() {
30095
30115
  super(...arguments);
30096
30116
  this.onKeyPress = (event) => {
30097
- const special = this.specialKeys[event.which], character = (event.key || String.fromCharCode(event.which)).toLowerCase();
30117
+ const special = this.specialKeys[event.which];
30118
+ const character = (event.key || String.fromCharCode(event.which)).toLowerCase();
30098
30119
  const modif = [special || character];
30099
30120
  ['alt', 'ctrl', 'shift', 'meta'].forEach(specialKey => {
30100
30121
  if (event[specialKey + 'Key'] && special !== specialKey) {
@@ -30188,7 +30209,8 @@ class hotkeys extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_3__/* .Plugin *
30188
30209
  }
30189
30210
  })
30190
30211
  .on('keydown.hotkeys', (event) => {
30191
- const shortcut = this.onKeyPress(event), stop = {
30212
+ const shortcut = this.onKeyPress(event);
30213
+ const stop = {
30192
30214
  shouldStop: true
30193
30215
  };
30194
30216
  const resultOfFire = this.j.e.fire(shortcut + '.hotkey', event.type, stop);
@@ -38103,7 +38125,7 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__/* .Plug
38103
38125
  break;
38104
38126
  case 'addcolumnafter':
38105
38127
  case 'addcolumnbefore':
38106
- this.__tableModule.appendColumn(table, cell.cellIndex, command === 'addcolumnafter');
38128
+ this.__tableModule.appendColumn(table, cell, command === 'addcolumnafter');
38107
38129
  break;
38108
38130
  case 'addrowafter':
38109
38131
  case 'addrowbefore':
@@ -40633,6 +40655,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_4__/* .Config */ .T.prototype.controls.tab
40633
40655
  }
40634
40656
  },
40635
40657
  popup: (editor, current, close, button) => {
40658
+ editor.editor.normalize();
40659
+ const snapshot = editor.history.snapshot.make();
40636
40660
  const control = button.control;
40637
40661
  const default_rows_count = control.data && control.data.rows ? control.data.rows : 10, default_cols_count = control.data && control.data.cols ? control.data.cols : 10;
40638
40662
  const generateExtraClasses = () => {
@@ -40725,10 +40749,24 @@ jodit_config__WEBPACK_IMPORTED_MODULE_4__/* .Config */ .T.prototype.controls.tab
40725
40749
  table.classList.add(className);
40726
40750
  });
40727
40751
  });
40728
- if (editor.editor.firstChild) {
40729
- editor.s.insertNode(crt.text('\n'), false, false);
40752
+ editor.s.restore();
40753
+ editor.s.removeMarkers();
40754
+ editor.editor.normalize();
40755
+ editor.history.snapshot.restore(snapshot);
40756
+ const block = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .J.furthest(editor.s.current(), jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .J.isBlock, editor.editor);
40757
+ if (block && jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .J.isEmpty(block)) {
40758
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .J.replace(block, table, undefined, false, true);
40759
+ }
40760
+ else {
40761
+ if (block) {
40762
+ const fake = crt.text('\n');
40763
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .J.after(block, fake);
40764
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .J.after(fake, table);
40765
+ }
40766
+ else {
40767
+ editor.s.insertNode(table, false);
40768
+ }
40730
40769
  }
40731
- editor.s.insertNode(table, false);
40732
40770
  if (first_td) {
40733
40771
  editor.s.setCursorIn(first_td);
40734
40772
  (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.scrollIntoViewIfNeeded)(first_td, editor.editor, editor.ed);