1
我目前使用tinyMCE並使用oninit函數將自定義頁腳添加到messageBody。在編輯器中獲取頁腳沒有任何問題,但當用戶添加導致頁面刷新的附件時,我遇到了問題。除了頁腳以外的所有內容都將從編輯器中刪除。 (代碼正在做它應該做的事情!)有沒有辦法讓tinyMCE在頁面刷新時不能重新啓動,或者我可以採用不同的路由?代碼如下:在頁面刷新時不啓動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:[email protected]">here</a> <br><a href="https://www.google.com">The Tool</a></p>');
}
});
</script>
這可能是一個選項。真的不想把頁面放在框架中,但看着它,這可能是我唯一的方法。謝謝 –
不要把你的頁面放在iframe中,只需要一個iframe來完成上傳,這樣你的tinymce主頁就不會被刷新。有很多通過iframe簡單上傳的例子。祝你好運 :) – jjay225