liuhong1happy / react-umeditor

React Editor like Umeditor
MIT License
279 stars 77 forks source link

解决在其他页面触发了setState操作 #38

Closed dlyt closed 7 years ago

dlyt commented 7 years ago

window.addEventListener("mousedown", this.handleWindowMouseDown.bind(this)) window.removeEventListener("mousedown",this.handleWindowMouseDown.bind(this)) 因为bind会创建一个新函数,所以add的是一个新函数,remove的是一个新函数。它俩并不是一个函数。 继而没有remove掉add的event。 现在换成 window.addEventListener("mousedown", this.handleWindowMouseDown) window.removeEventListener("mousedown", this.handleWindowMouseDown) add和remove的同一个函数。 但是在add的时候需要将this传过去,所以需要加上 this.handleWindowMouseDown = this.handleWindowMouseDown.bind(this)

liuhong1happy commented 7 years ago

lib目录是打包混淆过后的,能否修改src目录下相应文件,build之后再pr呐?@dlyt