GithubHelp home page GithubHelp logo

Comments (3)

jaywcjlove avatar jaywcjlove commented on June 16, 2024 1

@nanqic 你的两个问题

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

const getCommands: () => ICommand[] = () => [
bold,
italic,
strikethrough,
hr,
group([title1, title2, title3, title4, title5, title6], {
name: 'title',
groupName: 'title',
buttonProps: { 'aria-label': 'Insert title', title: 'Insert title' },
}),
divider,
link,
quote,
code,
codeBlock,
comment,
image,
table,
divider,
unorderedListCommand,
orderedListCommand,
checkedListCommand,
divider,
help,
];
const getExtraCommands: () => ICommand[] = () => [codeEdit, codeLive, codePreview, divider, fullscreen];

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

### Remove Code Highlight
The following example can help you _exclude code highlighting code_<!--rehype:style=color: #333;background-color: rgb(196 255 122 / 86%);--> from being included in the bundle. `@uiw/react-md-editor/nohighlight`<!--rehype:style=color: #e24444;--> component does not contain the ~~`rehype-prism-plus`~~ code highlighting package, ~~`highlightEnable`~~, ~~`showLineNumbers`~~ and ~~`highlight line`~~ functions will no longer work. ([#586](https://github.com/uiwjs/react-md-editor/issues/586))
```jsx mdx:preview
import React from "react";
import MDEditor from '@uiw/react-md-editor/nohighlight';
const code = `**Hello world!!!**
\`\`\`js
function demo() {}
\`\`\`
`
export default function App() {
const [value, setValue] = React.useState(code);
return (
<div className="container">
<MDEditor
value={value}
onChange={setValue}
/>
<MDEditor.Markdown source={value} style={{ whiteSpace: 'pre-wrap' }} />
</div>
);
}
```

from react-md-editor.

nanqic avatar nanqic commented on June 16, 2024

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

from react-md-editor.

nanqic avatar nanqic commented on June 16, 2024

已解决,感谢您的回复!

from react-md-editor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.