mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 04:03:57 -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);
|
||||
});
|
||||
|
||||
if (window.visualViewport !== undefined) {
|
||||
if (this.shouldUseVisualViewportListener()) {
|
||||
this.viewportResize();
|
||||
window.visualViewport.addEventListener("resize", this.viewportResize);
|
||||
}
|
||||
},
|
||||
|
||||
shouldUseVisualViewportListener() {
|
||||
return this.capabilities.isIOS && window.visualViewport !== undefined;
|
||||
},
|
||||
|
||||
viewportResize() {
|
||||
const composerVH = window.visualViewport.height * 0.01;
|
||||
|
||||
@ -174,7 +178,7 @@ export default Ember.Component.extend(KeyEnterEscape, {
|
||||
willDestroyElement() {
|
||||
this._super(...arguments);
|
||||
this.appEvents.off("composer:resize", this, this.resize);
|
||||
if (window.visualViewport !== undefined) {
|
||||
if (this.shouldUseVisualViewportListener()) {
|
||||
window.visualViewport.removeEventListener("resize", this.viewportResize);
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user