Fix crypto icon

This commit is contained in:
Julia Radzhabova 2022-05-11 16:08:19 +03:00
parent 1d126c12c6
commit 3202694bd9
2 changed files with 11 additions and 3 deletions

View file

@ -208,10 +208,11 @@ define([
if ( this.labelDocName ) { if ( this.labelDocName ) {
if ( config.isCrypted ) { if ( config.isCrypted ) {
this.labelDocName.before( this.labelDocName.before(
'<div class="inner-box-icon crypted">' + '<div class="inner-box-icon crypted hidden">' +
'<svg class="icon"><use xlink:href="#svg-icon-crypted"></use></svg>' + '<svg class="icon"><use xlink:href="#svg-icon-crypted"></use></svg>' +
'</div>'); '</div>');
this.imgCrypted = this.labelDocName.parent().find('.crypted'); this.imgCrypted = this.labelDocName.parent().find('.crypted');
this._showImgCrypted = true;
} }
var $parent = this.labelDocName.parent(); var $parent = this.labelDocName.parent();
@ -227,6 +228,7 @@ define([
if (!(config.customization && config.customization.toolbarHideFileName) && (!config.isEdit || config.customization && config.customization.compactHeader)) { if (!(config.customization && config.customization.toolbarHideFileName) && (!config.isEdit || config.customization && config.customization.compactHeader)) {
var basis = parseFloat($parent.css('padding-left') || 0) + parseFloat($parent.css('padding-right') || 0) + parseInt(this.labelDocName.css('min-width') || 50); // 2px - box-shadow var basis = parseFloat($parent.css('padding-left') || 0) + parseFloat($parent.css('padding-right') || 0) + parseInt(this.labelDocName.css('min-width') || 50); // 2px - box-shadow
config.isCrypted && (basis += 20);
$parent.css('flex-basis', Math.ceil(basis) + 'px'); $parent.css('flex-basis', Math.ceil(basis) + 'px');
$parent.closest('.extra.right').css('flex-basis', Math.ceil(basis) + $parent.next().outerWidth() + 'px'); $parent.closest('.extra.right').css('flex-basis', Math.ceil(basis) + $parent.next().outerWidth() + 'px');
} }
@ -342,7 +344,7 @@ define([
function onFocusDocName(e){ function onFocusDocName(e){
var me = this; var me = this;
me.imgCrypted && me.imgCrypted.attr('hidden', true); me.imgCrypted && me.imgCrypted.toggleClass('hidden', true);
me.isSaveDocName =false; me.isSaveDocName =false;
if(me.withoutExt) return; if(me.withoutExt) return;
var name = me.cutDocName(me.labelDocName.val()); var name = me.cutDocName(me.labelDocName.val());
@ -722,7 +724,7 @@ define([
'keydown': onDocNameKeyDown.bind(this), 'keydown': onDocNameKeyDown.bind(this),
'focus': onFocusDocName.bind(this), 'focus': onFocusDocName.bind(this),
'blur': function (e) { 'blur': function (e) {
me.imgCrypted && me.imgCrypted.attr('hidden', false); me.imgCrypted && me.imgCrypted.toggleClass('hidden', false);
label[0].selectionStart = label[0].selectionEnd = 0; label[0].selectionStart = label[0].selectionEnd = 0;
if(!me.isSaveDocName) { if(!me.isSaveDocName) {
me.withoutExt = false; me.withoutExt = false;
@ -764,6 +766,10 @@ define([
name = this.labelDocName.val(); name = this.labelDocName.val();
var width = this.getTextWidth(name); var width = this.getTextWidth(name);
(width>=0) && this.labelDocName.width(width); (width>=0) && this.labelDocName.width(width);
if (this._showImgCrypted && width>=0) {
this.imgCrypted.toggleClass('hidden', false);
this._showImgCrypted = false;
}
}, },
getTextWidth: function(text) { getTextWidth: function(text) {

View file

@ -533,6 +533,8 @@
width: 20px; width: 20px;
position: relative; position: relative;
margin-right: 1px; margin-right: 1px;
flex-shrink: 0;
flex-grow: 0;
> svg { > svg {
position: absolute; position: absolute;
width: 20px; width: 20px;