mirror of
https://github.com/ourongxing/newsnow.git
synced 2025-01-19 03:09:14 +08:00
fix: cannot dnd in firefox
This commit is contained in:
parent
bf07610c43
commit
5af24c88d6
@ -140,10 +140,10 @@ function NewsCard({ id, setHandleRef }: NewsCardProps) {
|
|||||||
className={$("btn", isFocused ? "i-ph:star-fill" : "i-ph:star-duotone")}
|
className={$("btn", isFocused ? "i-ph:star-fill" : "i-ph:star-duotone")}
|
||||||
onClick={toggleFocus}
|
onClick={toggleFocus}
|
||||||
/>
|
/>
|
||||||
|
{/* firefox cannot drag a button */}
|
||||||
{setHandleRef && (
|
{setHandleRef && (
|
||||||
<button
|
<div
|
||||||
ref={setHandleRef}
|
ref={setHandleRef}
|
||||||
type="button"
|
|
||||||
className={$("btn", "i-ph:dots-six-vertical-duotone", "cursor-grab")}
|
className={$("btn", "i-ph:dots-six-vertical-duotone", "cursor-grab")}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
@ -37,10 +37,8 @@ export function useSortable(props: SortableProps) {
|
|||||||
if (handleRef && nodeRef) {
|
if (handleRef && nodeRef) {
|
||||||
const cleanup = combine(
|
const cleanup = combine(
|
||||||
draggable({
|
draggable({
|
||||||
// use custom drag preview
|
element: nodeRef,
|
||||||
element: handleRef,
|
dragHandle: handleRef,
|
||||||
// element: ref,
|
|
||||||
// dragHandle: handleRef,
|
|
||||||
getInitialData: () => ({ id: props.id, instanceId }),
|
getInitialData: () => ({ id: props.id, instanceId }),
|
||||||
onGenerateDragPreview({ nativeSetDragImage, location }) {
|
onGenerateDragPreview({ nativeSetDragImage, location }) {
|
||||||
setCustomNativeDragPreview({
|
setCustomNativeDragPreview({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user