♏ 一款浏览器端的 Markdown 编辑器,支持所见即所得(富文本)、即时渲染(类似 Typora)和分屏预览模式。An In-browser Markdown editor, support WYSIWYG (Rich Text), Instant Rendering (Typora-like) and Split View modes.
8.09k
stars
844
forks
source link
引入antd css , 编辑器内全选长文本 删除 会卡顿,如果没有引入,则很丝滑 #1626
Closed
xppcnn closed 2 months ago
import Vditor from "vditor"; import "vditor/dist/index.css"; import "antd/dist/antd.css"; const App = () => { const [vd, setVd] = useState();
useEffect(() => {
const vditor = new Vditor("vditor", {
after: () => {
vditor.setValue("
Vditor
最小代码示例"); setVd(vditor); }, }); // Clear the effect return () => { vd?.destroy(); setVd(undefined); }; }, []); return ; };export default App;
{ "name": "vditor-react-minimal-example", "version": "1.0.0", "description": "", "keywords": [], "main": "src/index.tsx", "dependencies": { "react": "18.2.0", "react-dom": "18.2.0", "react-scripts": "5.0.1", "vditor": "3.9.8", "antd": "4.10.2" }, "devDependencies": { "@types/react": "18.2.48", "@types/react-dom": "18.2.18", "typescript": "5.3.3" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject" }, "browserslist": [">0.2%", "not dead", "not ie <= 11", "not op_mini all"] }