2013-06-24 28 views
2

我在JQuery UI模態對話框中運行tinyMCE編輯器。一切工作正常,除了tinyMCE自己打開一個新模式的功能(例如鏈接)。這些模式顯示正常,但輸入區域不可編輯。 根據Firebug的js代碼是可以的,HTML非常簡單。JQuery模式中的TinyMCE模態不可編輯

任何線索可能來自哪裏?

編輯:

<script type="text/javascript"> 
tinymce.init({ 
    selector: "textarea", 
    plugins: "autolink link table textcolor", 
    menubar: false, 
    toolbar: "undo redo | styleselect | forecolor backcolor | bold italic | link unlink | table" 
}); 
$(document).ready(function(){ 
    $(".sendmail") 
     .button({ 
      icons: { 
       primary: "ui-icon-mail-closed" 
      }, 
      text: false 
     }) 
     .click(function(){ 
      $("#sendmailform").dialog("open"); 
     }) 
    ; 
    $(function(){ 
     $("#sendmailform") 
      .dialog({ 
       autoOpen: false, 
       title: "Send mail confirmation", 
       modal:true, 
       width: 750, 
       [buttons & ajax] 
      }) 
     ; 
    }); 
}); 
</script> 

回答

2

感謝@Harry,TinyMCE bugtracker上的傑出人物提供瞭解決方案。

我剛添加下面的代碼在DOM加載後我的腳本的頂部,只是裝了tinyMCE前:

$(document).on('focusin', function(e) { 
    if ($(event.target).closest(".mce-window").length) { 
     e.stopImmediatePropagation(); 
    } 
}); 

工程就像一個魅力,而一個發表@Harry沒有。

0

你的問題需要更詳細的回答,但你可以試試這個:

tinymce.get('editor_id').getBody().setAttribute('contenteditable', 'false'); 
+0

這將如何解決OP的問題? – alex

2

http://www.tinymce.com/develop/bugtracker_view.php?id=5917

的jQuery UI的對話框,你可以這樣做:

$.widget("ui.dialog", $.ui.dialog, { 
    _allowInteraction: function(event) { 
     return !!$(event.target).closest(".mce-container").length || this._super(event); 
    } 
}); 
+0

非常感謝您提供鏈接。 Upvoted,但不是解決方案 - 發佈在下面的答案:) – Sylvain

+0

經過一些發展後,似乎這兩種解決方案取決於上下文。我發佈的帖子在大多數頁面上都有效,但其中一個頁面不斷拋出「事件未定義錯誤」。我用上面的代碼替換了我的代碼,這些代碼運行正常。 – Sylvain

+0

當您在頁面上進行嵌套對話時,它可以正常工作。爲什麼默認情況下這不是內置的? –