簡體   English   中英

tinyMce activeeditor在回發時為空

[英]tinyMce activeeditor is null on postback

我正在使用tinymce editor到具有確切ID的文本區域。 在頁面加載上運行正常。 但是,當我單擊“ asp”按鈕“保存”時,會回發將數據保存到DB中,因此活動編輯器將變為null,並且不會保留其值。 如何克服這個問題?

我在pageload中的tinyMce初始化代碼是

tinyMCE.init({
mode: "exact",
elements : "divLabTemplateTree",
encoding: "xml",
convert_urls: false,
theme: "advanced",
width:"300",
height:"400",
skin : "o2k7",
plugins: "spellchecker,pagebreak,style,layer,table,advhr,advimage,advlink,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,paste,directionality,fullscreen,visualchars,nonbreaking,xhtmlxtras",
extended_valid_elements: "iframe[src|width|height|name|align]",
theme_advanced_buttons1: "spellchecker,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect,|,print,fullscreen",
theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3: "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,media,advhr,|",
theme_advanced_toolbar_location: "top",
theme_advanced_toolbar_align: "left",
theme_advanced_path_location: "bottom",
theme_advanced_resizing: true,
theme_advanced_resize_horizontal: false,    
dom_loaded : 1,
theme_advanced_styles: "Link to Image: lightbox;Image Right Border: rightbordered;Image Left Border: leftbordered;Darker Text: darker",
setup: function (ed) {
    ed.onSaveContent.add(function (i, o) {
        o.content = o.content.replace(/&#39/g, "&apos");
    });

    ed.onInit.add(function(ed) {
        tinyMCE.execCommand("mceAddControl", true, "divLabTemplateTree");
    });

    }
});

我正在設定其價值

if(tinyMCE.activeEditor != null)
{
    tinyMCE.activeEditor.setContent("bbbbbbbbbbbbbbb");
}

頁面初始化后,直到用戶明確單擊編輯器之前,tinyMCE.activeEditor都為null。

建議在這里使用tinymce.get('your_editor_id') 您的編輯器等於您為其初始化的textarea ID。 如果此textarea(或其他HTML源代碼)沒有id,則將content用作默認值。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM