jodit 4.18.6 → 4.18.7

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 (68) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +8 -8
  4. package/es2015/jodit.js +103 -22
  5. package/es2015/jodit.min.js +8 -8
  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 +6 -6
  13. package/es2018/jodit.min.js +6 -6
  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 +6 -6
  18. package/es2021/jodit.js +102 -22
  19. package/es2021/jodit.min.js +6 -6
  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 +10 -10
  28. package/es2021.en/jodit.js +102 -22
  29. package/es2021.en/jodit.min.js +6 -6
  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 +110 -21
  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/config.d.ts +2 -0
  51. package/esm/core/constants.js +1 -1
  52. package/esm/core/decorators/component/component.js +12 -0
  53. package/esm/core/ui/popup/popup.js +14 -9
  54. package/esm/jodit.js +5 -1
  55. package/esm/modules/file-browser/ui/files/files.js +17 -2
  56. package/esm/modules/file-browser/ui/tree/tree.js +17 -2
  57. package/esm/plugins/backspace/cases/check-remove-char.d.ts +2 -1
  58. package/esm/plugins/backspace/cases/check-remove-char.js +25 -4
  59. package/esm/plugins/backspace/config.d.ts +2 -0
  60. package/esm/plugins/backspace/config.js +6 -3
  61. package/esm/plugins/image-properties/image-properties.d.ts +5 -0
  62. package/esm/plugins/image-properties/image-properties.js +30 -5
  63. package/esm/plugins/mobile/mobile.js +7 -4
  64. package/package.json +1 -1
  65. package/types/config.d.ts +2 -0
  66. package/types/plugins/backspace/cases/check-remove-char.d.ts +2 -1
  67. package/types/plugins/backspace/config.d.ts +2 -0
  68. package/types/plugins/image-properties/image-properties.d.ts +5 -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.18.6
4
+ * Version: v4.18.7
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1822,7 +1822,7 @@ __webpack_require__.r(__webpack_exports__);
1822
1822
  * ```
1823
1823
  * @packageDocumentation
1824
1824
  * @module constants
1825
- */ const APP_VERSION = "4.18.6";
1825
+ */ const APP_VERSION = "4.18.7";
1826
1826
  // prettier-ignore
1827
1827
  const ES = "es2021";
1828
1828
  const IS_ES_MODERN = true;
@@ -2560,6 +2560,8 @@ function cacheHTML(target, _, descriptor) {
2560
2560
  */
2561
2561
 
2562
2562
  const componentRegistry = new Map();
2563
+ const decoratedClasses = new WeakSet();
2564
+ const warnedClasses = new WeakSet();
2563
2565
  /**
2564
2566
  * Decorate components and set status isReady after constructor
2565
2567
  * @param constructorFunction - Component constructor class
@@ -2576,9 +2578,16 @@ const componentRegistry = new Map();
2576
2578
  Object.setPrototypeOf(this, newConstructorFunction.prototype);
2577
2579
  }
2578
2580
  this.setStatus('ready');
2581
+ } else if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.IS_PROD && !decoratedClasses.has(this.constructor) && !warnedClasses.has(this.constructor)) {
2582
+ // Only the outermost class's decorator sets `ready`, so a subclass
2583
+ // without its own decorator stays in `beforeInit`. See #1685
2584
+ warnedClasses.add(this.constructor);
2585
+ console.warn(`Component "${this.constructor.name || (0,jodit_core_helpers_utils_get_class_name__WEBPACK_IMPORTED_MODULE_1__.getClassName)(this)}" extends a @component class without being decorated itself, so it never becomes ready and its @watch, @debounce, @throttle and @hook handlers never run`);
2579
2586
  }
2580
2587
  }
2581
2588
  }
2589
+ decoratedClasses.add(constructorFunction);
2590
+ decoratedClasses.add(newConstructorFunction);
2582
2591
  const name = (0,jodit_core_helpers_utils_get_class_name__WEBPACK_IMPORTED_MODULE_1__.getClassName)(constructorFunction.prototype);
2583
2592
  if (componentRegistry.has(name) && !jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.IS_PROD) {
2584
2593
  throw new Error(`Component with name "${name}" is already registered`);
@@ -17560,6 +17569,9 @@ class Popup extends jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_10__.UIGr
17560
17569
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
17561
17570
  jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
17562
17571
  ], Popup.prototype, "__closeOnOutsideClick", null);
17572
+ Popup = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
17573
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.component
17574
+ ], Popup);
17563
17575
 
17564
17576
 
17565
17577
  /***/ }),
@@ -18671,7 +18683,7 @@ class Jodit extends jodit_modules__WEBPACK_IMPORTED_MODULE_10__.ViewWithToolbar
18671
18683
  commands.push(command);
18672
18684
  if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.isFunction)(command)) {
18673
18685
  const hotkeys = this.o.commandToHotkeys[commandName] || this.o.commandToHotkeys[commandNameOriginal] || command.hotkeys;
18674
- if (hotkeys) {
18686
+ if (hotkeys && hotkeys.length) {
18675
18687
  this.registerHotkeyToCommand(hotkeys, commandName, options?.stopPropagation);
18676
18688
  }
18677
18689
  }
@@ -18680,6 +18692,10 @@ class Jodit extends jodit_modules__WEBPACK_IMPORTED_MODULE_10__.ViewWithToolbar
18680
18692
  /**
18681
18693
  * Register hotkey for command
18682
18694
  */ registerHotkeyToCommand(hotkeys, commandName, shouldStop = true) {
18695
+ // An empty list (e.g. `commandToHotkeys: { cmd: [] }`) turns the key off
18696
+ if (!hotkeys || !hotkeys.length) {
18697
+ return;
18698
+ }
18683
18699
  const shortcuts = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.asArray)(hotkeys).map(jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.normalizeKeyAliases).map((hotkey)=>hotkey + '.hotkey').join(' ');
18684
18700
  this.e.off(shortcuts).on(shortcuts, (type, stop)=>{
18685
18701
  if (stop) {
@@ -22580,18 +22596,25 @@ const DEFAULT_SOURCE_NAME = 'default';
22580
22596
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
22581
22597
  /* harmony export */ FileBrowserFiles: function() { return /* binding */ FileBrowserFiles; }
22582
22598
  /* harmony export */ });
22583
- /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4099);
22599
+ /* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31635);
22600
+ /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84839);
22601
+ /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4099);
22602
+
22584
22603
  /*!
22585
22604
  * Jodit Editor (https://xdsoft.net/jodit/)
22586
22605
  * Released under MIT see LICENSE.txt in the project root for license information.
22587
22606
  * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
22588
22607
  */
22589
22608
 
22590
- class FileBrowserFiles extends jodit_core_ui__WEBPACK_IMPORTED_MODULE_0__.UIGroup {
22609
+
22610
+ class FileBrowserFiles extends jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.UIGroup {
22591
22611
  className() {
22592
22612
  return 'FileBrowserFiles';
22593
22613
  }
22594
22614
  }
22615
+ FileBrowserFiles = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
22616
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.component
22617
+ ], FileBrowserFiles);
22595
22618
 
22596
22619
 
22597
22620
  /***/ }),
@@ -22625,18 +22648,25 @@ class FileBrowserFiles extends jodit_core_ui__WEBPACK_IMPORTED_MODULE_0__.UIGrou
22625
22648
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
22626
22649
  /* harmony export */ FileBrowserTree: function() { return /* binding */ FileBrowserTree; }
22627
22650
  /* harmony export */ });
22628
- /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4099);
22651
+ /* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31635);
22652
+ /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84839);
22653
+ /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4099);
22654
+
22629
22655
  /*!
22630
22656
  * Jodit Editor (https://xdsoft.net/jodit/)
22631
22657
  * Released under MIT see LICENSE.txt in the project root for license information.
22632
22658
  * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
22633
22659
  */
22634
22660
 
22635
- class FileBrowserTree extends jodit_core_ui__WEBPACK_IMPORTED_MODULE_0__.UIGroup {
22661
+
22662
+ class FileBrowserTree extends jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.UIGroup {
22636
22663
  className() {
22637
22664
  return 'FileBrowserTree';
22638
22665
  }
22639
22666
  }
22667
+ FileBrowserTree = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
22668
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.component
22669
+ ], FileBrowserTree);
22640
22670
 
22641
22671
 
22642
22672
  /***/ }),
@@ -28423,9 +28453,10 @@ function moveContentAndRemoveEmpty(jodit, mainClosestBox, sibling, backspace) {
28423
28453
  * ```html
28424
28454
  * t|st
28425
28455
  * ```
28456
+ * With `stopBeforeSpace`, nothing is removed when the next char is a space.
28426
28457
  * @private
28427
28458
  */ // eslint-disable-next-line complexity
28428
- function checkRemoveChar(jodit, fakeNode, backspace, mode) {
28459
+ function checkRemoveChar(jodit, fakeNode, backspace, mode, stopBeforeSpace = false) {
28429
28460
  const step = backspace ? -1 : 1;
28430
28461
  const anotherSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.sibling(fakeNode, !backspace);
28431
28462
  let sibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.sibling(fakeNode, backspace);
@@ -28443,6 +28474,9 @@ function checkRemoveChar(jodit, fakeNode, backspace, mode) {
28443
28474
  break;
28444
28475
  }
28445
28476
  if (sibling.nodeValue?.length) {
28477
+ if (stopBeforeSpace && isSpace(nextChar(sibling.nodeValue, backspace))) {
28478
+ break;
28479
+ }
28446
28480
  removed = tryRemoveChar(sibling, backspace, step, anotherSibling);
28447
28481
  if (!sibling.nodeValue.length && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isInlineBlock(sibling.parentNode)) {
28448
28482
  sibling.nodeValue = jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.INVISIBLE_SPACE;
@@ -28549,10 +28583,26 @@ function replaceSpaceOnNBSP(anotherSibling, backspace, value) {
28549
28583
  }
28550
28584
  function checkRepeatRemoveCharAction(backspace, sibling, fakeNode, mode, removed, jodit) {
28551
28585
  ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.call)(backspace ? jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.after : jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before, sibling, fakeNode);
28552
- if (mode === 'sentence' || mode === 'word' && removed !== ' ' && removed !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.NBSP_SPACE) {
28553
- checkRemoveChar(jodit, fakeNode, backspace, mode);
28586
+ const wordChar = mode === 'word' && !isSpace(removed);
28587
+ // Backspace by word removes the spaces before the caret, then the word, and keeps the space in front of it
28588
+ if (mode === 'sentence' || wordChar || mode === 'word' && backspace) {
28589
+ checkRemoveChar(jodit, fakeNode, backspace, mode, wordChar && backspace);
28554
28590
  }
28555
28591
  }
28592
+ /**
28593
+ * The char tryRemoveChar would remove next
28594
+ */ function nextChar(value, backspace) {
28595
+ const chars = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.toArray)(value);
28596
+ const step = backspace ? -1 : 1;
28597
+ let index = backspace ? chars.length - 1 : 0;
28598
+ while(chars[index] === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.INVISIBLE_SPACE){
28599
+ index += step;
28600
+ }
28601
+ return chars[index];
28602
+ }
28603
+ function isSpace(char) {
28604
+ return char === ' ' || char === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.NBSP_SPACE;
28605
+ }
28556
28606
 
28557
28607
 
28558
28608
  /***/ }),
@@ -28935,7 +28985,8 @@ function checkRepeatRemoveCharAction(backspace, sibling, fakeNode, mode, removed
28935
28985
  /***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
28936
28986
 
28937
28987
  "use strict";
28938
- /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5266);
28988
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81937);
28989
+ /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5266);
28939
28990
  /*!
28940
28991
  * Jodit Editor (https://xdsoft.net/jodit/)
28941
28992
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -28943,13 +28994,18 @@ function checkRepeatRemoveCharAction(backspace, sibling, fakeNode, mode, removed
28943
28994
  */ /**
28944
28995
  * @module plugins/backspace
28945
28996
  */
28946
- jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.delete = {
28997
+
28998
+ jodit_config__WEBPACK_IMPORTED_MODULE_1__.Config.prototype.delete = {
28947
28999
  hotkeys: {
28948
- delete: [
29000
+ delete: jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.IS_MAC ? [
29001
+ 'delete'
29002
+ ] : [
28949
29003
  'delete',
28950
29004
  'cmd+backspace'
28951
29005
  ],
28952
- deleteWord: [
29006
+ deleteWord: jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.IS_MAC ? [
29007
+ 'ctrl+delete'
29008
+ ] : [
28953
29009
  'ctrl+delete',
28954
29010
  'cmd+alt+backspace',
28955
29011
  'ctrl+alt+backspace'
@@ -28961,7 +29017,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.delete = {
28961
29017
  backspace: [
28962
29018
  'backspace'
28963
29019
  ],
28964
- backspaceWord: [
29020
+ backspaceWord: jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.IS_MAC ? [] : [
28965
29021
  'ctrl+backspace'
28966
29022
  ],
28967
29023
  backspaceSentence: [
@@ -34647,8 +34703,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.image = {
34647
34703
  dialog.close();
34648
34704
  });
34649
34705
  buttons.remove.onAction(()=>{
34706
+ const caret = j.s.createRange();
34707
+ caret.setStartBefore(this.state.sourceImage);
34708
+ caret.collapse(true);
34650
34709
  j.s.removeNode(this.state.sourceImage);
34651
34710
  dialog.close();
34711
+ j.s.selectRange(caret);
34652
34712
  });
34653
34713
  buttons.cancel.onAction(()=>{
34654
34714
  dialog.close();
@@ -34662,10 +34722,20 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.image = {
34662
34722
  ],
34663
34723
  buttons.check
34664
34724
  ]);
34665
- j.e.on(dialog, 'afterClose', ()=>{
34666
- if (this.state.image.parentNode && j.o.image.selectImageAfterClose) {
34667
- j.s.select(this.state.sourceImage);
34725
+ // The dialog fires `afterClose` on its own emitter, not the editor's
34726
+ dialog.e.on(dialog, 'afterClose', ()=>{
34727
+ const { sourceImage } = this.state;
34728
+ if (j.isInDestruct || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isOrContains(j.editor, sourceImage)) {
34729
+ return;
34668
34730
  }
34731
+ if (j.o.image.selectImageAfterClose) {
34732
+ j.s.select(sourceImage);
34733
+ return;
34734
+ }
34735
+ const caret = j.s.createRange();
34736
+ caret.setStartAfter(sourceImage);
34737
+ caret.collapse(true);
34738
+ j.s.selectRange(caret);
34669
34739
  });
34670
34740
  dialog.setSize(j.o.image.dialogWidth);
34671
34741
  (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.markOwner)(j, dialog.container);
@@ -34696,6 +34766,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.image = {
34696
34766
  this.activeTabState.activeTab = 'Image';
34697
34767
  this.__lock();
34698
34768
  this.dialog.open().setModal(true).setPosition();
34769
+ this.__focusFirstField();
34699
34770
  this.async.promise((resolve, reject)=>(0,_readers__WEBPACK_IMPORTED_MODULE_12__.readValuesFromImage)(this.j, this.state).then(resolve, reject)).catch((e)=>{
34700
34771
  if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.isAbortError)(e)) {
34701
34772
  this.dialog.message.error(e.message);
@@ -34703,6 +34774,13 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.image = {
34703
34774
  }).finally(()=>this.__unlock());
34704
34775
  return false;
34705
34776
  }
34777
+ /**
34778
+ * Keys typed while the dialog is open must not reach the editor behind it,
34779
+ * so focus the active tab's first field, or else the first field shown
34780
+ */ __focusFirstField() {
34781
+ const fields = (box)=>(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.toArray)(box.querySelectorAll('input, select, textarea'));
34782
+ fields(this.form.getElm('tabsBox')).concat(fields(this.form.container)).find((field)=>field.offsetParent != null)?.focus();
34783
+ }
34706
34784
  __lock() {
34707
34785
  this.dialog.lock();
34708
34786
  this.form.setMod('lock', true);
@@ -38788,9 +38866,11 @@ const isButtonSeparator = (item)=>item === '|' || item === '---' || item === '\n
38788
38866
  return cleaned;
38789
38867
  }
38790
38868
  /**
38791
- * The width that decides which breakpoint set the toolbar uses. A toolbar
38792
- * rendered into an external container (`toolbar` set to an element or a
38793
- * selector) lays out in that container, so its width is what matters there.
38869
+ * The width that decides which breakpoint set the toolbar uses: the editor's
38870
+ * own width, or its parent's while the editor has none yet (for example
38871
+ * while hidden at init). A toolbar rendered into an external container
38872
+ * (`toolbar` set to an element or a selector) lays out in that container, so
38873
+ * its width is what matters there.
38794
38874
  */ function adaptiveWidth(editor) {
38795
38875
  const { toolbar } = editor.o;
38796
38876
  if ((0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_3__.isString)(toolbar) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isHTMLElement(toolbar)) {
@@ -38799,7 +38879,7 @@ const isButtonSeparator = (item)=>item === '|' || item === '---' || item === '\n
38799
38879
  return width;
38800
38880
  }
38801
38881
  }
38802
- return (editor.container.parentElement ?? editor.container).offsetWidth;
38882
+ return editor.container.offsetWidth || (editor.container.parentElement ?? editor.container).offsetWidth;
38803
38883
  }
38804
38884
  /**
38805
38885
  * Rebuild toolbar in depends on editor's width