Skip to content

Commit 76291c7

Browse files
committed
Merge branch 'master' into pm/add-data-transfer-api
2 parents c52f03f + 25a14aa commit 76291c7

File tree

4 files changed

+31
-10
lines changed

4 files changed

+31
-10
lines changed

CHANGELOG.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,21 @@ Breaking changes:
88

99
New features:
1010
- Added `items` function for `DataTransfer` and related types (`DataTransferItem`, `DataTransferItemList`) (#55 by @ptrfrncsmrph)
11+
12+
Bugfixes:
13+
14+
Other improvements:
15+
16+
## [v3.2.0](https://github.com/purescript-web/purescript-web-html/releases/tag/v3.2.0) - 2021-10-06
17+
18+
New features:
1119
- Added `languages` value for `Navigator` (#59 by @toastal)
1220
- Added `HTMLHtmlElement` module and `documentElement` function `HTMLDocument` (#60 by @toastal)
1321
- Added `onLine` value for `Navigator` (#61 by @toastal)
22+
- Added `setDragImage` function for `DataTransfer` (#65 by @ajarista)
1423

1524
Bugfixes:
16-
17-
Other improvements:
25+
- Removed duplicated `cells` export from the FFI in HTMLTableRowElement.js (#58 by @thomashoneyman)
1826

1927
## [v3.1.0](https://github.com/purescript-web/purescript-web-html/releases/tag/v3.1.0) - 2021-05-06
2028

src/Web/HTML/Event/DataTransfer.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@ exports._setData = function (format) {
3030
};
3131
};
3232

33+
exports._setDragImage = function (dataTransfer) {
34+
return function (image) {
35+
return function (x) {
36+
return function (y) {
37+
return function () {
38+
return dataTransfer.setDragImage(image, x, y);
39+
};
40+
};
41+
};
42+
};
43+
};
44+
3345
exports._dropEffect = function (dataTransfer) {
3446
return function () {
3547
return dataTransfer.dropEffect;

src/Web/HTML/Event/DataTransfer.purs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module Web.HTML.Event.DataTransfer
55
, types
66
, getData
77
, setData
8+
, setDragImage
89
, DropEffect(..)
910
, dropEffect
1011
, setDropEffect
@@ -16,6 +17,7 @@ import Data.Maybe (Maybe)
1617
import Data.MediaType (MediaType(..))
1718
import Data.Nullable (Nullable, toMaybe)
1819
import Effect (Effect)
20+
import Web.DOM.Element (Element)
1921
import Web.File.FileList (FileList)
2022
import Web.HTML.Event.DataTransfer.DataTransferItem (DataTransferItemList)
2123

@@ -63,6 +65,13 @@ setData
6365
-> Effect Unit
6466
setData (MediaType format) dat dt = _setData format dat dt
6567

68+
foreign import _setDragImage :: DataTransfer -> Element -> Int -> Int -> Effect Unit
69+
70+
-- | Sets the image to be used for dragging if a custom one is desired.
71+
-- | The image will typically be an <image> but could be any other *visible* element.
72+
-- | The x and y coordinates define where the image appears relative to the mouse.
73+
setDragImage :: DataTransfer -> Element -> Int -> Int -> Effect Unit
74+
setDragImage = _setDragImage
6675
foreign import _dropEffect :: DataTransfer -> Effect String
6776

6877
data DropEffect = Copy | Link | Move | None

src/Web/HTML/HTMLTableRowElement.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,6 @@ exports.cells = function (row) {
2424

2525
// ----------------------------------------------------------------------------
2626

27-
exports.cells = function (row) {
28-
return function () {
29-
return row.cells;
30-
};
31-
};
32-
33-
// ----------------------------------------------------------------------------
34-
3527
exports.insertCellAt = function (index) {
3628
return function (row) {
3729
return function () {

0 commit comments

Comments
 (0)