uiwjs / react-md-editor

A simple markdown editor with preview, implemented with React.js and TypeScript.
https://uiwjs.github.io/react-md-editor
MIT License
2.03k stars 149 forks source link

toolbar只使用部分功能 #611

Closed nanqic closed 6 months ago

nanqic commented 6 months ago

感谢开源贡献者。 我想只保留部分toolbar图标,必须像demo这么复杂吗?https://uiwjs.github.io/react-md-editor/#custom-toolbars 有没有一个简单的配置,只启用或关闭不用的功能,这样打包体积是不是也小一点。

nanqic commented 6 months ago

用默认的配置,打包体积1M,有办法优化吗? dist/assets/mdEditor-teGtT9UY.js 1,041.59 kB

jaywcjlove commented 6 months ago

@nanqic 你的两个问题

  1. 自定义配置 toolbar ,官方示例在官方文档

https://github.com/uiwjs/react-md-editor/blob/c7d5acdf26e437973b826e914fb7b15493641c43/core/src/commands/index.ts#L90-L116

  1. 体积大的原因,是里面集成了编程语言代码高亮,改变导入方式 import MDEditor from '@uiw/react-md-editor/nohighlight'; 移除代码高亮,自己自定义,根据自己的需要引入代码高亮

https://github.com/uiwjs/react-md-editor/blob/c7d5acdf26e437973b826e914fb7b15493641c43/core/README.md?plain=1#L140-L166

nanqic commented 5 months ago

已解决,感谢您的回复!