2

tinymce で保存したデータをリロードしようとしています。そうすると、すべての html タグがコントロール内に表示されます。

以前に保存されたのと同じように(タグを表示せずに)htmlをコントロールにロードするにはどうすればよいですか?

ここに私の初期化があります:

    $('textarea.tinymce').tinymce({
        // Location of TinyMCE script
        script_url : '/Scripts/tinymce/tiny_mce.js',

        encoding: "xml",

        // General options
        theme : "advanced",
        plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

        // Theme options
        theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect,|,forecolor,backcolor",
        theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,undo,redo,|,image,",
        theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,ltr,rtl,|,fullscreen",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_resizing : false,

        // Example content CSS (should be your site CSS)
        //content_css : "/Content/content.css",

        // Drop lists for link/image/media/template dialogs
        template_external_list_url: "/Scripts/tinymce/lists/template_list.js",
        external_link_list_url: "/Scripts/tinymce/lists/link_list.js",
        external_image_list_url: "/Scripts/tinymce/lists/image_list.js",
        media_external_list_url: "/Scripts/tinymce/lists/media_list.js"
    });//end tinymce

と私のテキストエリア:

<%: Html.TextArea("Blog", Model.Blog, new { @class = "tinymce", rows = "25", cols = "40"  })%>

お時間をいただきありがとうございます。ビリー

4

2 に答える 2

2

MVC 2 の使用 -

この問題の解決策は、HttpUtility.HtmlDecode を使用してデコードされたデータを保存することでした。

次に、それを元に戻し、モデルの display(string) プロパティに割り当てるときに、HttpUtility.HtmlEncode を使用して文字列をエンコードしました。

最後に、ビュー ページで、もう一度 HttpUtility.HtmlDecode を使用して表示用に同じプロパティをデコードしました。

これが同様の問題を抱えている他の人に役立つことを願っています。

于 2013-01-29T16:17:03.760 に答える
0

http://www.tinymce.com/wiki.php/Configuration:encodingを参照してください。

構成を設定する必要があるようですencoding: 'xml'

于 2013-01-10T10:46:35.497 に答える