Refactoring: always show scrollers in the left panel

This commit is contained in:
Julia Radzhabova 2020-06-11 14:00:23 +03:00
parent a9850f64b3
commit 104ac9d7ad
3 changed files with 129 additions and 30 deletions

View file

@ -93,13 +93,19 @@ define([
if (_.isUndefined(this.scroller)) { if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: this.$el, el: this.$el,
suppressScrollX: true suppressScrollX: true,
alwaysVisibleY: true
}); });
} }
return this; return this;
}, },
show: function() {
Common.UI.BaseView.prototype.show.call(this,arguments);
this.scroller && this.scroller.update();
},
onFormatClick: function(e) { onFormatClick: function(e) {
var type = e.currentTarget.attributes['format']; var type = e.currentTarget.attributes['format'];
if (!_.isUndefined(type) && this.menu) { if (!_.isUndefined(type) && this.menu) {
@ -154,13 +160,19 @@ define([
if (_.isUndefined(this.scroller)) { if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: this.$el, el: this.$el,
suppressScrollX: true suppressScrollX: true,
alwaysVisibleY: true
}); });
} }
return this; return this;
}, },
show: function() {
Common.UI.BaseView.prototype.show.call(this,arguments);
this.scroller && this.scroller.update();
},
onFormatClick: function(e) { onFormatClick: function(e) {
var type = e.currentTarget.attributes['format'], var type = e.currentTarget.attributes['format'],
ext = e.currentTarget.attributes['format-ext']; ext = e.currentTarget.attributes['format-ext'];
@ -429,7 +441,8 @@ define([
if (_.isUndefined(this.scroller)) { if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: this.$el, el: this.$el,
suppressScrollX: true suppressScrollX: true,
alwaysVisibleY: true
}); });
} }
return this; return this;
@ -439,6 +452,7 @@ define([
Common.UI.BaseView.prototype.show.call(this,arguments); Common.UI.BaseView.prototype.show.call(this,arguments);
this.updateSettings(); this.updateSettings();
this.scroller && this.scroller.update();
}, },
setMode: function(mode) { setMode: function(mode) {
@ -670,13 +684,19 @@ define([
if (_.isUndefined(this.scroller)) { if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: this.$el, el: this.$el,
suppressScrollX: true suppressScrollX: true,
alwaysVisibleY: true
}); });
} }
return this; return this;
}, },
show: function() {
Common.UI.BaseView.prototype.show.call(this,arguments);
this.scroller && this.scroller.update();
},
onRecentFileClick: function(view, itemview, record){ onRecentFileClick: function(view, itemview, record){
if ( this.menu ) if ( this.menu )
this.menu.fireEvent('recent:open', [this.menu, record.get('url')]); this.menu.fireEvent('recent:open', [this.menu, record.get('url')]);
@ -739,13 +759,19 @@ define([
if (_.isUndefined(this.scroller)) { if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: this.$el, el: this.$el,
suppressScrollX: true suppressScrollX: true,
alwaysVisibleY: true
}); });
} }
return this; return this;
}, },
show: function() {
Common.UI.BaseView.prototype.show.call(this,arguments);
this.scroller && this.scroller.update();
},
_onBlankDocument: function() { _onBlankDocument: function() {
if ( this.menu ) if ( this.menu )
this.menu.fireEvent('create:new', [this.menu, 'blank']); this.menu.fireEvent('create:new', [this.menu, 'blank']);
@ -978,7 +1004,8 @@ define([
if (_.isUndefined(this.scroller)) { if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: this.$el, el: this.$el,
suppressScrollX: true suppressScrollX: true,
alwaysVisibleY: true
}); });
} }
return this; return this;
@ -989,6 +1016,7 @@ define([
this.updateStatisticInfo(); this.updateStatisticInfo();
this.updateFileInfo(); this.updateFileInfo();
this.scroller && this.scroller.update();
}, },
hide: function() { hide: function() {
@ -1292,7 +1320,8 @@ define([
if (_.isUndefined(this.scroller)) { if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: this.$el, el: this.$el,
suppressScrollX: true suppressScrollX: true,
alwaysVisibleY: true
}); });
} }
return this; return this;
@ -1300,6 +1329,7 @@ define([
show: function() { show: function() {
Common.UI.BaseView.prototype.show.call(this,arguments); Common.UI.BaseView.prototype.show.call(this,arguments);
this.scroller && this.scroller.update();
}, },
hide: function() { hide: function() {
@ -1610,7 +1640,8 @@ define([
if (_.isUndefined(this.scroller)) { if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: this.$el, el: this.$el,
suppressScrollX: true suppressScrollX: true,
alwaysVisibleY: true
}); });
} }
@ -1624,6 +1655,7 @@ define([
Common.UI.BaseView.prototype.show.call(this,arguments); Common.UI.BaseView.prototype.show.call(this,arguments);
this.updateSignatures(); this.updateSignatures();
this.updateEncrypt(); this.updateEncrypt();
this.scroller && this.scroller.update();
}, },
setMode: function(mode) { setMode: function(mode) {

View file

@ -90,13 +90,19 @@ define([
if (_.isUndefined(this.scroller)) { if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: this.$el, el: this.$el,
suppressScrollX: true suppressScrollX: true,
alwaysVisibleY: true
}); });
} }
return this; return this;
}, },
show: function() {
Common.UI.BaseView.prototype.show.call(this,arguments);
this.scroller && this.scroller.update();
},
onFormatClick: function(e) { onFormatClick: function(e) {
var type = e.currentTarget.attributes['format']; var type = e.currentTarget.attributes['format'];
if (!_.isUndefined(type) && this.menu) { if (!_.isUndefined(type) && this.menu) {
@ -146,13 +152,19 @@ define([
if (_.isUndefined(this.scroller)) { if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: this.$el, el: this.$el,
suppressScrollX: true suppressScrollX: true,
alwaysVisibleY: true
}); });
} }
return this; return this;
}, },
show: function() {
Common.UI.BaseView.prototype.show.call(this,arguments);
this.scroller && this.scroller.update();
},
onFormatClick: function(e) { onFormatClick: function(e) {
var type = e.currentTarget.attributes['format'], var type = e.currentTarget.attributes['format'],
ext = e.currentTarget.attributes['format-ext']; ext = e.currentTarget.attributes['format-ext'];
@ -372,7 +384,8 @@ define([
if (_.isUndefined(this.scroller)) { if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: this.$el, el: this.$el,
suppressScrollX: true suppressScrollX: true,
alwaysVisibleY: true
}); });
} }
@ -383,6 +396,7 @@ define([
Common.UI.BaseView.prototype.show.call(this,arguments); Common.UI.BaseView.prototype.show.call(this,arguments);
this.updateSettings(); this.updateSettings();
this.scroller && this.scroller.update();
}, },
setMode: function(mode) { setMode: function(mode) {
@ -577,13 +591,19 @@ define([
if (_.isUndefined(this.scroller)) { if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: this.$el, el: this.$el,
suppressScrollX: true suppressScrollX: true,
alwaysVisibleY: true
}); });
} }
return this; return this;
}, },
show: function() {
Common.UI.BaseView.prototype.show.call(this,arguments);
this.scroller && this.scroller.update();
},
onRecentFileClick: function(view, itemview, record){ onRecentFileClick: function(view, itemview, record){
if ( this.menu ) if ( this.menu )
this.menu.fireEvent('recent:open', [this.menu, record.get('url')]); this.menu.fireEvent('recent:open', [this.menu, record.get('url')]);
@ -646,13 +666,19 @@ define([
if (_.isUndefined(this.scroller)) { if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: this.$el, el: this.$el,
suppressScrollX: true suppressScrollX: true,
alwaysVisibleY: true
}); });
} }
return this; return this;
}, },
show: function() {
Common.UI.BaseView.prototype.show.call(this,arguments);
this.scroller && this.scroller.update();
},
_onBlankDocument: function() { _onBlankDocument: function() {
if ( this.menu ) if ( this.menu )
this.menu.fireEvent('create:new', [this.menu, 'blank']); this.menu.fireEvent('create:new', [this.menu, 'blank']);
@ -853,7 +879,8 @@ define([
if (_.isUndefined(this.scroller)) { if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: this.$el, el: this.$el,
suppressScrollX: true suppressScrollX: true,
alwaysVisibleY: true
}); });
} }
@ -864,6 +891,7 @@ define([
Common.UI.BaseView.prototype.show.call(this,arguments); Common.UI.BaseView.prototype.show.call(this,arguments);
this.updateFileInfo(); this.updateFileInfo();
this.scroller && this.scroller.update();
}, },
hide: function() { hide: function() {
@ -1096,7 +1124,8 @@ define([
if (_.isUndefined(this.scroller)) { if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: this.$el, el: this.$el,
suppressScrollX: true suppressScrollX: true,
alwaysVisibleY: true
}); });
} }
@ -1108,6 +1137,7 @@ define([
show: function() { show: function() {
Common.UI.BaseView.prototype.show.call(this,arguments); Common.UI.BaseView.prototype.show.call(this,arguments);
this.scroller && this.scroller.update();
}, },
hide: function() { hide: function() {
@ -1385,7 +1415,8 @@ define([
if (_.isUndefined(this.scroller)) { if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: this.$el, el: this.$el,
suppressScrollX: true suppressScrollX: true,
alwaysVisibleY: true
}); });
} }
@ -1399,6 +1430,7 @@ define([
Common.UI.BaseView.prototype.show.call(this,arguments); Common.UI.BaseView.prototype.show.call(this,arguments);
this.updateSignatures(); this.updateSignatures();
this.updateEncrypt(); this.updateEncrypt();
this.scroller && this.scroller.update();
}, },
setMode: function(mode) { setMode: function(mode) {

View file

@ -84,13 +84,19 @@ define([
if (_.isUndefined(this.scroller)) { if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: this.$el, el: this.$el,
suppressScrollX: true suppressScrollX: true,
alwaysVisibleY: true
}); });
} }
return this; return this;
}, },
show: function() {
Common.UI.BaseView.prototype.show.call(this,arguments);
this.scroller && this.scroller.update();
},
onFormatClick: function(e) { onFormatClick: function(e) {
var type = e.currentTarget.attributes['format']; var type = e.currentTarget.attributes['format'];
if (!_.isUndefined(type) && this.menu) { if (!_.isUndefined(type) && this.menu) {
@ -145,13 +151,19 @@ define([
if (_.isUndefined(this.scroller)) { if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: this.$el, el: this.$el,
suppressScrollX: true suppressScrollX: true,
alwaysVisibleY: true
}); });
} }
return this; return this;
}, },
show: function() {
Common.UI.BaseView.prototype.show.call(this,arguments);
this.scroller && this.scroller.update();
},
onFormatClick: function(e) { onFormatClick: function(e) {
var type = e.currentTarget.attributes['format'], var type = e.currentTarget.attributes['format'],
ext = e.currentTarget.attributes['format-ext']; ext = e.currentTarget.attributes['format-ext'];
@ -169,9 +181,9 @@ define([
'<div style="width:100%; height:100%; position: relative;">', '<div style="width:100%; height:100%; position: relative;">',
'<div id="id-settings-menu" style="position: absolute; width:200px; top: 0; bottom: 0;" class="no-padding"></div>', '<div id="id-settings-menu" style="position: absolute; width:200px; top: 0; bottom: 0;" class="no-padding"></div>',
'<div id="id-settings-content" style="position: absolute; left: 200px; top: 0; right: 0; bottom: 0;" class="no-padding">', '<div id="id-settings-content" style="position: absolute; left: 200px; top: 0; right: 0; bottom: 0;" class="no-padding">',
'<div id="panel-settings-general" style="width:100%; height:100%;" class="no-padding main-settings-panel active"></div>', '<div id="panel-settings-general" style="width:100%; height:100%;position:relative;" class="no-padding main-settings-panel active"></div>',
'<div id="panel-settings-print" style="width:100%; height:100%;" class="no-padding main-settings-panel"></div>', '<div id="panel-settings-print" style="width:100%; height:100%;position:relative;" class="no-padding main-settings-panel"></div>',
'<div id="panel-settings-spellcheck" style="width:100%; height:100%;" class="no-padding main-settings-panel"></div>', '<div id="panel-settings-spellcheck" style="width:100%; height:100%;position:relative;" class="no-padding main-settings-panel"></div>',
'</div>', '</div>',
'</div>' '</div>'
].join('')), ].join('')),
@ -505,7 +517,8 @@ define([
if (_.isUndefined(this.scroller)) { if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: this.$el, el: this.$el,
suppressScrollX: true suppressScrollX: true,
alwaysVisibleY: true
}); });
} }
@ -567,6 +580,7 @@ define([
this.updateMetricUnit(); this.updateMetricUnit();
this._initSettings = false; this._initSettings = false;
} }
this.scroller && this.scroller.update();
this.fireEvent('show', this); this.fireEvent('show', this);
}, },
@ -938,10 +952,10 @@ define([
if (_.isUndefined(this.scroller)) { if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: this.$el, el: this.$el,
suppressScrollX: true suppressScrollX: true,
alwaysVisibleY: true
}); });
} }
return this; return this;
}, },
@ -949,6 +963,7 @@ define([
Common.UI.BaseView.prototype.show.call(this,arguments); Common.UI.BaseView.prototype.show.call(this,arguments);
this.updateSettings(); this.updateSettings();
this.scroller && this.scroller.update();
}, },
setMode: function(mode) { setMode: function(mode) {
@ -1268,7 +1283,8 @@ define([
if (_.isUndefined(this.scroller)) { if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: this.$el, el: this.$el,
suppressScrollX: true suppressScrollX: true,
alwaysVisibleY: true
}); });
} }
@ -1279,6 +1295,7 @@ define([
Common.UI.BaseView.prototype.show.call(this,arguments); Common.UI.BaseView.prototype.show.call(this,arguments);
this.updateSettings(); this.updateSettings();
this.scroller && this.scroller.update();
}, },
setMode: function(mode) { setMode: function(mode) {
@ -1391,13 +1408,19 @@ define([
if (_.isUndefined(this.scroller)) { if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: this.$el, el: this.$el,
suppressScrollX: true suppressScrollX: true,
alwaysVisibleY: true
}); });
} }
return this; return this;
}, },
show: function() {
Common.UI.BaseView.prototype.show.call(this,arguments);
this.scroller && this.scroller.update();
},
onRecentFileClick: function(view, itemview, record){ onRecentFileClick: function(view, itemview, record){
if ( this.menu ) if ( this.menu )
this.menu.fireEvent('recent:open', [this.menu, record.get('url')]); this.menu.fireEvent('recent:open', [this.menu, record.get('url')]);
@ -1460,13 +1483,19 @@ define([
if (_.isUndefined(this.scroller)) { if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: this.$el, el: this.$el,
suppressScrollX: true suppressScrollX: true,
alwaysVisibleY: true
}); });
} }
return this; return this;
}, },
show: function() {
Common.UI.BaseView.prototype.show.call(this,arguments);
this.scroller && this.scroller.update();
},
_onBlankDocument: function() { _onBlankDocument: function() {
if ( this.menu ) if ( this.menu )
this.menu.fireEvent('create:new', [this.menu, 'blank']); this.menu.fireEvent('create:new', [this.menu, 'blank']);
@ -1662,7 +1691,8 @@ define([
if (_.isUndefined(this.scroller)) { if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: this.$el, el: this.$el,
suppressScrollX: true suppressScrollX: true,
alwaysVisibleY: true
}); });
} }
@ -1673,6 +1703,7 @@ define([
Common.UI.BaseView.prototype.show.call(this,arguments); Common.UI.BaseView.prototype.show.call(this,arguments);
this.updateFileInfo(); this.updateFileInfo();
this.scroller && this.scroller.update();
}, },
hide: function() { hide: function() {
@ -1903,7 +1934,8 @@ define([
if (_.isUndefined(this.scroller)) { if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: this.$el, el: this.$el,
suppressScrollX: true suppressScrollX: true,
alwaysVisibleY: true
}); });
} }
@ -1915,6 +1947,7 @@ define([
show: function() { show: function() {
Common.UI.BaseView.prototype.show.call(this,arguments); Common.UI.BaseView.prototype.show.call(this,arguments);
this.scroller && this.scroller.update();
}, },
hide: function() { hide: function() {
@ -2193,7 +2226,8 @@ define([
if (_.isUndefined(this.scroller)) { if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: this.$el, el: this.$el,
suppressScrollX: true suppressScrollX: true,
alwaysVisibleY: true
}); });
} }
@ -2207,6 +2241,7 @@ define([
Common.UI.BaseView.prototype.show.call(this,arguments); Common.UI.BaseView.prototype.show.call(this,arguments);
this.updateSignatures(); this.updateSignatures();
this.updateEncrypt(); this.updateEncrypt();
this.scroller && this.scroller.update();
}, },
setMode: function(mode) { setMode: function(mode) {