Skip to content

Commit 4710a8f

Browse files
yangshunmmissey
authored andcommitted
Upgrade to Docusaurus 2 (facebookarchive#2268)
Summary: **Summary** Fixes facebookarchive#2261. This should be merged after facebookarchive#2267 (how I wish there were stacked diffs on GitHub) Migrate the website to Docusaurus 2 which provides the following benefits specific to Draft.js: - Consistency with the other FB Docusaurus websites - Easy way to import Draft.js (bundle via webpack, no more ugly client-side script tags) - Nicer CSS framework - Dark mode (disabled for now until I sort out the dark mode styling for the editor) Changes made: - I also changed the theme color of Draft.js to be lighter brown so that the contrast is better in general (much better on dark mode). Let me know if this is not ok. **Test Plan** <img width="1552" alt="Screen Shot 2019-11-30 at 9 16 32 PM" src="https://user-images.githubusercontent.com/1315101/69909874-bc28fd80-13b6-11ea-90bb-c6b44a1186a5.png"> <img width="1552" alt="Screen Shot 2019-11-30 at 9 16 39 PM" src="https://user-images.githubusercontent.com/1315101/69909875-bcc19400-13b6-11ea-9eda-c6eabfc4fde4.png"> Try it out here - https://build-swart-eight.now.sh Pull Request resolved: facebookarchive#2268 Reviewed By: mrkev Differential Revision: D18758642 Pulled By: yangshun fbshipit-source-id: 169087f716ef2792dade75388b86debbaf34ac44
1 parent b14a1d1 commit 4710a8f

22 files changed

+4898
-2965
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ script:
4949
git config --global user.name "Travis CI"
5050
git config --global user.email "[email protected]"
5151
echo "machine github.com login reactjs-bot password $GITHUB_TOKEN" > ~/.netrc
52-
cd website && yarn install && GIT_USER=reactjs-bot npm run publish-gh-pages
52+
cd website && yarn install && GIT_USER=reactjs-bot USE_SSH=true yarn deploy
5353
else
5454
# Make sure the website builds without error
5555
cd website && yarn install && yarn build

docs/APIReference-ContentBlock.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ supplied text.
7474
</li>
7575
<li>
7676
<a href="#getcharacterlist">
77-
<pre>getCharacterList(): List<CharacterMetadata></pre>
77+
<pre>getCharacterList(): List&lt;CharacterMetadata&gt;</pre>
7878
</a>
7979
</li>
8080
<li>
@@ -99,7 +99,7 @@ supplied text.
9999
</li>
100100
<li>
101101
<a href="#getdata">
102-
<pre>getData(): Map<any, any></pre>
102+
<pre>getData(): Map&lt;any, any&gt;</pre>
103103
</a>
104104
</li>
105105
<li>
@@ -139,7 +139,7 @@ supplied text.
139139
</li>
140140
<li>
141141
<a href="#characterlist">
142-
<pre>characterList: List<CharacterMetadata></pre>
142+
<pre>characterList: List&lt;CharacterMetadata&gt;</pre>
143143
</a>
144144
</li>
145145
<li>
@@ -149,7 +149,7 @@ supplied text.
149149
</li>
150150
<li>
151151
<a href="#data">
152-
<pre>data: Map<any, any></pre>
152+
<pre>data: Map&lt;any, any&gt;</pre>
153153
</a>
154154
</li>
155155
</ul>

docs/APIReference-ContentState.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ objects.
2828
</li>
2929
<li>
3030
<a href="#createfromblockarray">
31-
<pre>static createFromBlockArray(blocks: Array<ContentBlock>): ContentState</pre>
31+
<pre>static createFromBlockArray(blocks: Array&lt;ContentBlock&gt;): ContentState</pre>
3232
</a>
3333
</li>
3434
</ul>

docs/Overview.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Draft.js allows you to build any type of rich text input, whether you're only lo
1010

1111
Draft.js was introduced at [React.js Conf](https://conf2016.reactjs.org/schedule#rich-text-editing-with-react) in February 2016.
1212

13-
<iframe width="650" height="365" src="https://www.youtube.com/embed/feUYwoLhE_4" frameborder="0" allowfullscreen></iframe>
13+
<iframe width="100%" height="365" src="https://www.youtube.com/embed/feUYwoLhE_4" frameBorder="0" allowFullScreen></iframe>
1414

1515
## Installation
1616

website/.gitignore

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Dependencies
2+
node_modules
3+
4+
# Production
5+
build
6+
7+
# Generated files
8+
.docusaurus
9+
.cache-loader
10+
11+
# Misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
# Logs
19+
npm-debug.log*
20+
yarn-debug.log*
21+
yarn-error.log*

website/README.md

+24-12
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,33 @@
1-
Draft.js uses Docusaurus to maintain our documentation website. Please see the
2-
[Docusaurus Documentation](https://docusaurus.io/) for more info.
1+
# Draft.js website
32

4-
# Run the server
3+
This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.
54

6-
The first time, get all the dependencies loaded via
5+
### Installation
76

8-
```bash
9-
yarn
7+
```
8+
$ yarn
9+
```
10+
11+
### Local Development
12+
13+
```
14+
$ yarn start
1015
```
1116

12-
in the root directory.
17+
This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server.
1318

14-
Then, run the server via
19+
### Build
1520

16-
```bash
17-
npm start
18-
Open http://localhost:3000
21+
```
22+
$ yarn build
23+
```
24+
25+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
26+
27+
### Deployment
28+
29+
```
30+
$ GIT_USER=<Your GitHub username> USE_SSH=true yarn deploy
1931
```
2032

21-
Anytime you change the contents, refresh the page and it's going to be updated
33+
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.

website/core/Footer.js

-80
This file was deleted.

website/docusaurus.config.js

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
module.exports = {
9+
title: 'Draft.js',
10+
tagline: 'Rich Text Editor Framework for React',
11+
url: 'https://draftjs.org',
12+
baseUrl: '/',
13+
organizationName: 'facebook',
14+
projectName: 'draft-js',
15+
favicon: 'img/draftjs-logo.ico',
16+
presets: [
17+
[
18+
'@docusaurus/preset-classic',
19+
{
20+
docs: {
21+
path: '../docs',
22+
sidebarPath: require.resolve('./sidebars.json'),
23+
editUrl: 'https://github.com/facebook/draft-js/edit/master/docs',
24+
showLastUpdateAuthor: true,
25+
showLastUpdateTime: true,
26+
},
27+
theme: {
28+
customCss: require.resolve('./src/css/custom.css'),
29+
},
30+
},
31+
],
32+
],
33+
themeConfig: {
34+
disableDarkMode: true,
35+
navbar: {
36+
title: 'Draft.js',
37+
logo: {
38+
alt: 'Draft.js Logo',
39+
src: 'img/draftjs-logo.svg',
40+
},
41+
links: [
42+
{to: 'docs/getting-started', label: 'Docs', position: 'right'},
43+
{
44+
href: 'https://github.com/facebook/draft-js',
45+
label: 'GitHub',
46+
position: 'right',
47+
},
48+
],
49+
},
50+
algolia: {
51+
apiKey: 'ae94c9e3ee00ea8edddd484adafc37cd',
52+
indexName: 'draft-js',
53+
},
54+
googleAnalytics: {
55+
trackingID: 'UA-44373548-19',
56+
},
57+
footer: {
58+
style: 'dark',
59+
links: [
60+
{
61+
title: 'Docs',
62+
items: [
63+
{
64+
label: 'Getting Started',
65+
to: 'docs/getting-started',
66+
},
67+
{
68+
label: 'API Reference',
69+
to: 'docs/api-reference-editor',
70+
},
71+
],
72+
},
73+
{
74+
title: 'Community',
75+
items: [
76+
{
77+
label: 'Stack Overflow',
78+
href: 'https://stackoverflow.com/questions/tagged/draftjs',
79+
},
80+
{
81+
label: 'Twitter',
82+
href: 'https://twitter.com/draft_js',
83+
},
84+
],
85+
},
86+
{
87+
title: 'More',
88+
items: [
89+
{
90+
label: 'GitHub',
91+
href: 'https://github.com/facebook/draft-js',
92+
},
93+
],
94+
},
95+
],
96+
logo: {
97+
alt: 'Facebook Open Source Logo',
98+
src: '/img/oss_logo.png',
99+
href: 'https://opensource.facebook.com/',
100+
},
101+
copyright: `Copyright © ${new Date().getFullYear()} Facebook, Inc.`,
102+
},
103+
},
104+
};

0 commit comments

Comments
 (0)