File tree Expand file tree Collapse file tree 5 files changed +28
-28
lines changed Expand file tree Collapse file tree 5 files changed +28
-28
lines changed Original file line number Diff line number Diff line change @@ -812,12 +812,26 @@ export class DashboardContainer extends StatefulUIElement<
812
812
onListDragEnd = { ( listId ) => ( e ) =>
813
813
this . processEvent ( 'dropList' , { listId } ) }
814
814
initDropReceivingState = { ( listId ) => ( {
815
- onDragEnter : ( ) =>
816
- this . processEvent ( 'setDragOverListId' , { listId } ) ,
817
- onDragLeave : ( ) =>
815
+ onDragEnter : ( e ) => {
816
+ e . preventDefault ( )
817
+ e . stopPropagation ( )
818
+ // Needed to push this op back on the event queue, so it fires after the previous
819
+ // list item's `onDropLeave` event
820
+ setTimeout (
821
+ ( ) =>
822
+ this . processEvent ( 'setDragOverListId' , {
823
+ listId,
824
+ } ) ,
825
+ 0 ,
826
+ )
827
+ } ,
828
+ onDragLeave : ( e ) => {
829
+ e . preventDefault ( )
830
+ e . stopPropagation ( )
818
831
this . processEvent ( 'setDragOverListId' , {
819
832
listId : undefined ,
820
- } ) ,
833
+ } )
834
+ } ,
821
835
onDrop : ( dataTransfer ) =>
822
836
this . processEvent ( 'dropOnListItem' , {
823
837
listId,
Original file line number Diff line number Diff line change 1
1
import React from 'react'
2
2
import { fonts } from 'src/dashboard-refactor/styles'
3
3
import styled , { css } from 'styled-components'
4
- import Icon from '@worldbrain/memex-common/lib/common-ui/components/icon'
5
- import { TooltipBox } from '@worldbrain/memex-common/lib/common-ui/components/tooltip-box'
6
4
import type { DropReceivingState } from 'src/dashboard-refactor/types'
7
5
8
6
export interface Props {
@@ -38,14 +36,6 @@ export default class ListsSidebarItem extends React.PureComponent<
38
36
> {
39
37
state : State = { isHovering : false , canDisableHover : false }
40
38
41
- private handleDragEnter : React . DragEventHandler = ( e ) => {
42
- e . preventDefault ( )
43
- e . stopPropagation ( )
44
- // Needed to push this op back on the event queue, so it fires after the previous
45
- // list item's `onDropLeave` event
46
- setTimeout ( ( ) => this . props . dropReceivingState ?. onDragEnter ( ) , 0 )
47
- }
48
-
49
39
private handleDrop : React . DragEventHandler = ( e ) => {
50
40
e . preventDefault ( )
51
41
if ( ! this . props . dropReceivingState ?. canReceiveDroppedItems ) {
@@ -75,7 +65,7 @@ export default class ListsSidebarItem extends React.PureComponent<
75
65
} )
76
66
} }
77
67
spaceSidebarWidth = { this . props . spaceSidebarWidth }
78
- onDragEnter = { this . handleDragEnter }
68
+ onDragEnter = { this . props . dropReceivingState ?. onDragEnter }
79
69
onDragLeave = { this . props . dropReceivingState ?. onDragLeave }
80
70
onDragOver = { ( e ) => {
81
71
e . preventDefault ( )
Original file line number Diff line number Diff line change @@ -116,16 +116,7 @@ export default class ListsSidebar extends PureComponent<ListsSidebarProps> {
116
116
< ReorderLine
117
117
isActive = { this . props . someListIsDragging }
118
118
isVisible = { reorderLineDropReceivingState . isDraggedOver }
119
- onDragEnter = { ( e : React . DragEvent ) => {
120
- e . preventDefault ( )
121
- e . stopPropagation ( )
122
- // Needed to push this op back on the event queue, so it fires after the previous
123
- // list item's `onDropLeave` event
124
- setTimeout (
125
- ( ) => reorderLineDropReceivingState . onDragEnter ( ) ,
126
- 0 ,
127
- )
128
- } }
119
+ onDragEnter = { reorderLineDropReceivingState . onDragEnter }
129
120
onDragLeave = { reorderLineDropReceivingState . onDragLeave }
130
121
onDragOver = { ( e : React . DragEvent ) => {
131
122
e . preventDefault ( )
Original file line number Diff line number Diff line change @@ -4382,9 +4382,13 @@ export class DashboardLogic extends UILogic<State, Events> {
4382
4382
} )
4383
4383
}
4384
4384
4385
- setDragOverListId : EventHandler < 'setDragOverListId' > = async ( {
4385
+ setDragOverListId : EventHandler < 'setDragOverListId' > = ( {
4386
4386
event,
4387
+ previousState,
4387
4388
} ) => {
4389
+ if ( event . listId === previousState . listsSidebar . dragOverListId ) {
4390
+ return
4391
+ }
4388
4392
this . emitMutation ( {
4389
4393
listsSidebar : { dragOverListId : { $set : event . listId } } ,
4390
4394
} )
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ import type { SpaceSearchSuggestion } from '@worldbrain/memex-common/lib/editor'
52
52
import type { HighlightColor } from '@worldbrain/memex-common/lib/common-ui/components/highlightColorPicker/types'
53
53
import type { BulkEditCollection } from 'src/bulk-edit/types'
54
54
import type { PersonalCloudRemoteInterface } from 'src/personal-cloud/background/types'
55
+ import type { DragEventHandler } from 'react'
55
56
56
57
export interface RootState {
57
58
loadState : TaskState
@@ -152,8 +153,8 @@ export interface DropReceivingState {
152
153
wasPageDropped ?: boolean
153
154
canReceiveDroppedItems ?: boolean
154
155
onDrop ( dataTransfer : DataTransfer ) : void
155
- onDragEnter ( ) : void
156
- onDragLeave ( ) : void
156
+ onDragEnter : DragEventHandler
157
+ onDragLeave : DragEventHandler
157
158
}
158
159
159
160
export interface SearchResultTextPart {
You can’t perform that action at this time.
0 commit comments