11![ dependencies] ( https://img.shields.io/david/timruffles/ios-html5-drag-drop-shim/rewrite.svg )
22![ devdependencies] ( https://img.shields.io/david/dev/timruffles/ios-html5-drag-drop-shim/rewrite.svg )
3- [ ![ npmversion] ( https://img.shields.io/npm/v/drag-drop-polyfill .svg )] ( https://www.npmjs.com/package/drag-drop-polyfill )
4- ![ bowerversion] ( https://img.shields.io/bower/v/drag-drop-polyfill .svg )
5- ![ license] ( https://img.shields.io/npm/l/drag-drop-polyfill .svg )
3+ [ ![ npmversion] ( https://img.shields.io/npm/v/mobile- drag-drop.svg )] ( https://www.npmjs.com/package/mobile- drag-drop )
4+ ![ bowerversion] ( https://img.shields.io/bower/v/mobile- drag-drop.svg )
5+ ![ license] ( https://img.shields.io/npm/l/mobile- drag-drop.svg )
66![ issues] ( https://img.shields.io/github/issues/timruffles/ios-html5-drag-drop-shim.svg )
7- ![ size] ( https://badge-size.herokuapp.com/timruffles/ios-html5-drag-drop-shim/rewrite/release/drag-drop-polyfill .min.js )
8- ![ gzippedsize] ( https://badge-size.herokuapp.com/timruffles/ios-html5-drag-drop-shim/rewrite/release/drag-drop-polyfill .min.js?compression=gzip )
7+ ![ size] ( https://badge-size.herokuapp.com/timruffles/ios-html5-drag-drop-shim/rewrite/release/index .min.js )
8+ ![ gzippedsize] ( https://badge-size.herokuapp.com/timruffles/ios-html5-drag-drop-shim/rewrite/release/index .min.js?compression=gzip )
99
1010
1111# Polyfill for HTML 5 drag'n'drop
@@ -15,7 +15,7 @@ The HTML 5 drag'n'drop API allows you to implement drag'n'drop on [most desktop
1515Unfortunately, you'll notice most mobile browsers don't support it, so no iPad (or Nexus) action for you!
1616
1717Luckily, browsers give us enough tools to make it happen ourselves. If you drop
18- this package in your page your existing HTML 5 drag'n'drop code should just work .
18+ this package in your page your existing HTML 5 drag'n'drop code should _ just work _ ( [ * almost ] ( #polyfill-requires-dragenter-listener ) ) .
1919
2020
2121## Demos
@@ -31,52 +31,52 @@ Check out the demo to see it in action and monitor the console to see the events
3131
3232** bower**
3333
34- ` bower install drag-drop-polyfill#2.0.0-rc.0 --save `
34+ ` bower install mobile- drag-drop --save `
3535
3636** npm**
3737
38- ` npm install drag-drop[email protected] --save ` 38+ ` npm install mobile- drag-drop --save `
3939
4040** jspm**
4141
42- ` jspm install npm:drag-drop-polyfill `
42+ ` jspm install npm:mobile- drag-drop `
4343
4444
4545### Include
4646
4747** global**
4848
4949``` HTML
50- <link rel =" stylesheet" href =" libs/drag-drop-polyfill /release/drag-drop-polyfill .css" >
51- <script src =" libs/drag-drop-polyfill /release/drag-drop-polyfill .min.js" ></script >
50+ <link rel =" stylesheet" href =" libs/mobile- drag-drop/release/default .css" >
51+ <script src =" libs/mobile- drag-drop/release/index .min.js" ></script >
5252
5353<!-- optional import of scroll behaviour-->
54- <script src =" libs/drag-drop-polyfill /release/drag-drop-polyfill- scroll-behaviour.min.js" ></script >
54+ <script src =" libs/mobile- drag-drop/release/scroll-behaviour.min.js" ></script >
5555
5656<script >
5757 // options are optional ;)
58- DragDropPolyfill .polyfill ({
58+ MobileDragDrop .polyfill ({
5959 // use this to make use of the scroll behaviour
60- dragImageTranslateOverride: DragDropPolyfill .scrollBehaviourDragImageTranslateOverride
60+ dragImageTranslateOverride: MobileDragDrop .scrollBehaviourDragImageTranslateOverride
6161 });
6262 </script >
6363```
6464
6565** SystemJS/JSPM**
6666
6767``` JavaScript
68- System .import (" drag-drop-polyfill " );
68+ System .import (" mobile- drag-drop" );
6969// import css if using system-js css loader plugin
70- System .import (" drag-drop-polyfill/ drag-drop-polyfill .css!" );
70+ System .import (" mobile- drag-drop/default .css!" );
7171```
7272
7373** ES2015/TypeScript/webpack**
7474
75- ```JavaScript`
76- import {polyfill} from "drag-drop-polyfill/ drag-drop-polyfill ";
75+ ``` JavaScript
76+ import {polyfill } from " mobile- drag-drop" ;
7777
7878// optional import of scroll behaviour
79- import {scrollBehaviourDragImageTranslateOverride} from "drag-drop-polyfill/ drag-drop-polyfill- scroll-behaviour";
79+ import {scrollBehaviourDragImageTranslateOverride } from " mobile- drag-drop/ scroll-behaviour" ;
8080
8181// options are optional ;)
8282polyfill ({
@@ -85,13 +85,21 @@ polyfill({
8585});
8686```
8787
88+ ** Make sure to implement a ` dragenter ` -listener!** ([ read here why] ( #polyfill-requires-dragenter-listener ) )
89+
90+ ```
91+ // dragenter listener
92+ (event)=> {
93+ event.preventDefault();
94+ }
95+ ```
96+
8897** webpack/scss**
8998
9099``` SCSS
91- @import "~drag-drop-polyfill/ drag-drop-polyfill .css";
100+ @import " ~mobile- drag-drop/default .css" ;
92101```
93102
94-
95103## API & Options <a name =" options " ></a >
96104
97105``` TypeScript
@@ -164,11 +172,11 @@ Override the classes that are applied by the polyfill. Mind the `!important`.
164172CSS classes are applied to the ` dragImage ` -element according to the
165173current drop effect: ` none ` , ` copy ` , ` move ` , ` link ` .
166174
167- There is ` drag-drop-polyfill- icons.css` which defines default styles and icons.
175+ There is ` icons.css ` which defines default styles and icons.
168176Feel free to use this as a starting point.
169177
170178``` HTML
171- <link rel =" stylesheet" href =" [...]/drag-drop-polyfill/ drag-drop-polyfill- icons.css" >
179+ <link rel =" stylesheet" href =" [...]/mobile- drag-drop/ icons.css" >
172180```
173181
174182[ setDragImage()] ( https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/setDragImage ) is supported.
@@ -226,13 +234,19 @@ This table is an effort to list all things required to make drag'n'drop work in
226234
227235_ empty cells mean there is nothing special to take into account_
228236
237+ #### Polyfill requires dragenter listener
238+
239+ On desktop browsers if no ` dragenter ` -handler is registered the drag-operation is silently allowed. Browsers don't implement ` dropzone ` -attribute
240+ according to [ caniuse] ( http://caniuse.com/#search=drag ) which is why they allow it by default, which violates the spec.
241+
242+ If a handler is set up it has to call ` event.preventDefault() ` to allow dropping.
243+
244+ This is pretty bad for the polyfill since JS doesn't allow to check how many listeners were invoked when the event is dispatched,
245+ which forces the polyfill to rely on a listener being present calling ` event.preventDefault() ` to make it work.
246+
247+
229248** Further notices:**
230249
231- * If no ` dragenter ` -handler is registered the drag-operation is silently allowed. Browsers don't implement ` dropzone ` -attribute
232- according to [ caniuse] ( http://caniuse.com/#search=drag ) so they allow it by default, which violates the spec.
233- If a handler is set up it has to call ` event.preventDefault() ` to allow dropping.
234- This is pretty bad for the polyfill since JS doesn't allow to check how many listeners were invoked when the event is dispatched,
235- which forces the polyfill to rely on a listener being present calling ` event.preventDefault() ` to make it work.
236250* FF:<a name =" ff-quirk " ></a > If ` effectAllowed ` or ` dropEffect ` is set in ` dragstart ` then ` dragenter/dragover ` also need to set it.
237251* When using a MS Surface tablet a drag-operation is initiated by touch and hold on a draggable.
238252* IE11 and Chrome scroll automatically when dragging close to a viewport edge.
0 commit comments