@ckeditor/ckeditor5-ui 45.0.0-alpha.6 → 45.0.0-alpha.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-ui",
3
- "version": "45.0.0-alpha.6",
3
+ "version": "45.0.0-alpha.7",
4
4
  "description": "The UI framework and standard UI library of CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -17,11 +17,11 @@
17
17
  "type": "module",
18
18
  "main": "src/index.js",
19
19
  "dependencies": {
20
- "@ckeditor/ckeditor5-core": "45.0.0-alpha.6",
21
- "@ckeditor/ckeditor5-editor-multi-root": "45.0.0-alpha.6",
22
- "@ckeditor/ckeditor5-engine": "45.0.0-alpha.6",
23
- "@ckeditor/ckeditor5-icons": "45.0.0-alpha.6",
24
- "@ckeditor/ckeditor5-utils": "45.0.0-alpha.6",
20
+ "@ckeditor/ckeditor5-core": "45.0.0-alpha.7",
21
+ "@ckeditor/ckeditor5-editor-multi-root": "45.0.0-alpha.7",
22
+ "@ckeditor/ckeditor5-engine": "45.0.0-alpha.7",
23
+ "@ckeditor/ckeditor5-icons": "45.0.0-alpha.7",
24
+ "@ckeditor/ckeditor5-utils": "45.0.0-alpha.7",
25
25
  "@types/color-convert": "2.0.4",
26
26
  "color-convert": "2.0.1",
27
27
  "color-parse": "1.4.2",
@@ -153,4 +153,8 @@ export default class StickyPanelView extends View {
153
153
  * @private
154
154
  */
155
155
  private get _contentPanelRect();
156
+ /**
157
+ * Sets custom CSS properties to the panel element to make it aware of the visual viewport offset.
158
+ */
159
+ private _updateVisualViewport;
156
160
  }
@@ -113,6 +113,11 @@ export default class StickyPanelView extends View {
113
113
  this.listenTo(this, 'change:isActive', () => {
114
114
  this.checkIfShouldBeSticky();
115
115
  });
116
+ if (global.window.visualViewport) {
117
+ this.listenTo(global.window.visualViewport, 'scroll', () => this._updateVisualViewport());
118
+ this.listenTo(global.window.visualViewport, 'resize', () => this._updateVisualViewport());
119
+ this._updateVisualViewport();
120
+ }
116
121
  }
117
122
  /**
118
123
  * Analyzes the environment to decide whether the panel should be sticky or not.
@@ -166,7 +171,8 @@ export default class StickyPanelView extends View {
166
171
  // @if CK_DEBUG_STICKYPANEL // );
167
172
  // Check if sticking the panel to the bottom of the limiter does not cause it to suddenly
168
173
  // move upwards if there's not enough space for it.
169
- if (limiterRect.bottom - stickyBottomOffset > limiterRect.top + this._contentPanelRect.height) {
174
+ // Adding 1 avoids rounding problems and toolbar flickering when offset almost equals the height.
175
+ if (limiterRect.bottom - stickyBottomOffset > limiterRect.top + this._contentPanelRect.height + 1) {
170
176
  this._stickToBottomOfLimiter(stickyBottomOffset);
171
177
  }
172
178
  else {
@@ -245,4 +251,11 @@ export default class StickyPanelView extends View {
245
251
  get _contentPanelRect() {
246
252
  return new Rect(this.contentPanelElement);
247
253
  }
254
+ /**
255
+ * Sets custom CSS properties to the panel element to make it aware of the visual viewport offset.
256
+ */
257
+ _updateVisualViewport() {
258
+ this.element.style.setProperty('--ck-visual-viewport-left', `${global.window.visualViewport.offsetLeft}px`);
259
+ this.element.style.setProperty('--ck-visual-viewport-top', `${global.window.visualViewport.offsetTop}px`);
260
+ }
248
261
  }
@@ -3,15 +3,22 @@
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
 
6
+ :root {
7
+ --ck-visual-viewport-left: 0px;
8
+ --ck-visual-viewport-top: 0px;
9
+ }
10
+
6
11
  .ck.ck-sticky-panel {
7
12
  & .ck-sticky-panel__content_sticky {
8
13
  z-index: var(--ck-z-panel); /* #315 */
9
14
  position: fixed;
10
15
  top: 0;
16
+ transform: translate(var(--ck-visual-viewport-left, 0px), var(--ck-visual-viewport-top, 0px));
11
17
  }
12
18
 
13
19
  & .ck-sticky-panel__content_sticky_bottom-limit {
14
20
  top: auto;
15
21
  position: absolute;
22
+ transform: none;
16
23
  }
17
24
  }