Skip to content

Commit

Permalink
fix(grid-list): handle drop events in Firefox (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickmichalina authored Jul 20, 2019
1 parent 81da97b commit 0ab9898
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ interface IDragDropMap<TItem> { readonly index: number, readonly value: TItem }

// tslint:disable: readonly-keyword
// tslint:disable: no-object-mutation
// tslint:disable: no-if-statement
@Directive({
selector: '[floGridListDragDrop]',
})
Expand Down Expand Up @@ -34,6 +35,8 @@ export class FloGridListDragDropDirective<TItem extends IFloGridListBaseItem, TE
.tapSome(dt => dt.setData('text', JSON.stringify({ index: this.floGridListDragDropIndex, value: this.floGridListDragDropItem })))
}
@HostListener('drop', ['$event']) drop(evt: DragEvent) {
if (evt.preventDefault) { evt.preventDefault() }
if (evt.stopPropagation) { evt.stopPropagation() }
maybe(evt.dataTransfer)
.map(dt => JSON.parse(dt.getData('text')) as IDragDropMap<TItem>)
.map(from => ({ from, to: { index: this.floGridListDragDropIndex, value: this.floGridListDragDropItem } }))
Expand Down

0 comments on commit 0ab9898

Please sign in to comment.