commit
77339d7cca
@ -138,8 +138,12 @@ editor_datapanel_wrapper = function (editor) {
|
|||||||
var newFileName = document.getElementById('newFileName');
|
var newFileName = document.getElementById('newFileName');
|
||||||
newMap.onclick = function () {
|
newMap.onclick = function () {
|
||||||
if (!newFileName.value) return;
|
if (!newFileName.value) return;
|
||||||
if (core.floorIds.indexOf(newFileName.value) >= 0) {
|
var findFunc = function (id) {
|
||||||
printe("该楼层已存在!");
|
var re = new RegExp(newFileName.value, 'i');
|
||||||
|
return re.test(id);
|
||||||
|
}
|
||||||
|
if (core.floorIds.find(findFunc) != null) {
|
||||||
|
printe("同名楼层已存在!(不区分大小写)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(newFileName.value)) {
|
if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(newFileName.value)) {
|
||||||
@ -200,8 +204,12 @@ editor_datapanel_wrapper = function (editor) {
|
|||||||
var floorId = floorIds.replace(/\${(.*?)}/g, function (word, value) {
|
var floorId = floorIds.replace(/\${(.*?)}/g, function (word, value) {
|
||||||
return eval(value);
|
return eval(value);
|
||||||
});
|
});
|
||||||
if (core.floorIds.indexOf(floorId) >= 0) {
|
var findFunc = function (id) {
|
||||||
printe("要创建的楼层 " + floorId + " 已存在!");
|
var re = new RegExp(floorId, 'i');
|
||||||
|
return re.test(id);
|
||||||
|
}
|
||||||
|
if (core.floorIds.find(findFunc) != null) {
|
||||||
|
printe("同名楼层已存在!(不区分大小写)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(floorId)) {
|
if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(floorId)) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user