Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Commit

Permalink
Upgrade to Docusaurus 2 (#2268)
Browse files Browse the repository at this point in the history
Summary:
**Summary**

Fixes #2261. This should be merged after #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: #2268

Reviewed By: mrkev

Differential Revision: D18758642

Pulled By: yangshun

fbshipit-source-id: 169087f716ef2792dade75388b86debbaf34ac44
  • Loading branch information
yangshun authored and facebook-github-bot committed Dec 4, 2019
1 parent b889d5d commit 5b10191
Show file tree
Hide file tree
Showing 22 changed files with 4,898 additions and 2,965 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ script:
git config --global user.name "Travis CI"
git config --global user.email "travis@reactjs.org"
echo "machine github.com login reactjs-bot password $GITHUB_TOKEN" > ~/.netrc
cd website && yarn install && GIT_USER=reactjs-bot npm run publish-gh-pages
cd website && yarn install && GIT_USER=reactjs-bot USE_SSH=true yarn deploy
else
# Make sure the website builds without error
cd website && yarn install && yarn build
Expand Down
8 changes: 4 additions & 4 deletions docs/APIReference-ContentBlock.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ supplied text.
</li>
<li>
<a href="#getcharacterlist">
<pre>getCharacterList(): List<CharacterMetadata></pre>
<pre>getCharacterList(): List&lt;CharacterMetadata&gt;</pre>
</a>
</li>
<li>
Expand All @@ -99,7 +99,7 @@ supplied text.
</li>
<li>
<a href="#getdata">
<pre>getData(): Map<any, any></pre>
<pre>getData(): Map&lt;any, any&gt;</pre>
</a>
</li>
<li>
Expand Down Expand Up @@ -139,7 +139,7 @@ supplied text.
</li>
<li>
<a href="#characterlist">
<pre>characterList: List<CharacterMetadata></pre>
<pre>characterList: List&lt;CharacterMetadata&gt;</pre>
</a>
</li>
<li>
Expand All @@ -149,7 +149,7 @@ supplied text.
</li>
<li>
<a href="#data">
<pre>data: Map<any, any></pre>
<pre>data: Map&lt;any, any&gt;</pre>
</a>
</li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion docs/APIReference-ContentState.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ objects.
</li>
<li>
<a href="#createfromblockarray">
<pre>static createFromBlockArray(blocks: Array<ContentBlock>): ContentState</pre>
<pre>static createFromBlockArray(blocks: Array&lt;ContentBlock&gt;): ContentState</pre>
</a>
</li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion docs/Overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Draft.js allows you to build any type of rich text input, whether you're only lo

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

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

## Installation

Expand Down
21 changes: 21 additions & 0 deletions website/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Dependencies
node_modules

# Production
build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

# Logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
36 changes: 24 additions & 12 deletions website/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
Draft.js uses Docusaurus to maintain our documentation website. Please see the
[Docusaurus Documentation](https://docusaurus.io/) for more info.
# Draft.js website

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

The first time, get all the dependencies loaded via
### Installation

```bash
yarn
```
$ yarn
```

### Local Development

```
$ yarn start
```

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

Then, run the server via
### Build

```bash
npm start
Open http://localhost:3000
```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

```
$ GIT_USER=<Your GitHub username> USE_SSH=true yarn deploy
```

Anytime you change the contents, refresh the page and it's going to be updated
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.
80 changes: 0 additions & 80 deletions website/core/Footer.js

This file was deleted.

104 changes: 104 additions & 0 deletions website/docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

module.exports = {
title: 'Draft.js',
tagline: 'Rich Text Editor Framework for React',
url: 'https://draftjs.org',
baseUrl: '/',
organizationName: 'facebook',
projectName: 'draft-js',
favicon: 'img/draftjs-logo.ico',
presets: [
[
'@docusaurus/preset-classic',
{
docs: {
path: '../docs',
sidebarPath: require.resolve('./sidebars.json'),
editUrl: 'https://github.com/facebook/draft-js/edit/master/docs',
showLastUpdateAuthor: true,
showLastUpdateTime: true,
},
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
},
],
],
themeConfig: {
disableDarkMode: true,
navbar: {
title: 'Draft.js',
logo: {
alt: 'Draft.js Logo',
src: 'img/draftjs-logo.svg',
},
links: [
{to: 'docs/getting-started', label: 'Docs', position: 'right'},
{
href: 'https://github.com/facebook/draft-js',
label: 'GitHub',
position: 'right',
},
],
},
algolia: {
apiKey: 'ae94c9e3ee00ea8edddd484adafc37cd',
indexName: 'draft-js',
},
googleAnalytics: {
trackingID: 'UA-44373548-19',
},
footer: {
style: 'dark',
links: [
{
title: 'Docs',
items: [
{
label: 'Getting Started',
to: 'docs/getting-started',
},
{
label: 'API Reference',
to: 'docs/api-reference-editor',
},
],
},
{
title: 'Community',
items: [
{
label: 'Stack Overflow',
href: 'https://stackoverflow.com/questions/tagged/draftjs',
},
{
label: 'Twitter',
href: 'https://twitter.com/draft_js',
},
],
},
{
title: 'More',
items: [
{
label: 'GitHub',
href: 'https://github.com/facebook/draft-js',
},
],
},
],
logo: {
alt: 'Facebook Open Source Logo',
src: '/img/oss_logo.png',
href: 'https://opensource.facebook.com/',
},
copyright: `Copyright © ${new Date().getFullYear()} Facebook, Inc.`,
},
},
};
Loading

0 comments on commit 5b10191

Please sign in to comment.