@ckeditor/ckeditor5-ui 43.2.0 → 43.3.0-alpha.1

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 (174) hide show
  1. package/dist/dialog/dialog.d.ts +16 -0
  2. package/dist/dialog/dialogview.d.ts +3 -1
  3. package/dist/editorui/accessibilityhelp/accessibilityhelp.d.ts +4 -0
  4. package/dist/index-editor.css +12 -15
  5. package/dist/index.css +14 -15
  6. package/dist/index.css.map +1 -1
  7. package/dist/index.js +101 -30
  8. package/dist/index.js.map +1 -1
  9. package/dist/notification/notification.d.ts +4 -0
  10. package/dist/panel/balloon/contextualballoon.d.ts +4 -0
  11. package/dist/toolbar/balloon/balloontoolbar.d.ts +4 -0
  12. package/dist/toolbar/block/blocktoolbar.d.ts +4 -0
  13. package/dist/translations/ar.js +1 -1
  14. package/dist/translations/ar.umd.js +1 -1
  15. package/dist/translations/bs.js +1 -1
  16. package/dist/translations/bs.umd.js +1 -1
  17. package/dist/translations/cs.js +1 -1
  18. package/dist/translations/cs.umd.js +1 -1
  19. package/dist/translations/en.js +1 -1
  20. package/dist/translations/en.umd.js +1 -1
  21. package/dist/translations/es-co.js +1 -1
  22. package/dist/translations/es-co.umd.js +1 -1
  23. package/dist/translations/es.js +1 -1
  24. package/dist/translations/es.umd.js +1 -1
  25. package/dist/translations/fa.js +1 -1
  26. package/dist/translations/fa.umd.js +1 -1
  27. package/dist/translations/fr.js +1 -1
  28. package/dist/translations/fr.umd.js +1 -1
  29. package/dist/translations/gu.d.ts +8 -0
  30. package/dist/translations/gu.js +5 -0
  31. package/dist/translations/gu.umd.js +11 -0
  32. package/dist/translations/he.js +1 -1
  33. package/dist/translations/he.umd.js +1 -1
  34. package/dist/translations/hr.js +1 -1
  35. package/dist/translations/hr.umd.js +1 -1
  36. package/dist/translations/hy.d.ts +8 -0
  37. package/dist/translations/hy.js +5 -0
  38. package/dist/translations/hy.umd.js +11 -0
  39. package/dist/translations/it.js +1 -1
  40. package/dist/translations/it.umd.js +1 -1
  41. package/dist/translations/jv.js +1 -1
  42. package/dist/translations/jv.umd.js +1 -1
  43. package/dist/translations/kk.d.ts +8 -0
  44. package/dist/translations/kk.js +5 -0
  45. package/dist/translations/kk.umd.js +11 -0
  46. package/dist/translations/kn.js +1 -1
  47. package/dist/translations/kn.umd.js +1 -1
  48. package/dist/translations/lt.js +1 -1
  49. package/dist/translations/lt.umd.js +1 -1
  50. package/dist/translations/lv.js +1 -1
  51. package/dist/translations/lv.umd.js +1 -1
  52. package/dist/translations/oc.d.ts +8 -0
  53. package/dist/translations/oc.js +5 -0
  54. package/dist/translations/oc.umd.js +11 -0
  55. package/dist/translations/pl.js +1 -1
  56. package/dist/translations/pl.umd.js +1 -1
  57. package/dist/translations/pt-br.js +1 -1
  58. package/dist/translations/pt-br.umd.js +1 -1
  59. package/dist/translations/pt.js +1 -1
  60. package/dist/translations/pt.umd.js +1 -1
  61. package/dist/translations/ro.js +1 -1
  62. package/dist/translations/ro.umd.js +1 -1
  63. package/dist/translations/ru.js +1 -1
  64. package/dist/translations/ru.umd.js +1 -1
  65. package/dist/translations/si.d.ts +8 -0
  66. package/dist/translations/si.js +5 -0
  67. package/dist/translations/si.umd.js +11 -0
  68. package/dist/translations/sk.js +1 -1
  69. package/dist/translations/sk.umd.js +1 -1
  70. package/dist/translations/sl.js +1 -1
  71. package/dist/translations/sl.umd.js +1 -1
  72. package/dist/translations/sr-latn.js +1 -1
  73. package/dist/translations/sr-latn.umd.js +1 -1
  74. package/dist/translations/sr.js +1 -1
  75. package/dist/translations/sr.umd.js +1 -1
  76. package/dist/translations/ug.js +1 -1
  77. package/dist/translations/ug.umd.js +1 -1
  78. package/dist/translations/uk.js +1 -1
  79. package/dist/translations/uk.umd.js +1 -1
  80. package/dist/translations/uz.js +1 -1
  81. package/dist/translations/uz.umd.js +1 -1
  82. package/lang/translations/af.po +3 -9
  83. package/lang/translations/ar.po +4 -10
  84. package/lang/translations/ast.po +3 -9
  85. package/lang/translations/az.po +3 -9
  86. package/lang/translations/bg.po +3 -9
  87. package/lang/translations/bn.po +3 -9
  88. package/lang/translations/bs.po +4 -10
  89. package/lang/translations/ca.po +3 -9
  90. package/lang/translations/cs.po +4 -10
  91. package/lang/translations/da.po +3 -9
  92. package/lang/translations/de-ch.po +3 -9
  93. package/lang/translations/de.po +3 -9
  94. package/lang/translations/el.po +3 -9
  95. package/lang/translations/en-au.po +3 -9
  96. package/lang/translations/en-gb.po +3 -9
  97. package/lang/translations/en.po +5 -11
  98. package/lang/translations/eo.po +3 -9
  99. package/lang/translations/es-co.po +4 -10
  100. package/lang/translations/es.po +4 -10
  101. package/lang/translations/et.po +3 -9
  102. package/lang/translations/eu.po +3 -9
  103. package/lang/translations/fa.po +4 -10
  104. package/lang/translations/fi.po +3 -9
  105. package/lang/translations/fr.po +4 -10
  106. package/lang/translations/gl.po +3 -9
  107. package/lang/translations/gu.po +208 -0
  108. package/lang/translations/he.po +4 -10
  109. package/lang/translations/hi.po +3 -9
  110. package/lang/translations/hr.po +4 -10
  111. package/lang/translations/hu.po +3 -9
  112. package/lang/translations/hy.po +208 -0
  113. package/lang/translations/id.po +3 -9
  114. package/lang/translations/it.po +4 -10
  115. package/lang/translations/ja.po +3 -9
  116. package/lang/translations/jv.po +4 -10
  117. package/lang/translations/kk.po +208 -0
  118. package/lang/translations/km.po +3 -9
  119. package/lang/translations/kn.po +4 -10
  120. package/lang/translations/ko.po +3 -9
  121. package/lang/translations/ku.po +3 -9
  122. package/lang/translations/lt.po +4 -10
  123. package/lang/translations/lv.po +4 -10
  124. package/lang/translations/ms.po +3 -9
  125. package/lang/translations/nb.po +3 -9
  126. package/lang/translations/ne.po +3 -9
  127. package/lang/translations/nl.po +3 -9
  128. package/lang/translations/no.po +3 -9
  129. package/lang/translations/oc.po +208 -0
  130. package/lang/translations/pl.po +4 -10
  131. package/lang/translations/pt-br.po +4 -10
  132. package/lang/translations/pt.po +4 -10
  133. package/lang/translations/ro.po +4 -10
  134. package/lang/translations/ru.po +4 -10
  135. package/lang/translations/si.po +208 -0
  136. package/lang/translations/sk.po +4 -10
  137. package/lang/translations/sl.po +4 -10
  138. package/lang/translations/sq.po +3 -9
  139. package/lang/translations/sr-latn.po +4 -10
  140. package/lang/translations/sr.po +4 -10
  141. package/lang/translations/sv.po +3 -9
  142. package/lang/translations/th.po +3 -9
  143. package/lang/translations/ti.po +3 -9
  144. package/lang/translations/tk.po +3 -9
  145. package/lang/translations/tr.po +3 -9
  146. package/lang/translations/tt.po +3 -9
  147. package/lang/translations/ug.po +4 -10
  148. package/lang/translations/uk.po +4 -10
  149. package/lang/translations/ur.po +3 -9
  150. package/lang/translations/uz.po +4 -10
  151. package/lang/translations/vi.po +3 -9
  152. package/lang/translations/zh-cn.po +3 -9
  153. package/lang/translations/zh.po +3 -9
  154. package/package.json +4 -4
  155. package/src/dialog/dialog.d.ts +16 -0
  156. package/src/dialog/dialog.js +31 -0
  157. package/src/dialog/dialogview.d.ts +3 -1
  158. package/src/dialog/dialogview.js +26 -17
  159. package/src/dropdown/menu/dropdownmenunestedmenuview.js +1 -0
  160. package/src/dropdown/utils.js +17 -2
  161. package/src/editorui/accessibilityhelp/accessibilityhelp.d.ts +4 -0
  162. package/src/editorui/accessibilityhelp/accessibilityhelp.js +6 -0
  163. package/src/editorui/editorui.js +2 -2
  164. package/src/notification/notification.d.ts +4 -0
  165. package/src/notification/notification.js +6 -0
  166. package/src/panel/balloon/contextualballoon.d.ts +4 -0
  167. package/src/panel/balloon/contextualballoon.js +6 -0
  168. package/src/toolbar/balloon/balloontoolbar.d.ts +4 -0
  169. package/src/toolbar/balloon/balloontoolbar.js +7 -1
  170. package/src/toolbar/block/blocktoolbar.d.ts +4 -0
  171. package/src/toolbar/block/blocktoolbar.js +6 -0
  172. package/src/toolbar/toolbarview.js +3 -3
  173. package/theme/components/dialog/dialog.css +5 -2
  174. package/theme/mixins/_dir.css +1 -1
package/dist/index.js CHANGED
@@ -3438,6 +3438,7 @@ const toPx$6 = /* #__PURE__ */ toUnit('px');
3438
3438
  class: [
3439
3439
  'ck',
3440
3440
  'ck-dialog',
3441
+ bind.if('isModal', 'ck-dialog_modal'),
3441
3442
  bind.to('className')
3442
3443
  ],
3443
3444
  role: 'dialog',
@@ -3501,7 +3502,8 @@ const toPx$6 = /* #__PURE__ */ toUnit('px');
3501
3502
  /**
3502
3503
  * Returns the element that should be used as a drag handle.
3503
3504
  */ get dragHandleElement() {
3504
- if (this.headerView) {
3505
+ // Modals should not be draggable.
3506
+ if (this.headerView && !this.isModal) {
3505
3507
  return this.headerView.element;
3506
3508
  } else {
3507
3509
  return null;
@@ -3710,9 +3712,30 @@ const toPx$6 = /* #__PURE__ */ toUnit('px');
3710
3712
  return new Rect(this.element.firstElementChild);
3711
3713
  }
3712
3714
  /**
3713
- * Calculates the viewport rect.
3715
+ * Returns a viewport `Rect` shrunk by the viewport offset config from all sides.
3716
+ *
3717
+ * TODO: This is a duplicate from position.ts module. It should either be exported there or land somewhere in utils.
3714
3718
  */ _getViewportRect() {
3715
- return getConstrainedViewportRect(this._getViewportOffset());
3719
+ const viewportRect = new Rect(global.window);
3720
+ // Modals should not be restricted by the viewport offsets as they are always displayed on top of the page.
3721
+ if (this.isModal) {
3722
+ return viewportRect;
3723
+ }
3724
+ const viewportOffset = {
3725
+ top: 0,
3726
+ bottom: 0,
3727
+ left: 0,
3728
+ right: 0,
3729
+ ...this._getViewportOffset()
3730
+ };
3731
+ viewportRect.top += viewportOffset.top;
3732
+ viewportRect.height -= viewportOffset.top;
3733
+ viewportRect.bottom -= viewportOffset.bottom;
3734
+ viewportRect.height -= viewportOffset.bottom;
3735
+ viewportRect.left += viewportOffset.left;
3736
+ viewportRect.right -= viewportOffset.right;
3737
+ viewportRect.width -= viewportOffset.left + viewportOffset.right;
3738
+ return viewportRect;
3716
3739
  }
3717
3740
  /**
3718
3741
  * Collects all focusable elements inside the dialog parts
@@ -3756,25 +3779,6 @@ const toPx$6 = /* #__PURE__ */ toUnit('px');
3756
3779
  return buttonView;
3757
3780
  }
3758
3781
  }
3759
- // Returns a viewport `Rect` shrunk by the viewport offset config from all sides.
3760
- // TODO: This is a duplicate from position.ts module. It should either be exported there or land somewhere in utils.
3761
- function getConstrainedViewportRect(viewportOffset) {
3762
- viewportOffset = Object.assign({
3763
- top: 0,
3764
- bottom: 0,
3765
- left: 0,
3766
- right: 0
3767
- }, viewportOffset);
3768
- const viewportRect = new Rect(global.window);
3769
- viewportRect.top += viewportOffset.top;
3770
- viewportRect.height -= viewportOffset.top;
3771
- viewportRect.bottom -= viewportOffset.bottom;
3772
- viewportRect.height -= viewportOffset.bottom;
3773
- viewportRect.left += viewportOffset.left;
3774
- viewportRect.right -= viewportOffset.right;
3775
- viewportRect.width -= viewportOffset.left + viewportOffset.right;
3776
- return viewportRect;
3777
- }
3778
3782
 
3779
3783
  /**
3780
3784
  * The dialog controller class. It is used to show and hide the {@link module:ui/dialog/dialogview~DialogView}.
@@ -3799,6 +3803,11 @@ function getConstrainedViewportRect(viewportOffset) {
3799
3803
  */ static get pluginName() {
3800
3804
  return 'Dialog';
3801
3805
  }
3806
+ /**
3807
+ * @inheritDoc
3808
+ */ static get isOfficialPlugin() {
3809
+ return true;
3810
+ }
3802
3811
  /**
3803
3812
  * @inheritDoc
3804
3813
  */ constructor(editor){
@@ -3823,6 +3832,12 @@ function getConstrainedViewportRect(viewportOffset) {
3823
3832
  ]
3824
3833
  });
3825
3834
  }
3835
+ /**
3836
+ * @inheritDoc
3837
+ */ destroy() {
3838
+ super.destroy();
3839
+ this._unlockBodyScroll();
3840
+ }
3826
3841
  /**
3827
3842
  * Initiates listeners for the `show` and `hide` events emitted by this plugin.
3828
3843
  *
@@ -3999,6 +4014,9 @@ function getConstrainedViewportRect(viewportOffset) {
3999
4014
  if (!position) {
4000
4015
  position = isModal ? DialogViewPosition.SCREEN_CENTER : DialogViewPosition.EDITOR_CENTER;
4001
4016
  }
4017
+ if (isModal) {
4018
+ this._lockBodyScroll();
4019
+ }
4002
4020
  view.set({
4003
4021
  position,
4004
4022
  _isVisible: true,
@@ -4036,6 +4054,9 @@ function getConstrainedViewportRect(viewportOffset) {
4036
4054
  }
4037
4055
  const editor = this.editor;
4038
4056
  const view = this.view;
4057
+ if (view.isModal) {
4058
+ this._unlockBodyScroll();
4059
+ }
4039
4060
  // Reset the content view to prevent its children from being destroyed in the standard
4040
4061
  // View#destroy() (and collections) chain. If the content children were left in there,
4041
4062
  // they would have to be re-created by the feature using the dialog every time the dialog
@@ -4052,6 +4073,16 @@ function getConstrainedViewportRect(viewportOffset) {
4052
4073
  this.isOpen = false;
4053
4074
  Dialog._visibleDialogPlugin = null;
4054
4075
  }
4076
+ /**
4077
+ * Makes the <body> unscrollable (e.g. when the modal shows up).
4078
+ */ _lockBodyScroll() {
4079
+ document.documentElement.classList.add('ck-dialog-scroll-locked');
4080
+ }
4081
+ /**
4082
+ * Makes the <body> scrollable again (e.g. once the modal hides).
4083
+ */ _unlockBodyScroll() {
4084
+ document.documentElement.classList.remove('ck-dialog-scroll-locked');
4085
+ }
4055
4086
  }
4056
4087
 
4057
4088
  /**
@@ -4348,6 +4379,11 @@ var accessibilityIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/20
4348
4379
  */ static get pluginName() {
4349
4380
  return 'AccessibilityHelp';
4350
4381
  }
4382
+ /**
4383
+ * @inheritDoc
4384
+ */ static get isOfficialPlugin() {
4385
+ return true;
4386
+ }
4351
4387
  /**
4352
4388
  * @inheritDoc
4353
4389
  */ init() {
@@ -8092,6 +8128,7 @@ const POSITION_OFF_SCREEN = {
8092
8128
  this.panelView.render();
8093
8129
  this.focusTracker.add(this.buttonView.element);
8094
8130
  this.focusTracker.add(this.panelView.element);
8131
+ this.focusTracker.add(this.listView);
8095
8132
  // Listen for keystrokes coming from within #element.
8096
8133
  this.keystrokes.listenTo(this.element);
8097
8134
  this._mountPanelOnOpen();
@@ -8574,13 +8611,13 @@ const NESTED_TOOLBAR_ICONS = /* #__PURE__ */ (()=>({
8574
8611
  this.focusTracker.add(this.element);
8575
8612
  // Children added before rendering should be known to the #focusTracker.
8576
8613
  for (const item of this.items){
8577
- this.focusTracker.add(item.element);
8614
+ this.focusTracker.add(item);
8578
8615
  }
8579
8616
  this.items.on('add', (evt, item)=>{
8580
- this.focusTracker.add(item.element);
8617
+ this.focusTracker.add(item);
8581
8618
  });
8582
8619
  this.items.on('remove', (evt, item)=>{
8583
- this.focusTracker.remove(item.element);
8620
+ this.focusTracker.remove(item);
8584
8621
  });
8585
8622
  // Start listening for the keystrokes coming from #element.
8586
8623
  this.keystrokes.listenTo(this.element);
@@ -9484,6 +9521,7 @@ const NESTED_TOOLBAR_ICONS = /* #__PURE__ */ (()=>({
9484
9521
  * @param options.ariaLabel Label used by assistive technologies to describe the top-level menu.
9485
9522
  */ function addMenuToDropdown(dropdownView, body, definition, options = {}) {
9486
9523
  dropdownView.menuView = new DropdownMenuRootListView(dropdownView.locale, body, definition);
9524
+ dropdownView.focusTracker.add(dropdownView.menuView);
9487
9525
  if (dropdownView.isOpen) {
9488
9526
  addMenuToOpenDropdown(dropdownView, options);
9489
9527
  } else {
@@ -9511,7 +9549,7 @@ function addMenuToOpenDropdown(dropdownView, options) {
9511
9549
  // Nested menu panels are added to body collection, so they are not children of the `dropdownView` from DOM perspective.
9512
9550
  // Add these panels to `dropdownView` focus tracker, so they are treated like part of the `dropdownView` for focus-related purposes.
9513
9551
  for (const menu of dropdownMenuRootListView.menus){
9514
- dropdownView.focusTracker.add(menu.panelView.element);
9552
+ dropdownView.focusTracker.add(menu);
9515
9553
  }
9516
9554
  dropdownMenuRootListView.ariaLabel = options.ariaLabel || t('Dropdown menu');
9517
9555
  }
@@ -9604,6 +9642,7 @@ function addMenuToOpenDropdown(dropdownView, options) {
9604
9642
  toolbarView.items.addMany(buttons);
9605
9643
  }
9606
9644
  dropdownView.panelView.children.add(toolbarView);
9645
+ dropdownView.focusTracker.add(toolbarView);
9607
9646
  toolbarView.items.delegate('execute').to(dropdownView);
9608
9647
  }
9609
9648
  /**
@@ -9745,10 +9784,22 @@ function addMenuToOpenDropdown(dropdownView, options) {
9745
9784
  },
9746
9785
  contextElements: ()=>[
9747
9786
  dropdownView.element,
9748
- ...dropdownView.focusTracker.elements
9787
+ // Include all elements connected to the dropdown's focus tracker, but exclude those that are direct children
9788
+ // of DropdownView#element. They would be identified as descendants of #element anyway upon clicking and would
9789
+ // not contribute to the logic.
9790
+ ...getFocusTrackerTreeElements(dropdownView.focusTracker).filter((element)=>!dropdownView.element.contains(element))
9749
9791
  ]
9750
9792
  });
9751
9793
  }
9794
+ /**
9795
+ * Returns all DOM elements connected to a DropdownView's focus tracker, either directly (same DOM sub-tree)
9796
+ * or indirectly (external views registered in the focus tracker).
9797
+ */ function getFocusTrackerTreeElements(focusTracker) {
9798
+ return [
9799
+ ...focusTracker.elements,
9800
+ ...focusTracker.externalViews.flatMap((view)=>getFocusTrackerTreeElements(view.focusTracker))
9801
+ ];
9802
+ }
9752
9803
  /**
9753
9804
  * Adds a behavior to a dropdownView that closes the dropdown view on "execute" event.
9754
9805
  */ function closeDropdownOnExecute(dropdownView) {
@@ -13710,11 +13761,11 @@ function isMenuDefinition(definition) {
13710
13761
  * @param toolbarView A instance of the toolbar to be registered.
13711
13762
  */ addToolbar(toolbarView, options = {}) {
13712
13763
  if (toolbarView.isRendered) {
13713
- this.focusTracker.add(toolbarView.element);
13764
+ this.focusTracker.add(toolbarView);
13714
13765
  this.editor.keystrokes.listenTo(toolbarView.element);
13715
13766
  } else {
13716
13767
  toolbarView.once('render', ()=>{
13717
- this.focusTracker.add(toolbarView.element);
13768
+ this.focusTracker.add(toolbarView);
13718
13769
  this.editor.keystrokes.listenTo(toolbarView.element);
13719
13770
  });
13720
13771
  }
@@ -14420,6 +14471,11 @@ function isMenuDefinition(definition) {
14420
14471
  */ static get pluginName() {
14421
14472
  return 'Notification';
14422
14473
  }
14474
+ /**
14475
+ * @inheritDoc
14476
+ */ static get isOfficialPlugin() {
14477
+ return true;
14478
+ }
14423
14479
  /**
14424
14480
  * @inheritDoc
14425
14481
  */ init() {
@@ -14664,6 +14720,11 @@ const toPx$4 = /* #__PURE__ */ toUnit('px');
14664
14720
  */ static get pluginName() {
14665
14721
  return 'ContextualBalloon';
14666
14722
  }
14723
+ /**
14724
+ * @inheritDoc
14725
+ */ static get isOfficialPlugin() {
14726
+ return true;
14727
+ }
14667
14728
  /**
14668
14729
  * @inheritDoc
14669
14730
  */ constructor(editor){
@@ -16149,6 +16210,11 @@ const toPx$2 = /* #__PURE__ */ toUnit('px');
16149
16210
  */ static get pluginName() {
16150
16211
  return 'BalloonToolbar';
16151
16212
  }
16213
+ /**
16214
+ * @inheritDoc
16215
+ */ static get isOfficialPlugin() {
16216
+ return true;
16217
+ }
16152
16218
  /**
16153
16219
  * @inheritDoc
16154
16220
  */ static get requires() {
@@ -16165,7 +16231,7 @@ const toPx$2 = /* #__PURE__ */ toUnit('px');
16165
16231
  this.focusTracker = new FocusTracker();
16166
16232
  // Track focusable elements in the toolbar and the editable elements.
16167
16233
  this._trackFocusableEditableElements();
16168
- this.focusTracker.add(this.toolbarView.element);
16234
+ this.focusTracker.add(this.toolbarView);
16169
16235
  // Register the toolbar so it becomes available for Alt+F10 and Esc navigation.
16170
16236
  editor.ui.addToolbar(this.toolbarView, {
16171
16237
  beforeFocus: ()=>this.show(true),
@@ -16520,6 +16586,11 @@ const toPx = /* #__PURE__ */ toUnit('px');
16520
16586
  */ static get pluginName() {
16521
16587
  return 'BlockToolbar';
16522
16588
  }
16589
+ /**
16590
+ * @inheritDoc
16591
+ */ static get isOfficialPlugin() {
16592
+ return true;
16593
+ }
16523
16594
  /**
16524
16595
  * @inheritDoc
16525
16596
  */ constructor(editor){