forked from lingjieee/fantasy-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ed9ae07
Showing
272 changed files
with
20,243 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/dist | ||
/lib | ||
/es | ||
|
||
/examples/dist | ||
/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module.exports = { | ||
env: { | ||
browser: true, | ||
}, | ||
parser: '@typescript-eslint/parser', | ||
extends: [ | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:react/recommended', | ||
'plugin:prettier/recommended', | ||
'prettier/@typescript-eslint', | ||
], | ||
plugins: ['@typescript-eslint', 'react', 'prettier'], | ||
rules: { | ||
'@typescript-eslint/explicit-function-return-type': 0, | ||
'@typescript-eslint/no-empty-function': 0, | ||
'@typescript-eslint/no-empty-interface': 0, | ||
'@typescript-eslint/no-explicit-any': 0, | ||
'react/prop-types': 0, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.DS_Store | ||
|
||
/node_modules | ||
|
||
/dist | ||
/lib | ||
/es | ||
|
||
.umi | ||
.umi-production | ||
.env.local | ||
|
||
.eslintcache | ||
/examples/dist | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
/.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.DS_Store | ||
/.idea | ||
/docs | ||
/examples | ||
/scripts | ||
/src | ||
.eslintignore | ||
.eslintrc.js | ||
.prettierignore | ||
.prettierrc.js | ||
.umirc.ts | ||
babel.config.js | ||
tsconfig.cjs.json | ||
tsconfig.json | ||
yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/examples/**/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
printWidth: 120, | ||
singleQuote: true, | ||
trailingComma: 'all', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { defineConfig } from 'dumi'; | ||
|
||
export default defineConfig({ | ||
mode: 'site', | ||
logo: 'https://cdn-blog.jieee.xyz/img/fe-128.png', | ||
title: 'Fantasy Editor', | ||
favicon: 'https://cdn-blog.jieee.xyz/img/fe-24.ico', | ||
navs: [ | ||
null, | ||
{ | ||
title: 'GitHub', | ||
path: 'https://github.com/lingjieee/fantasy-editor', | ||
}, | ||
{ | ||
title: 'Changelog', | ||
path: 'https://github.com/lingjieee/fantasy-editor/blob/master/CHANGELOG.md', | ||
}, | ||
], | ||
exportStatic: {}, | ||
styles: [], | ||
scripts: [], | ||
externals: {}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module.exports = function(api) { | ||
api.cache(true); | ||
|
||
const presets = [ | ||
[ | ||
'@babel/preset-env', | ||
{ | ||
loose: true, | ||
modules: false, | ||
}, | ||
], | ||
'@babel/preset-react', | ||
]; | ||
|
||
const plugins = ['lodash']; | ||
|
||
return { | ||
presets, | ||
plugins, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
title: Demo | ||
group: | ||
title: DD | ||
order: 1 | ||
--- | ||
|
||
<code src="../../examples/demo" compact/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
title: FullUsage | ||
group: | ||
title: Core | ||
order: 1 | ||
--- | ||
|
||
<code src="../../examples/full" compact/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
title: 快速上手 | ||
group: | ||
title: 指南 | ||
order: 0 | ||
nav: | ||
title: 指南 | ||
--- | ||
|
||
## 安装 | ||
|
||
### npm | ||
|
||
```bash | pure | ||
npm install fantasy-editor --save | ||
``` | ||
|
||
### umd | ||
|
||
```html | pure | ||
<script src="https://unpkg.com/fantasy-editor@${version}/dist/index.js"></script> | ||
``` | ||
|
||
## 示例 | ||
|
||
```bash | pure | ||
# 克隆仓库 | ||
$ git clone https://github.com/lingjieee/fantasy-editor.git | ||
|
||
# 切换目录 | ||
$ cd fantasy-editor | ||
|
||
# 安装依赖 | ||
$ yarn install | ||
|
||
# 运行示例 | ||
$ yarn start | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
title: Fantasy Editor - A React Rich Text Editor Based On Slate | ||
hero: | ||
title: Fantasy Editor | ||
desc: A React Rich Text Editor Based On Slate | ||
actions: | ||
- text: Getting Started | ||
link: /guide/getting-started | ||
footer: Open-source MIT Licensed | Copyright © 2020<br />Powered by [dumi](https://d.umijs.org) | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
import React, { FunctionComponent } from 'react'; | ||
|
||
interface OwnProps {} | ||
|
||
type Props = OwnProps; | ||
|
||
const Demo: FunctionComponent<Props> = (props) => { | ||
|
||
return ( | ||
<div> | ||
demo | ||
</div> | ||
); | ||
}; | ||
|
||
export default Demo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React, {FunctionComponent, useState} from 'react'; | ||
import initValue from './value.json'; | ||
import {Node} from 'slate'; | ||
import FantasyEditor from "fantasy-editor"; | ||
import {Config} from "../../src"; | ||
|
||
interface OwnProps { | ||
} | ||
|
||
type Props = OwnProps; | ||
|
||
const FullUsage: FunctionComponent<Props> = (props) => { | ||
|
||
const [value, setValue] = useState<Node[]>(initValue as any); | ||
const config: Config = { | ||
plugin: { | ||
undo: true, | ||
redo: true, | ||
heading: true, | ||
fontSize: true, | ||
bold: true, | ||
italic: true, | ||
underline: true, | ||
strikeThrough: true, | ||
blockquote: true, | ||
subscript: true, | ||
superscript: true, | ||
fontColor: true, | ||
backgroundColor: true, | ||
align: true, | ||
code: true, | ||
codeBlock: true, | ||
list: true, | ||
ident: true, | ||
link: true, | ||
image: true, | ||
file: true, | ||
hr: true, | ||
table: true, | ||
lineHeight: true, | ||
full: true, | ||
}, | ||
}; | ||
|
||
const onChange = (value: Node[]) => { | ||
setValue(value); | ||
}; | ||
|
||
return ( | ||
<div style={{padding: 50}}> | ||
<FantasyEditor value={value} config={config} onChange={onChange}/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default FullUsage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[ | ||
{ | ||
"type": "paragraph", | ||
"children": [{ "text": "hello" }] | ||
}, | ||
{ | ||
"type": "paragraph", | ||
"children": [ | ||
{ | ||
"type": "file", | ||
"filename": "测试.pdf", | ||
"url": "https://www.baidu.com/test.pdf", | ||
"children": [{ "text": "" }] | ||
}, | ||
{ | ||
"type": "file", | ||
"filename": "测试.pdf", | ||
"url": "https://www.baidu.com/test.txt", | ||
"children": [{ "text": "" }] | ||
}, | ||
{ | ||
"text": "xxxx" | ||
} | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"compilerOptions": { | ||
"allowSyntheticDefaultImports": true, | ||
"module": "esnext", | ||
"moduleResolution": "node", | ||
"target": "esnext", | ||
"jsx": "react", | ||
"noImplicitThis": true, | ||
"strictBindCallApply": true, | ||
"baseUrl": ".", | ||
"sourceMap": true, | ||
} | ||
} |
Oops, something went wrong.