Skip to content

Commit 1f33a8c

Browse files
committed
feat: updated docs
1 parent 69df1fc commit 1f33a8c

File tree

13 files changed

+26
-322
lines changed

13 files changed

+26
-322
lines changed

docs/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
ReactPage is a smart, extensible and modern editor ("WYSIWYG") for the web written in React. If you are fed up with the limitations of `contenteditable`, you are in the right place.
88

9-
<img width="60%" alt="ReactPage Demo" src="images/quick-example.gif">
9+
<a href="..">Check out the demo here</a>
1010

1111
## Philosophy
1212

docs/_sidebar.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- docs/_sidebar.md -->
22

3-
- [Home](//)
3+
- [Home](/)
44
- [Getting started](/quick-start.md)
55
- [`<Editor />`](/editor.md)
66
- [Rich text editing](/slate.md)
@@ -11,4 +11,3 @@
1111
- [SSR](/server-side-rendering.md)
1212
- [Bundle size](/bundle-size.md)
1313
- [IE11](/ie11.md)
14-

docs/examples

-1
This file was deleted.

docs/examples/pages

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../examples/pages

docs/examples/plugins

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../examples/plugins

docs/quick-start.md

+1-6
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@ $ yarn add @react-page/plugins-slate
1616
$ npm i --save @react-page/plugins-slate
1717
```
1818

19-
2019
## Simple example
2120

2221
To get off the ground as soon as possible, simply create a component like so:
2322

2423
[simple.tsx](examples/pages/examples/simple.tsx ':include :type=code typescript')
2524

26-
That's it, congratulations!
25+
That's it, congratulations!
2726

2827
[You should see something like this now (click for the demo)](//demo/simple)
2928

@@ -35,10 +34,6 @@ Simply provide a `readOnly={true}` prop to your editor.
3534

3635
We won't load any UI related code unless readOnly changes to `false`. In this case, the ui will be lazy loaded if your bundler supports that (e.g. webpack)
3736

38-
3937
[simple.tsx](examples/pages/examples/readonly.tsx ':include :type=code typescript')
4038

4139
(see demo here)](//demo/readonly)
42-
43-
44-

docs/slate.md

+5-14
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@ We provide an advanced rich text editor as a `CellPlugin` based on [slate](http:
22

33
It has to be installed separatly:
44

5-
65
```bash
76
$ yarn add @react-page/plugins-slate
87
# OR
98
$ npm i --save @react-page/plugins-slate
109
```
1110

12-
1311
<p>
1412
<figure align="center">
1513
<img alt="Text editing plugin" src="./images/text-editing-plugin.gif"><br>
@@ -36,23 +34,21 @@ By default we provide the following plugins:
3634

3735
[See the full list here](/packages/plugins/content/slate/plugins/index.tsx)
3836

39-
4037
## Customization
4138

42-
the slate plugin itself is highly customizable and has even itself its own plugin sytem!
43-
Not only can you perfectly control how any paragraph, headline or other markup is rendereed,
39+
the slate plugin itself is highly customizable and has even itself its own plugin sytem!
40+
Not only can you perfectly control how any paragraph, headline or other markup is rendereed,
4441
you can also add custom plugins with their own control.
4542

46-
A common example is to create internal links, where the pages are stored in a database. Instead of asking for the full url,
47-
the user will see a select field of all pages. When the user makes a selection, ReactPage will only store the id of that page.
43+
A common example is to create internal links, where the pages are stored in a database. Instead of asking for the full url,
44+
the user will see a select field of all pages. When the user makes a selection, ReactPage will only store the id of that page.
4845
That way the links will still be valid when the page is moved or renamed.
4946

5047
Another example: if you create a landing page for an ecomerce project, you can enable the webmasters
5148
that will edit this landing page to create links to products from your shop.
5249

5350
To create a customized slate plugin, call it with a function that changes its default configuration:
5451

55-
5652
```typescript
5753
import Editor from '@react-page/editor';
5854
import slate from '@react-page/plugins-slate';
@@ -124,7 +120,6 @@ const slatePlugin = slate(def => ({
124120
125121
Notice: `yourCustomNamespace` and `myCustomPlugin` can be named arbitrary. Typescript users will find the existing type definition on def.plugins usefull to see which plugins do exist.
126122
127-
128123
### Create your own custom plugin
129124
130125
If you want to create your own slate plugin, we provide a bunch of factory functions to help you with that:
@@ -137,11 +132,8 @@ If you want to create your own slate plugin, we provide a bunch of factory funct
137132
138133
```typescript
139134
import { pluginFactories } from '@react-page/plugins-slate';
140-
141135
```
142136
143-
144-
145137
### Slate-Plugins with custom data
146138
147139
Some plugins require custom data that the user has to provide. E.g. the `link` plugin needs a `href: string`. Easiest way is to define a jsonSchema for your slate plugin. This will auto-generate a form that can update your plugin.
@@ -300,7 +292,6 @@ const infobox: CellPlugin = {
300292
onChange={save} />
301293
```
302294
303-
304295
### Examples
305296
306297
#### Example: Simple color plugin
@@ -309,4 +300,4 @@ const infobox: CellPlugin = {
309300
310301
#### Example: Katex plugin
311302
312-
[katexSlatePlugin.tsx](examples/plugins/katexSlatePlugin.tsx ':include :type=code typescript')
303+
[katexSlatePlugin.tsx](examples/plugins/katexSlatePlugin.tsx ':include :type=code typescript')

examples/components/Navigation.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ const Navigation: React.FC = () => {
1717
<div>
1818
<div className={classes.toolbar} />
1919
<Divider />
20+
21+
<ListItem component="a" href="/docs">
22+
<ListItemText primary={'Docs'} />
23+
</ListItem>
24+
2025
<Link passHref href="/">
2126
<ListItem component="a">
2227
<ListItemText primary={'Home'} />

examples/next.config.js

+8
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,12 @@ module.exports = {
44
? '/'
55
: '/' + process.env.RELEASE_CHANNEL
66
: undefined,
7+
async rewrites() {
8+
return [
9+
{
10+
source: '/docs',
11+
destination: '/docs/index.html',
12+
},
13+
];
14+
},
715
};

examples/public/docs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../docs/

examples/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"jsx": "preserve"
1616
},
1717
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
18-
"exclude": ["node_modules"],
18+
"exclude": ["node_modules", "build", "public"],
1919
"references": [
2020
{
2121
"path": "../packages/editor"

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
"cross-env": "^5.2.0",
3030
"docsify": "^4.11.6",
3131
"docsify-cli": "^4.4.2",
32-
3332
"enzyme": "^3.11.0",
3433
"enzyme-adapter-react-16": "1.7.1",
3534
"eslint": "^7.1.0",
@@ -59,7 +58,7 @@
5958
"unexpected": "^11.14.0"
6059
},
6160
"scripts": {
62-
"start:docs": "docsify serve -p 3100 ./docs",
61+
"docs": "docsify serve -p 3100 ./docs",
6362
"coveralls": "cat ./coverage/lcov.info | coveralls",
6463
"bootstrap": "lerna bootstrap",
6564
"build": "cross-env NODE_ENV=production lerna run build --stream",

0 commit comments

Comments
 (0)