fix cannot add deleted tags

This commit is contained in:
lealife
2017-01-23 17:42:21 +08:00
parent cabf89f9b8
commit f294fa4124
2 changed files with 25 additions and 1 deletions

View File

@ -210,6 +210,8 @@ Tag.removeTag = function($target) {
tag = Tag.mapCn2En[tag] || tag;
}
Note.curChangedSaveIt(true, function() {
return;
ajaxPost("/tag/updateTag", {tag: tag}, function(ret) {
if(reIsOk(ret)) {
Tag.addTagNav(ret.Item);
@ -239,6 +241,17 @@ Tag.renderTagNav = function(tags) {
}
};
Tag.deleteTag = function(title) {
var me = this;
for(var i = 0; i < this.tags.length; ++i) {
var tag = this.tags[i];
if (tag.Tag == title) {
this.tags.splice(i, 1);
break;
}
}
};
// 添加的标签重新render到左边, 放在第一个位置
// 重新render
Tag.addTagNav = function(newTag) {
@ -328,6 +341,9 @@ $(function() {
var item = re.Item; // 被删除的
Note.deleteNoteTag(item, tag);
$li.remove();
// 删除tags
Tag.deleteTag(tag);
}
});
};