TagSpaces is an offline, open source, document manager with tagging support
File renamed on drag and drop without drop of tag (#1505)
Stanimir56eea1589ca5
diff --git a/.eslintrc b/.eslintrcindex 0ac8f10b9..9e57ca7ef 100644--- a/.eslintrc+++ b/.eslintrc@@ -4,7 +4,7 @@"sourceType": "module","allowImportExportEverywhere": true},- "extends": ["airbnb", "prettier", "prettier/react"],+ "extends": ["airbnb", "prettier", "prettier/react", "react-app"],"env": {"browser": true,"node": truediff --git a/app/components/EntryContainer.tsx b/app/components/EntryContainer.tsxindex 2976985f3..1bb98e0dc 100644--- a/app/components/EntryContainer.tsx+++ b/app/components/EntryContainer.tsx@@ -385,7 +385,7 @@ const EntryContainer = (props: Props) => {// @ts-ignorefileViewer.current.contentWindow.setContent) {- // @ts-ignore+ // @ts-ignore call setContent from iframefileViewer.current.contentWindow.setContent(content,fileDirectory,diff --git a/app/components/TagContainerDnd.tsx b/app/components/TagContainerDnd.tsxindex 585812df3..3faf11a69 100644--- a/app/components/TagContainerDnd.tsx+++ b/app/components/TagContainerDnd.tsx@@ -29,6 +29,9 @@ import { getEmptyImage } from 'react-dnd-html5-backend';import DragItemTypes from './DragItemTypes';import TagContainer from './TagContainer';import { TS } from '-/tagspaces.namespace';+import { extractTags } from '-/utils/paths';+import PlatformIO from '-/services/platform-io';+import AppConfig from '-/config';const boxSource = {// Expected the drag source specification to only have some of the following keys: canDrag, beginDrag, isDragging, endDrag@@ -147,6 +150,27 @@ const boxTarget = {if (dragItem.tag.functionality !== undefined) {return;}+ // Skip reorder from TagGroup source+ if (dragItem.sourceTagGroupId !== undefined) {+ return;+ }+ // Skip reorder on DnD Tag from an other file+ if(dragItem.tag.type === 'plain') {+ const extractedTags = extractTags(+ props.entryPath,+ AppConfig.tagDelimiter,+ PlatformIO.getDirSeparator()+ );+ if (+ extractedTags.length > 0 &&+ !extractedTags.includes(dragItem.tag.title)+ ) {+ return;+ }+ } else {+ //TODO check if sidecar tag exist in file (reorder only if exist)+ }+dragItem.tag.position = hoverIndex;props.editTagForEntry(props.entryPath, dragItem.tag);diff --git a/app/reducers/tagging-actions.ts b/app/reducers/tagging-actions.tsindex f1eb907cc..1ec9b2dd2 100644--- a/app/reducers/tagging-actions.ts+++ b/app/reducers/tagging-actions.ts@@ -414,7 +414,7 @@ const actions = {}return true;});- if (tag.position !== undefined) {+ if (tag.position !== undefined && tagFoundPosition > -1) {// move tagconst element = fsEntryMeta.tags[tagFoundPosition];fsEntryMeta.tags.splice(tagFoundPosition, 1);