我在TinyMce中使用html标签时遇到了问题。
我尝试过不同的事情来完成这些工作。
TinyMce Docu说的 使用 []包含所有元素和所有属性。
但它不起作用。
以下是代码:
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: '+*[*]',
});
我想要一些bootstrap元素(比如等等)
非常感谢我的朋友=)
答案 0 :(得分:0)
由于tinymce使用自己的iframe和自己的head,html和body html元素这一事实 - 你可能不会在你的内容中使用这些元素。
更新:这是我的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' }
},