1.1.4 • Published 2 years 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
2 years ago
1.1.2
2 years ago
1.1.1
3 years ago
1.1.0
3 years ago
1.0.7
3 years ago
1.0.6
3 years ago
1.0.5
3 years ago
1.0.4
3 years ago
1.0.3
3 years ago
1.0.2
3 years ago
0.1.30
3 years ago
1.0.1
3 years ago
1.0.0
3 years ago
0.1.10
3 years ago
0.1.11
3 years ago
0.1.12
3 years ago
0.1.13
3 years ago
0.1.14
3 years ago
0.1.15
3 years ago
0.1.27
3 years ago
0.1.28
3 years ago
0.1.29
3 years ago
0.1.20
3 years ago
0.1.21
3 years ago
0.1.22
3 years ago
0.1.23
3 years ago
0.1.24
3 years ago
0.1.25
3 years ago
0.1.26
3 years ago
0.1.0
3 years ago
0.1.2
3 years ago
0.1.16
3 years ago
0.1.8
3 years ago
0.1.17
3 years ago
0.1.7
3 years ago
0.1.18
3 years ago
0.1.19
3 years ago
0.1.9
3 years ago
0.1.4
3 years ago
0.0.5
3 years ago
0.0.4
3 years ago
0.1.5
3 years ago
0.0.3
3 years ago
0.0.1
3 years ago