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

Upgrade to Docusaurus 2 #2268

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the new deploy command in Docusaurus v2

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>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately we use MDX (JSX in Markdown) now so it thinks <CharacterMetadata> is a React component and I have to change it to use the character entity references.

</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