Fix ole editor resizing

This commit is contained in:
Julia Radzhabova 2022-04-04 21:10:04 +03:00
parent 6e197c53c8
commit c0c6a03279

View file

@ -51,7 +51,7 @@ define([
width: 910, width: 910,
height: (_inner_height - 700)<0 ? _inner_height : 700, height: (_inner_height - 700)<0 ? _inner_height : 700,
minwidth: 355, minwidth: 355,
minheight: 280, minheight: 275,
cls: 'advanced-settings-dlg', cls: 'advanced-settings-dlg',
header: true, header: true,
toolclose: 'hide', toolclose: 'hide',
@ -59,8 +59,10 @@ define([
resizable: true resizable: true
}, options); }, options);
this._headerFooterHeight = 85;
this.template = [ this.template = [
'<div id="id-ole-editor-container" class="box" style="height:' + (_options.height-85) + 'px; padding: 0 5px;">', '<div id="id-ole-editor-container" class="box" style="height:' + (_options.height-this._headerFooterHeight) + 'px; padding: 0 5px;">',
'<div id="id-ole-editor-placeholder" style="width: 100%;height: 100%;"></div>', '<div id="id-ole-editor-placeholder" style="width: 100%;height: 100%;"></div>',
'</div>', '</div>',
'<div class="separator horizontal"></div>', '<div class="separator horizontal"></div>',
@ -80,7 +82,6 @@ define([
render: function() { render: function() {
Common.UI.Window.prototype.render.call(this); Common.UI.Window.prototype.render.call(this);
this._headerFooterHeight = 85 + ((parseInt(this.$window.css('border-top-width')) + parseInt(this.$window.css('border-bottom-width'))));
this.boxEl = this.$window.find('.body > .box'); this.boxEl = this.$window.find('.body > .box');
this.btnSave = new Common.UI.Button({ this.btnSave = new Common.UI.Button({
@ -144,7 +145,7 @@ define([
var header_height = (this.initConfig.header) ? parseInt(this.$window.find('> .header').css('height')) : 0; var header_height = (this.initConfig.header) ? parseInt(this.$window.find('> .header').css('height')) : 0;
this.$window.find('> .body').css('height', height-header_height); this.$window.find('> .body').css('height', height-header_height);
this.$window.find('> .body > .box').css('height', height-85); this.$window.find('> .body > .box').css('height', height-this._headerFooterHeight);
} }
}, },
@ -161,20 +162,22 @@ define([
var maxHeight = Common.Utils.innerHeight(), var maxHeight = Common.Utils.innerHeight(),
maxWidth = Common.Utils.innerWidth(), maxWidth = Common.Utils.innerWidth(),
borders_width = (parseInt(this.$window.css('border-left-width')) + parseInt(this.$window.css('border-right-width'))), borders_width = (parseInt(this.$window.css('border-left-width')) + parseInt(this.$window.css('border-right-width'))),
bordersOffset = this.bordersOffset*2; paddings = (parseInt(this.boxEl.css('padding-left')) + parseInt(this.boxEl.css('padding-right')));
height += 90; // add toolbar and statusbar height height += 90; // add toolbar and statusbar height
if (maxHeight - bordersOffset<height + this._headerFooterHeight) if (maxHeight<height + this._headerFooterHeight)
height = maxHeight - bordersOffset - this._headerFooterHeight; height = maxHeight - this._headerFooterHeight;
if (maxWidth - bordersOffset<width + borders_width) if (maxWidth<width + paddings + borders_width)
width = maxWidth - bordersOffset - borders_width; width = maxWidth - paddings - borders_width;
this.boxEl.css('height', height); this.boxEl.css('height', height);
this.setHeight(height + this._headerFooterHeight); this.setHeight(height + this._headerFooterHeight);
this.setWidth(width + borders_width); this.setWidth(width + paddings + borders_width);
// this.$window.css('left',(maxWidth - width - borders_width) / 2); if (this.getLeft()<0)
// this.$window.css('top',(maxHeight - height - this._headerFooterHeight) / 2); this.$window.css('left', 0);
if (this.getTop() < Common.Utils.InternalSettings.get('window-inactive-area-top') )
this.$window.css('top', Common.Utils.InternalSettings.get('window-inactive-area-top'));
}, },
setPlaceholder: function(placeholder) { setPlaceholder: function(placeholder) {