因为需要把ueditor编辑的整个html保存到数据库,app需要展示。
但这样ueditor的方式就无法回显。
UE.getEditor('editor').execCommand('insertHtml', value);
通过以上方式会提示错误
ueditor.all.min.js:11 Uncaught TypeError: Cannot read property 'getRange' of undefined
ue.ready(function() {
//异步回调
UE.getEditor('editor').execCommand('insertHtml', value);
});
先$("#editor").html(value),然后UE.getEditor('editor')生成编辑器实例,因为生成编辑器是异步的