2012-03-27 3 views
3

tinyMCEの人々にバグを提出しましたが、他の誰かがこの問題を抱えていて、適切な回避策があることを期待しています。FirefoxとTinyMCE 3.4.9はうまくいっていません

状況: jqueryダイアログにロードするtinyMCEコントロールがあるフォームがあります。それは最初に素晴らしい、その後彼らがそれを閉じた後、新しいものを開く。 tinyMCEコントロールとのやりとりは次のようになります。

"Node cannot be used in a document other than the one in which it was created" 

これは、あらかじめ入力されているはずのテキストでコントロールに入力されません。私は私のbeforeCloseハンドラで次のスクリプトを持っている私のjqueryのダイアログで

if (typeof tinyMCE != 'undefined') { 
       $(this).find(':tinymce').each(function() { 
        var theMce = $(this); 

        tinyMCE.execCommand('mceFocus', false, theMce.attr('id')); 
        tinyMCE.execCommand('mceRemoveControl', false, theMce.attr('id')); 
        $(this).remove(); 
       }); 
      } 

、ここでは私のTinyMCEのセットアップスクリプトです:

$('#' + controlId).tinymce({ 
     script_url: v2ScriptPaths.TinyMCEPath, 
     mode: "none", 
     elements: controlId, 
     theme: "advanced", 
     plugins: "paste", 
     paste_retain_style_properties: "*", 
     theme_advanced_toolbar_location: "top", 
     theme_advanced_buttons1: "bold, italic, underline, strikethrough, separator, justifyleft, justifycenter, justifyright, justifyfull, indent, outdent, separator, undo, redo, separator, numlist, bullist, hr, link, unlink,removeformat", 
     theme_advanced_buttons2: "fontsizeselect, forecolor, backcolor, charmap, pastetext,pasteword,selectall, sub, sup", 
     theme_advanced_buttons3: "", 
     language: v2LocalizedSettings.languageCode, 
     gecko_spellcheck : true, 
     onchange_callback: function (editor) { 
      tinyMCE.triggerSave(); 
     }, 
     setup: function (editor) { 
      editor.onInit.add(function (editor, event) { 
       if (typeof v2SetInitialContent == 'function') { 
        v2SetInitialContent(); 
       } 
      }) 
     } 
    }); 

ここで明らかに何がありますか?私はそれが削除されずに削除されたHTMLを持っているのが好きではありません。

setInitialContent()の内容は、電子署名がある場合は、事前に読み込むことができます。そのコードの有無にかかわらず壊れているので問題はありません。

ため、私はこの問題を3.4.9にアップデートすることを余儀なくされた:誰かがそれを解決できるかどう

http://www.tinymce.com/forum/viewtopic.php?id=28400

がそう、それはこのような状況に役立つだろう。私は運がないと結論からの示唆を試みました。

EDIT:もともとこれは影響を受けたFirefox 11だと思っていましたが、10をダウンロードしましたが、影響を受けています。

EDIT:わかりました。わかりました。わかりました。これはかなり単純な例です。

ベースページのコード:

<a href="<%=Url.Action(MVC.Temp.GetRTEDialogContent)%>" id="TestSendEmailDialog">Get Dialog</a> 
<div id="TestDialog"></div> 
<script type="text/javascript"> 
    $('#TestSendEmailDialog').click(function (e) { 
     e.preventDefault(); 

     var theDialog = buildADialog('Test', 500, 800, 'TestDialog'); 
     theDialog.dialog('open'); 
     theDialog.empty().load($(this).attr('href'), function() { 

     }); 

    }); 

    function buildADialog(title, height, width, dialogId, maxHeight) { 
     var customDialog = $('#' + dialogId); 

     customDialog.dialog('destory'); 

     customDialog.dialog({ 
      title: title, 
      autoOpen: false, 
      height: height, 
      modal: true, 
      width: width, 
      close: function (ev, ui) { 

       $(this).dialog("destroy"); 
       $(this).empty(); 

      }, 
      beforeClose: function (event, ui) { 

       if (typeof tinyMCE != 'undefined') { 
        $(this).find(':tinymce').each(function() { 
         var theMce = $(this); 

         tinyMCE.execCommand('mceFocus', false, theMce.attr('id')); 
         tinyMCE.execCommand('mceRemoveControl', false, theMce.attr('id')); 
         $(this).remove(); 
        }); 
       } 

      } 
     }); 

     return customDialog; 

    } 

</script> 

とダイアログにロードされたページのコード:

<form id="SendAnEmailForm" name="SendAnEmailForm" enctype="multipart/form-data" method="post"> 
    <textarea cols="50" id="MessageBody" name="MessageBody" rows="10" style="width: 710px; height:200px;"></textarea> 
</form> 

<script type="text/javascript"> 

    $(function() { 
     $('#MessageBody').tinymce({ 
      script_url: v2ScriptPaths.TinyMCEPath, 
      mode: "exact", 
      elements: 'MessageBody', 
      theme: "advanced", 
      plugins: "paste, preview", 
      paste_retain_style_properties: "*", 
      theme_advanced_toolbar_location: "top", 
      theme_advanced_buttons1: "bold, italic, underline, strikethrough, separator, justifyleft, justifycenter, justifyright, justifyfull, indent, outdent, separator, undo, redo, separator, numlist, bullist, hr, link, unlink,removeformat", 
      theme_advanced_buttons2: "fontsizeselect, forecolor, backcolor, charmap, pastetext,pasteword,selectall, sub, sup, preview", 
      theme_advanced_buttons3: "", 
      language: 'EN', 
      gecko_spellcheck: true, 
      onchange_callback: function (editor) { 
       tinyMCE.triggerSave(); 
      } 
     }); 
    }); 

</script> 

私はTinyMCEのを移動する場合、私は、気づいた非常に興味深いです負荷のコールバックにセットアップ、それは動作するようです。これは実際には解決策ではありません。なぜなら、ダイアログをロードしているときに、tinyMCEコントロールを持っているかどうかを前もってコードで知ることができないからです!

答えて

0

私はtinyMCEの設定を関数に移動してから、load()呼び出しでその関数が存在するかどうかを確認してから呼び出すことでこれを解決しました。

ベストソリューションではありませんが、機能します。

関連する問題