1.1.4 • Published 11 months ago
kedao v1.1.4
Kedao(刻刀) 编辑器
kedao 是一个基于 braft-editor 修改而来的前端编辑器,底层基于 draft-js。
在 Braft-Editor 的基础之上,kedao 做了一些改进工作,如:
- 重构了 braft-editor 的多个工程,合并成一个大工程,并修改构建产物,从原来的 webpack 打包后的 bundle,改成源码打包。
- 升级了依赖包和工具链的版本。
- 改成 Typescript 语言,添加类型定义,方便使用。
安装
npm i kedao
使用
import React, { useState } from "react";
import Editor, {
EditorState,
convertRawToEditorState,
convertEditorStateToRaw,
} from "kedao";
import { useLocalStorage } from "react-use";
function App() {
const [value, setValue] = useLocalStorage(
"kedao-state",
convertEditorStateToRaw(EditorState.createEmpty())
);
const [editorState, setEditorState] = useState(
convertRawToEditorState(value)
);
const handleChange = (newEditorState: EditorState) => {
setEditorState(newEditorState);
setValue(convertEditorStateToRaw(newEditorState));
};
return (
<div className="App">
<Editor value={editorState} onChange={handleChange} />
</div>
);
}
export default App;
更多示例参见 examples
贡献
欢迎任何方式的贡献,issue、文档、翻译等。
文档
更多文档见组件官网:https://kedao.vercel.app
1.1.4
11 months ago
1.1.2
11 months ago
1.1.1
1 year ago
1.1.0
2 years ago
1.0.7
2 years ago
1.0.6
2 years ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.3
2 years ago
1.0.2
2 years ago
0.1.30
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago
0.1.10
2 years ago
0.1.11
2 years ago
0.1.12
2 years ago
0.1.13
2 years ago
0.1.14
2 years ago
0.1.15
2 years ago
0.1.27
2 years ago
0.1.28
2 years ago
0.1.29
2 years ago
0.1.20
2 years ago
0.1.21
2 years ago
0.1.22
2 years ago
0.1.23
2 years ago
0.1.24
2 years ago
0.1.25
2 years ago
0.1.26
2 years ago
0.1.0
2 years ago
0.1.2
2 years ago
0.1.16
2 years ago
0.1.8
2 years ago
0.1.17
2 years ago
0.1.7
2 years ago
0.1.18
2 years ago
0.1.19
2 years ago
0.1.9
2 years ago
0.1.4
2 years ago
0.0.5
2 years ago
0.0.4
2 years ago
0.1.5
2 years ago
0.0.3
2 years ago
0.0.1
2 years ago