工学1号馆

home

UEditor在html状态下无法修改内容解决办法

Wu Yudong    July 13, 2019     HTML5+CSS3   778   

这个问题也是在无意之中发现的,后台编辑文章的时候需要切换到html状态下,然后保存的时候发现内容并没有更新,但是在其他模式下是可以正常保存的,其实加入以下js代码即可搞定:

$('#save').click(function(){ //save为按钮id值
	if(UE.getEditor("myEditor").queryCommandState('source')!=0)  
         //myEditor为uedit的id值
	UE.getEditor("myEditor").execCommand('source'); 
});

 

如果文章对您有帮助,欢迎点击下方按钮打赏作者

Comments

No comments yet.
To verify that you are human, please fill in "七"(required)