简体   繁体   English

Markdown 预览项目中的编辑器在我下载“标记”后无法正常工作

[英]Editor in Markdown Preview project not working after I downloaded 'Marked'

Trying to make a Markdown Previewer for a freeCodeCamp project.尝试为 freeCodeCamp 项目制作 Markdown 预览器。 My editor was working fine, but now I can't update the markdown in my state;我的编辑器工作正常,但现在我无法更新 state 中的 markdown; it's stuck on the placeholder text I wrote.它卡在我写的占位符文本上。 Whenever I try to type in the editor textarea, it sends my cursor to the bottom of the text box.每当我尝试在编辑器文本区域中输入时,它都会将我的 cursor 发送到文本框的底部。 Editor is supposed to just accept an event using a handleChange method, and I cannot figure out why it's not working for the life of me.编辑器应该只接受使用 handleChange 方法的事件,我无法弄清楚为什么它对我的生活不起作用。 Worked fine until I downloaded Marked.在我下载 Marked 之前工作正常。 Here's a link to the CodePen where I'm fiddling with it.这是我正在摆弄的 CodePen 的链接 The onChange function is pretty standard. onChange function 非常标准。 handleChange(event) {this.setState({markdown: event.target.value})};

Update: found out the problem.更新:发现问题。 Figured out I needed to set the markdown as the defaultValue prop, not the value prop.发现我需要将 markdown 设置为 defaultValue 道具,而不是 value 道具。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM