[DE mobile] Fix plugin resize

This commit is contained in:
Julia Svinareva 2019-07-08 09:45:19 +03:00
parent 269fc87bb3
commit c828e8072c

View file

@ -49,7 +49,8 @@ define([
DE.Controllers.Plugins = Backbone.Controller.extend(_.extend((function() { DE.Controllers.Plugins = Backbone.Controller.extend(_.extend((function() {
// Private // Private
var rootView; var rootView,
modal;
return { return {
models: [], models: [],
@ -65,6 +66,7 @@ define([
this.api = api; this.api = api;
this.api.asc_registerCallback("asc_onPluginShow", _.bind(this.showPluginModal, this)); this.api.asc_registerCallback("asc_onPluginShow", _.bind(this.showPluginModal, this));
this.api.asc_registerCallback("asc_onPluginClose", _.bind(this.pluginClose, this)); this.api.asc_registerCallback("asc_onPluginClose", _.bind(this.pluginClose, this));
this.api.asc_registerCallback("asc_onPluginResize", _.bind(this.pluginResize, this));
}, },
onLaunch: function () { onLaunch: function () {
@ -102,7 +104,7 @@ define([
}; };
}); });
} }
var modal = uiApp.modal({ modal = uiApp.modal({
title: '', title: '',
text: '', text: '',
afterText: afterText:
@ -133,9 +135,11 @@ define([
}); });
$$(modal).find('.modal-inner').css({padding: '0'}); $$(modal).find('.modal-inner').css({padding: '0'});
if (Common.SharedSettings.get('phone')) { if (Common.SharedSettings.get('phone')) {
$$(modal).find('#plugin-frame').css({height: '240px'}); var height = Math.min(size[1], 240);
$$(modal).find('#plugin-frame').css({height: height + 'px'});
} else { } else {
$$(modal).find('#plugin-frame').css({height: '500px'}); var height = Math.min(size[1], 500);
$$(modal).find('#plugin-frame').css({height: height + 'px'});
} }
if (Framework7.prototype.device.android === true) { if (Framework7.prototype.device.android === true) {
@ -158,6 +162,16 @@ define([
} }
}, },
pluginResize: function(size) {
if (Common.SharedSettings.get('phone')) {
var height = Math.min(size[1], 240);
$$(modal).find('#plugin-frame').css({height: height + 'px'});
} else {
var height = Math.min(size[1], 500);
$$(modal).find('#plugin-frame').css({height: height + 'px'});
}
},
textCancel: 'Cancel', textCancel: 'Cancel',
textLoading: 'Loading' textLoading: 'Loading'
} }