ueditor:Cannot read property 'offsetWidth' of null

我自己出现这个问题的时候是这样的:

我先是在页面上这样引用ueditor:

<script id="editor_4" type="text/plain" style="100%;height:500px;"></script>

然后实例化:

var ue4 = UE.getEditor('editor_4');

所以,页面上成功出现了一个编辑器的界面,但是在获取编辑器里面的值的时候,就报错了:

Cannot read property 'offsetWidth' of null 

因为,我是这样写的:

var ProjectEnvironmental =  UE.getEditor('ue4').getAllHtml()

错误的原因就是,我在UE.getEditor('ue4'),里面的值不是ue4,而是那个id,editor_4

原文地址:https://www.cnblogs.com/baby-lijun/p/9630165.html