From 1feaa1b7ae53bf1900a33ea855d7b631bc6c238c Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Tue, 20 Sep 2022 14:18:45 +0300 Subject: [PATCH] [DE PE SSE] By bug 59088 (fix four-words captions) --- apps/common/main/lib/component/Button.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/apps/common/main/lib/component/Button.js b/apps/common/main/lib/component/Button.js index 622739cf7c..2e0baaa600 100644 --- a/apps/common/main/lib/component/Button.js +++ b/apps/common/main/lib/component/Button.js @@ -359,15 +359,19 @@ define([ words[1] = getShortText(words[1], maxWidth); newCaption = words[0] + '
' + words[1]; } else { + var otherWords = ''; if (getWidthOfCaption(words[0] + ' ' + words[1]) < maxWidth) { // first and second words in first line - words[2] = getShortText(words[2], maxWidth); - newCaption = words[0] + ' ' + words[1] + '
' + words[2]; - } else if (getWidthOfCaption(words[1] + ' ' + words[2]) < maxWidth) { // second and third words in second line - words[2] = getShortText(words[2], maxWidth); - newCaption = words[0] + '
' + words[1] + ' ' + words[2]; - } else { - words[1] = getShortText(words[1] + ' ' + words[2], maxWidth); - newCaption = words[0] + '
' + words[1]; + for (var i = 2; i < words.length; i++) { + otherWords += words[i] + ' '; + } + otherWords = getShortText(otherWords.trim(), maxWidth); + newCaption = words[0] + ' ' + words[1] + '
' + 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] + '
' + otherWords; } } } else {