[DE][PE] Fix Bug 50031. Change set language button

This commit is contained in:
Julia Radzhabova 2021-09-02 17:58:18 +03:00
parent 9d2de2698b
commit d2ce8e60c4
7 changed files with 33 additions and 155 deletions

View file

@ -1019,57 +1019,6 @@
}
}
.cnt-lang {
color: @text-normal-ie;
color: @text-normal;
height: 20px;
line-height: 18px;
border: 0;
.border-radius(1px);
vertical-align: middle;
.dropdown-toggle {
margin: 0 6px 0 4px;
}
&:hover:not(.disabled) {
background-color: @highlight-button-hover-ie;
background-color: @highlight-button-hover;
}
&[disabled], &.disabled {
opacity: @component-disabled-opacity;
}
.caret {
width: 4px;
height: 4px;
border: solid 1px @icon-normal-ie;
border: solid 1px @icon-normal;
border-bottom: none;
border-right: none;
background-image: none;
transition: transform 0.2s ease;
transform: rotate(-135deg) translate(1px,1px);
}
&.open:not(.disabled){
&, .status-label {
color: @text-normal-pressed-ie;
color: @text-normal-pressed;
}
background-color: @highlight-button-pressed-ie;
background-color: @highlight-button-pressed;
.caret {
transform: rotate(45deg);
border-color: @icon-normal-pressed-ie;
border-color: @icon-normal-pressed;
}
}
}
// Dialog buttons
// ------------------------

View file

@ -12,12 +12,7 @@
</div>
<div class="status-group" style="">
<div class="separator short el-edit"></div>
<div class="cnt-lang el-edit">
<div class="dropdown-toggle" data-toggle="dropdown" data-hint="0" data-hint-direction="top">
<label id="status-label-lang" class="status-label">English (United States)</label>
<div class="caret"></div>
</div>
</div>
<span id="btn-cnt-lang" class="el-edit"></span>
<span id="btn-doc-lang" class="el-edit"></span>
<span id="btn-doc-spell" class="el-edit"></span>
<div class="separator short el-edit"></div>

View file

@ -67,10 +67,8 @@ define([
}
function _clickLanguage(menu, item) {
var $parent = menu.$el.parent();
$parent.find('#status-label-lang').text(item.caption);
this.langMenu.prevTip = item.value.value;
this.btnLanguage.setCaption(item.caption);
this.fireEvent('langchanged', [this, item.value.code, item.caption]);
}
@ -83,23 +81,6 @@ define([
if (me.btnLanguage && me.btnLanguage.cmpEl) {
me.btnLanguage.updateHint(me.tipSetLang);
me.btnLanguage.cmpEl.on({
'show.bs.dropdown': function () {
_.defer(function () {
me.btnLanguage.cmpEl.find('ul').focus();
}, 100);
},
'hide.bs.dropdown': function () {
_.defer(function () {
me.api.asc_enableKeyEvents(true);
}, 100);
},
'click': function (e) {
if (me.btnLanguage.isDisabled()) {
return false;
}
}
});
me.langMenu.on('item:click', _.bind(_clickLanguage, this));
}
@ -223,9 +204,14 @@ define([
});
this.btnLanguage = new Common.UI.Button({
// el: panelLang,
hintAnchor: 'top-left',
disabled: true
cls : 'btn-toolbar',
caption : 'English (United States)',
hintAnchor : 'top-left',
style : 'margin-left: 6px;',
disabled: true,
dataHint : '0',
dataHintDirection: 'top',
menu: true
});
this.langMenu = new Common.UI.MenuSimple({
@ -299,11 +285,8 @@ define([
_btn_render(me.txtGoToPage, $('#status-goto-page', me.$layout));
if ( !config || config.isEdit ) {
var panelLang = $('.cnt-lang', me.$layout);
_btn_render(me.btnLanguage, panelLang);
me.langMenu.render(panelLang);
me.langMenu.cmpEl.attr({tabindex: -1});
me.btnLanguage.render($('#btn-cnt-lang', me.$layout));
me.btnLanguage.setMenu(me.langMenu);
me.langMenu.prevTip = 'en';
}
@ -360,9 +343,7 @@ define([
setLanguage: function(info) {
if (this.langMenu.prevTip != info.value && info.code !== undefined) {
var $parent = $(this.langMenu.el.parentNode, this.$el);
$parent.find('#status-label-lang').text(info.displayValue);
this.btnLanguage.setCaption(info.displayValue);
this.langMenu.prevTip = info.value;
var lang = _.find(this.langMenu.items, function(item) { return item.caption == info.displayValue; });
@ -384,8 +365,7 @@ define([
},
SetDisabled: function(disable) {
var langs = this.langMenu.items.length>0;
this.btnLanguage.setDisabled(disable || !langs);
this.btnLanguage.setDisabled(disable || this.langMenu.items.length<1);
},
onApiCoAuthoringDisconnect: function() {

View file

@ -66,20 +66,9 @@
}
}
.cnt-lang {
display: inline-block;
cursor: pointer;
margin-left: 6px;
label {
cursor: pointer;
}
&.disabled {
cursor: default;
label {
cursor: default;
}
#btn-cnt-lang {
button {
font-weight: 700;
}
}

View file

@ -27,12 +27,7 @@
<label id="status-label-action" class="status-label"></label>
</div>
<div class="status-group" style="">
<div class="cnt-lang el-edit">
<div class="dropdown-toggle" data-toggle="dropdown" data-hint="0" data-hint-direction="top">
<label id="status-label-lang" class="status-label">English (United States)</label>
<div class="caret"></div>
</div>
</div>
<span id="btn-cnt-lang" class="el-edit"></span>
<span id="btn-doc-lang" class="el-edit"></span>
<span id="btn-doc-spell" class="el-edit"></span>
<div class="separator short el-edit"></div>

View file

@ -70,8 +70,7 @@ define([
}
function _clickLanguage(menu, item) {
var $parent = menu.$el.parent();
$parent.find('#status-label-lang').text(item.caption);
this.btnLanguage.setCaption(item.caption);
this.langMenu.prevTip = item.value.value;
this.fireEvent('langchanged', [this, item.value.code, item.caption]);
@ -250,7 +249,6 @@ define([
dataHintOffset: '0, -16'
});
var panelLang = $('.cnt-lang',this.el);
this.langMenu = new Common.UI.MenuSimple({
cls: 'lang-menu',
style: 'margin-top:-5px;',
@ -266,31 +264,17 @@ define([
});
this.btnLanguage = new Common.UI.Button({
el: panelLang,
parentEl: $('#btn-cnt-lang', this.el),
cls : 'btn-toolbar',
caption : 'English (United States)',
hint: this.tipSetLang,
hintAnchor: 'top-left',
disabled: true
hintAnchor : 'top-left',
style : 'margin-left: 6px;',
disabled: true,
dataHint : '0',
dataHintDirection: 'top',
menu: this.langMenu
});
this.btnLanguage.cmpEl.on({
'show.bs.dropdown': function () {
_.defer(function(){
me.btnLanguage.cmpEl.find('ul').focus();
}, 100);
},
'hide.bs.dropdown': function () {
_.defer(function(){
me.api.asc_enableKeyEvents(true);
}, 100);
},
'click': function (e) {
if (me.btnLanguage.isDisabled()) {
return false;
}
}
});
this.langMenu.render(panelLang);
this.langMenu.cmpEl.attr({tabindex: -1});
this.langMenu.prevTip = 'en';
this.langMenu.on('item:click', _.bind(_clickLanguage,this));
@ -351,9 +335,7 @@ define([
setLanguage: function(info) {
if (this.langMenu.prevTip != info.value && info.code !== undefined) {
var $parent = $(this.langMenu.el.parentNode, this.$el);
$parent.find('#status-label-lang').text(info.displayValue);
this.btnLanguage.setCaption(info.displayValue);
this.langMenu.prevTip = info.value;
var lang = _.find(this.langMenu.items, function(item) { return item.caption == info.displayValue; });
if (lang) {
@ -366,8 +348,7 @@ define([
},
SetDisabled: function(disable) {
var langs = this.langMenu.items.length>0;
this.btnLanguage.setDisabled(disable || !langs || this._state.no_paragraph);
this.btnLanguage.setDisabled(disable || this.langMenu.items.length<1 || this._state.no_paragraph);
},
onApiFocusObject: function(selectedObjects) {

View file

@ -67,20 +67,9 @@
}
}
.cnt-lang {
display: inline-block;
cursor: pointer;
margin-left: 6px;
label {
cursor: pointer;
}
&.disabled {
cursor: default;
label {
cursor: default;
}
#btn-cnt-lang {
button {
font-weight: 700;
}
}