簡體   English   中英

TinyMce允許HTML標簽

[英]TinyMce allow HTML Tags

我在TinyMce中使用html標記時遇到問題。

我嘗試了不同的方法來完成這些任務。

TinyMce Docu說的Use [ ]包括所有元素和所有屬性。

但這沒有用。

這是代碼:

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: '+*[*]',
});

我想要一些引導元素(例如,依此類推)

非常感謝我的朋友們=)

由於tinymce使用帶有自己的head,html和body html元素的自己的iframe,因此您不得在內容中使用這些元素。

更新 :這是我的tinymce基本配置

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' }
},

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM