Skip to content

Commit 5e137e5

Browse files
authored
DragPreview: fixed text (#311)
Sometimes, selecting two or more files & started dragging would incorrectly use the row under the mouse as ghost element. This should always show "Copy x elements" instead. Current row is used as ghost element only when a single file is being dragged.
1 parent 06a5e78 commit 5e137e5

4 files changed

Lines changed: 35 additions & 37 deletions

File tree

package-lock.json

Lines changed: 30 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@
131131
"mobx": "^6.6.2",
132132
"mobx-react": "^7.5.3",
133133
"react": "^16.9.0",
134-
"react-dnd": "^13.1.1",
135-
"react-dnd-html5-backend": "^12.1.1",
134+
"react-dnd": "^14.0.5",
135+
"react-dnd-html5-backend": "^14.1.0",
136136
"react-dnd-text-dragpreview": "^0.2.3",
137137
"react-dom": "^16.9.0",
138138
"react-i18next": "^12.0.0",

src/components/RowRenderer.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,9 @@ export function RowRendererFn({
155155
}
156156

157157
if (fileCache.isVisible) {
158-
if (selectedCount > 1) {
159-
connectDragPreview(createPreview(selectedCount, isDarkModeActive))
160-
} else {
161-
connectDragPreview(undefined)
158+
const img = selectedCount > 1 ? createPreview(selectedCount, isDarkModeActive) : undefined
159+
if (img) {
160+
img.onload = () => connectDragPreview(img)
162161
}
163162
}
164163

src/components/menus/FileContextMenu.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react'
22
import { Menu, MenuItem, MenuDivider, Intent } from '@blueprintjs/core'
3-
import { AppState } from '$src/state/appState'
43
import { useStores } from '$src/hooks/useStores'
54
import { File, sameID } from '$src/services/Fs'
65
import { useTranslation } from 'react-i18next'

0 commit comments

Comments
 (0)