2012-03-05 10 views
2

okies私は完全なajaxシステムをすべてのページにロードしていますが、現時点ではあまりにも面倒なコードがたくさんあります。TinyMCE jQuery ajaxが保存後に表示されないようにしました

問題は、私がTinyMCEを読み込むコンテンツに行ったときに完全に動作し、一度フォームが送信されると、TinyMCE要素のremove()を使用してから、サーバーこれはTinyMCE用のテキストエリアを持っていて、それは奇妙なことをロードします。コンテンツは表示されませんが、HTMLボタンをクリックするとコンテンツはTinyMCEテキストエリア内にあります。

私は、これはconentがサーバ

$(".addonContent form textarea.tinyMCE").tinymce({ 
     // Location of TinyMCE script 
     script_url : '/script/tiny_mce/tiny_mce.js', 

     // General options 
     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", 

     // Theme options 
     theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect", 
     theme_advanced_buttons2 : "cut,copy,paste,pasteword,|,bullist,numlist,|,blockquote,|,undo,redo,|,link,unlink,anchor,image,code,", 
     theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,charmap,emotions,media,|,ltr,rtl,|,fullscreen", 
     theme_advanced_buttons4 : "", 
     theme_advanced_toolbar_location : "top", 
     theme_advanced_toolbar_align : "left", 
     theme_advanced_statusbar_location : "bottom", 
     theme_advanced_resizing : true, 

     // Example content CSS (should be your site CSS) 
     content_css : "/style/style_content.css", 

     // Drop lists for link/image/media/template dialogs 
     template_external_list_url : "lists/template_list.js", 
     external_link_list_url : "lists/link_list.js", 
     external_image_list_url : "lists/image_list.js", 
     media_external_list_url : "lists/media_list.js", 

     // Replace values for the template plugin 
     template_replace_values : { 
       username : "Some User", 
       staffid : "991234" 
     } 
    }); 

そして、これは完璧に動作からリロードされるたびにTinyMCEの呼び出しですかのう

ほどわずかなコードを使用して少し良く説明することを示すためにしようとしますそれは

$(".addonContent form textarea.tinyMCE").tinymce().remove() 
を呼び出してサーバーにデータを送信する直前に初めて

今、私のajaxFormコードの実行と

が、内容は背中や小型MCE負荷来るとき、それは、エディタのコンテンツが表示されませんが、私はHTMLボタンをクリックすると、コンテンツが

EDIT を示しこれはTinyMCEを持つバグのように見えます以下のコードのようにGoogle ChromeはIE8 +で動作し、Firefoxで動作します。今はCKeditorを試しています。

+0

+1良い質問の説明 – Thariama

答えて

0

同じIDを持つ2つ目のものを読み込む前に、tinymceのeditroインスタンスをシャットダウンする必要があります。 ここでmceRemoveControl execCommandを使用してください。

+0

いいえ、申し訳ありませんが私のために働いていません –

+0

あなたはまだこれを呼び出していますか? – Thariama

+0

いいえ私はちょうど '$("。addonContent form textarea.tinyMCE ")。tinymce()。execCommand( 'mceRemoveControl');' –

関連する問題