富文字編輯器(umeditor資料回顯(草稿)):
阿新 • • 發佈:2020-07-24
UM.getEditor("addPowersToDocument").setContent("");
setContent(UM.getEditor('addPowersToDocument').execCommand( "getlocaldata" ));(用於把內容替換為草稿)
UM.getEditor('addPowersToDocument').setContent(isAppendTo);(用於儲存文字內容)
Html配置:function getLocalData () { /* alert(UE.getEditor('addPowersToDocument').execCommand( "getlocaldata" ));*/ um.setContent(UM.getEditor('addPowersToDocument').execCommand( "getlocaldata" )); }
<!--um style給定寬度可以影響編輯器的最終寬度--> <div class="layui-form-item" id="addPowersToDocumentPage" style="display:none;"> <form class="layui-form layui-form-pane" action="" lay-filter="addPowersToDocumentForm"id="addPowersToDocumentForm"> <input type="hidden" name="documentId"/> <div type="text/plain" id="addPowersToDocument" name="content" style="width:1000px;height:240px;"> </div> <div class="layui-form-item"> <button type="button"id="addPowersToDocumentSubmit" lay-filter="addPowersToDocumentSubmit" style="display:none" lay-submit></button> </div> </form> <div> <button onclick="getLocalData()" >獲取草稿箱內容</button> </div> </div>