Merge pull request #1321 from ONLYOFFICE/fix/fix-save-status

Fix/fix save status
This commit is contained in:
Julia Radzhabova 2021-11-16 14:57:20 +03:00 committed by GitHub
commit f22973f849
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 4 deletions

View file

@ -380,12 +380,11 @@ define([
var customizeStatusBarMenuTemplate = _.template('<a id="<%= id %>" tabindex="-1" type="menuitem">'+ var customizeStatusBarMenuTemplate = _.template('<a id="<%= id %>" tabindex="-1" type="menuitem">'+
'<div style="position: relative;">'+ '<div style="position: relative;">'+
'<div style="position: absolute; left: 0; width: 85px;"><%= caption %></div>' + '<div class="item-caption"><%= caption %></div>' +
'<label style="width: 100%; overflow: hidden; text-overflow: ellipsis; text-align: right; vertical-align: bottom; padding-left: 85px; color: silver;cursor: pointer;"><%= options.exampleval ? options.exampleval : "" %></label>' + '<label class="item-value"><%= options.exampleval ? options.exampleval : "" %></label>' +
'</div></a>'); '</div></a>');
this.customizeStatusBarMenu = new Common.UI.Menu({ this.customizeStatusBarMenu = new Common.UI.Menu({
style: 'margin-top: 0px; margin-left: -7px;',
menuAlign: 'bl-tl', menuAlign: 'bl-tl',
menuAlignEl: $(this.el), menuAlignEl: $(this.el),
items: [ items: [
@ -858,6 +857,13 @@ define([
this.tabBarBox.css('right', '0px'); this.tabBarBox.css('right', '0px');
} }
this.boxZoom.find('.separator').css('border-left-color', visible ? '' : 'transparent'); this.boxZoom.find('.separator').css('border-left-color', visible ? '' : 'transparent');
if (this.statusMessage) {
var status = this.getStatusMessage(this.statusMessage);
if (status !== this.boxAction.text().trim()) {
this.labelAction.text(status);
}
}
}, },
updateVisibleItemsBoxMath: function () { updateVisibleItemsBoxMath: function () {
@ -962,8 +968,19 @@ define([
); );
}, },
getStatusMessage: function (message) {
var _message;
if (this.isCompact && message.length > 17 && this.boxAction.width() < 180) {
_message = message.substr(0, 17) + '...'
} else {
_message = message;
}
return _message;
},
showStatusMessage: function(message) { showStatusMessage: function(message) {
this.labelAction.text(message); this.statusMessage = message;
this.labelAction.text(this.getStatusMessage(message));
this.customizeStatusBarMenu.items.forEach(function (item) { this.customizeStatusBarMenu.items.forEach(function (item) {
if (item.options.id === 'saved-status') { if (item.options.id === 'saved-status') {
item.options.exampleval = message; item.options.exampleval = message;
@ -982,6 +999,7 @@ define([
clearStatusMessage: function() { clearStatusMessage: function() {
this.labelAction.text(''); this.labelAction.text('');
this.statusMessage = undefined;
}, },
sheetIndexText : 'Sheet {0} of {1}', sheetIndexText : 'Sheet {0} of {1}',

View file

@ -481,12 +481,27 @@
#statusbar-menu { #statusbar-menu {
.dropdown-menu { .dropdown-menu {
margin-top: 0;
margin-left: -7px;
li { li {
> a { > a {
padding: 5px 12px 5px 26px; padding: 5px 12px 5px 26px;
&::before { &::before {
margin-left: -22px; margin-left: -22px;
} }
.item-caption {
min-width: 98px;
display: inline-block;
}
.item-value {
overflow: hidden;
text-overflow: ellipsis;
text-align: right;
vertical-align: bottom;
padding-left: 5px;
color: silver;
cursor: pointer;
}
} }
} }
} }