@ckeditor/ckeditor5-ui 48.5.2-alpha.0 → 48.5.3

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.
package/dist/index.js CHANGED
@@ -855,8 +855,10 @@ var TemplateToBinding = class extends TemplateBinding {
855
855
  */
856
856
  activateDomEventListener(domEvtName, domSelector, data) {
857
857
  const callback = (evt, domEvt) => {
858
- if (!domSelector || domEvt.target.matches(domSelector)) if (typeof this.eventNameOrFunction == "function") this.eventNameOrFunction(domEvt);
859
- else this.observable.fire(this.eventNameOrFunction, domEvt);
858
+ if (!domSelector || domEvt.target.matches(domSelector)) {
859
+ if (typeof this.eventNameOrFunction == "function") this.eventNameOrFunction(domEvt);
860
+ else this.observable.fire(this.eventNameOrFunction, domEvt);
861
+ }
860
862
  };
861
863
  this.emitter.listenTo(data.node, domEvtName, callback);
862
864
  return () => {
@@ -1025,9 +1027,11 @@ function normalize(def) {
1025
1027
  if (!def.text) {
1026
1028
  if (def.attributes) normalizeAttributes(def.attributes);
1027
1029
  const children = [];
1028
- if (def.children) if (isViewCollection(def.children)) children.push(def.children);
1029
- else for (const child of def.children) if (isTemplate(child) || isView(child) || isNode(child)) children.push(child);
1030
- else children.push(new Template(child));
1030
+ if (def.children) {
1031
+ if (isViewCollection(def.children)) children.push(def.children);
1032
+ else for (const child of def.children) if (isTemplate(child) || isView(child) || isNode(child)) children.push(child);
1033
+ else children.push(new Template(child));
1034
+ }
1031
1035
  def.children = children;
1032
1036
  }
1033
1037
  return def;
@@ -2718,11 +2722,13 @@ var ButtonView = class extends View {
2718
2722
  * @param keystroke Button keystroke.
2719
2723
  */
2720
2724
  _getTooltipString(tooltip, label, keystroke) {
2721
- if (tooltip) if (typeof tooltip == "string") return tooltip;
2722
- else {
2723
- if (keystroke) keystroke = getEnvKeystrokeText(keystroke);
2724
- if (tooltip instanceof Function) return tooltip(label, keystroke);
2725
- else return `${label}${keystroke ? ` (${keystroke})` : ""}`;
2725
+ if (tooltip) {
2726
+ if (typeof tooltip == "string") return tooltip;
2727
+ else {
2728
+ if (keystroke) keystroke = getEnvKeystrokeText(keystroke);
2729
+ if (tooltip instanceof Function) return tooltip(label, keystroke);
2730
+ else return `${label}${keystroke ? ` (${keystroke})` : ""}`;
2731
+ }
2726
2732
  }
2727
2733
  return "";
2728
2734
  }
@@ -7948,8 +7954,10 @@ var DropdownMenuNestedMenuPanelView = class extends BalloonPanelView {
7948
7954
  */
7949
7955
  focus(direction = 1) {
7950
7956
  const { content } = this;
7951
- if (content.length) if (direction === 1) content.first.focus();
7952
- else content.last.focus();
7957
+ if (content.length) {
7958
+ if (direction === 1) content.first.focus();
7959
+ else content.last.focus();
7960
+ }
7953
7961
  }
7954
7962
  };
7955
7963
 
@@ -12643,27 +12651,28 @@ function handleAdditions(originalConfig, config, items) {
12643
12651
  for (const itemToAdd of items) {
12644
12652
  const relation = getRelationFromPosition(itemToAdd.position);
12645
12653
  const relativeId = getRelativeIdFromPosition(itemToAdd.position);
12646
- if (isMenuBarMenuAddition(itemToAdd)) if (!relativeId) {
12647
- if (relation === "start") {
12648
- config.items.unshift(itemToAdd.menu);
12649
- successFullyAddedItems.push(itemToAdd);
12650
- } else if (relation === "end") {
12651
- config.items.push(itemToAdd.menu);
12652
- successFullyAddedItems.push(itemToAdd);
12653
- }
12654
- } else {
12655
- const topLevelMenuDefinitionIndex = config.items.findIndex((menuDefinition) => menuDefinition.menuId === relativeId);
12656
- if (topLevelMenuDefinitionIndex != -1) {
12657
- if (relation === "before") {
12658
- config.items.splice(topLevelMenuDefinitionIndex, 0, itemToAdd.menu);
12654
+ if (isMenuBarMenuAddition(itemToAdd)) {
12655
+ if (!relativeId) {
12656
+ if (relation === "start") {
12657
+ config.items.unshift(itemToAdd.menu);
12659
12658
  successFullyAddedItems.push(itemToAdd);
12660
- } else if (relation === "after") {
12661
- config.items.splice(topLevelMenuDefinitionIndex + 1, 0, itemToAdd.menu);
12659
+ } else if (relation === "end") {
12660
+ config.items.push(itemToAdd.menu);
12662
12661
  successFullyAddedItems.push(itemToAdd);
12663
12662
  }
12664
- } else if (addMenuOrItemToGroup(config, itemToAdd.menu, relativeId, relation)) successFullyAddedItems.push(itemToAdd);
12665
- }
12666
- else if (isMenuBarMenuGroupAddition(itemToAdd)) walkConfigMenus(config.items, (menuDefinition) => {
12663
+ } else {
12664
+ const topLevelMenuDefinitionIndex = config.items.findIndex((menuDefinition) => menuDefinition.menuId === relativeId);
12665
+ if (topLevelMenuDefinitionIndex != -1) {
12666
+ if (relation === "before") {
12667
+ config.items.splice(topLevelMenuDefinitionIndex, 0, itemToAdd.menu);
12668
+ successFullyAddedItems.push(itemToAdd);
12669
+ } else if (relation === "after") {
12670
+ config.items.splice(topLevelMenuDefinitionIndex + 1, 0, itemToAdd.menu);
12671
+ successFullyAddedItems.push(itemToAdd);
12672
+ }
12673
+ } else if (addMenuOrItemToGroup(config, itemToAdd.menu, relativeId, relation)) successFullyAddedItems.push(itemToAdd);
12674
+ }
12675
+ } else if (isMenuBarMenuGroupAddition(itemToAdd)) walkConfigMenus(config.items, (menuDefinition) => {
12667
12676
  if (menuDefinition.menuId === relativeId) {
12668
12677
  if (relation === "start") {
12669
12678
  menuDefinition.groups.unshift(itemToAdd.group);
@@ -14387,13 +14396,16 @@ var ContextualBalloon = class extends Plugin {
14387
14396
  throw new CKEditorError("contextualballoon-remove-view-not-exist", [this, view]);
14388
14397
  const stack = this._viewToStack.get(view);
14389
14398
  if (this._singleViewMode && this.visibleView === view) this._singleViewMode = false;
14390
- if (this.visibleView === view) if (stack.size === 1) if (this._idToStack.size > 1) this._showNextStack();
14391
- else {
14392
- this.view.hide();
14393
- this.visibleView = null;
14394
- this._rotatorView.hideView();
14399
+ if (this.visibleView === view) {
14400
+ if (stack.size === 1) {
14401
+ if (this._idToStack.size > 1) this._showNextStack();
14402
+ else {
14403
+ this.view.hide();
14404
+ this.visibleView = null;
14405
+ this._rotatorView.hideView();
14406
+ }
14407
+ } else this._showView(Array.from(stack.values())[stack.size - 2]);
14395
14408
  }
14396
- else this._showView(Array.from(stack.values())[stack.size - 2]);
14397
14409
  if (stack.size === 1) {
14398
14410
  this._idToStack.delete(this._getStackId(stack));
14399
14411
  this._numberOfStacks = this._idToStack.size;
@@ -14843,13 +14855,14 @@ var StickyPanelView = class extends View {
14843
14855
  const { left: visualViewportOffsetLeft, top: visualViewportOffsetTop } = getVisualViewportOffset();
14844
14856
  limiterRect.moveBy(visualViewportOffsetLeft, visualViewportOffsetTop);
14845
14857
  if (visibleLimiterRect) visibleLimiterRect.moveBy(visualViewportOffsetLeft, visualViewportOffsetTop);
14846
- if (visibleLimiterRect && limiterRect.top < visibleLimiterRect.top) if (this._contentPanelRect.height + this.limiterBottomOffset > visibleLimiterRect.height) {
14847
- const stickyBottomOffset = Math.max(limiterRect.bottom - visibleLimiterRect.bottom, 0) + this.limiterBottomOffset;
14848
- if (this._contentPanelRect.height + stickyBottomOffset + 1 < limiterRect.height) this._stickToBottomOfLimiter(stickyBottomOffset);
14858
+ if (visibleLimiterRect && limiterRect.top < visibleLimiterRect.top) {
14859
+ if (this._contentPanelRect.height + this.limiterBottomOffset > visibleLimiterRect.height) {
14860
+ const stickyBottomOffset = Math.max(limiterRect.bottom - visibleLimiterRect.bottom, 0) + this.limiterBottomOffset;
14861
+ if (this._contentPanelRect.height + stickyBottomOffset + 1 < limiterRect.height) this._stickToBottomOfLimiter(stickyBottomOffset);
14862
+ else this._unstick();
14863
+ } else if (this._contentPanelRect.height + this.limiterBottomOffset < limiterRect.height) this._stickToTopOfAncestors(visibleLimiterRect.top);
14849
14864
  else this._unstick();
14850
- } else if (this._contentPanelRect.height + this.limiterBottomOffset < limiterRect.height) this._stickToTopOfAncestors(visibleLimiterRect.top);
14851
- else this._unstick();
14852
- else this._unstick();
14865
+ } else this._unstick();
14853
14866
  }
14854
14867
  /**
14855
14868
  * Sticks the panel at the given CSS `top` offset.
@@ -15281,14 +15294,15 @@ var SearchTextView = class extends View {
15281
15294
  if (!data.resultsCount) {
15282
15295
  const defaultTextConfig = this._config.infoView && this._config.infoView.text;
15283
15296
  let primaryText, secondaryText;
15284
- if (data.totalItemsCount) if (defaultTextConfig?.notFound) {
15285
- primaryText = defaultTextConfig.notFound.primary;
15286
- secondaryText = defaultTextConfig.notFound.secondary;
15287
- } else {
15288
- primaryText = t("No results found");
15289
- secondaryText = "";
15290
- }
15291
- else if (defaultTextConfig?.noSearchableItems) {
15297
+ if (data.totalItemsCount) {
15298
+ if (defaultTextConfig?.notFound) {
15299
+ primaryText = defaultTextConfig.notFound.primary;
15300
+ secondaryText = defaultTextConfig.notFound.secondary;
15301
+ } else {
15302
+ primaryText = t("No results found");
15303
+ secondaryText = "";
15304
+ }
15305
+ } else if (defaultTextConfig?.noSearchableItems) {
15292
15306
  primaryText = defaultTextConfig.noSearchableItems.primary;
15293
15307
  secondaryText = defaultTextConfig.noSearchableItems.secondary;
15294
15308
  } else {
@@ -16388,8 +16402,10 @@ var MenuBarMenuPanelView = class extends View {
16388
16402
  * Focuses the first child of the panel (default) or the last one if the `direction` is `-1`.
16389
16403
  */
16390
16404
  focus(direction = 1) {
16391
- if (this.children.length) if (direction === 1) this.children.first.focus();
16392
- else this.children.last.focus();
16405
+ if (this.children.length) {
16406
+ if (direction === 1) this.children.first.focus();
16407
+ else this.children.last.focus();
16408
+ }
16393
16409
  }
16394
16410
  };
16395
16411
 
@@ -16533,19 +16549,20 @@ var MenuBarMenuView = class MenuBarMenuView extends View {
16533
16549
  */
16534
16550
  get _panelPositions() {
16535
16551
  const { southEast, southWest, northEast, northWest, westSouth, eastSouth, westNorth, eastNorth } = MenuBarMenuViewPanelPositioningFunctions;
16536
- if (this.locale.uiLanguageDirection === "ltr") if (this.parentMenuView) return [
16537
- eastSouth,
16538
- eastNorth,
16539
- westSouth,
16540
- westNorth
16541
- ];
16542
- else return [
16543
- southEast,
16544
- southWest,
16545
- northEast,
16546
- northWest
16547
- ];
16548
- else if (this.parentMenuView) return [
16552
+ if (this.locale.uiLanguageDirection === "ltr") {
16553
+ if (this.parentMenuView) return [
16554
+ eastSouth,
16555
+ eastNorth,
16556
+ westSouth,
16557
+ westNorth
16558
+ ];
16559
+ else return [
16560
+ southEast,
16561
+ southWest,
16562
+ northEast,
16563
+ northWest
16564
+ ];
16565
+ } else if (this.parentMenuView) return [
16549
16566
  westSouth,
16550
16567
  westNorth,
16551
16568
  eastSouth,
@@ -16563,9 +16580,10 @@ var MenuBarMenuView = class MenuBarMenuView extends View {
16563
16580
  * It is used when the optimal position cannot be calculated.
16564
16581
  */
16565
16582
  get _defaultMenuPositionName() {
16566
- if (this.locale.uiLanguageDirection === "ltr") if (this.parentMenuView) return "es";
16567
- else return "se";
16568
- else if (this.parentMenuView) return "ws";
16583
+ if (this.locale.uiLanguageDirection === "ltr") {
16584
+ if (this.parentMenuView) return "es";
16585
+ else return "se";
16586
+ } else if (this.parentMenuView) return "ws";
16569
16587
  else return "sw";
16570
16588
  }
16571
16589
  /**