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 ( config.isCrypted ) {
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>' +
'</div>');
this.imgCrypted = this.labelDocName.parent().find('.crypted');
this._showImgCrypted = true;
}
var $parent = this.labelDocName.parent();
@ -227,6 +228,7 @@ define([
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
config.isCrypted && (basis += 20);
$parent.css('flex-basis', Math.ceil(basis) + 'px');
$parent.closest('.extra.right').css('flex-basis', Math.ceil(basis) + $parent.next().outerWidth() + 'px');
}
@ -342,7 +344,7 @@ define([
function onFocusDocName(e){
var me = this;
me.imgCrypted && me.imgCrypted.attr('hidden', true);
me.imgCrypted && me.imgCrypted.toggleClass('hidden', true);
me.isSaveDocName =false;
if(me.withoutExt) return;
var name = me.cutDocName(me.labelDocName.val());
@ -722,7 +724,7 @@ define([
'keydown': onDocNameKeyDown.bind(this),
'focus': onFocusDocName.bind(this),
'blur': function (e) {
me.imgCrypted && me.imgCrypted.attr('hidden', false);
me.imgCrypted && me.imgCrypted.toggleClass('hidden', false);
label[0].selectionStart = label[0].selectionEnd = 0;
if(!me.isSaveDocName) {
me.withoutExt = false;
@ -764,6 +766,10 @@ define([
name = this.labelDocName.val();
var width = this.getTextWidth(name);
(width>=0) && this.labelDocName.width(width);
if (this._showImgCrypted && width>=0) {
this.imgCrypted.toggleClass('hidden', false);
this._showImgCrypted = false;
}
},
getTextWidth: function(text) {

View file

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