2015-09-03 51 views
1

我想自定义forecolor(文本颜色更改)按钮的默认操作。默认情况下,它添加一个span标签与内联css.But我想将内联CSS添加到其父项元素也有。有什么方法可以自定义按钮的默认动作。有关更多信息,我正在使用内联编辑器。tinymce默认按钮的自定义操作

回答

0

我希望这个答案有用 您可以使用style_formats选项微小编辑

tinyMCE.init({ 
    mode : "exact", 
    autosave_ask_before_unload: false, 
    language : 'de', 
    theme : "advanced", 
    width : 930, 
    height:210, 
    custom_shortcuts : false, 
    theme_advanced_buttons1 : "fontselect,fontsizeselect,weddixsignaturebutton,styleselect,|,charmap,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,copy,paste,|,bullist,numlist,|,undo,redo,code", 
    theme_advanced_buttons2 : "weddixsymbolbutton,weddixhochzeitspoesietextblock,weddixdresscodetextblock,weddixgeldgeschenketextblock,weddixtextblock,weddixdanksagungtextblock", 
// theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen,|,link,unlink,|,code,preview", 
// theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft", 
    theme_advanced_toolbar_location : "top", 
    theme_advanced_toolbar_align : "left", 
    theme_advanced_statusbar_location : "bottom", 
    theme_advanced_resizing : false,      
    theme_advanced_font_sizes: "10pt,12pt,13pt,14pt,16pt,18pt,20pt,22pt,24pt,28pt,30pt,34pt,36pt,38pt,40pt,50pt,60pt", 
    style_formats: [      
        {title : 'Braun', inline : 'span', styles: {color: '#674708'}}, 
        {title : 'Hellbraun', inline : 'span', styles: {color: '#a78e5e'}}, 
        {title : 'Dunkelbraun', inline : 'span',styles: {color: '#4c4029'}}, 
        {title : 'Grün', inline : 'span', styles: {color: '#218d47'}}, 
        {title : 'Dunkelgrün', inline : 'span', styles: {color: '#3a7751'}}, 
        {title : 'Apfelgrün', inline : 'span', styles: {color: '#9bbb0c'}}, 

        {title : 'Olivgrün', inline : 'span', styles: {color: '#596539'}}, 
        {title : 'Grau', inline : 'span', styles: {color: '#919194'}}, 
        {title : 'Dunkelgrau', inline : 'span',styles: {color: '#515154'}}, 
        {title : 'Schwarz', inline : 'span', styles: {color: '#000000'}}, 
        {title : 'Orange', inline : 'span', styles: {color: '#e58e11'}}, 

        {title : 'Rot', inline : 'span', styles: {color: '#d40606'}}, 
        {title : 'Dunkelrot', inline : 'span', styles: {color: '#880606'}}, 
        {title : 'Pink', inline : 'span',styles: {color: '#e40477'}}, 
        {title : 'Rosa', inline : 'span', styles: {color: '#c47781'}}, 
        {title : 'Altrosa', inline : 'span', styles: {color: '#eeb2ba'}}, 

        {title : 'Mint', inline : 'span', styles: {color: '#a1d7ca'}}, 
        {title : 'Türkis', inline : 'span', styles: {color: '#116e68'}},     
        {title : 'Hellblau', inline : 'span', styles: {color: '#56cae7'}}, 
        {title : 'Blau', inline : 'span', styles: {color: '#0082ac'}}, 
        {title : 'Dunkelblau', inline : 'span', styles: {color: '#00008b'}}, 
        {title : 'Lila', inline : 'span', styles: {color: '#56009f'}}, 
        {title : 'Flieder', inline : 'span', styles: {color: '#af8dcb'}} 

        ] 
}); 
</script> 
+0

我希望ANS有用的,否则不会请描述完全 –

+0

我需要检查是否与特定的类中的任何父对象的存在与否,然后添加一些内联风格的对象。 – BlackJack

相关问题