You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 8, 2019. It is now read-only.
本来想通过设置div元素contenteditable=true来制作markdown编辑器的,textarea无法自适应,写多了有滚动条。但contenteditable方法也有缺陷,考虑到div元素没有onChange事件绑定,如何获取
<div>hello</div>中的文本节点呢?(这个文本是我需要的)我是设想在componentDidMount后,通过findDOMNode来获取真实节点:通过DOMSubtreeModified事件监听文本的变化抽取e.target.nodeValue(注意,不是e.target.value,与react不同,可以console看一下e对象)。问题是,当我在编辑的时候连续输入还好,一旦回车后,就会发生这样的事:
产生了
<div><br/></div>这样的结构,百思不得其解,这样我就无法抽取nodeValue了。放弃了。。先用textare凑个数,以后再研究。