3

TinyMCE is encoding HTML tags, so if I have something like:

<b>Test</b> 

When saved to the DB will be saved as:

&lt;b&gt;test&lt;/b&gt; 

My init is:

tinymce.init({ selector: '#post-message', mode: "specific_textareas", height: 500, menubar: false, plugins: 'paste print preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists textcolor wordcount imagetools contextmenu colorpicker textpattern help', theme_advanced_buttons3_add : "pastetext,pasteword,selectall", toolbar: 'bold italic link | numlist bullist', paste_word_valid_elements: "b,i,p,a[href],ol,ul,li,em,br", entity_encoding: "raw", paste_preprocess: function(p1, precontent){ var clean_content = clear_content(precontent.content); precontent.content = html_decode(clean_content) }, branding: false }); 

Notice that entity_encoding is set to raw. Is there a way to disable this? I want the data to be saved as entered.

Thanks

1 Answer 1

1

I don't think that TinyMCE is doing that on its own...it won't modify the HTML as you show. Can you make a TinyMCE Fiddle that shows a call to getContent() causing TinyMCE to return the content as you suggest? Are you using a server side framework? Is it possible that some other part of your app is doing this modification?

Sign up to request clarification or add additional context in comments.

4 Comments

I'll create the fiddle in a second. When the editor content is posted, it converts each line into <p> and when saved to the DB it's saved as <p>. But if I manually entered a tag, let's say <p>, it automatically encodes it. That's why I think is the editor and not the server side code, otherwise it would also have converted those entities created by the editor
Are you entering the html/tags in wysiwyg view and not the code view? If so it should encode the tags - that is what is should do in that scenario.
Yes, I'm adding the code in wysiwyg view. How can I avoid the encoding in that scenario?
You can't - to show you a < it needs to be encoded. If you want to enter code to be interpreted as code use the code view.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.