jodit 4.19.11 → 4.19.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 (76) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/es2015/jodit.css +33 -1
  3. package/es2015/jodit.fat.min.css +1 -1
  4. package/es2015/jodit.fat.min.js +9 -9
  5. package/es2015/jodit.js +83 -34
  6. package/es2015/jodit.min.css +1 -1
  7. package/es2015/jodit.min.js +9 -9
  8. package/es2015/plugins/debug/debug.css +1 -1
  9. package/es2015/plugins/debug/debug.js +1 -1
  10. package/es2015/plugins/debug/debug.min.js +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  12. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  13. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  14. package/es2018/jodit.fat.min.css +1 -1
  15. package/es2018/jodit.fat.min.js +9 -9
  16. package/es2018/jodit.min.css +1 -1
  17. package/es2018/jodit.min.js +9 -9
  18. package/es2018/plugins/debug/debug.min.js +1 -1
  19. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  20. package/es2021/jodit.css +33 -1
  21. package/es2021/jodit.fat.min.css +1 -1
  22. package/es2021/jodit.fat.min.js +9 -9
  23. package/es2021/jodit.js +82 -32
  24. package/es2021/jodit.min.css +1 -1
  25. package/es2021/jodit.min.js +9 -9
  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 +33 -1
  33. package/es2021.en/jodit.fat.min.css +1 -1
  34. package/es2021.en/jodit.fat.min.js +9 -9
  35. package/es2021.en/jodit.js +82 -32
  36. package/es2021.en/jodit.min.css +1 -1
  37. package/es2021.en/jodit.min.js +10 -10
  38. package/es2021.en/plugins/debug/debug.css +1 -1
  39. package/es2021.en/plugins/debug/debug.js +1 -1
  40. package/es2021.en/plugins/debug/debug.min.js +1 -1
  41. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  42. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  43. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  44. package/es5/jodit.css +34 -2
  45. package/es5/jodit.fat.min.css +1 -1
  46. package/es5/jodit.fat.min.js +2 -2
  47. package/es5/jodit.js +101 -34
  48. package/es5/jodit.min.css +3 -3
  49. package/es5/jodit.min.js +2 -2
  50. package/es5/plugins/debug/debug.css +1 -1
  51. package/es5/plugins/debug/debug.js +1 -1
  52. package/es5/plugins/debug/debug.min.js +1 -1
  53. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  54. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  55. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  56. package/es5/polyfills.fat.min.js +1 -1
  57. package/es5/polyfills.js +1 -1
  58. package/es5/polyfills.min.js +1 -1
  59. package/esm/core/constants.js +1 -1
  60. package/esm/core/ui/button/tooltip/tooltip.d.ts +6 -0
  61. package/esm/core/ui/button/tooltip/tooltip.js +14 -3
  62. package/esm/core/view/view-with-toolbar.js +6 -1
  63. package/esm/plugins/add-new-line/add-new-line.d.ts +5 -0
  64. package/esm/plugins/add-new-line/add-new-line.js +20 -3
  65. package/esm/plugins/delete/delete.d.ts +7 -0
  66. package/esm/plugins/delete/delete.js +22 -0
  67. package/esm/plugins/hr/hr.js +5 -0
  68. package/esm/plugins/media/media.js +8 -5
  69. package/esm/plugins/resizer/resizer.js +4 -1
  70. package/esm/plugins/select-cells/select-cells.d.ts +1 -0
  71. package/esm/plugins/select-cells/select-cells.js +12 -18
  72. package/package.json +1 -1
  73. package/types/core/ui/button/tooltip/tooltip.d.ts +6 -0
  74. package/types/plugins/add-new-line/add-new-line.d.ts +5 -0
  75. package/types/plugins/delete/delete.d.ts +7 -0
  76. package/types/plugins/select-cells/select-cells.d.ts +1 -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.19.11
4
+ * Version: v4.19.12
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1824,7 +1824,7 @@ __webpack_require__.r(__webpack_exports__);
1824
1824
  * ```
1825
1825
  * @packageDocumentation
1826
1826
  * @module constants
1827
- */ const APP_VERSION = "4.19.11";
1827
+ */ const APP_VERSION = "4.19.12";
1828
1828
  // prettier-ignore
1829
1829
  const ES = "es2021";
1830
1830
  const IS_ES_MODERN = true;
@@ -16023,6 +16023,18 @@ class UITooltip extends jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_9__.UIEle
16023
16023
  render() {
16024
16024
  return '<div><div class="&__content"></div></div>';
16025
16025
  }
16026
+ get __isEnabled() {
16027
+ const { o } = this.j;
16028
+ return !o.textIcons && Boolean(o.showTooltip) && !o.useNativeTooltip;
16029
+ }
16030
+ /**
16031
+ * Show tooltips for the buttons in an element outside the editor's
16032
+ * container, such as a toolbar placed by the `toolbar` option
16033
+ */ attach(container) {
16034
+ if (this.__isEnabled) {
16035
+ this.__onAttach(container);
16036
+ }
16037
+ }
16026
16038
  __onAttach(container) {
16027
16039
  // TODO Move it inside __show method. Now it is here because testcase failed with capturing
16028
16040
  jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append((0,jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.getContainer)(this.j, UITooltip), this.container);
@@ -16157,7 +16169,7 @@ class UITooltip extends jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_9__.UIEle
16157
16169
  }
16158
16170
  constructor(view){
16159
16171
  super(view), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__isOpened", false), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__attachedContainers", new Set()), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__listenClose", false), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__currentTarget", null), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__delayShowTimeout", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__hideTimeout", 0);
16160
- if (!view.o.textIcons && view.o.showTooltip && !view.o.useNativeTooltip) {
16172
+ if (this.__isEnabled) {
16161
16173
  this.j.e.on('getContainer', (box)=>{
16162
16174
  this.__onAttach(box);
16163
16175
  });
@@ -18476,7 +18488,12 @@ class ViewWithToolbar extends jodit_core_view_view__WEBPACK_IMPORTED_MODULE_11__
18476
18488
  return;
18477
18489
  }
18478
18490
  const buttons = this.o.buttons ? (0,jodit_core_helpers_array__WEBPACK_IMPORTED_MODULE_6__.splitArray)(this.o.buttons) : [];
18479
- this.toolbar?.setRemoveButtons(this.o.removeButtons).build(buttons.concat(this.o.extraButtons || [])).appendTo(this.toolbarContainer);
18491
+ const container = this.toolbarContainer;
18492
+ this.toolbar?.setRemoveButtons(this.o.removeButtons).build(buttons.concat(this.o.extraButtons || [])).appendTo(container);
18493
+ // The toolbar's own element, as editors can share the one it is placed in
18494
+ if (this.toolbar && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_5__.Dom.isOrContains(this.container, container)) {
18495
+ this.__tooltip.attach(this.toolbar.container);
18496
+ }
18480
18497
  }
18481
18498
  getRegisteredButtonGroups() {
18482
18499
  return this.groupToButtons;
@@ -28414,6 +28431,17 @@ const ns = 'addnewline';
28414
28431
  editor.editor
28415
28432
  ], 'scroll' + '.' + ns, this.__hideForce).on('finishedCleanHTMLWorker' + '.' + ns, this.__hideForce).on(editor.editor, 'click' + '.' + ns, this.__hide).on(editor.container, 'mouseleave' + '.' + ns, this.__hide).on(editor.editor, 'mousemove' + '.' + ns, this.__onMouseMove);
28416
28433
  }
28434
+ /**
28435
+ * An empty line with a `<br>`, as Enter makes, so it keeps its height
28436
+ * without clean-html's fillEmptyParagraph (#1807)
28437
+ */ __newLine() {
28438
+ const { j } = this;
28439
+ const line = j.createInside.element(j.o.enter);
28440
+ if (!jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isTag(line, 'br')) {
28441
+ jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(line, j.createInside.element('br'));
28442
+ }
28443
+ return line;
28444
+ }
28417
28445
  /**
28418
28446
  * A paragraph holding only an embed has no place for the caret, so the
28419
28447
  * arrow keys can't get past one that ends the content, or before one that
@@ -28426,6 +28454,11 @@ const ns = 'addnewline';
28426
28454
  return;
28427
28455
  }
28428
28456
  const { startContainer, startOffset } = editor.s.range;
28457
+ // A caret in the editor itself, as beside a horizontal line, is in no
28458
+ // paragraph, and the browsers can leave it there with text beyond (#1803)
28459
+ if (startContainer === editor.editor) {
28460
+ return;
28461
+ }
28429
28462
  // Once the browser has moved the caret, if it could. With a 0 timeout
28430
28463
  // Jodit would run this at once, before the browser moves it
28431
28464
  editor.async.setTimeout(()=>{
@@ -28434,7 +28467,7 @@ const ns = 'addnewline';
28434
28467
  if (e.defaultPrevented || !editor.s.isInsideArea || !range.collapsed || range.startContainer !== startContainer || range.startOffset !== startOffset || !block || !jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.findNotEmptyNeighbor(block, !forward, editor.editor)) {
28435
28468
  return;
28436
28469
  }
28437
- const p = editor.createInside.element(editor.o.enter);
28470
+ const p = this.__newLine();
28438
28471
  forward ? jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.append(editor.editor, p) : jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.prepend(editor.editor, p);
28439
28472
  editor.s.setCursorIn(p);
28440
28473
  (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.scrollIntoViewIfNeeded)(p, editor.editor, editor.ed);
@@ -28446,7 +28479,7 @@ const ns = 'addnewline';
28446
28479
  if (!editor.o.readonly && editor.o.addNewLineOnDBLClick && e.target === editor.editor && editor.s.isCollapsed()) {
28447
28480
  const editorBound = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.offset)(editor.editor, editor, editor.ed);
28448
28481
  const top = e.pageY - editor.ew.scrollX;
28449
- const p = editor.createInside.element(editor.o.enter);
28482
+ const p = this.__newLine();
28450
28483
  if (Math.abs(top - editorBound.top) < Math.abs(top - (editorBound.height + editorBound.top)) && editor.editor.firstChild) {
28451
28484
  jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.prepend(editor.editor, p);
28452
28485
  } else {
@@ -28530,7 +28563,7 @@ const ns = 'addnewline';
28530
28563
  return elm != null && jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock(elm) && !/^(img|table|iframe|hr)$/i.test(elm.nodeName);
28531
28564
  }), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__onClickLine", (e)=>{
28532
28565
  const editor = this.j;
28533
- const p = editor.createInside.element(editor.o.enter);
28566
+ const p = this.__newLine();
28534
28567
  if (this.__isBeforeContent && this.__current && this.__current.parentNode) {
28535
28568
  if (this.__current === editor.editor) {
28536
28569
  jodit_modules__WEBPACK_IMPORTED_MODULE_7__.Dom.prepend(editor.editor, p);
@@ -32900,6 +32933,7 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugi
32900
32933
  }
32901
32934
  jodit.s.expandSelection();
32902
32935
  const range = jodit.s.range;
32936
+ this.__moveEdgesIntoCells(range);
32903
32937
  const caret = this.__clearSelectedCells(range);
32904
32938
  if (caret && range.collapsed) {
32905
32939
  jodit.s.selectRange(caret);
@@ -32921,6 +32955,22 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugi
32921
32955
  jodit.s.selectRange(caret ?? range);
32922
32956
  return false;
32923
32957
  }
32958
+ /**
32959
+ * Firefox selects cells whole from their row, as after a drag into or out
32960
+ * of a table nested in a cell, and `deleteContents` would remove them. The
32961
+ * edges move into the cells, so their content is cleared instead, as in
32962
+ * Firefox's own delete
32963
+ */ __moveEdgesIntoCells(range) {
32964
+ const { startContainer, startOffset, endContainer, endOffset } = range;
32965
+ const first = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(startContainer, 'tr') ? startContainer.childNodes[startOffset] : null;
32966
+ const last = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(endContainer, 'tr') ? endContainer.childNodes[endOffset - 1] : null;
32967
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isCell(first)) {
32968
+ range.setStart(first, 0);
32969
+ }
32970
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isCell(last)) {
32971
+ range.setEnd(last, last.childNodes.length);
32972
+ }
32973
+ }
32924
32974
  /**
32925
32975
  * A selection that starts or ends in a table cell clears the selected part
32926
32976
  * of each cell it covers and keeps the cells, as the browsers do.
@@ -36036,6 +36086,11 @@ function hr(editor) {
36036
36086
  return false;
36037
36087
  }
36038
36088
  const p = editor.createInside.element(editor.o.enter);
36089
+ // As Enter's new line has, so it keeps its height without clean-html's
36090
+ // fillEmptyParagraph (#1807)
36091
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(p, 'br')) {
36092
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.append(p, editor.createInside.element('br'));
36093
+ }
36039
36094
  jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.after(elm, p);
36040
36095
  editor.s.setCursorIn(p);
36041
36096
  return false;
@@ -41752,11 +41807,15 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.mediaWrappers = {};
41752
41807
  });
41753
41808
  (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_4__.attr)(wrapper, 'style', (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_4__.attr)(element, 'style'));
41754
41809
  // The wrapper fits the media, whose size changes as its metadata loads
41755
- // and as it's resized. A percentage width is of the line, so it takes that
41810
+ // and as it's resized. It's inline, as the media is by default, so the
41811
+ // line's text-align still places it, or a block when the media is one.
41812
+ // A percentage width is of the line, so the wrapper is a block that
41813
+ // takes the line, and the media in it follows the text-align it inherits
41756
41814
  const fit = ()=>{
41815
+ const ofLine = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_5__.cssInline)(media, 'width').endsWith('%');
41757
41816
  (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_5__.css)(wrapper, {
41758
- display: (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_5__.cssInline)(media, 'display') === 'inline-block' ? 'inline-block' : 'block',
41759
- width: (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_5__.cssInline)(media, 'width').endsWith('%') ? '' : 'fit-content',
41817
+ display: !ofLine && /^inline/.test((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_5__.css)(media, 'display').toString()) ? 'inline-block' : 'block',
41818
+ width: ofLine ? '' : 'fit-content',
41760
41819
  height: ''
41761
41820
  });
41762
41821
  };
@@ -44754,8 +44813,11 @@ const IFRAME_WRAPPER = '[data-jodit_iframe_wrapper]';
44754
44813
  // is nothing measurable at all, let the wrapper size itself.
44755
44814
  const width = element.offsetWidth || attrPixelSize(element, 'width');
44756
44815
  const height = element.offsetHeight || attrPixelSize(element, 'height');
44816
+ // The wrapper takes the iframe's place in its line: inline, as an
44817
+ // iframe is by default, so the line's text-align still places it,
44818
+ // or a block when the iframe is one
44757
44819
  (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.css)(wrapper, {
44758
- display: (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_8__.cssInline)(element, 'display') === 'inline-block' ? 'inline-block' : 'block'
44820
+ display: /^inline/.test((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.css)(element, 'display').toString()) ? 'inline-block' : 'block'
44759
44821
  });
44760
44822
  if (width) {
44761
44823
  (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.css)(wrapper, 'width', width);
@@ -46065,13 +46127,7 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46065
46127
  if (this.j.isLockedNotBy(key)) {
46066
46128
  return;
46067
46129
  }
46068
- // Inside Shadow DOM `document.elementFromPoint` returns the shadow
46069
- // host, so the lookup must start from the shadow root
46070
- const node = (this.j.o.shadowRoot ?? this.j.ed).elementFromPoint(e.clientX, e.clientY);
46071
- const cell = node && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(node, [
46072
- 'td',
46073
- 'th'
46074
- ], table);
46130
+ const cell = this.__cellUnder(e, table);
46075
46131
  if (!cell || !this.__selectedCell) {
46076
46132
  return;
46077
46133
  }
@@ -46114,6 +46170,13 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46114
46170
  this.__isSelectionMode = false;
46115
46171
  this.__selectedCell = null;
46116
46172
  }
46173
+ // The cell of this table under the pointer; over a table nested in a cell, the mouse is still in that cell
46174
+ __cellUnder(e, table) {
46175
+ // Inside Shadow DOM `document.elementFromPoint` returns the shadow
46176
+ // host, so the lookup must start from the shadow root
46177
+ const node = (this.j.o.shadowRoot ?? this.j.ed).elementFromPoint(e.clientX, e.clientY);
46178
+ return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(node, (elm)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isCell(elm) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(elm, 'table', table), table);
46179
+ }
46117
46180
  /**
46118
46181
  * Stop a selection process
46119
46182
  */ __onStopSelection(table, e) {
@@ -46122,23 +46185,10 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46122
46185
  }
46123
46186
  this.__isSelectionMode = false;
46124
46187
  this.j.unlock();
46125
- // Inside Shadow DOM `document.elementFromPoint` returns the shadow
46126
- // host, so the lookup must start from the shadow root
46127
- const node = (this.j.o.shadowRoot ?? this.j.ed).elementFromPoint(e.clientX, e.clientY);
46128
- if (!node) {
46129
- return;
46130
- }
46131
- const cell = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(node, [
46132
- 'td',
46133
- 'th'
46134
- ], table);
46188
+ const cell = this.__cellUnder(e, table);
46135
46189
  if (!cell) {
46136
46190
  return;
46137
46191
  }
46138
- const ownTable = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(cell, 'table', table);
46139
- if (ownTable && ownTable !== table) {
46140
- return; // Nested tables
46141
- }
46142
46192
  this.__showCellsPopup(table, [
46143
46193
  cell,
46144
46194
  this.__selectedCell