Merge pull request #1978 from ONLYOFFICE/fix/bug_59088

Fix/bug 59088
This commit is contained in:
maxkadushkin 2022-09-26 13:04:11 +03:00 committed by GitHub
commit f0c85f7135
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 12 deletions

View file

@ -351,22 +351,37 @@ define([
getCaptionWithBreaks: function (caption) { getCaptionWithBreaks: function (caption) {
var words = caption.split(' '), var words = caption.split(' '),
newCaption = null, newCaption = null,
maxWidth = 85 - 4; maxWidth = 160 - 4, //85 - 4
containAnd = words.indexOf('&');
if (containAnd > -1) { // add & to previous word
words[containAnd - 1] += ' &';
words.splice(containAnd, 1);
}
if (words.length > 1) { if (words.length > 1) {
maxWidth = !!this.menu || this.split === true ? maxWidth - 10 : maxWidth; maxWidth = !!this.menu || this.split === true ? maxWidth - 10 : maxWidth;
if (words.length < 3) { if (words.length < 3) {
words[0] = getShortText(words[0], !!this.menu ? maxWidth + 10 : maxWidth);
words[1] = getShortText(words[1], maxWidth); words[1] = getShortText(words[1], maxWidth);
newCaption = words[0] + '<br>' + words[1]; newCaption = words[0] + '<br>' + words[1];
} else { } else {
var otherWords = '';
if (getWidthOfCaption(words[0] + ' ' + words[1]) < maxWidth) { // first and second words in first line if (getWidthOfCaption(words[0] + ' ' + words[1]) < maxWidth) { // first and second words in first line
words[2] = getShortText(words[2], maxWidth); for (var i = 2; i < words.length; i++) {
newCaption = words[0] + ' ' + words[1] + '<br>' + words[2]; otherWords += words[i] + ' ';
} else if (getWidthOfCaption(words[1] + ' ' + words[2]) < maxWidth) { // second and third words in second line }
words[2] = getShortText(words[2], maxWidth); if (getWidthOfCaption(otherWords + (!!this.menu ? 10 : 0))*2 < getWidthOfCaption(words[0] + ' ' + words[1])) {
newCaption = words[0] + '<br>' + words[1] + ' ' + words[2]; otherWords = getShortText((words[1] + ' ' + otherWords).trim(), maxWidth);
} else { newCaption = words[0] + '<br>' + otherWords;
words[1] = getShortText(words[1] + ' ' + words[2], maxWidth); } else {
newCaption = words[0] + '<br>' + words[1]; otherWords = getShortText(otherWords.trim(), maxWidth);
newCaption = words[0] + ' ' + words[1] + '<br>' + otherWords;
}
} else { // only first word is in first line
for (var j = 1; j < words.length; j++) {
otherWords += words[j] + ' ';
}
otherWords = getShortText(otherWords.trim(), maxWidth);
newCaption = words[0] + '<br>' + otherWords;
} }
} }
} else { } else {

View file

@ -246,7 +246,7 @@
height: 24px; height: 24px;
.caption { .caption {
max-width: 85px; max-width: 160px;//85px;
max-height: 24px; max-height: 24px;
text-overflow: ellipsis; text-overflow: ellipsis;

View file

@ -132,7 +132,7 @@
.x-huge.icon-top { .x-huge.icon-top {
.caption { .caption {
text-overflow: ellipsis; text-overflow: ellipsis;
max-width: 85px; max-width: 160px;
} }
} }

View file

@ -415,7 +415,7 @@
"Common.Views.ReviewChanges.txtCommentResolveCurrent": "Լուծել ընթացիկ մեկնաբանությունները", "Common.Views.ReviewChanges.txtCommentResolveCurrent": "Լուծել ընթացիկ մեկնաբանությունները",
"Common.Views.ReviewChanges.txtCommentResolveMy": "Լուծել իմ մեկնաբանությունները", "Common.Views.ReviewChanges.txtCommentResolveMy": "Լուծել իմ մեկնաբանությունները",
"Common.Views.ReviewChanges.txtCommentResolveMyCurrent": "Լուծել իմ ընթացիկ մեկնաբանությունները", "Common.Views.ReviewChanges.txtCommentResolveMyCurrent": "Լուծել իմ ընթացիկ մեկնաբանությունները",
"Common.Views.ReviewChanges.txtCompare": " Համեմատել", "Common.Views.ReviewChanges.txtCompare": "Համեմատել",
"Common.Views.ReviewChanges.txtDocLang": "Լեզու", "Common.Views.ReviewChanges.txtDocLang": "Լեզու",
"Common.Views.ReviewChanges.txtEditing": "Խմբագրում ", "Common.Views.ReviewChanges.txtEditing": "Խմբագրում ",
"Common.Views.ReviewChanges.txtFinal": "Բոլոր փոփոխումներն ընդունված են {0}", "Common.Views.ReviewChanges.txtFinal": "Բոլոր փոփոխումներն ընդունված են {0}",