You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* docs: use the dragdropcontextprovider in the tutorial example
* docs: turn on auto-formatting of markdown files, run auto-formatting on existing documentation
* docs: add a prettier override for markdown to not use tabs
Copy file name to clipboardExpand all lines: packages/dnd-core/README.md
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -13,17 +13,17 @@ It powers [React DnD](https://github.com/react-dnd/react-dnd) internally.
13
13
14
14
To give you a better idea:
15
15
16
-
* There is no DOM here
17
-
* We let you define drop target and drag source logic
18
-
* We let you supply custom underlying implementations (console, DOM via jQuery, React, React Native, _whatever_)
19
-
* We manage drag source and drop target interaction
16
+
- There is no DOM here
17
+
- We let you define drop target and drag source logic
18
+
- We let you supply custom underlying implementations (console, DOM via jQuery, React, React Native, _whatever_)
19
+
- We manage drag source and drop target interaction
20
20
21
21
This was written to support some rather complicated scenarios that were too hard to implement in [React DnD](https://github.com/react-dnd/react-dnd) due to its current architecture:
22
22
23
-
*[Mocking drag and drop interaction in tests](https://github.com/react-dnd/react-dnd/issues/55)
24
-
*[Full support for arbitrary nesting and handling drag sources and drop targets](https://github.com/react-dnd/react-dnd/issues/87)
25
-
*[Dragging multiple items at once](https://github.com/react-dnd/react-dnd/issues/14)
26
-
*[Even when source is removed, letting another drag source “represent it” (e.g. card disappeared from one Kanban list, reappeared in another one)](https://github.com/react-dnd/react-dnd/pull/64#issuecomment-76118757)
23
+
-[Mocking drag and drop interaction in tests](https://github.com/react-dnd/react-dnd/issues/55)
24
+
-[Full support for arbitrary nesting and handling drag sources and drop targets](https://github.com/react-dnd/react-dnd/issues/87)
25
+
-[Dragging multiple items at once](https://github.com/react-dnd/react-dnd/issues/14)
26
+
-[Even when source is removed, letting another drag source “represent it” (e.g. card disappeared from one Kanban list, reappeared in another one)](https://github.com/react-dnd/react-dnd/pull/64#issuecomment-76118757)
27
27
28
28
As it turns out, these problems are much easier to solve when DOM is thrown out of the window.
Copy file name to clipboardExpand all lines: packages/documentation/README.md
+32-32Lines changed: 32 additions & 32 deletions
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@
7
7
Gatsby's default starter
8
8
</h1>
9
9
10
-
Kick off your project with this default boilerplate. This barebones starter ships with the main Gatsby configuration files you might need.
10
+
Kick off your project with this default boilerplate. This barebones starter ships with the main Gatsby configuration files you might need.
11
11
12
12
_Have another more specific idea? You may want to check out our vibrant collection of [official and community-created starters](https://www.gatsbyjs.org/docs/gatsby-starters/)._
13
13
@@ -34,11 +34,11 @@ _Have another more specific idea? You may want to check out our vibrant collecti
34
34
1. **Open the source code and start editing!**
35
35
36
36
Your site is now running at `http://localhost:8000`!
37
-
38
-
*Note: You'll also see a second link: `http://localhost:8000/___graphql`. This is a tool you can use to experiment with querying your data. Learn more about using this tool in the [Gatsby tutorial](https://www.gatsbyjs.org/tutorial/part-five/#introducing-graphiql).*
39
-
37
+
38
+
\_Note: You'll also see a second link: `http://localhost:8000/___graphql`. This is a tool you can use to experiment with querying your data. Learn more about using this tool in the [Gatsby tutorial](https://www.gatsbyjs.org/tutorial/part-five/#introducing-graphiql).\_
39
+
40
40
Open the `my-default-starter` directory in your code editor of choice and edit `src/pages/index.js`. Save your changes and the browser will update in real time!
41
-
41
+
42
42
## 🧐 What's inside?
43
43
44
44
A quick look at the top-level files and directories you'll see in a Gatsby project.
@@ -58,39 +58,39 @@ A quick look at the top-level files and directories you'll see in a Gatsby proje
58
58
├── README.md
59
59
└── yarn.lock
60
60
61
-
1. **`/node_modules`**: This directory contains all of the modules of code that your project depends on (npm packages) are automatically installed.
62
-
63
-
2. **`/src`**: This directory will contain all of the code related to what you will see on the front-end of your site (what you see in the browser) such as your site header or a page template. `src` is a convention for “source code”.
64
-
65
-
3. **`.gitignore`**: This file tells git which files it should not track / not maintain a version history for.
66
-
67
-
4. **`.prettierrc`**: This is a configuration file for [Prettier](https://prettier.io/). Prettier is a tool to help keep the formatting of your code consistent.
68
-
69
-
5. **`gatsby-browser.js`**: This file is where Gatsby expects to find any usage of the [Gatsby browser APIs](https://www.gatsbyjs.org/docs/browser-apis/) (if any). These allow customization/extension of default Gatsby settings affecting the browser.
70
-
71
-
6. **`gatsby-config.js`**: This is the main configuration file for a Gatsby site. This is where you can specify information about your site (metadata) like the site title and description, which Gatsby plugins you’d like to include, etc. (Check out the [config docs](https://www.gatsbyjs.org/docs/gatsby-config/) for more detail).
72
-
73
-
7. **`gatsby-node.js`**: This file is where Gatsby expects to find any usage of the [Gatsby Node APIs](https://www.gatsbyjs.org/docs/node-apis/) (if any). These allow customization/extension of default Gatsby settings affecting pieces of the site build process.
74
-
75
-
8. **`gatsby-ssr.js`**: This file is where Gatsby expects to find any usage of the [Gatsby server-side rendering APIs](https://www.gatsbyjs.org/docs/ssr-apis/) (if any). These allow customization of default Gatsby settings affecting server-side rendering.
76
-
77
-
9. **`LICENSE`**: Gatsby is licensed under the MIT license.
78
-
79
-
10. **`package-lock.json`** (See `package.json` below, first). This is an automatically generated file based on the exact versions of your npm dependencies that were installed for your project. **(You won’t change this file directly).**
80
-
81
-
11. **`package.json`**: A manifest file for Node.js projects, which includes things like metadata (the project’s name, author, etc). This manifest is how npm knows which packages to install for your project.
82
-
83
-
12. **`README.md`**: A text file containing useful reference information about your project.
84
-
85
-
13. **`yarn.lock`**: [Yarn](https://yarnpkg.com/) is a package manager alternative to npm. You can use either yarn or npm, though all of the Gatsby docs reference npm. This file serves essentially the same purpose as `package-lock.json`, just for a different package management system.
61
+
1. **`/node_modules`**: This directory contains all of the modules of code that your project depends on (npm packages) are automatically installed.
62
+
63
+
2. **`/src`**: This directory will contain all of the code related to what you will see on the front-end of your site (what you see in the browser) such as your site header or a page template. `src` is a convention for “source code”.
64
+
65
+
3. **`.gitignore`**: This file tells git which files it should not track / not maintain a version history for.
66
+
67
+
4. **`.prettierrc`**: This is a configuration file for [Prettier](https://prettier.io/). Prettier is a tool to help keep the formatting of your code consistent.
68
+
69
+
5. **`gatsby-browser.js`**: This file is where Gatsby expects to find any usage of the [Gatsby browser APIs](https://www.gatsbyjs.org/docs/browser-apis/) (if any). These allow customization/extension of default Gatsby settings affecting the browser.
70
+
71
+
6. **`gatsby-config.js`**: This is the main configuration file for a Gatsby site. This is where you can specify information about your site (metadata) like the site title and description, which Gatsby plugins you’d like to include, etc. (Check out the [config docs](https://www.gatsbyjs.org/docs/gatsby-config/) for more detail).
72
+
73
+
7. **`gatsby-node.js`**: This file is where Gatsby expects to find any usage of the [Gatsby Node APIs](https://www.gatsbyjs.org/docs/node-apis/) (if any). These allow customization/extension of default Gatsby settings affecting pieces of the site build process.
74
+
75
+
8. **`gatsby-ssr.js`**: This file is where Gatsby expects to find any usage of the [Gatsby server-side rendering APIs](https://www.gatsbyjs.org/docs/ssr-apis/) (if any). These allow customization of default Gatsby settings affecting server-side rendering.
76
+
77
+
9. **`LICENSE`**: Gatsby is licensed under the MIT license.
78
+
79
+
10. **`package-lock.json`** (See `package.json` below, first). This is an automatically generated file based on the exact versions of your npm dependencies that were installed for your project. **(You won’t change this file directly).**
80
+
81
+
11. **`package.json`**: A manifest file for Node.js projects, which includes things like metadata (the project’s name, author, etc). This manifest is how npm knows which packages to install for your project.
82
+
83
+
12. **`README.md`**: A text file containing useful reference information about your project.
84
+
85
+
13. **`yarn.lock`**: [Yarn](https://yarnpkg.com/) is a package manager alternative to npm. You can use either yarn or npm, though all of the Gatsby docs reference npm. This file serves essentially the same purpose as `package-lock.json`, just for a different package management system.
86
86
87
87
## 🎓 Learning Gatsby
88
88
89
89
Looking for more guidance? Full documentation for Gatsby lives [on the website](https://www.gatsbyjs.org/). Here are some places to start:
90
90
91
-
- **For most developers, we recommend starting with our [in-depth tutorial for creating a site with Gatsby](https://www.gatsbyjs.org/tutorial/).** It starts with zero assumptions about your level of ability and walks through every step of the process.
91
+
- **For most developers, we recommend starting with our [in-depth tutorial for creating a site with Gatsby](https://www.gatsbyjs.org/tutorial/).** It starts with zero assumptions about your level of ability and walks through every step of the process.
92
92
93
-
- **To dive straight into code samples, head [to our documentation](https://www.gatsbyjs.org/docs/).** In particular, check out the _Guides_, _API Reference_, and _Advanced Tutorials_ sections in the sidebar.
93
+
- **To dive straight into code samples, head [to our documentation](https://www.gatsbyjs.org/docs/).** In particular, check out the _Guides_, _API Reference_, and _Advanced Tutorials_ sections in the sidebar.
Copy file name to clipboardExpand all lines: packages/documentation/markdown/docs/00 Quick Start/FAQ.md
+29-34Lines changed: 29 additions & 34 deletions
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,11 @@
1
1
---
2
-
path: "/docs/faq"
3
-
title: "FAQ"
2
+
path: '/docs/faq'
3
+
title: 'FAQ'
4
4
---
5
-
*New to React DnD? [Read the overview](/docs/overview) before jumping into the docs.*
6
5
7
-
FAQ
8
-
===================
6
+
_New to React DnD? [Read the overview](/docs/overview) before jumping into the docs._
7
+
8
+
# FAQ
9
9
10
10
## Usage
11
11
@@ -45,55 +45,50 @@ Because [`DragSource`](/docs/api/drag-source) and [`DropTarget`](/docs/api/drop-
45
45
46
46
When using [function components](https://facebook.github.io/react/docs/reusable-components.html#stateless-functions), the `component` parameter will always be `null` in the `beginDrag`/`endDrag`/`drop`/`hover` methods. This is because it is not possible to attach a ref to a stateless function component as explained in [the React docs](https://facebook.github.io/react/docs/reusable-components.html#stateless-functions).
47
47
48
-
49
48
```js
50
-
import { DragSource } from'react-dnd';
51
-
importflowfrom'lodash/flow';
49
+
import { DragSource } from'react-dnd'
50
+
importflowfrom'lodash/flow'
52
51
53
52
classYourComponent {
54
53
/* ... */
55
54
}
56
55
57
56
exportdefaultflow(
58
-
DragSource(/* ... */)
59
-
DropTarget(/* ... */)
60
-
)(YourComponent);
57
+
DragSource(/* ... */),
58
+
DropTarget(/* ... */),
59
+
)(YourComponent)
61
60
```
62
61
63
62
### How do I register a drop target for the native files?
64
63
65
64
If you are using the [HTML5 backend](/docs//backends/html5), you can register a drop target for one of the `NativeTypes` it exports:
It might surprise you that your route handler's `willTransitionTo` (or a similar method) won't get triggered in this case! React DnD doesn't proxy your components' static methods and properties. This is too fragile and full of edge cases, so you must do it yourself. It's not hard! Just put your statics onto the components returned by React DnD instead:
@@ -163,8 +158,8 @@ It is loosely based on the pre-React code written at Stampsy by [Andrew Kuznetso
163
158
164
159
React DnD would not have reached the 1.0 release without the generous donations from:
165
160
166
-
*[Macropod](https://macropod.com/), a company developing team productivity software;
167
-
*[Webflow](https://webflow.com/), a company creating a professional responsive website builder.
161
+
-[Macropod](https://macropod.com/), a company developing team productivity software;
162
+
-[Webflow](https://webflow.com/), a company creating a professional responsive website builder.
168
163
169
164
[Gadzhi Kharkharov](http://kkga.me/) styled the website, and the [fixed-data-table](https://github.com/facebook/fixed-data-table) project provided the website template.
0 commit comments