Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TinyMCE & .Net - Error when POSTing with a single quote in the text

I am using the jQuery TinyMCE control in my .Net Web Forms application.
I primarily use it with AJAX and webservices however in one instance I have to let it post to the server as a part of the form.

For almost all input it works fine with

$('#<%= eText.ClientID %>').tinymce({
    encoding: 'xml'
});

However the moment I try to save a single quote ' I get the unsafe input error.

What can I do to handle this?

like image 396
Biff MaGriff Avatar asked Dec 13 '11 21:12

Biff MaGriff


People also ask

Is TinyMCE free for commercial use?

Is TinyMCE free? Yes. The TinyMCE core editor is free to use for commercial and noncommercial purposes.

Can I use TinyMCE without API key?

You can use TinyMCE without an API key. However there will be warning messages in the text editor area.

What is TinyMCE plugin?

TinyMCE is an incredibly powerful, flexible and customizable rich text editor. This section will help you configure and extend your editor instance. Contribute to this page.


2 Answers

For those using version 4:

setup: function (editor) {
   editor.on('SaveContent', function (ed) {
      ed.content = ed.content.replace(/&#39/g, "&apos");
   });
} 
like image 195
webStuff Avatar answered Nov 15 '22 10:11

webStuff


Oi, just when you give up and ask a SO question you find the answer on google. I'm probably going to need this later so I'm going to leave this here.

Thanks to OP on this blog. http://blog.tentaclesoftware.com/archive/2010/07/22/96.aspx#414

tinyMCE.init({
    // ...
    setup: function (ed) {
        ed.onSaveContent.add(function (ed, o) {
            o.content = o.content.replace(/&#39/g, "&apos");
        });
    }
});
like image 27
Biff MaGriff Avatar answered Nov 15 '22 11:11

Biff MaGriff