2
votes

I'm having issue with TinyMCE.

After saving the contents of the editor and redisplaying it all the HTML tags are visible.

This is how I'm initializing the editor:

// Tinymce Config
tinyMCE.init({
    // General options
    mode : "specific_textareas",
    editor_selector : "mceEditor",
    language : "<?php echo $tinyMceLang?>",
    setup : function(ed) {
        ed.onActivate.add(tinyOnEdit);
    },
    theme : "advanced",
    plugins : "table",
    // Theme options
    theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,fontsizeselect,|,forecolor,backcolor,|,table,row_before,row_after,delete_row,col_before,col_after,delete_col,code",
    theme_advanced_buttons2 : "",
    theme_advanced_buttons3 : "",
    theme_advanced_buttons4 : "",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "bottom",
    theme_advanced_path : false,
    theme_advanced_resizing : true,
    convert_fonts_to_spans : true,
    //font_size_style_values : "0.7em,0.8em,1em,1.2em,1.5em,2em,3em",
    //font_size_style_values : "8pt,10pt,12pt,14pt,18pt,24pt,36pt",

    // content CSS (should be your site CSS)
    content_css : "/css/tiny_content.css"
});

if i paste a content like this (With HTML tags):

<p><span style="color: #ff0000;">testing tinymce contents</span></p>

redisplayed as :

<p><span style="color: #ff0000;">testing tinymce contents</span></p> (With html tags)

but excepted result is :

testing tinymce contents (Text with red color)(Not to allow html tags)

1

1 Answers

0
votes

Open the HTML Source Editor.

Paste your content (With HTML tags) at the desired place in the html source editor. Click on update.

That's it.

In respond to your comment Add paste in your list of plugins,also include this plugin option

plugins : "table,paste",
paste_remove_styles: true,

in your tinyMCE.init like

// Tinymce Config
tinyMCE.init({
// General options
mode : "specific_textareas",
editor_selector : "mceEditor",
language : "<?php echo $tinyMceLang?>",
setup : function(ed) {
    ed.onActivate.add(tinyOnEdit);
},
theme : "advanced",

plugins : "table,paste",
paste_remove_styles: true,


// Theme options
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,fontsizeselect,|,forecolor,backcolor,|,table,row_before,row_after,delete_row,col_before,col_after,delete_col,code",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_buttons4 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_path : false,
theme_advanced_resizing : true,
convert_fonts_to_spans : true,
//font_size_style_values : "0.7em,0.8em,1em,1.2em,1.5em,2em,3em",
//font_size_style_values : "8pt,10pt,12pt,14pt,18pt,24pt,36pt",

// content CSS (should be your site CSS)
content_css : "/css/tiny_content.css"
});   

Hope this helps,cheers!!