0

i used tinymce into fancy box.when first open fancy box tinymce work but after closing and Opening Again fancybox,tinymce not work and i could not type any words.

my code for open fancybox is:

            $.fancybox("#AddNews", {
            'autoScale': true,
            'transitionIn': 'elastic',
            'transitionOut': 'elastic',
            'speedIn': 500,
            'speedOut': 300,
            'autoDimensions': true,
            'centerOnScroll': true,
            width: "100%",
            height: 870,
            'autoSize': false,
            afterLoad: function () {
                //init tinymce in your form here
                debugger;
                if(tt)
                    CreateTinyMCE();
                tt = false;
            }
        });

and function CreateTinyMce is:

        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
        });
    }
Hoorakhsh
  • 51
  • 10

1 Answers1

1

i used this post and solve problem:

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

in fancybox function changed and used beforeShow,beforeClose.

new code:

                beforeShow: function () { tinymce.EditorManager.execCommand('mceAddEditor', true, 'id'); },
            beforeClose: function () { tinymce.EditorManager.execCommand('mceRemoveEditor', true, 'id'); },
Community
  • 1
  • 1
Hoorakhsh
  • 51
  • 10