This commit is contained in:
OVSharova 2022-04-12 09:49:23 +03:00
parent 4220962c40
commit da9b57c2d9

View file

@ -340,10 +340,10 @@ define([
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());
_.delay(function(){
me.labelDocName.val(name);
},100);
me.withoutExt = true; me.withoutExt = true;
_.delay(function(){
me.setDocTile(name,true);
},100);
} }
function onDocNameKeyDown(e) { function onDocNameKeyDown(e) {
@ -372,8 +372,8 @@ define([
name = me.cutDocName(name); name = me.cutDocName(name);
me.options.wopi ? me.api.asc_wopi_renameFile(name) : Common.Gateway.requestRename(name); me.options.wopi ? me.api.asc_wopi_renameFile(name) : Common.Gateway.requestRename(name);
name += me.fileExtention; name += me.fileExtention;
me.labelDocName.val(name);
me.withoutExt = false; me.withoutExt = false;
me.setDocTile(name);
Common.NotificationCenter.trigger('edit:complete', me); Common.NotificationCenter.trigger('edit:complete', me);
} }
@ -490,7 +490,7 @@ define([
if ( !me.labelDocName ) { if ( !me.labelDocName ) {
me.labelDocName = $html.find('#rib-doc-name'); me.labelDocName = $html.find('#rib-doc-name');
if ( me.documentCaption ) { if ( me.documentCaption ) {
me.labelDocName.val(me.documentCaption); me.setDocTile(me.documentCaption);
} }
} else { } else {
$html.find('#rib-doc-name').hide(); $html.find('#rib-doc-name').hide();
@ -569,7 +569,8 @@ define([
!!me.labelDocName && me.labelDocName.hide().off(); // hide document title if it was created in right box !!me.labelDocName && me.labelDocName.hide().off(); // hide document title if it was created in right box
me.labelDocName = $html.find('#title-doc-name'); me.labelDocName = $html.find('#title-doc-name');
me.labelDocName.val( me.documentCaption ); me.setDocTile( me.documentCaption );
me.options.wopi && me.labelDocName.attr('maxlength', me.options.wopi.FileNameMaxLength); me.options.wopi && me.labelDocName.attr('maxlength', me.options.wopi.FileNameMaxLength);
if (config.user.guest && config.canRenameAnonymous) { if (config.user.guest && config.canRenameAnonymous) {
@ -723,16 +724,14 @@ define([
'blur': function (e) { 'blur': function (e) {
me.imgCrypted && me.imgCrypted.attr('hidden', false); me.imgCrypted && me.imgCrypted.attr('hidden', false);
if(!me.isSaveDocName) { if(!me.isSaveDocName) {
me.labelDocName.val(me.documentCaption);
me.withoutExt = false; me.withoutExt = false;
me.setDocTile(me.documentCaption);
} }
}, },
'paste': function (e) { 'paste': function (e) {
setTimeout(function() { setTimeout(function() {
var name = me.cutDocName(me.labelDocName.val()); var name = me.cutDocName(me.labelDocName.val());
me.labelDocName.val(name); me.setDocTile(name, true); });
me.labelDocName.attr('size', name.length + me.fileExtention.length > 10 ? name.length + me.fileExtention.length : 10);
});
} }
}); });
@ -755,6 +754,12 @@ define([
return (name.substring(idx) == this.fileExtention) ? name.substring(0, idx) : name ; return (name.substring(idx) == this.fileExtention) ? name.substring(0, idx) : name ;
}, },
setDocTile: function(name){
this.labelDocName.val(name);
var ln = this.withoutExt ? this.fileExtention.length : 0;
this.labelDocName.attr('size', name.length + ln > 10 ? name.length + ln : 10);
},
setUserName: function(name) { setUserName: function(name) {
this.options.userName = name; this.options.userName = name;