Change for file rename
This commit is contained in:
parent
c482be11c8
commit
e648acfbfc
|
@ -356,18 +356,19 @@ define([
|
||||||
me.btnOptions.updateHint(me.tipViewSettings);
|
me.btnOptions.updateHint(me.tipViewSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cutDocName(name) {
|
||||||
|
var idx = name.lastIndexOf('.');
|
||||||
|
return (idx>0) ? name.substring(0, idx) : name ;
|
||||||
|
}
|
||||||
|
|
||||||
function onFocusDocName(e){
|
function onFocusDocName(e){
|
||||||
var me = this;
|
var me = this;
|
||||||
if(me.options.isNotTrimAfterPoint) return;
|
if(me.options.isNotTrimAfterPoint) return;
|
||||||
|
|
||||||
var name = me.labelDocName.val();
|
var name = cutDocName(me.labelDocName.val());
|
||||||
var idx = name.lastIndexOf('.');
|
|
||||||
if (idx>0)
|
|
||||||
name = name.substring(0, idx);
|
|
||||||
_.delay(function(){
|
_.delay(function(){
|
||||||
me.labelDocName.val(name);
|
me.labelDocName.val(name);
|
||||||
},100);
|
},100);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDocNameKeyDown(e) {
|
function onDocNameKeyDown(e) {
|
||||||
|
@ -376,7 +377,7 @@ define([
|
||||||
var name = me.labelDocName.val();
|
var name = me.labelDocName.val();
|
||||||
if ( e.keyCode == Common.UI.Keys.RETURN ) {
|
if ( e.keyCode == Common.UI.Keys.RETURN ) {
|
||||||
name = name.trim();
|
name = name.trim();
|
||||||
if ( !_.isEmpty(name) && me.documentCaption !== name ) {
|
if ( !_.isEmpty(name) && cutDocName(me.documentCaption) !== name ) {
|
||||||
if ( /[\t*\+:\"<>?|\\\\/]/gim.test(name) ) {
|
if ( /[\t*\+:\"<>?|\\\\/]/gim.test(name) ) {
|
||||||
_.defer(function() {
|
_.defer(function() {
|
||||||
Common.UI.error({
|
Common.UI.error({
|
||||||
|
@ -388,13 +389,15 @@ define([
|
||||||
}, 50);
|
}, 50);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
me.api.asc_wopi_renameFile(name);
|
|
||||||
me.labelDocName.blur();
|
me.labelDocName.blur();
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
Common.Gateway.requestRename(name);
|
me.options.wopi ? me.api.asc_wopi_renameFile(name) : Common.Gateway.requestRename(name);
|
||||||
Common.NotificationCenter.trigger('edit:complete', me);
|
Common.NotificationCenter.trigger('edit:complete', me);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
me.labelDocName.val(me.documentCaption);
|
||||||
|
Common.NotificationCenter.trigger('edit:complete', me);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if ( e.keyCode == Common.UI.Keys.ESC ) {
|
if ( e.keyCode == Common.UI.Keys.ESC ) {
|
||||||
|
@ -654,7 +657,6 @@ define([
|
||||||
|
|
||||||
//this.setCanRename(true);
|
//this.setCanRename(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue