tinymce get HTML code when postback

前端 未结 8 658
醉话见心
醉话见心 2020-12-18 06:26

I have the tinymce -control as a WYSIWYG-Editior in my asp.net page.

When I have e.g. a Text in Bold, after the Postback it is shown as

 \"

相关标签:
8条回答
  • 2020-12-18 07:23

    Change the init function and set encoding to an empty string.

    <script type="text/javascript">
        tinyMCE.init({
            mode: "textareas",
            theme: "simple",
            encoding: ""
        });
    </script>
    

    This is default setting, and worked in my case. See documentation on this page http://www.tinymce.com/wiki.php/Configuration3x:encoding

    0 讨论(0)
  • 2020-12-18 07:25

    Step 1: in TinyMCE Configuration use

    encoding: "xml",
    

    Step 2: in Java Script after init the TinyMCE use this code, where 'textarea.RichText' is the class selector for the text area

    tinymce.init(TMCEconfig);
    
     // Fix Html Decodeing
        $('textarea.RichText').each(function () {
                var $this = $(this);
                var x = $this.text();
                $this.html(x)
        });
    

    Step 3 : in Server code, when setting the value of the text area , decode the text first For example in ASP.net use

    textarea.text = HttpUtility.HtmlDecode(Source)
    
    0 讨论(0)
提交回复
热议问题