自定义tinymce

时间:2015-09-03 10:59:39

标签: javascript jquery web tinymce wysiwyg

我正在尝试自定义forecolor(文本颜色更改)按钮的默认操作。默认情况下,它添加带内联css的span标签。但是我想将内联css添加到其父元素中。是否有任何方法可以自定义按钮的默认操作。有关更多信息,我使用内联编辑器。

1 个答案:

答案 0 :(得分:0)

我希望这个有帮助 您可以使用style_formats Option Tiny Editor

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>