TagSpaces is an offline, open source, document manager with tagging support
disabling dnd of tags in readonly mode
Ilian Sapundshiev06b113cac0c3
diff --git a/app/components/TagLibrary.js b/app/components/TagLibrary.jsindex 8c0e5a6a5..e0b39f7b4 100644--- a/app/components/TagLibrary.js+++ b/app/components/TagLibrary.js@@ -33,6 +33,7 @@ import MoreVertIcon from '@material-ui/icons/MoreVert';import ArrowDownIcon from '@material-ui/icons/KeyboardArrowDown';import ArrowRightIcon from '@material-ui/icons/KeyboardArrowRight';import TagContainerDnd from './TagContainerDnd';+import TagContainer from './TagContainer';import ConfirmDialog from './dialogs/ConfirmDialog';import styles from './SidePanels.css';import CreateTagGroupDialog from './dialogs/CreateTagGroupDialog';@@ -53,11 +54,12 @@ import {import TaggingActions from '../reducers/tagging-actions';import i18n from '../services/i18n';import { getTagColor, getTagTextColor } from '../reducers/settings';-import { getSelectedEntries } from '../reducers/app';+import { getSelectedEntries, isReadOnlyMode } from '../reducers/app';type Props = {classes: Object,style: Object,+ isReadOnlyMode: boolean,tagTextColor: string,tagBackgroundColor: string,tagGroups: Array<TagGroup>,@@ -244,17 +246,30 @@ class TagLibrary extends React.Component<Props, State> {</ListItem><Collapse in={tagGroup.expanded} unmountOnExit><TagGroupContainer taggroup={tagGroup} data-tid={'tagGroupContainer_' + tagGroup.title}>- {tagGroup.children && tagGroup.children.map((tag: Tag) => (- <TagContainerDnd- key={tag.id}- tag={tag}- tagGroup={tagGroup}- handleTagMenu={this.handleTagMenu}- addTags={this.props.addTags}- moveTag={this.props.moveTag}- selectedEntries={this.props.selectedEntries}- />- ))}+ {tagGroup.children && tagGroup.children.map((tag: Tag) => {+ const isReadOnly = this.props.isReadOnlyMode;+ return isReadOnly ? (+ <TagContainer+ key={tag.id}+ tag={tag}+ tagGroup={tagGroup}+ handleTagMenu={this.handleTagMenu}+ addTags={this.props.addTags}+ moveTag={this.props.moveTag}+ selectedEntries={this.props.selectedEntries}+ />+ ) : (+ <TagContainerDnd+ key={tag.id}+ tag={tag}+ tagGroup={tagGroup}+ handleTagMenu={this.handleTagMenu}+ addTags={this.props.addTags}+ moveTag={this.props.moveTag}+ selectedEntries={this.props.selectedEntries}+ />+ );+ })}</TagGroupContainer></Collapse></div>@@ -368,7 +383,8 @@ function mapStateToProps(state) {tagBackgroundColor: getTagColor(state),tagTextColor: getTagTextColor(state),selectedEntries: getSelectedEntries(state),- allTags: getAllTags(state)+ allTags: getAllTags(state),+ isReadOnlyMode: isReadOnlyMode(state)};}diff --git a/app/perspectives/grid-perspective/src/index.js b/app/perspectives/grid-perspective/src/index.jsindex 34c5c29e6..1628ae4b2 100644--- a/app/perspectives/grid-perspective/src/index.js+++ b/app/perspectives/grid-perspective/src/index.js@@ -74,6 +74,7 @@ import FileMenu from '../../../components/menus/FileMenu';import DirectoryMenu from '../../../components/menus/DirectoryMenu';import EntryTagMenu from '../../../components/menus/EntryTagMenu';import TagContainerDnd from '../../../components/TagContainerDnd';+import TagContainer from '../../../components/TagContainer';import i18n from '../../../services/i18n';import ConfirmDialog from '../../../components/dialogs/ConfirmDialog';import AddRemoveTagsDialog from '../../../components/dialogs/AddRemoveTagsDialog';@@ -633,16 +634,28 @@ class GridPerspective extends React.Component<Props, State> {);};- renderTag = (tag: Object, fsEntry) => (- <TagContainerDnd- tag={tag}- key={tag.id}- entryPath={fsEntry.path}- addTags={this.props.addTags}- handleTagMenu={this.handleTagMenu}- selectedEntries={this.props.selectedEntries}- />- );+ renderTag = (tag: Object, fsEntry) => {+ const isReadOnly = this.props.isReadOnlyMode;+ return isReadOnly ? (+ <TagContainer+ tag={tag}+ key={tag.id}+ entryPath={fsEntry.path}+ addTags={this.props.addTags}+ handleTagMenu={this.handleTagMenu}+ selectedEntries={this.props.selectedEntries}+ />+ ) : (+ <TagContainerDnd+ tag={tag}+ key={tag.id}+ entryPath={fsEntry.path}+ addTags={this.props.addTags}+ handleTagMenu={this.handleTagMenu}+ selectedEntries={this.props.selectedEntries}+ />+ );+ };renderCellContent = (fsEntry: FileSystemEntry, entryHeight: number) => {const { classes, theme, supportedFileTypes } = this.props;