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.15k stars 155 forks source link

自适应高度时,切到preview模式,高度没了 #631

Open Somnus007 opened 5 months ago

jaywcjlove commented 5 months ago

@Somnus007 如果你提供可重现错误的示例,我可以免费帮你看一下

Somnus007 commented 5 months ago

你的demo页面就有这个问题,请看: https://uiwjs.github.io/react-md-editor/#editor-height-adapts-to-text

截屏2024-04-12 20 48 49
Somnus007 commented 5 months ago

MDEditor 加了 height="100%"属性,编辑器的高度就没了。 我主要是想根据文字多少实现编辑器的高度自适应,按照你上面那个链接里做的,结果没成功...

jaywcjlove commented 5 months ago

@Somnus007 Example: https://codesandbox.io/embed/markdown-editor-for-react-https-github-com-uiwjs-react-md-editor-issues-480-0ttkoe?fontsize=14&hidenavigation=1&theme=dark

Somnus007 commented 5 months ago

谢谢 🙏

我好像看到问题在哪里了,从nohighlight引入的MDEditer有我说的那个问题: import MDEditor, { commands } from "@uiw/react-md-editor/nohighlight";

但是,从 @uiw/react-md-editor 引入的 MDEditor,仍然会在 preview="preview" 时出现丢失高度的问题,就像我上面截图的那样 https://github.com/uiwjs/react-md-editor/issues/631#issuecomment-2051700948

截屏2024-04-12 22 34 30
jaywcjlove commented 5 months ago

@Somnus007 排查一下 节点的高度