jodit 4.12.22 → 4.12.23

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 (71) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +10 -10
  4. package/es2015/jodit.js +211 -69
  5. package/es2015/jodit.min.js +10 -10
  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.fat.min.js +10 -10
  13. package/es2018/jodit.min.js +15 -15
  14. package/es2018/plugins/debug/debug.min.js +1 -1
  15. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  16. package/es2021/jodit.css +1 -1
  17. package/es2021/jodit.fat.min.js +12 -12
  18. package/es2021/jodit.js +202 -68
  19. package/es2021/jodit.min.js +12 -12
  20. package/es2021/plugins/debug/debug.css +1 -1
  21. package/es2021/plugins/debug/debug.js +1 -1
  22. package/es2021/plugins/debug/debug.min.js +1 -1
  23. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  24. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  25. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  26. package/es2021.en/jodit.css +1 -1
  27. package/es2021.en/jodit.fat.min.js +13 -13
  28. package/es2021.en/jodit.js +180 -46
  29. package/es2021.en/jodit.min.js +12 -12
  30. package/es2021.en/plugins/debug/debug.css +1 -1
  31. package/es2021.en/plugins/debug/debug.js +1 -1
  32. package/es2021.en/plugins/debug/debug.min.js +1 -1
  33. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  34. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  35. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  36. package/es5/jodit.css +2 -2
  37. package/es5/jodit.fat.min.js +2 -2
  38. package/es5/jodit.js +255 -104
  39. package/es5/jodit.min.css +2 -2
  40. package/es5/jodit.min.js +2 -2
  41. package/es5/plugins/debug/debug.css +1 -1
  42. package/es5/plugins/debug/debug.js +1 -1
  43. package/es5/plugins/debug/debug.min.js +1 -1
  44. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  45. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  46. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  47. package/es5/polyfills.fat.min.js +1 -1
  48. package/es5/polyfills.js +1 -1
  49. package/es5/polyfills.min.js +1 -1
  50. package/esm/core/component/view-component.js +8 -0
  51. package/esm/core/constants.js +1 -1
  52. package/esm/core/helpers/checker/is-html-from-word.d.ts +1 -1
  53. package/esm/core/helpers/checker/is-html-from-word.js +12 -1
  54. package/esm/core/selection/style/api/wrap.js +18 -3
  55. package/esm/core/ui/popup/popup.js +4 -1
  56. package/esm/jodit.js +12 -0
  57. package/esm/modules/toolbar/button/content.d.ts +6 -0
  58. package/esm/modules/toolbar/button/content.js +26 -1
  59. package/esm/plugins/add-new-line/add-new-line.js +4 -1
  60. package/esm/plugins/ai-assistant/ai-assistant.js +7 -1
  61. package/esm/plugins/backspace/cases/check-join-neighbors.js +15 -1
  62. package/esm/plugins/color/color.js +21 -21
  63. package/esm/plugins/inline-popup/inline-popup.d.ts +7 -0
  64. package/esm/plugins/inline-popup/inline-popup.js +18 -2
  65. package/esm/plugins/paste/config.js +11 -2
  66. package/esm/plugins/search/ui/search.js +22 -12
  67. package/esm/plugins/select-cells/select-cells.js +10 -6
  68. package/package.json +1 -1
  69. package/types/core/helpers/checker/is-html-from-word.d.ts +1 -1
  70. package/types/modules/toolbar/button/content.d.ts +6 -0
  71. package/types/plugins/inline-popup/inline-popup.d.ts +7 -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.12.22
4
+ * Version: v4.12.23
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1698,6 +1698,14 @@ class ViewComponent extends _component__WEBPACK_IMPORTED_MODULE_1__.Component {
1698
1698
  * Attach component to View
1699
1699
  */ setParentView(jodit) {
1700
1700
  this.jodit = jodit;
1701
+ // Inherit the owner window from the parent view — for an editor
1702
+ // created with a custom `ownerWindow` (e.g. inside an iframe) the
1703
+ // component default (the global `window`) is wrong: outside-click
1704
+ // handlers of dropdowns/popups listened to the wrong window. See
1705
+ // https://github.com/xdan/jodit/issues/965
1706
+ if (jodit.ow) {
1707
+ this.ownerWindow = jodit.ow;
1708
+ }
1701
1709
  jodit.components.add(this);
1702
1710
  return this;
1703
1711
  }
@@ -1802,7 +1810,7 @@ __webpack_require__.r(__webpack_exports__);
1802
1810
  * ```
1803
1811
  * @packageDocumentation
1804
1812
  * @module constants
1805
- */ const APP_VERSION = "4.12.22";
1813
+ */ const APP_VERSION = "4.12.23";
1806
1814
  // prettier-ignore
1807
1815
  const ES = "es2021";
1808
1816
  const IS_ES_MODERN = true;
@@ -5170,9 +5178,15 @@ function isFastEqual(a, b) {
5170
5178
  */ /**
5171
5179
  * @module helpers/checker
5172
5180
  */ /**
5173
- * Detect if string is HTML from MS Word or Excel
5181
+ * Detect if string is HTML from MS Word, Excel or LibreOffice/OpenOffice
5174
5182
  */ function isHtmlFromWord(data) {
5175
- return data.search(/<meta.*?Microsoft Excel\s[\d].*?>/) !== -1 || data.search(/<meta.*?Microsoft Word\s[\d].*?>/) !== -1 || data.search(/style="[^"]*mso-/) !== -1 && data.search(/<font/) !== -1;
5183
+ return data.search(/<meta.*?Microsoft Excel\s[\d].*?>/) !== -1 || data.search(/<meta.*?Microsoft Word\s[\d].*?>/) !== -1 || // `<meta name=ProgId content=Word.Document>` attribute values are
5184
+ // unquoted in the raw Word clipboard fragment
5185
+ data.search(/<meta[^>]*?ProgId[^>]*?(Word|Excel)\./i) !== -1 || // LibreOffice/OpenOffice Writer & Calc
5186
+ data.search(/<meta[^>]*?(LibreOffice|OpenOffice)/i) !== -1 || // Office namespaces on the root element of the clipboard fragment
5187
+ data.search(/urn:schemas-microsoft-com:office:(word|excel)/) !== -1 || // `class=MsoNormal` and friends (unquoted/quoted)
5188
+ data.search(/<\w[^>]*\sclass=("|')?Mso/) !== -1 || // the raw Word clipboard uses SINGLE quotes: style='mso-…'
5189
+ data.search(/style='[^']*mso-/) !== -1 || data.search(/style="[^"]*mso-/) !== -1 && data.search(/<font/) !== -1;
5176
5190
  }
5177
5191
 
5178
5192
 
@@ -12314,8 +12328,9 @@ function toggleAttribute(jodit, value, elm, key, dry, mode) {
12314
12328
  /* harmony export */ });
12315
12329
  /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27795);
12316
12330
  /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7909);
12317
- /* harmony import */ var _list_wrap_list__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(97110);
12318
- /* harmony import */ var _wrap_unwrapped_text__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(83335);
12331
+ /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(80991);
12332
+ /* harmony import */ var _list_wrap_list__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(97110);
12333
+ /* harmony import */ var _wrap_unwrapped_text__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(83335);
12319
12334
  /*!
12320
12335
  * Jodit Editor (https://xdsoft.net/jodit/)
12321
12336
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -12324,12 +12339,29 @@ function toggleAttribute(jodit, value, elm, key, dry, mode) {
12324
12339
 
12325
12340
 
12326
12341
 
12342
+
12327
12343
  /**
12328
12344
  * Replaces the parent tag with the applicable one, or wraps the text and also replaces the tag
12329
12345
  * @private
12330
12346
  */ function wrap(commitStyle, font, jodit) {
12331
12347
  const wrapper = findOrCreateWrapper(commitStyle, font, jodit);
12332
- return commitStyle.elementIsList ? (0,_list_wrap_list__WEBPACK_IMPORTED_MODULE_2__.wrapList)(commitStyle, wrapper, jodit) : jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.replace(wrapper, commitStyle.element, jodit.createInside, true);
12348
+ if (commitStyle.elementIsList) {
12349
+ return (0,_list_wrap_list__WEBPACK_IMPORTED_MODULE_3__.wrapList)(commitStyle, wrapper, jodit);
12350
+ }
12351
+ const newWrapper = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.replace(wrapper, commitStyle.element, jodit.createInside, true);
12352
+ if (commitStyle.elementIsBlock) {
12353
+ // Inline font styles left over from pasted content visually override
12354
+ // the new block format — e.g. an h2 with `font-weight: normal;
12355
+ // font-size: 24px` does not look like a heading at all, so the
12356
+ // command seems to do nothing. See
12357
+ // https://github.com/xdan/jodit/issues/1063
12358
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.css)(newWrapper, 'fontSize', null);
12359
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.css)(newWrapper, 'fontWeight', null);
12360
+ if (!(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(newWrapper, 'style')) {
12361
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(newWrapper, 'style', null);
12362
+ }
12363
+ }
12364
+ return newWrapper;
12333
12365
  }
12334
12366
  const WRAP_NODES = new Set([
12335
12367
  'td',
@@ -12350,7 +12382,7 @@ const WRAP_NODES = new Set([
12350
12382
  if (box) {
12351
12383
  return box;
12352
12384
  }
12353
- return (0,_wrap_unwrapped_text__WEBPACK_IMPORTED_MODULE_3__.wrapUnwrappedText)(commitStyle, font, jodit);
12385
+ return (0,_wrap_unwrapped_text__WEBPACK_IMPORTED_MODULE_4__.wrapUnwrappedText)(commitStyle, font, jodit);
12354
12386
  }
12355
12387
  (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(font, 'size', null);
12356
12388
  return font;
@@ -15946,7 +15978,9 @@ class Popup extends jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_9__.UIGro
15946
15978
  * Calculate static bound for point
15947
15979
  */ getKeepBound(getBound) {
15948
15980
  const oldBound = getBound();
15949
- const elmUnderCursor = this.od.elementFromPoint(oldBound.left, oldBound.top);
15981
+ // Inside Shadow DOM `document.elementFromPoint` returns the shadow
15982
+ // host, so the lookup must start from the shadow root
15983
+ const elmUnderCursor = (this.j.o.shadowRoot ?? this.od).elementFromPoint(oldBound.left, oldBound.top);
15950
15984
  if (!elmUnderCursor) {
15951
15985
  return getBound;
15952
15986
  }
@@ -17614,6 +17648,16 @@ class Jodit extends jodit_modules__WEBPACK_IMPORTED_MODULE_9__.ViewWithToolbar {
17614
17648
  const init = ()=>{
17615
17649
  if (opt.enableDragAndDropFileToEditor && opt.uploader && (opt.uploader.url || opt.uploader.insertImageAsBase64URI)) {
17616
17650
  this.uploader.bind(this.editor);
17651
+ } else if (!opt.enableDragAndDropFileToEditor) {
17652
+ // Without a bound uploader nobody cancels a file drop, and
17653
+ // Firefox inserts the dropped image natively — the option
17654
+ // must mean "do nothing". See
17655
+ // https://github.com/xdan/jodit/issues/1077
17656
+ this.e.on(editor, 'drop', (e)=>{
17657
+ if (e.dataTransfer?.files?.length) {
17658
+ e.preventDefault();
17659
+ }
17660
+ });
17617
17661
  }
17618
17662
  // in initEditor - the editor could change
17619
17663
  if (!this.__elementToPlace.get(this.editor)) {
@@ -23713,13 +23757,34 @@ class ToolbarContent extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_5__.U
23713
23757
  return 'ToolbarContent';
23714
23758
  }
23715
23759
  /** @override */ update() {
23716
- const content = this.control.getContent(this.j, this);
23760
+ const { control } = this;
23761
+ const content = control.getContent(this.j, this);
23717
23762
  if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.isString)(content) || content.parentNode !== this.container) {
23718
23763
  jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.detach(this.container);
23719
23764
  this.container.appendChild((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.isString)(content) ? this.j.create.fromHTML(content) : content);
23720
23765
  }
23766
+ // Content controls never went through the ToolbarButton status
23767
+ // calculation, so `isDisabled`/`isActive`/`update` declared on the
23768
+ // control were silently ignored (e.g. the FileBrowser Upload button
23769
+ // ignored the backend permissions). See
23770
+ // https://github.com/xdan/jodit/issues/1094
23771
+ this.state.disabled = Boolean(control.isDisabled?.(this.j, this));
23772
+ this.state.activated = Boolean(control.isActive?.(this.j, this));
23773
+ control.update?.(this.j, this);
23774
+ // The first update() runs before the state watchers are attached, so
23775
+ // apply the calculated state explicitly (the calls are idempotent)
23776
+ this.onChangeDisabled();
23777
+ this.onChangeActivated();
23721
23778
  super.update();
23722
23779
  }
23780
+ /**
23781
+ * The content is arbitrary HTML — propagate the disabled state to the
23782
+ * nested form controls (e.g. the file input of the Upload button),
23783
+ * otherwise they stay interactive.
23784
+ */ onChangeDisabled() {
23785
+ super.onChangeDisabled();
23786
+ this.container.querySelectorAll('input,button,select,textarea').forEach((elm)=>(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.attr)(elm, 'disabled', this.state.disabled || null));
23787
+ }
23723
23788
  /** @override */ createContainer() {
23724
23789
  return this.j.c.span(this.componentName);
23725
23790
  }
@@ -25375,7 +25440,9 @@ const ns = 'addnewline';
25375
25440
  }
25376
25441
  __onMouseMove(e) {
25377
25442
  const editor = this.j;
25378
- let currentElement = editor.ed.elementFromPoint(e.clientX, e.clientY);
25443
+ // Inside Shadow DOM `document.elementFromPoint` returns the shadow
25444
+ // host, so the lookup must start from the shadow root
25445
+ let currentElement = (editor.o.shadowRoot ?? editor.ed).elementFromPoint(e.clientX, e.clientY);
25379
25446
  if (!jodit_modules__WEBPACK_IMPORTED_MODULE_5__.Dom.isHTMLElement(currentElement) || !jodit_modules__WEBPACK_IMPORTED_MODULE_5__.Dom.isOrContains(editor.editor, currentElement)) {
25380
25447
  return;
25381
25448
  }
@@ -25565,7 +25632,13 @@ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_0__.Icon.set('enter', (_enter_svg__W
25565
25632
  return new _ui_ui_ai_assistant__WEBPACK_IMPORTED_MODULE_8__.UiAiAssistant(jodit, {
25566
25633
  onInsertAfter (html) {
25567
25634
  jodit.s.focus();
25568
- jodit.s.setCursorAfter(jodit.s.current());
25635
+ // `current()` returns a node of the selection START, so with
25636
+ // several selected paragraphs the result landed after the
25637
+ // first one — collapse the range to the END of the selection
25638
+ // instead. See https://github.com/xdan/jodit/issues/1263
25639
+ const range = jodit.s.range;
25640
+ range.collapse(false);
25641
+ jodit.s.selectRange(range);
25569
25642
  jodit.s.insertHTML(html);
25570
25643
  __dialog.close();
25571
25644
  },
@@ -26134,13 +26207,26 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
26134
26207
  jodit.s.setCursorBefore(fakeNode);
26135
26208
  return true;
26136
26209
  }
26137
- if (sibling && (checkMoveListContent(jodit, mainClosestBox, sibling, backspace) || moveContentAndRemoveEmpty(jodit, mainClosestBox, sibling, backspace))) {
26210
+ if (sibling && (checkMoveListContent(jodit, mainClosestBox, sibling, backspace) || moveContentAndRemoveEmpty(jodit, mainClosestBox, resolveTableSibling(sibling, backspace), backspace))) {
26138
26211
  jodit.s.setCursorBefore(fakeNode);
26139
26212
  return true;
26140
26213
  }
26141
26214
  }
26142
26215
  return false;
26143
26216
  }
26217
+ /**
26218
+ * Content cannot be merged into the `<table>` element itself — it would land
26219
+ * between the table sections (after `</tbody>`), which is invalid HTML and
26220
+ * gets foster-parented out of the table on the next parse. Merge into the
26221
+ * edge cell instead. See https://github.com/xdan/jodit/issues/1064
26222
+ * @private
26223
+ */ function resolveTableSibling(sibling, backspace) {
26224
+ if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(sibling, 'table')) {
26225
+ return sibling;
26226
+ }
26227
+ const cells = sibling.querySelectorAll('td,th');
26228
+ return cells.length ? cells[backspace ? cells.length - 1 : 0] : null;
26229
+ }
26144
26230
  function checkMoveListContent(jodit, mainClosestBox, sibling, backspace) {
26145
26231
  // Process UL/LI/OL cases
26146
26232
  const siblingIsList = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(sibling, jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.LIST_TAGS);
@@ -28329,25 +28415,33 @@ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_0__.Icon.set('copy', (_icons_copy_sv
28329
28415
  });
28330
28416
  const callback = (command, second, third)=>{
28331
28417
  const colorHEX = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.normalizeColor)(third);
28332
- switch(command){
28333
- case 'background':
28334
- editor.s.commitStyle({
28335
- attributes: {
28336
- style: {
28337
- backgroundColor: !colorHEX ? '' : colorHEX
28338
- }
28339
- }
28340
- });
28341
- break;
28342
- case 'forecolor':
28418
+ const value = !colorHEX ? '' : colorHEX;
28419
+ const style = command === 'background' ? {
28420
+ backgroundColor: value
28421
+ } : {
28422
+ color: value
28423
+ };
28424
+ // Cells selected with the `select-cells` plugin drop or collapse the
28425
+ // native range, so `commitStyle` would paint a pending caret format
28426
+ // outside the table instead of the selection the user sees. Apply the
28427
+ // style to the content of every selected cell instead. See #1250
28428
+ const selectedCells = editor.getInstance('Table', editor.o).getAllSelectedCells();
28429
+ if (selectedCells.length && editor.s.isCollapsed()) {
28430
+ selectedCells.forEach((cell)=>{
28431
+ editor.s.select(cell, true);
28343
28432
  editor.s.commitStyle({
28344
28433
  attributes: {
28345
- style: {
28346
- color: !colorHEX ? '' : colorHEX
28347
- }
28434
+ style
28348
28435
  }
28349
28436
  });
28350
- break;
28437
+ });
28438
+ editor.s.sel?.removeAllRanges();
28439
+ } else {
28440
+ editor.s.commitStyle({
28441
+ attributes: {
28442
+ style
28443
+ }
28444
+ });
28351
28445
  }
28352
28446
  editor.synchronizeValues();
28353
28447
  return false;
@@ -33801,10 +33895,30 @@ const align = {
33801
33895
  this.j.async.setTimeout(()=>{
33802
33896
  const sel = this.j.s.sel;
33803
33897
  if (sel && !sel.isCollapsed) {
33804
- this.showPopup(()=>this.j.s.range.getBoundingClientRect(), 'selection');
33898
+ this.showPopup(()=>this.__selectionBound(), 'selection');
33805
33899
  }
33806
33900
  }, 1);
33807
33901
  }
33902
+ /**
33903
+ * The selection rect comes from the editor document — in iframe mode its
33904
+ * coordinates are iframe-local, while the popup lives in the host
33905
+ * document, so the iframe offset must be added. See
33906
+ * https://github.com/xdan/jodit/issues/1058
33907
+ */ __selectionBound() {
33908
+ const rect = this.j.s.range.getBoundingClientRect();
33909
+ let { left, top } = rect;
33910
+ if (this.j.iframe) {
33911
+ const offset = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.position)(this.j.iframe, this.j, true);
33912
+ left += offset.left;
33913
+ top += offset.top;
33914
+ }
33915
+ return {
33916
+ left,
33917
+ top,
33918
+ width: rect.width,
33919
+ height: rect.height
33920
+ };
33921
+ }
33808
33922
  onSelectionStart() {
33809
33923
  this.snapRange = this.j.s.range.cloneRange();
33810
33924
  }
@@ -33836,7 +33950,7 @@ const align = {
33836
33950
  if (!node) {
33837
33951
  return;
33838
33952
  }
33839
- this.showPopup(()=>range.getBoundingClientRect(), type);
33953
+ this.showPopup(()=>this.__selectionBound(), type);
33840
33954
  }
33841
33955
  /**
33842
33956
  * In not collapsed selection - only one image
@@ -35772,7 +35886,13 @@ jodit_config__WEBPACK_IMPORTED_MODULE_1__.Config.prototype.controls.paste = {
35772
35886
  try {
35773
35887
  const items = await navigator.clipboard.read();
35774
35888
  if (items && items.length) {
35775
- const textBlob = await items[0].getType(jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.TEXT_PLAIN);
35889
+ const item = items[0];
35890
+ // Prefer the HTML flavor so the button behaves like the
35891
+ // Ctrl+V shortcut (which receives text/html from the
35892
+ // native paste event). See
35893
+ // https://github.com/xdan/jodit/issues/1061
35894
+ const type = item.types?.includes(jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.TEXT_HTML) ? jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.TEXT_HTML : jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.TEXT_PLAIN;
35895
+ const textBlob = await item.getType(type);
35776
35896
  text = await new Response(textBlob).text();
35777
35897
  }
35778
35898
  error = false;
@@ -38378,20 +38498,30 @@ class UISearch extends jodit_core_ui__WEBPACK_IMPORTED_MODULE_6__.UIElement {
38378
38498
  return false;
38379
38499
  }).on(this.queryInput, 'input', ()=>{
38380
38500
  this.setMod('empty-query', !(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.trim)(this.queryInput.value).length);
38381
- }).on(this.queryInput, 'keydown', this.j.async.debounce(async (e)=>{
38382
- switch(e.key){
38383
- case jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_ENTER:
38501
+ }).on(this.queryInput, 'keydown', (()=>{
38502
+ const debounced = this.j.async.debounce(async (e)=>{
38503
+ switch(e.key){
38504
+ case jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_ENTER:
38505
+ if (await jodit.e.fire('searchNext')) {
38506
+ this.close();
38507
+ }
38508
+ break;
38509
+ default:
38510
+ jodit.e.fire(this, 'needUpdateCounters');
38511
+ break;
38512
+ }
38513
+ }, this.j.defaultTimeout);
38514
+ return (e)=>{
38515
+ // Must be canceled synchronously — inside the debounced
38516
+ // handler the browser has already submitted the parent
38517
+ // form. See https://github.com/xdan/jodit/issues/918
38518
+ if (e.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_ENTER) {
38384
38519
  e.preventDefault();
38385
38520
  e.stopImmediatePropagation();
38386
- if (await jodit.e.fire('searchNext')) {
38387
- this.close();
38388
- }
38389
- break;
38390
- default:
38391
- jodit.e.fire(this, 'needUpdateCounters');
38392
- break;
38393
- }
38394
- }, this.j.defaultTimeout));
38521
+ }
38522
+ debounced(e);
38523
+ };
38524
+ })());
38395
38525
  }
38396
38526
  }
38397
38527
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
@@ -38546,7 +38676,9 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
38546
38676
  if (this.j.isLockedNotBy(key)) {
38547
38677
  return;
38548
38678
  }
38549
- const node = this.j.ed.elementFromPoint(e.clientX, e.clientY);
38679
+ // Inside Shadow DOM `document.elementFromPoint` returns the shadow
38680
+ // host, so the lookup must start from the shadow root
38681
+ const node = (this.j.o.shadowRoot ?? this.j.ed).elementFromPoint(e.clientX, e.clientY);
38550
38682
  if (!node) {
38551
38683
  return;
38552
38684
  }
@@ -38605,7 +38737,9 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
38605
38737
  }
38606
38738
  this.__isSelectionMode = false;
38607
38739
  this.j.unlock();
38608
- const node = this.j.ed.elementFromPoint(e.clientX, e.clientY);
38740
+ // Inside Shadow DOM `document.elementFromPoint` returns the shadow
38741
+ // host, so the lookup must start from the shadow root
38742
+ const node = (this.j.o.shadowRoot ?? this.j.ed).elementFromPoint(e.clientX, e.clientY);
38609
38743
  if (!node) {
38610
38744
  return;
38611
38745
  }
@@ -42030,7 +42164,7 @@ module.exports["default"] = {"Type something":"Start writing...","pencil":"Edit"
42030
42164
  /***/ 53414:
42031
42165
  /***/ (function(module) {
42032
42166
 
42033
- module.exports["default"] = ["Type something","About Jodit","Jodit Editor","Jodit User's Guide","contains detailed help for using","For information about the license, please go to our website:","Buy full version","Copyright © XDSoft.net - Chupurnov Valeriy. All rights reserved.","Anchor","Open in new tab","Open in fullsize","Clear Formatting","Fill color or set the text color","Redo","Undo","Bold","Italic","Insert Unordered List","Insert Ordered List","Align Center","Align Justify","Align Left","Align Right","Insert Horizontal Line","Insert Image","Insert file","Insert youtube/vimeo video","Insert link","Font size","Font family","Insert format block","Normal","Heading 1","Heading 2","Heading 3","Heading 4","Quote","Code","Insert","Insert table","Decrease Indent","Increase Indent","Select Special Character","Insert Special Character","Paint format","Change mode","Margins","top","right","bottom","left","Styles","Classes","Align","Right","Center","Left","--Not Set--","Src","Title","Alternative","Link","Open link in new tab","Image","file","Advanced","Image properties","Cancel","Ok","File Browser","Error on load list","Error on load folders","Are you sure?","Enter Directory name","Create directory","type name","Drop image","Drop file","or click","Alternative text","Upload","Browse","Background","Text","Top","Middle","Bottom","Insert column before","Insert column after","Insert row above","Insert row below","Delete table","Delete row","Delete column","Empty cell","Chars: %d","Words: %d","Strike through","Underline","superscript","subscript","Cut selection","Select all","Break","Search for","Replace with","Replace","Paste","Choose Content to Paste","source","bold","italic","brush","link","undo","redo","table","image","eraser","paragraph","fontsize","video","font","about","print","underline","strikethrough","indent","outdent","fullsize","shrink","hr","ul","ol","cut","selectall","Embed code","Open link","Edit link","No follow","Unlink","Update","pencil","Eye"," URL","Edit","Horizontal align","Filter","Sort by changed","Sort by name","Sort by size","Add folder","Reset","Save","Save as ...","Resize","Crop","Width","Height","Keep Aspect Ratio","Yes","No","Remove","Select","Select %s","Vertical align","Split","Merge","Add column","Add row","License: %s","Delete","Split vertical","Split horizontal","Border","Your code is similar to HTML. Keep as HTML?","Paste as HTML","Keep","Insert as Text","Insert only Text","You can only edit your own images. Download this image on the host?","The image has been successfully uploaded to the host!","palette","There are no files","Rename","Enter new name","preview","download","Paste from clipboard","Your browser doesn't support direct access to the clipboard.","Copy selection","copy","Border radius","Show all","Apply","Please fill out this field","Please enter a web address","Default","Circle","Dot","Quadrate","Find","Find Previous","Find Next","The pasted content is coming from a Microsoft Word/Excel document. Do you want to keep the format or clean it up?","Word Paste Detected","Clean","Insert className","Press Alt for custom resizing","Line height","spellcheck","Speech Recognize","All"]
42167
+ module.exports["default"] = [" URL","--Not Set--","About Jodit","Add column","Add folder","Add row","Advanced","Align","Align Center","Align Justify","Align Left","Align Right","All","Alternative","Alternative text","Anchor","Apply","Are you sure?","Background","Bold","Border","Border radius","Bottom","Break","Browse","Buy full version","Cancel","Center","Change mode","Chars: %d","Choose Content to Paste","Circle","Class name","Classes","Clean","Clear Formatting","Code","Copy selection","Copyright © XDSoft.net - Chupurnov Valeriy. All rights reserved.","Create directory","Crop","Cut selection","Decrease Indent","Default","Delete","Delete column","Delete row","Delete table","Dot","Drop file","Drop image","Edit","Edit link","Embed code","Empty cell","Enter Directory name","Enter new name","Error on load folders","Error on load list","Eye","File Browser","Fill color or set the text color","Filter","Find","Find Next","Find Previous","Font family","Font size","For information about the license, please go to our website:","Free Non-commercial Version","Heading 1","Heading 2","Heading 3","Heading 4","Height","Horizontal align","Image","Image properties","Increase Indent","Insert","Insert Horizontal Line","Insert Image","Insert Ordered List","Insert Special Character","Insert Unordered List","Insert as Text","Insert className","Insert column after","Insert column before","Insert file","Insert format block","Insert link","Insert only Text","Insert row above","Insert row below","Insert table","Insert youtube/vimeo video","Interim Results","Italic","Jodit Editor","Jodit User's Guide","Keep","Keep Aspect Ratio","Left","License: %s","Line height","Link","Lower Alpha","Lower Greek","Lower Roman","Margins","Merge","Middle","No","No follow","Normal","Ok","Open in fullsize","Open in new tab","Open link","Open link in new tab","Paint format","Paste","Paste as HTML","Paste from clipboard","Please enter a web address","Please fill out this field","Press Alt for custom resizing","Print","Quadrate","Quote","Redo","Remove","Rename","Replace","Replace with","Reset","Resize","Right","Save","Save as ...","Search for","Select","Select %s","Select Special Character","Select all","Show all","Sort by changed","Sort by name","Sort by size","Sound","Speech Recognize","Split","Split horizontal","Split vertical","Src","Strike through","Styles","Text","The image has been successfully uploaded to the host!","The pasted content is coming from a Microsoft Word/Excel document. Do you want to keep the format or clean it up?","There are no files","Title","Top","Type something","Underline","Undo","Unlink","Update","Upload","Upper Alpha","Upper Roman","Vertical align","Width","Word Paste Detected","Words: %d","Yes","You can only edit your own images. Download this image on the host?","Your browser doesn't support direct access to the clipboard.","Your code is similar to HTML. Keep as HTML?","about","apply","bold","bottom","brush","circle","contains detailed help for using","copy","cut","default","dot","download","edit","eraser","file","font","fontsize","fullsize","hr","image","indent","italic","left","link","ol","or click","outdent","palette","paragraph","pencil","preview","print","redo","right","selectall","shrink","sound","source","spellcheck","square","strikethrough","subscript","superscript","table","top","type name","ul","underline","undo","video"]
42034
42168
 
42035
42169
  /***/ }),
42036
42170