commit
78e148c026
|
@ -244,6 +244,7 @@ define([
|
||||||
var key = _.findWhere(arrData, {type: 'key'}).value;
|
var key = _.findWhere(arrData, {type: 'key'}).value;
|
||||||
if (Common.Utils.InternalSettings.get("sse-doc-info-key") === key) {
|
if (Common.Utils.InternalSettings.get("sse-doc-info-key") === key) {
|
||||||
this.api.asc_moveWorksheet(index, _.findWhere(arrData, {type: 'indexes'}).value);
|
this.api.asc_moveWorksheet(index, _.findWhere(arrData, {type: 'indexes'}).value);
|
||||||
|
this.api.asc_enableKeyEvents(true);
|
||||||
Common.NotificationCenter.trigger('tabs:dragend', this);
|
Common.NotificationCenter.trigger('tabs:dragend', this);
|
||||||
} else {
|
} else {
|
||||||
var names = [], wc = this.api.asc_getWorksheetsCount();
|
var names = [], wc = this.api.asc_getWorksheetsCount();
|
||||||
|
@ -253,22 +254,19 @@ define([
|
||||||
var newNames = [];
|
var newNames = [];
|
||||||
var arrNames = _.findWhere(arrData, {type: 'names'}).value;
|
var arrNames = _.findWhere(arrData, {type: 'names'}).value;
|
||||||
arrNames.forEach(function (name) {
|
arrNames.forEach(function (name) {
|
||||||
var ind = 0,
|
var ind = 1,
|
||||||
name = name;
|
name = name;
|
||||||
var first = name;
|
var re = /^(.*)\((\d)\)$/.exec(name);
|
||||||
if (names.indexOf(name.toLowerCase()) !== -1) {
|
var first = re ? re[1] : name + ' ';
|
||||||
while (true) {
|
var arr = [];
|
||||||
if (names.indexOf(name.toLowerCase()) === -1) {
|
newNames.length > 0 && newNames.forEach(function (item) {
|
||||||
newNames.push(name);
|
arr.push(item.toLowerCase());
|
||||||
break;
|
});
|
||||||
} else {
|
while (names.indexOf(name.toLowerCase()) !== -1 || arr.indexOf(name.toLowerCase()) !== -1) {
|
||||||
ind++;
|
ind++;
|
||||||
name = first + '(' + ind + ')';
|
name = first + '(' + ind + ')';
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
newNames.push(name);
|
|
||||||
}
|
}
|
||||||
|
newNames.push(name);
|
||||||
});
|
});
|
||||||
this.api.asc_EndMoveSheet(index, newNames, _.findWhere(arrData, {type: 'onlyoffice'}).value);
|
this.api.asc_EndMoveSheet(index, newNames, _.findWhere(arrData, {type: 'onlyoffice'}).value);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue