打开后再关闭fancybox,tinymce无法正常工作

时间:2015-12-12 23:54:36

标签: jquery asp.net tinymce fancybox

我使用了tinymce进入花式盒子。当第一次打开花式盒子时,工作但是在关闭和打开再次fancybox后,tinymce不起作用,我无法输入任何单词。

我的open fancybox代码是:

        function CreateTinyMCE() {
        tinymce.init({
            fontsize_formats: "7px 8px 9px 10px 11px 12px 13px 14px 15px 16px 17px 18px 19px 20px 21px 22px 23px 24px 25px 26px 27px 28px 29px",
            height: 240,
            width: 980,
            selector: "textarea",
            content_css: "../TinyMCE.css",
            plugins: "table image autolink charmap print preview searchreplace code textcolor media link charmap emoticons",
            //  convert strong tag to b tag 
            extended_valid_elements: "table[class=data head],b/strong",
            toolbar: ["undo redo | fontselect fontsizeselect | alignleft aligncenter alignright alignjustify | styleselect table | image link unlink emoticons ",
                                "bold italic underline strikethrough subscript superscript | forecolor backcolor | bullist numlist outdent indent | blockquote subscript superscript charmap searchreplace | code preview"
            ],
            menubar: false,
            relative_urls: false
        });
    }

和函数CreateTinyMce是:

VGAM::gengamma

1 个答案:

答案 0 :(得分:1)

我使用这篇文章并解决问题:

How do i remove tinyMCE and then re-add it?

在fancybox函数中更改并使用beforeShow,beforeClose。

新代码:

                beforeShow: function () { tinymce.EditorManager.execCommand('mceAddEditor', true, 'id'); },
            beforeClose: function () { tinymce.EditorManager.execCommand('mceRemoveEditor', true, 'id'); },