1
votes

i got a problem using html tags in TinyMce.

I've tried different things to get these done.

The TinyMce Docu say's Use [] to include all elements and all attributes.

But it didn't work.

Here is the code:

tinymce.init({
    selector: ".mytextarea",
    theme: "modern",
    language: "de",
    plugins : 'advlist autolink link images lists charmap print preview jbimages',
    toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image jbimages",
    relative_urls: true,
    valid_elements: '+*[*]',
});

I want some bootstrap elements in it (like and so on)

Thanks a lot my friends =)

1
what is a "bootstrap element" ?dandavis
just plain html (i'm using bootstrap framework)cRsakaWolf

1 Answers

0
votes

Due to the fact that tinymce uses its own iframe with own head, html and body html element - you may not use those elements in your content.

Update: Here is my tinymce base config

plugins: 'paste,searchreplace,style',    // and some more ....

dialog_type : "modal",

// Override inline_styles setting to force TinyMCE to produce deprecated contents
inline_styles: false,

// Theme options
theme_advanced_buttons3 : "",
theme_advanced_buttons4 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : false,

relative_urls: false,

gecko_spellcheck: true,

button_tile_map: true,

// disable drag und drop
disable_drag: true,

indentation: "0px",

// No resize handle an the editor itself
resize: false,

//turn on/off the inline resizing controls of tables and images in Firefox/Mozilla
object_resizing: false,
paste_strip_class_attributes : "none",
paste_remove_styles: true,
paste_convert_middot_lists: false,

// Default ab 3.0.1
forced_root_block: 'p',

// All characters will be stored in non-entity form except these XML default entities: & < > "
entity_encoding: "raw",

// This option controls if invalid contents should be corrected before insertion in IE. This option is disabled by default since it might be a bit slow. 
fix_nesting: true,

// This option should contain a comma separated list of element names to exclude from the content. Elements in this list will be removed when TinyMCE executes a cleanup.
invalid_elements: "strong,em,div",

// The valid_elements option defines which elements will remain in the edited text when the editor saves.
valid_elements: "@[id|class|title|style],"
+ "a[name|href|target|title|alt],"
+ "#p,-ol,-ul,-li,br,img[src|unselectable],-sub,-sup,-b,-i,-u,"
+ "-span[data-mce-type],hr",

valid_child_elements : "body[p,ol,ul]"
+ ",p[a|span|b|i|u|sup|sub|img|hr|#text]"
+ ",span[a|b|i|u|sup|sub|img|#text]"
+ ",a[span|b|i|u|sup|sub|img|#text]"
+ ",b[span|a|i|u|sup|sub|img|#text]"
+ ",i[span|a|b|u|sup|sub|img|#text]"
+ ",sup[span|a|i|b|u|sub|img|#text]"
+ ",sub[span|a|i|b|u|sup|img|#text]"
+ ",li[span|a|b|i|u|sup|sub|img|ol|ul|#text]"
+ ",ol[li]"
+ ",ul[li]",

formats: {
    bold : {inline : 'b' },  
    italic : {inline : 'i' },
    underline: { inline: 'u' }
},