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/es2015/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
  */
@@ -1828,7 +1828,7 @@ __webpack_require__.r(__webpack_exports__);
1828
1828
  * ```
1829
1829
  * @packageDocumentation
1830
1830
  * @module constants
1831
- */ const APP_VERSION = "4.18.6";
1831
+ */ const APP_VERSION = "4.18.7";
1832
1832
  // prettier-ignore
1833
1833
  const ES = "es2015";
1834
1834
  const IS_ES_MODERN = true;
@@ -2568,6 +2568,8 @@ function cacheHTML(target, _, descriptor) {
2568
2568
  */
2569
2569
 
2570
2570
  const componentRegistry = new Map();
2571
+ const decoratedClasses = new WeakSet();
2572
+ const warnedClasses = new WeakSet();
2571
2573
  /**
2572
2574
  * Decorate components and set status isReady after constructor
2573
2575
  * @param constructorFunction - Component constructor class
@@ -2584,9 +2586,16 @@ const componentRegistry = new Map();
2584
2586
  Object.setPrototypeOf(this, newConstructorFunction.prototype);
2585
2587
  }
2586
2588
  this.setStatus('ready');
2589
+ } else if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.IS_PROD && !decoratedClasses.has(this.constructor) && !warnedClasses.has(this.constructor)) {
2590
+ // Only the outermost class's decorator sets `ready`, so a subclass
2591
+ // without its own decorator stays in `beforeInit`. See #1685
2592
+ warnedClasses.add(this.constructor);
2593
+ 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`);
2587
2594
  }
2588
2595
  }
2589
2596
  }
2597
+ decoratedClasses.add(constructorFunction);
2598
+ decoratedClasses.add(newConstructorFunction);
2590
2599
  const name = (0,jodit_core_helpers_utils_get_class_name__WEBPACK_IMPORTED_MODULE_1__.getClassName)(constructorFunction.prototype);
2591
2600
  if (componentRegistry.has(name) && !jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.IS_PROD) {
2592
2601
  throw new Error(`Component with name "${name}" is already registered`);
@@ -17705,6 +17714,9 @@ class Popup extends jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_12__.UIGr
17705
17714
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
17706
17715
  jodit_core_decorators__WEBPACK_IMPORTED_MODULE_5__.autobind
17707
17716
  ], Popup.prototype, "__closeOnOutsideClick", null);
17717
+ Popup = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
17718
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_5__.component
17719
+ ], Popup);
17708
17720
 
17709
17721
 
17710
17722
  /***/ }),
@@ -18825,7 +18837,7 @@ class Jodit extends jodit_modules__WEBPACK_IMPORTED_MODULE_11__.ViewWithToolbar
18825
18837
  commands.push(command);
18826
18838
  if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction)(command)) {
18827
18839
  const hotkeys = this.o.commandToHotkeys[commandName] || this.o.commandToHotkeys[commandNameOriginal] || command.hotkeys;
18828
- if (hotkeys) {
18840
+ if (hotkeys && hotkeys.length) {
18829
18841
  this.registerHotkeyToCommand(hotkeys, commandName, options === null || options === void 0 ? void 0 : options.stopPropagation);
18830
18842
  }
18831
18843
  }
@@ -18834,6 +18846,10 @@ class Jodit extends jodit_modules__WEBPACK_IMPORTED_MODULE_11__.ViewWithToolbar
18834
18846
  /**
18835
18847
  * Register hotkey for command
18836
18848
  */ registerHotkeyToCommand(hotkeys, commandName, shouldStop = true) {
18849
+ // An empty list (e.g. `commandToHotkeys: { cmd: [] }`) turns the key off
18850
+ if (!hotkeys || !hotkeys.length) {
18851
+ return;
18852
+ }
18837
18853
  const shortcuts = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.asArray)(hotkeys).map(jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.normalizeKeyAliases).map((hotkey)=>hotkey + '.hotkey').join(' ');
18838
18854
  this.e.off(shortcuts).on(shortcuts, (type, stop)=>{
18839
18855
  if (stop) {
@@ -22794,18 +22810,25 @@ const DEFAULT_SOURCE_NAME = 'default';
22794
22810
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
22795
22811
  /* harmony export */ FileBrowserFiles: function() { return /* binding */ FileBrowserFiles; }
22796
22812
  /* harmony export */ });
22797
- /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4099);
22813
+ /* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31635);
22814
+ /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84839);
22815
+ /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4099);
22816
+
22798
22817
  /*!
22799
22818
  * Jodit Editor (https://xdsoft.net/jodit/)
22800
22819
  * Released under MIT see LICENSE.txt in the project root for license information.
22801
22820
  * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
22802
22821
  */
22803
22822
 
22804
- class FileBrowserFiles extends jodit_core_ui__WEBPACK_IMPORTED_MODULE_0__.UIGroup {
22823
+
22824
+ class FileBrowserFiles extends jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.UIGroup {
22805
22825
  className() {
22806
22826
  return 'FileBrowserFiles';
22807
22827
  }
22808
22828
  }
22829
+ FileBrowserFiles = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
22830
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.component
22831
+ ], FileBrowserFiles);
22809
22832
 
22810
22833
 
22811
22834
  /***/ }),
@@ -22839,18 +22862,25 @@ class FileBrowserFiles extends jodit_core_ui__WEBPACK_IMPORTED_MODULE_0__.UIGrou
22839
22862
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
22840
22863
  /* harmony export */ FileBrowserTree: function() { return /* binding */ FileBrowserTree; }
22841
22864
  /* harmony export */ });
22842
- /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4099);
22865
+ /* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31635);
22866
+ /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84839);
22867
+ /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4099);
22868
+
22843
22869
  /*!
22844
22870
  * Jodit Editor (https://xdsoft.net/jodit/)
22845
22871
  * Released under MIT see LICENSE.txt in the project root for license information.
22846
22872
  * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
22847
22873
  */
22848
22874
 
22849
- class FileBrowserTree extends jodit_core_ui__WEBPACK_IMPORTED_MODULE_0__.UIGroup {
22875
+
22876
+ class FileBrowserTree extends jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.UIGroup {
22850
22877
  className() {
22851
22878
  return 'FileBrowserTree';
22852
22879
  }
22853
22880
  }
22881
+ FileBrowserTree = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
22882
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.component
22883
+ ], FileBrowserTree);
22854
22884
 
22855
22885
 
22856
22886
  /***/ }),
@@ -28723,9 +28753,10 @@ function moveContentAndRemoveEmpty(jodit, mainClosestBox, sibling, backspace) {
28723
28753
  * ```html
28724
28754
  * t|st
28725
28755
  * ```
28756
+ * With `stopBeforeSpace`, nothing is removed when the next char is a space.
28726
28757
  * @private
28727
28758
  */ // eslint-disable-next-line complexity
28728
- function checkRemoveChar(jodit, fakeNode, backspace, mode) {
28759
+ function checkRemoveChar(jodit, fakeNode, backspace, mode, stopBeforeSpace = false) {
28729
28760
  const step = backspace ? -1 : 1;
28730
28761
  const anotherSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.sibling(fakeNode, !backspace);
28731
28762
  let sibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.sibling(fakeNode, backspace);
@@ -28744,6 +28775,9 @@ function checkRemoveChar(jodit, fakeNode, backspace, mode) {
28744
28775
  break;
28745
28776
  }
28746
28777
  if ((_sibling_nodeValue = sibling.nodeValue) === null || _sibling_nodeValue === void 0 ? void 0 : _sibling_nodeValue.length) {
28778
+ if (stopBeforeSpace && isSpace(nextChar(sibling.nodeValue, backspace))) {
28779
+ break;
28780
+ }
28747
28781
  removed = tryRemoveChar(sibling, backspace, step, anotherSibling);
28748
28782
  if (!sibling.nodeValue.length && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isInlineBlock(sibling.parentNode)) {
28749
28783
  sibling.nodeValue = jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.INVISIBLE_SPACE;
@@ -28851,9 +28885,25 @@ function replaceSpaceOnNBSP(anotherSibling, backspace, value) {
28851
28885
  }
28852
28886
  function checkRepeatRemoveCharAction(backspace, sibling, fakeNode, mode, removed, jodit) {
28853
28887
  ;(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);
28854
- if (mode === 'sentence' || mode === 'word' && removed !== ' ' && removed !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.NBSP_SPACE) {
28855
- checkRemoveChar(jodit, fakeNode, backspace, mode);
28888
+ const wordChar = mode === 'word' && !isSpace(removed);
28889
+ // Backspace by word removes the spaces before the caret, then the word, and keeps the space in front of it
28890
+ if (mode === 'sentence' || wordChar || mode === 'word' && backspace) {
28891
+ checkRemoveChar(jodit, fakeNode, backspace, mode, wordChar && backspace);
28892
+ }
28893
+ }
28894
+ /**
28895
+ * The char tryRemoveChar would remove next
28896
+ */ function nextChar(value, backspace) {
28897
+ const chars = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.toArray)(value);
28898
+ const step = backspace ? -1 : 1;
28899
+ let index = backspace ? chars.length - 1 : 0;
28900
+ while(chars[index] === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.INVISIBLE_SPACE){
28901
+ index += step;
28856
28902
  }
28903
+ return chars[index];
28904
+ }
28905
+ function isSpace(char) {
28906
+ return char === ' ' || char === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.NBSP_SPACE;
28857
28907
  }
28858
28908
 
28859
28909
 
@@ -29238,7 +29288,8 @@ function checkRepeatRemoveCharAction(backspace, sibling, fakeNode, mode, removed
29238
29288
  /***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
29239
29289
 
29240
29290
  "use strict";
29241
- /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5266);
29291
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81937);
29292
+ /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5266);
29242
29293
  /*!
29243
29294
  * Jodit Editor (https://xdsoft.net/jodit/)
29244
29295
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -29246,13 +29297,18 @@ function checkRepeatRemoveCharAction(backspace, sibling, fakeNode, mode, removed
29246
29297
  */ /**
29247
29298
  * @module plugins/backspace
29248
29299
  */
29249
- jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.delete = {
29300
+
29301
+ jodit_config__WEBPACK_IMPORTED_MODULE_1__.Config.prototype.delete = {
29250
29302
  hotkeys: {
29251
- delete: [
29303
+ delete: jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.IS_MAC ? [
29304
+ 'delete'
29305
+ ] : [
29252
29306
  'delete',
29253
29307
  'cmd+backspace'
29254
29308
  ],
29255
- deleteWord: [
29309
+ deleteWord: jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.IS_MAC ? [
29310
+ 'ctrl+delete'
29311
+ ] : [
29256
29312
  'ctrl+delete',
29257
29313
  'cmd+alt+backspace',
29258
29314
  'ctrl+alt+backspace'
@@ -29264,7 +29320,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.delete = {
29264
29320
  backspace: [
29265
29321
  'backspace'
29266
29322
  ],
29267
- backspaceWord: [
29323
+ backspaceWord: jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.IS_MAC ? [] : [
29268
29324
  'ctrl+backspace'
29269
29325
  ],
29270
29326
  backspaceSentence: [
@@ -35310,8 +35366,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.image = {
35310
35366
  dialog.close();
35311
35367
  });
35312
35368
  buttons.remove.onAction(()=>{
35369
+ const caret = j.s.createRange();
35370
+ caret.setStartBefore(this.state.sourceImage);
35371
+ caret.collapse(true);
35313
35372
  j.s.removeNode(this.state.sourceImage);
35314
35373
  dialog.close();
35374
+ j.s.selectRange(caret);
35315
35375
  });
35316
35376
  buttons.cancel.onAction(()=>{
35317
35377
  dialog.close();
@@ -35325,10 +35385,20 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.image = {
35325
35385
  ],
35326
35386
  buttons.check
35327
35387
  ]);
35328
- j.e.on(dialog, 'afterClose', ()=>{
35329
- if (this.state.image.parentNode && j.o.image.selectImageAfterClose) {
35330
- j.s.select(this.state.sourceImage);
35388
+ // The dialog fires `afterClose` on its own emitter, not the editor's
35389
+ dialog.e.on(dialog, 'afterClose', ()=>{
35390
+ const { sourceImage } = this.state;
35391
+ if (j.isInDestruct || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(j.editor, sourceImage)) {
35392
+ return;
35331
35393
  }
35394
+ if (j.o.image.selectImageAfterClose) {
35395
+ j.s.select(sourceImage);
35396
+ return;
35397
+ }
35398
+ const caret = j.s.createRange();
35399
+ caret.setStartAfter(sourceImage);
35400
+ caret.collapse(true);
35401
+ j.s.selectRange(caret);
35332
35402
  });
35333
35403
  dialog.setSize(j.o.image.dialogWidth);
35334
35404
  (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.markOwner)(j, dialog.container);
@@ -35359,6 +35429,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.image = {
35359
35429
  this.activeTabState.activeTab = 'Image';
35360
35430
  this.__lock();
35361
35431
  this.dialog.open().setModal(true).setPosition();
35432
+ this.__focusFirstField();
35362
35433
  this.async.promise((resolve, reject)=>(0,_readers__WEBPACK_IMPORTED_MODULE_13__.readValuesFromImage)(this.j, this.state).then(resolve, reject)).catch((e)=>{
35363
35434
  if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isAbortError)(e)) {
35364
35435
  this.dialog.message.error(e.message);
@@ -35366,6 +35437,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.image = {
35366
35437
  }).finally(()=>this.__unlock());
35367
35438
  return false;
35368
35439
  }
35440
+ /**
35441
+ * Keys typed while the dialog is open must not reach the editor behind it,
35442
+ * so focus the active tab's first field, or else the first field shown
35443
+ */ __focusFirstField() {
35444
+ var _fields_concat_find;
35445
+ const fields = (box)=>(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.toArray)(box.querySelectorAll('input, select, textarea'));
35446
+ (_fields_concat_find = fields(this.form.getElm('tabsBox')).concat(fields(this.form.container)).find((field)=>field.offsetParent != null)) === null || _fields_concat_find === void 0 ? void 0 : _fields_concat_find.focus();
35447
+ }
35369
35448
  __lock() {
35370
35449
  this.dialog.lock();
35371
35450
  this.form.setMod('lock', true);
@@ -39850,9 +39929,11 @@ const isButtonSeparator = (item)=>item === '|' || item === '---' || item === '\n
39850
39929
  return cleaned;
39851
39930
  }
39852
39931
  /**
39853
- * The width that decides which breakpoint set the toolbar uses. A toolbar
39854
- * rendered into an external container (`toolbar` set to an element or a
39855
- * selector) lays out in that container, so its width is what matters there.
39932
+ * The width that decides which breakpoint set the toolbar uses: the editor's
39933
+ * own width, or its parent's while the editor has none yet (for example
39934
+ * while hidden at init). A toolbar rendered into an external container
39935
+ * (`toolbar` set to an element or a selector) lays out in that container, so
39936
+ * its width is what matters there.
39856
39937
  */ function adaptiveWidth(editor) {
39857
39938
  var _editor_container_parentElement;
39858
39939
  const { toolbar } = editor.o;
@@ -39862,7 +39943,7 @@ const isButtonSeparator = (item)=>item === '|' || item === '---' || item === '\n
39862
39943
  return width;
39863
39944
  }
39864
39945
  }
39865
- return ((_editor_container_parentElement = editor.container.parentElement) !== null && _editor_container_parentElement !== void 0 ? _editor_container_parentElement : editor.container).offsetWidth;
39946
+ return editor.container.offsetWidth || ((_editor_container_parentElement = editor.container.parentElement) !== null && _editor_container_parentElement !== void 0 ? _editor_container_parentElement : editor.container).offsetWidth;
39866
39947
  }
39867
39948
  /**
39868
39949
  * Rebuild toolbar in depends on editor's width