Merge pull request #2138 from ONLYOFFICE/feature/shift-on-window-resize

shift on window resize
This commit is contained in:
Julia Radzhabova 2022-12-19 19:41:23 +03:00 committed by GitHub
commit 1fc747a702
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 5 deletions

View file

@ -158,7 +158,8 @@ define([
maxheight: undefined,
minwidth: 0,
minheight: 0,
enableKeyEvents: true
enableKeyEvents: true,
automove: true
};
var template = '<div class="asc-window<%= modal?" modal":"" %><%= cls?" "+cls:"" %>" id="<%= id %>" style="width:<%= width %>px;">' +
@ -677,7 +678,6 @@ define([
this.$window.find('.header').on('mousedown', this.binding.dragStart);
this.$window.find('.tool.close').on('click', _.bind(doclose, this));
this.$window.find('.tool.help').on('click', _.bind(dohelp, this));
$(window).on('resize', _.bind(_onResizeMove, this));
if (!this.initConfig.modal)
Common.Gateway.on('processmouse', _.bind(_onProcessMouse, this));
} else {
@ -761,6 +761,10 @@ define([
}
$(document).on('keydown.' + this.cid, this.binding.keydown);
if(this.initConfig.automove){
this.binding.windowresize = _.bind(_onResizeMove, this);
$(window).on('resize', this.binding.windowresize);
}
var me = this;
@ -812,6 +816,7 @@ define([
close: function(suppressevent) {
$(document).off('keydown.' + this.cid);
this.initConfig.automove && $(window).off('resize', this.binding.windowresize);
if ( this.initConfig.header ) {
this.$window.find('.header').off('mousedown', this.binding.dragStart);
}
@ -857,6 +862,7 @@ define([
hide: function() {
$(document).off('keydown.' + this.cid);
this.initConfig.automove && $(window).off('resize', this.binding.windowresize);
if (this.$window) {
if (this.initConfig.modal) {
var mask = _getMask(),

View file

@ -54,7 +54,8 @@ define([
var _options = {};
_.extend(_options, {
header: true,
enableKeyEvents: false
enableKeyEvents: false,
automove: false
}, options);
var header_footer = (_options.buttons && _.size(_options.buttons)>0) ? 85 : 34;

View file

@ -85,6 +85,7 @@ define([
height: 120,
header: false,
modal: false,
automove: false,
alias: 'Common.Views.ReviewPopover'
}, options);

View file

@ -53,7 +53,8 @@ define([
cls: 'search-bar',
alias: 'SearchBar',
showOpenPanel: true,
toolclose: 'hide'
toolclose: 'hide',
automove: false
},
initialize : function(options) {

View file

@ -2932,7 +2932,7 @@ define([
this.lockToolbar(Common.enumLock.cantPrint, true, {array: [this.btnPrint]});
} else {
this.mode = mode;
!mode.canPrint && this.btnPrint.hide();
!mode.canPrint && this.btnPrint && this.btnPrint.hide();
this.lockToolbar(Common.enumLock.cantPrint, !mode.canPrint, {array: [this.btnPrint]});
}