TagSpaces is an offline, open source, document manager with tagging support
- fixing issue, preventing the removal of the last tag in the properties area
Ilian Sapundshievf5a8ff6562a9
diff --git a/app/components/EntryProperties.js b/app/components/EntryProperties.jsindex e04496dc9..fcf5ff5b6 100644--- a/app/components/EntryProperties.js+++ b/app/components/EntryProperties.js@@ -452,12 +452,16 @@ class EntryProperties extends Component<Props, State> {handleChange = (name, value, action) => {if (action === 'remove-value') {- this.state.tags.map((tag) => {- if (value.findIndex(obj => obj.title === tag.title) === -1) {- this.props.removeTags([this.state.path], [tag]);- }- return tag;- });+ if (!value) { // no tags left in the select element+ this.props.removeAllTags([this.state.path]);+ } else {+ this.state.tags.map((tag) => {+ if (value.findIndex(obj => obj.title === tag.title) === -1) {+ this.props.removeTags([this.state.path], [tag]);+ }+ return true;+ });+ }} else if (action === 'clear') {this.props.removeAllTags([this.state.path]);} else { // create-option or select-option@@ -465,7 +469,7 @@ class EntryProperties extends Component<Props, State> {if (this.state.tags.findIndex(obj => obj.title === tag.title) === -1) {this.props.addTags([this.state.path], [tag]);}- return tag;+ return true;});}};