Skip to content

Commit

Permalink
Merge pull request #2917 from ONLYOFFICE/fix/bugfix
Browse files Browse the repository at this point in the history
[DE] Fix changing button's caption
  • Loading branch information
JuliaRadzhabova authored Apr 5, 2024
2 parents 046ef3c + e4cf966 commit 3d42ed1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/common/main/lib/component/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -898,17 +898,19 @@ define([

setCaption: function(caption) {
if (this.caption != caption) {
var isHuge = false;
if ( /icon-top/.test(this.options.cls) && !!this.caption && /huge/.test(this.options.cls) ) {
var newCaption = this.getCaptionWithBreaks(caption);
this.caption = newCaption || caption;
isHuge = true;
} else
this.caption = caption;

if (this.rendered) {
var captionNode = this.cmpEl.find('.caption');

if (captionNode.length > 0) {
captionNode.html((this.split || this.menu) ? _.template(templateBtnCaption)({caption: this.caption}) : this.caption);
captionNode.html(isHuge && (this.split || this.menu) ? _.template(templateBtnCaption)({caption: this.caption}) : this.caption);
} else {
this.cmpEl.find('button:first').addBack().filter('button').html(this.caption);
}
Expand Down

0 comments on commit 3d42ed1

Please sign in to comment.