我目前正在使用 tinyMCE 并使用 oninit 函数向 messageBody 添加自定义页脚。在编辑器中获取页脚没有问题,但是当用户添加导致页面刷新的附件时遇到问题。除页脚外的所有内容都将从编辑器中删除。(代码正在做它应该做的事情!)有没有办法让 tinyMCE 在页面刷新时不重新启动,或者我可以采取不同的路线?下面的代码:
<script type="text/javascript">
<!-- Intiate tinyMCE -->
tinyMCE.init({
// General options
mode : "textareas",
theme : "advanced",
plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount",
"apply_source_formatting" : true,
"paste_auto_cleanup_on_paste" : false,
"paste_retain_style_properties" : "all",
//The below two lines to fix enter problem after a pastes is done by the user
"force_br_newlines" : true,
"force_p_newlines" : false,
// Theme options
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,cut,copy,paste,pastetext,|,search,replace,|,bullist,numlist,|,outdent,indent,|,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "undo,redo,|,link,unlink,|,insertdate,inserttime,preview,|,forecolor,backcolor,|,tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,advhr,|,ltr,rtl,|,fullscreen,|,wordcount",
//Calling a new CSS file to set Default Font and Text size
content_css : "/js/tiny_mce/themes/advanced/skins/default/custom.css" + new Date().getTime(),
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
oninit: function(){
tinyMCE.get('messageBody').setContent('<br><br><p>This message was generated by the Tool <br> If you are experiencing any issues with the Tool, please contact us <a href="mailto:someone@something.com">here</a> <br><a href="https://www.google.com">The Tool</a></p>');
}
});
</script>