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
package/es2021/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.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) {
@@ -22604,18 +22620,25 @@ const DEFAULT_SOURCE_NAME = 'default';
22604
22620
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
22605
22621
  /* harmony export */ FileBrowserFiles: function() { return /* binding */ FileBrowserFiles; }
22606
22622
  /* harmony export */ });
22607
- /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4099);
22623
+ /* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31635);
22624
+ /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84839);
22625
+ /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4099);
22626
+
22608
22627
  /*!
22609
22628
  * Jodit Editor (https://xdsoft.net/jodit/)
22610
22629
  * Released under MIT see LICENSE.txt in the project root for license information.
22611
22630
  * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
22612
22631
  */
22613
22632
 
22614
- class FileBrowserFiles extends jodit_core_ui__WEBPACK_IMPORTED_MODULE_0__.UIGroup {
22633
+
22634
+ class FileBrowserFiles extends jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.UIGroup {
22615
22635
  className() {
22616
22636
  return 'FileBrowserFiles';
22617
22637
  }
22618
22638
  }
22639
+ FileBrowserFiles = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
22640
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.component
22641
+ ], FileBrowserFiles);
22619
22642
 
22620
22643
 
22621
22644
  /***/ }),
@@ -22649,18 +22672,25 @@ class FileBrowserFiles extends jodit_core_ui__WEBPACK_IMPORTED_MODULE_0__.UIGrou
22649
22672
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
22650
22673
  /* harmony export */ FileBrowserTree: function() { return /* binding */ FileBrowserTree; }
22651
22674
  /* harmony export */ });
22652
- /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4099);
22675
+ /* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31635);
22676
+ /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84839);
22677
+ /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4099);
22678
+
22653
22679
  /*!
22654
22680
  * Jodit Editor (https://xdsoft.net/jodit/)
22655
22681
  * Released under MIT see LICENSE.txt in the project root for license information.
22656
22682
  * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
22657
22683
  */
22658
22684
 
22659
- class FileBrowserTree extends jodit_core_ui__WEBPACK_IMPORTED_MODULE_0__.UIGroup {
22685
+
22686
+ class FileBrowserTree extends jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.UIGroup {
22660
22687
  className() {
22661
22688
  return 'FileBrowserTree';
22662
22689
  }
22663
22690
  }
22691
+ FileBrowserTree = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
22692
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.component
22693
+ ], FileBrowserTree);
22664
22694
 
22665
22695
 
22666
22696
  /***/ }),
@@ -28497,9 +28527,10 @@ function moveContentAndRemoveEmpty(jodit, mainClosestBox, sibling, backspace) {
28497
28527
  * ```html
28498
28528
  * t|st
28499
28529
  * ```
28530
+ * With `stopBeforeSpace`, nothing is removed when the next char is a space.
28500
28531
  * @private
28501
28532
  */ // eslint-disable-next-line complexity
28502
- function checkRemoveChar(jodit, fakeNode, backspace, mode) {
28533
+ function checkRemoveChar(jodit, fakeNode, backspace, mode, stopBeforeSpace = false) {
28503
28534
  const step = backspace ? -1 : 1;
28504
28535
  const anotherSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.sibling(fakeNode, !backspace);
28505
28536
  let sibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.sibling(fakeNode, backspace);
@@ -28517,6 +28548,9 @@ function checkRemoveChar(jodit, fakeNode, backspace, mode) {
28517
28548
  break;
28518
28549
  }
28519
28550
  if (sibling.nodeValue?.length) {
28551
+ if (stopBeforeSpace && isSpace(nextChar(sibling.nodeValue, backspace))) {
28552
+ break;
28553
+ }
28520
28554
  removed = tryRemoveChar(sibling, backspace, step, anotherSibling);
28521
28555
  if (!sibling.nodeValue.length && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isInlineBlock(sibling.parentNode)) {
28522
28556
  sibling.nodeValue = jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.INVISIBLE_SPACE;
@@ -28623,10 +28657,26 @@ function replaceSpaceOnNBSP(anotherSibling, backspace, value) {
28623
28657
  }
28624
28658
  function checkRepeatRemoveCharAction(backspace, sibling, fakeNode, mode, removed, jodit) {
28625
28659
  ;(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);
28626
- if (mode === 'sentence' || mode === 'word' && removed !== ' ' && removed !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.NBSP_SPACE) {
28627
- checkRemoveChar(jodit, fakeNode, backspace, mode);
28660
+ const wordChar = mode === 'word' && !isSpace(removed);
28661
+ // Backspace by word removes the spaces before the caret, then the word, and keeps the space in front of it
28662
+ if (mode === 'sentence' || wordChar || mode === 'word' && backspace) {
28663
+ checkRemoveChar(jodit, fakeNode, backspace, mode, wordChar && backspace);
28628
28664
  }
28629
28665
  }
28666
+ /**
28667
+ * The char tryRemoveChar would remove next
28668
+ */ function nextChar(value, backspace) {
28669
+ const chars = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.toArray)(value);
28670
+ const step = backspace ? -1 : 1;
28671
+ let index = backspace ? chars.length - 1 : 0;
28672
+ while(chars[index] === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.INVISIBLE_SPACE){
28673
+ index += step;
28674
+ }
28675
+ return chars[index];
28676
+ }
28677
+ function isSpace(char) {
28678
+ return char === ' ' || char === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.NBSP_SPACE;
28679
+ }
28630
28680
 
28631
28681
 
28632
28682
  /***/ }),
@@ -29009,7 +29059,8 @@ function checkRepeatRemoveCharAction(backspace, sibling, fakeNode, mode, removed
29009
29059
  /***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
29010
29060
 
29011
29061
  "use strict";
29012
- /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5266);
29062
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81937);
29063
+ /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5266);
29013
29064
  /*!
29014
29065
  * Jodit Editor (https://xdsoft.net/jodit/)
29015
29066
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -29017,13 +29068,18 @@ function checkRepeatRemoveCharAction(backspace, sibling, fakeNode, mode, removed
29017
29068
  */ /**
29018
29069
  * @module plugins/backspace
29019
29070
  */
29020
- jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.delete = {
29071
+
29072
+ jodit_config__WEBPACK_IMPORTED_MODULE_1__.Config.prototype.delete = {
29021
29073
  hotkeys: {
29022
- delete: [
29074
+ delete: jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.IS_MAC ? [
29075
+ 'delete'
29076
+ ] : [
29023
29077
  'delete',
29024
29078
  'cmd+backspace'
29025
29079
  ],
29026
- deleteWord: [
29080
+ deleteWord: jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.IS_MAC ? [
29081
+ 'ctrl+delete'
29082
+ ] : [
29027
29083
  'ctrl+delete',
29028
29084
  'cmd+alt+backspace',
29029
29085
  'ctrl+alt+backspace'
@@ -29035,7 +29091,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.delete = {
29035
29091
  backspace: [
29036
29092
  'backspace'
29037
29093
  ],
29038
- backspaceWord: [
29094
+ backspaceWord: jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.IS_MAC ? [] : [
29039
29095
  'ctrl+backspace'
29040
29096
  ],
29041
29097
  backspaceSentence: [
@@ -35034,8 +35090,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.image = {
35034
35090
  dialog.close();
35035
35091
  });
35036
35092
  buttons.remove.onAction(()=>{
35093
+ const caret = j.s.createRange();
35094
+ caret.setStartBefore(this.state.sourceImage);
35095
+ caret.collapse(true);
35037
35096
  j.s.removeNode(this.state.sourceImage);
35038
35097
  dialog.close();
35098
+ j.s.selectRange(caret);
35039
35099
  });
35040
35100
  buttons.cancel.onAction(()=>{
35041
35101
  dialog.close();
@@ -35049,10 +35109,20 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.image = {
35049
35109
  ],
35050
35110
  buttons.check
35051
35111
  ]);
35052
- j.e.on(dialog, 'afterClose', ()=>{
35053
- if (this.state.image.parentNode && j.o.image.selectImageAfterClose) {
35054
- j.s.select(this.state.sourceImage);
35112
+ // The dialog fires `afterClose` on its own emitter, not the editor's
35113
+ dialog.e.on(dialog, 'afterClose', ()=>{
35114
+ const { sourceImage } = this.state;
35115
+ if (j.isInDestruct || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isOrContains(j.editor, sourceImage)) {
35116
+ return;
35055
35117
  }
35118
+ if (j.o.image.selectImageAfterClose) {
35119
+ j.s.select(sourceImage);
35120
+ return;
35121
+ }
35122
+ const caret = j.s.createRange();
35123
+ caret.setStartAfter(sourceImage);
35124
+ caret.collapse(true);
35125
+ j.s.selectRange(caret);
35056
35126
  });
35057
35127
  dialog.setSize(j.o.image.dialogWidth);
35058
35128
  (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.markOwner)(j, dialog.container);
@@ -35083,6 +35153,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.image = {
35083
35153
  this.activeTabState.activeTab = 'Image';
35084
35154
  this.__lock();
35085
35155
  this.dialog.open().setModal(true).setPosition();
35156
+ this.__focusFirstField();
35086
35157
  this.async.promise((resolve, reject)=>(0,_readers__WEBPACK_IMPORTED_MODULE_12__.readValuesFromImage)(this.j, this.state).then(resolve, reject)).catch((e)=>{
35087
35158
  if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.isAbortError)(e)) {
35088
35159
  this.dialog.message.error(e.message);
@@ -35090,6 +35161,13 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.image = {
35090
35161
  }).finally(()=>this.__unlock());
35091
35162
  return false;
35092
35163
  }
35164
+ /**
35165
+ * Keys typed while the dialog is open must not reach the editor behind it,
35166
+ * so focus the active tab's first field, or else the first field shown
35167
+ */ __focusFirstField() {
35168
+ const fields = (box)=>(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.toArray)(box.querySelectorAll('input, select, textarea'));
35169
+ fields(this.form.getElm('tabsBox')).concat(fields(this.form.container)).find((field)=>field.offsetParent != null)?.focus();
35170
+ }
35093
35171
  __lock() {
35094
35172
  this.dialog.lock();
35095
35173
  this.form.setMod('lock', true);
@@ -39541,9 +39619,11 @@ const isButtonSeparator = (item)=>item === '|' || item === '---' || item === '\n
39541
39619
  return cleaned;
39542
39620
  }
39543
39621
  /**
39544
- * The width that decides which breakpoint set the toolbar uses. A toolbar
39545
- * rendered into an external container (`toolbar` set to an element or a
39546
- * selector) lays out in that container, so its width is what matters there.
39622
+ * The width that decides which breakpoint set the toolbar uses: the editor's
39623
+ * own width, or its parent's while the editor has none yet (for example
39624
+ * while hidden at init). A toolbar rendered into an external container
39625
+ * (`toolbar` set to an element or a selector) lays out in that container, so
39626
+ * its width is what matters there.
39547
39627
  */ function adaptiveWidth(editor) {
39548
39628
  const { toolbar } = editor.o;
39549
39629
  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)) {
@@ -39552,7 +39632,7 @@ const isButtonSeparator = (item)=>item === '|' || item === '---' || item === '\n
39552
39632
  return width;
39553
39633
  }
39554
39634
  }
39555
- return (editor.container.parentElement ?? editor.container).offsetWidth;
39635
+ return editor.container.offsetWidth || (editor.container.parentElement ?? editor.container).offsetWidth;
39556
39636
  }
39557
39637
  /**
39558
39638
  * Rebuild toolbar in depends on editor's width