mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 04:59:22 -06:00
FIX: Apply Visual Viewport composer height calc in iOS only
This commit is contained in:
parent
d0390fba3e
commit
ea4e9dba8e
@ -132,12 +132,16 @@ export default Ember.Component.extend(KeyEnterEscape, {
|
|||||||
$document.on(END_EVENTS, endDrag);
|
$document.on(END_EVENTS, endDrag);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (window.visualViewport !== undefined) {
|
if (this.shouldUseVisualViewportListener()) {
|
||||||
this.viewportResize();
|
this.viewportResize();
|
||||||
window.visualViewport.addEventListener("resize", this.viewportResize);
|
window.visualViewport.addEventListener("resize", this.viewportResize);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
shouldUseVisualViewportListener() {
|
||||||
|
return this.capabilities.isIOS && window.visualViewport !== undefined;
|
||||||
|
},
|
||||||
|
|
||||||
viewportResize() {
|
viewportResize() {
|
||||||
const composerVH = window.visualViewport.height * 0.01;
|
const composerVH = window.visualViewport.height * 0.01;
|
||||||
|
|
||||||
@ -174,7 +178,7 @@ export default Ember.Component.extend(KeyEnterEscape, {
|
|||||||
willDestroyElement() {
|
willDestroyElement() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
this.appEvents.off("composer:resize", this, this.resize);
|
this.appEvents.off("composer:resize", this, this.resize);
|
||||||
if (window.visualViewport !== undefined) {
|
if (this.shouldUseVisualViewportListener()) {
|
||||||
window.visualViewport.removeEventListener("resize", this.viewportResize);
|
window.visualViewport.removeEventListener("resize", this.viewportResize);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user