TagSpaces is an offline, open source, document manager with tagging support
Added the feature to tag all selected files when drag and dropping a tag onto a file.
HappyDay42b8111f5688
diff --git a/app/components/TagContainerDnd.js b/app/components/TagContainerDnd.jsindex 1cfcbf516..95db87fd6 100644--- a/app/components/TagContainerDnd.js+++ b/app/components/TagContainerDnd.js@@ -37,7 +37,8 @@ type Props = {entryPath?: string,connectDragSource: ConnectDragSource,connectDragPreview: ConnectDragPreview,- deleteIcon: Object+ deleteIcon: Object,+ selectedEntries: Array<string>};const boxSource = {@@ -61,7 +62,13 @@ const boxSource = {props.moveTag(item.tagId, item.sourceTagGroupId, dropResult.tagGroupId);} else if (dropResult && dropResult.entryPath) {// console.log(`Dropped item: ${item.tag.title} onto file: ${dropResult.entryPath}!`);- props.addTags([dropResult.entryPath], [item.tag]);+ if (props.selectedEntries.some(entry => entry.path === dropResult.entryPath)) {+ const selectedEntryPaths = [];+ props.selectedEntries.map(entry => selectedEntryPaths.push(entry.path));+ props.addTags(selectedEntryPaths, [item.tag]);+ } else {+ props.addTags([dropResult.entryPath], [item.tag]);+ }}}};@@ -103,7 +110,8 @@ class TagContainerDnd extends React.Component<Props> {tagGroup,entryPath,handleTagMenu,- deleteIcon+ deleteIcon,+ selectedEntries} = this.props;const { isDragging, connectDragSource, tagMode } = this.props;@@ -119,6 +127,7 @@ class TagContainerDnd extends React.Component<Props> {tagMode={tagMode}entryPath={entryPath}isDragging={isDragging}+ selectedEntries={selectedEntries}/></span>);// , { dropEffect: 'copy' });diff --git a/app/components/TagLibrary.js b/app/components/TagLibrary.jsindex 4491abfb9..6e8a497d0 100644--- a/app/components/TagLibrary.js+++ b/app/components/TagLibrary.js@@ -53,6 +53,7 @@ import {import TaggingActions from '../reducers/tagging-actions';import i18n from '../services/i18n';import { getTagColor, getTagTextColor } from '../reducers/settings';+import { getSelectedEntries } from '../reducers/app';type Props = {classes: Object,@@ -77,7 +78,8 @@ type Props = {moveTag: () => void,editTagGroup: () => void,editTag: () => void,- deleteTag: () => void+ deleteTag: () => void,+ selectedEntries: Array<Object>};type State = {@@ -251,6 +253,7 @@ class TagLibrary extends React.Component<Props, State> {addTags={this.props.addTags}moveTag={this.props.moveTag}deleteTag={this.props.deleteTag}+ selectedEntries={this.props.selectedEntries}/>))}</TagGroupContainer>@@ -365,6 +368,7 @@ function mapStateToProps(state) {tagGroups: getTagGroups(state),tagBackgroundColor: getTagColor(state),tagTextColor: getTagTextColor(state),+ selectedEntries: getSelectedEntries(state)allTags: getAllTags(state)};}