Merge pull request #985 from ONLYOFFICE/fix/bug-50945

Fix Bug 50945
This commit is contained in:
Julia Radzhabova 2021-07-15 00:43:16 +03:00 committed by GitHub
commit 146eb6741d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 72 additions and 0 deletions

View file

@ -127,6 +127,9 @@ label {
.panel-menu {
width: 260px;
max-height: 100%;
position: relative;
overflow: hidden;
float: left;
border-right: @scaled-one-px-value-ie solid @border-toolbar-ie;
border-right: @scaled-one-px-value solid @border-toolbar;

View file

@ -235,6 +235,17 @@ define([
this.rendered = true;
this.$el.html($markup);
this.$el.find('.content-box').hide();
if (_.isUndefined(this.scroller)) {
var me = this;
this.scroller = new Common.UI.Scroller({
el: this.$el.find('.panel-menu'),
suppressScrollX: true,
alwaysVisibleY: true
});
Common.NotificationCenter.on('window:resize', function() {
me.scroller.update();
});
}
this.applyMode();
if ( !!this.api ) {
@ -257,6 +268,7 @@ define([
if (!panel)
panel = this.active || defPanel;
this.$el.show();
this.scroller.update();
this.selectMenu(panel, opts, defPanel);
this.api.asc_enableKeyEvents(false);
@ -400,6 +412,17 @@ define([
this.$el.find('.content-box:visible').hide();
panel.show(opts);
if (this.scroller) {
var itemTop = item.$el.position().top,
itemHeight = item.$el.outerHeight(),
listHeight = this.$el.outerHeight();
if (itemTop < 0 || itemTop + itemHeight > listHeight) {
var height = this.scroller.$el.scrollTop() + itemTop + (itemHeight - listHeight)/2;
height = (Math.floor(height/itemHeight) * itemHeight);
this.scroller.scrollTop(height);
}
}
this.active = menu;
}
}

View file

@ -231,6 +231,17 @@ define([
this.rendered = true;
this.$el.html($markup);
this.$el.find('.content-box').hide();
if (_.isUndefined(this.scroller)) {
var me = this;
this.scroller = new Common.UI.Scroller({
el: this.$el.find('.panel-menu'),
suppressScrollX: true,
alwaysVisibleY: true
});
Common.NotificationCenter.on('window:resize', function() {
me.scroller.update();
});
}
this.applyMode();
if ( !!this.api ) {
@ -253,6 +264,7 @@ define([
if (!panel)
panel = this.active || defPanel;
this.$el.show();
this.scroller.update();
this.selectMenu(panel, defPanel);
this.api && this.api.asc_enableKeyEvents(false);
@ -393,6 +405,17 @@ define([
this.$el.find('.content-box:visible').hide();
panel.show();
if (this.scroller) {
var itemTop = item.$el.position().top,
itemHeight = item.$el.outerHeight(),
listHeight = this.$el.outerHeight();
if (itemTop < 0 || itemTop + itemHeight > listHeight) {
var height = this.scroller.$el.scrollTop() + itemTop + (itemHeight - listHeight)/2;
height = (Math.floor(height/itemHeight) * itemHeight);
this.scroller.scrollTop(height);
}
}
this.active = menu;
}
}

View file

@ -212,6 +212,17 @@ define([
this.rendered = true;
this.$el.html($markup);
this.$el.find('.content-box').hide();
if (_.isUndefined(this.scroller)) {
var me = this;
this.scroller = new Common.UI.Scroller({
el: this.$el.find('.panel-menu'),
suppressScrollX: true,
alwaysVisibleY: true
});
Common.NotificationCenter.on('window:resize', function() {
me.scroller.update();
});
}
this.applyMode();
if ( !!this.api ) {
@ -235,6 +246,7 @@ define([
if (!panel)
panel = this.active || defPanel;
this.$el.show();
this.scroller.update();
this.selectMenu(panel, defPanel);
this.api.asc_enableKeyEvents(false);
@ -377,6 +389,17 @@ define([
this.$el.find('.content-box:visible').hide();
panel.show();
if (this.scroller) {
var itemTop = item.$el.position().top,
itemHeight = item.$el.outerHeight(),
listHeight = this.$el.outerHeight();
if (itemTop < 0 || itemTop + itemHeight > listHeight) {
var height = this.scroller.$el.scrollTop() + itemTop + (itemHeight - listHeight)/2;
height = (Math.floor(height/itemHeight) * itemHeight);
this.scroller.scrollTop(height);
}
}
this.active = menu;
}
}