Fixes #352
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -34,3 +34,5 @@ dump.rdb
|
|||||||
# Ignore user uploads
|
# Ignore user uploads
|
||||||
/public/uploads/*
|
/public/uploads/*
|
||||||
!/public/uploads/.keep
|
!/public/uploads/.keep
|
||||||
|
|
||||||
|
.vscode
|
||||||
@@ -191,6 +191,7 @@ class TagsPanelCtrl extends PureCtrl {
|
|||||||
content_type: 'Tag'
|
content_type: 'Tag'
|
||||||
});
|
});
|
||||||
this.setState({
|
this.setState({
|
||||||
|
previousTag: this.state.selectedTag,
|
||||||
selectedTag: newTag,
|
selectedTag: newTag,
|
||||||
editingTag: newTag,
|
editingTag: newTag,
|
||||||
newTag: newTag
|
newTag: newTag
|
||||||
@@ -206,17 +207,24 @@ class TagsPanelCtrl extends PureCtrl {
|
|||||||
|
|
||||||
async saveTag($event, tag) {
|
async saveTag($event, tag) {
|
||||||
$event.target.blur();
|
$event.target.blur();
|
||||||
await this.setState({ editingTag: null });
|
await this.setState({
|
||||||
|
editingTag: null
|
||||||
|
});
|
||||||
if (!tag.title || tag.title.length === 0) {
|
if (!tag.title || tag.title.length === 0) {
|
||||||
if (this.editingOriginalName) {
|
if (this.state.editingTag) {
|
||||||
tag.title = this.editingOriginalName;
|
tag.title = this.editingOriginalName;
|
||||||
this.editingOriginalName = null;
|
this.editingOriginalName = null;
|
||||||
} else {
|
} else if(this.state.newTag) {
|
||||||
/** Newly created tag without content */
|
|
||||||
this.modelManager.removeItemLocally(tag);
|
this.modelManager.removeItemLocally(tag);
|
||||||
|
this.setState({
|
||||||
|
selectedTag: this.state.previousTag
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
this.setState({ newTag: null });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.editingOriginalName = null;
|
||||||
|
|
||||||
const matchingTag = this.modelManager.findTag(tag.title);
|
const matchingTag = this.modelManager.findTag(tag.title);
|
||||||
if (this.state.newTag === tag && matchingTag) {
|
if (this.state.newTag === tag && matchingTag) {
|
||||||
@@ -224,6 +232,7 @@ class TagsPanelCtrl extends PureCtrl {
|
|||||||
text: "A tag with this name already exists."
|
text: "A tag with this name already exists."
|
||||||
});
|
});
|
||||||
this.modelManager.removeItemLocally(tag);
|
this.modelManager.removeItemLocally(tag);
|
||||||
|
this.setState({ newTag: null });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,14 +245,12 @@ class TagsPanelCtrl extends PureCtrl {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedRenameTag($event, tag) {
|
async selectedRenameTag($event, tag) {
|
||||||
this.editingOriginalName = tag.title;
|
this.editingOriginalName = tag.title;
|
||||||
this.setState({
|
await this.setState({
|
||||||
editingTag: tag
|
editingTag: tag
|
||||||
});
|
});
|
||||||
this.$timeout(() => {
|
document.getElementById('tag-' + tag.uuid).focus();
|
||||||
document.getElementById('tag-' + tag.uuid).focus();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedDeleteTag(tag) {
|
selectedDeleteTag(tag) {
|
||||||
|
|||||||
56
dist/javascripts/app.js
vendored
56
dist/javascripts/app.js
vendored
@@ -2185,8 +2185,8 @@ var Footer = function Footer() {
|
|||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
__webpack_require__.r(__webpack_exports__);
|
__webpack_require__.r(__webpack_exports__);
|
||||||
/* harmony import */ var _abstract_pure_ctrl__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./abstract/pure_ctrl */ "./app/assets/javascripts/controllers/abstract/pure_ctrl.js");
|
/* harmony import */ var _abstract_pure_ctrl__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./abstract/pure_ctrl */ "./app/assets/javascripts/controllers/abstract/pure_ctrl.js");
|
||||||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PureCtrl", function() { return _abstract_pure_ctrl__WEBPACK_IMPORTED_MODULE_7__["PureCtrl"]; });
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PureCtrl", function() { return _abstract_pure_ctrl__WEBPACK_IMPORTED_MODULE_0__["PureCtrl"]; });
|
||||||
|
|
||||||
/* harmony import */ var _editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./editor */ "./app/assets/javascripts/controllers/editor.js");
|
/* harmony import */ var _editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./editor */ "./app/assets/javascripts/controllers/editor.js");
|
||||||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "EditorPanel", function() { return _editor__WEBPACK_IMPORTED_MODULE_1__["EditorPanel"]; });
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "EditorPanel", function() { return _editor__WEBPACK_IMPORTED_MODULE_1__["EditorPanel"]; });
|
||||||
@@ -4370,6 +4370,7 @@ function (_PureCtrl) {
|
|||||||
content_type: 'Tag'
|
content_type: 'Tag'
|
||||||
});
|
});
|
||||||
this.setState({
|
this.setState({
|
||||||
|
previousTag: this.state.selectedTag,
|
||||||
selectedTag: newTag,
|
selectedTag: newTag,
|
||||||
editingTag: newTag,
|
editingTag: newTag,
|
||||||
newTag: newTag
|
newTag: newTag
|
||||||
@@ -4399,25 +4400,31 @@ function (_PureCtrl) {
|
|||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
if (!(!tag.title || tag.title.length === 0)) {
|
if (!(!tag.title || tag.title.length === 0)) {
|
||||||
_context3.next = 6;
|
_context3.next = 7;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.editingOriginalName) {
|
if (this.state.editingTag) {
|
||||||
tag.title = this.editingOriginalName;
|
tag.title = this.editingOriginalName;
|
||||||
this.editingOriginalName = null;
|
this.editingOriginalName = null;
|
||||||
} else {
|
} else if (this.state.newTag) {
|
||||||
/** Newly created tag without content */
|
|
||||||
this.modelManager.removeItemLocally(tag);
|
this.modelManager.removeItemLocally(tag);
|
||||||
|
this.setState({
|
||||||
|
selectedTag: this.state.previousTag
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
newTag: null
|
||||||
|
});
|
||||||
return _context3.abrupt("return");
|
return _context3.abrupt("return");
|
||||||
|
|
||||||
case 6:
|
case 7:
|
||||||
|
this.editingOriginalName = null;
|
||||||
matchingTag = this.modelManager.findTag(tag.title);
|
matchingTag = this.modelManager.findTag(tag.title);
|
||||||
|
|
||||||
if (!(this.state.newTag === tag && matchingTag)) {
|
if (!(this.state.newTag === tag && matchingTag)) {
|
||||||
_context3.next = 11;
|
_context3.next = 14;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4425,9 +4432,12 @@ function (_PureCtrl) {
|
|||||||
text: "A tag with this name already exists."
|
text: "A tag with this name already exists."
|
||||||
});
|
});
|
||||||
this.modelManager.removeItemLocally(tag);
|
this.modelManager.removeItemLocally(tag);
|
||||||
|
this.setState({
|
||||||
|
newTag: null
|
||||||
|
});
|
||||||
return _context3.abrupt("return");
|
return _context3.abrupt("return");
|
||||||
|
|
||||||
case 11:
|
case 14:
|
||||||
this.modelManager.setItemDirty(tag);
|
this.modelManager.setItemDirty(tag);
|
||||||
this.syncManager.sync();
|
this.syncManager.sync();
|
||||||
this.modelManager.resortTag(tag);
|
this.modelManager.resortTag(tag);
|
||||||
@@ -4436,7 +4446,7 @@ function (_PureCtrl) {
|
|||||||
newTag: null
|
newTag: null
|
||||||
});
|
});
|
||||||
|
|
||||||
case 16:
|
case 19:
|
||||||
case "end":
|
case "end":
|
||||||
return _context3.stop();
|
return _context3.stop();
|
||||||
}
|
}
|
||||||
@@ -4446,13 +4456,25 @@ function (_PureCtrl) {
|
|||||||
}, {
|
}, {
|
||||||
key: "selectedRenameTag",
|
key: "selectedRenameTag",
|
||||||
value: function selectedRenameTag($event, tag) {
|
value: function selectedRenameTag($event, tag) {
|
||||||
this.editingOriginalName = tag.title;
|
return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.async(function selectedRenameTag$(_context4) {
|
||||||
this.setState({
|
while (1) {
|
||||||
editingTag: tag
|
switch (_context4.prev = _context4.next) {
|
||||||
});
|
case 0:
|
||||||
this.$timeout(function () {
|
this.editingOriginalName = tag.title;
|
||||||
document.getElementById('tag-' + tag.uuid).focus();
|
_context4.next = 3;
|
||||||
});
|
return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.awrap(this.setState({
|
||||||
|
editingTag: tag
|
||||||
|
}));
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
document.getElementById('tag-' + tag.uuid).focus();
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
case "end":
|
||||||
|
return _context4.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, null, this);
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
key: "selectedDeleteTag",
|
key: "selectedDeleteTag",
|
||||||
|
|||||||
2
dist/javascripts/app.js.map
vendored
2
dist/javascripts/app.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user