开发者

tinyMCE only displays in dialog box if initialized on page load

I created an application that uses a bunch of AJAX requests. It displays a table of products, and from there you can click the name of a product which will open a dialog box (box1). Within box1, there is another list of links you can click. When clicked, it will open another dialog box (box2).

In box2, I have a textarea field which is initialized as a tinyMCE. For some reason, initializing the textarea as a tinyMCE editor was not working. So, I created a separate textarea field, initialized as a tinyMCE on page load, in a stand alone div, which worked fine. So I navigated to the textarea within box 2, and surprisingly, it initialized itself as a tinyMCE. So, I simply set that stand alone div to display none. How does that make any sense?

For the time being, I will leave it this way because it works. However, I highly doubt that is the correct way to do this. Has anyone else ever experienced something similar?

Let me know if I should post some code.

Thanks.

EDIT: As requested, here is some code. Keep in mind that the initTinyMCE function was written by someone else a long time ago from a classic ASP file. My job is to convert it to an aspx file.

Backend file creating the textarea and calling the initTinyMCE() javascript function...

htmlSt开发者_运维知识库ring.Append("<p><span class=\"regTextBld\"><strong>Scenario Text</strong></span>");
            htmlString.Append("<script type=\"text/javascript\">initTinyMCE();</script>");
            htmlString.Append("<textarea class=\"TinyMCEeditor\" name=\"txtEntry\" id=\"txtEntry\" style=\"height:400px; width: 99%;\">" + reader["assumptions"] + "</textarea></p>");

And here is the initTinyMCE function...

function initTinyMCE() {
        //alert("x");
        initPlugins();
        tinyMCE.init({
            mode: "specific_textareas",
            editor_selector: "TinyMCEeditor",
            theme: "advanced",
            //plugins : "economy,safari,style,table,advhr,advimage,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,visualchars,nonbreaking,template",
            plugins: "economy,safari,style,table,inlinepopups,searchreplace,print,contextmenu,paste,fullscreen,visualchars,medclink",
            theme_advanced_buttons1: "cut,copy,paste,pastetext,replace,print,|,undo,redo,|,rspell,|,link,unlink,|,hr,image,table,|,code",
            theme_advanced_buttons2: "bold,italic,underline,removeformat,|,numlist, bullist,outdent,indent,|,justifyleft,justifycenter,justifyright,justifyfull,|,nonbreaking,charmap",
            theme_advanced_buttons3: "",
            theme_advanced_toolbar_location: "top",
            theme_advanced_toolbar_align: "left",
            content_css: "/style/intranet.css?" + new Date().getTime(),
            paste_preprocess: function(pl, o) {
                o.content = o.content.replace(/\u2019/gi, "'"); // ’
                o.content = o.content.replace(/\u201C/gi, "\""); // “
                o.content = o.content.replace(/\u201D/gi, "\""); // â€
            },
            cleanup: false,
            encoding: "html",
            entity_encoding: "named",
            verify_html: true
        });
    }


I am using jquery tinymce

$('#textareaid').tinymce().show();

Use this code when u click on textarea to activate tinymce.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜