【问题标题】:customize action of a default button of tinymce自定义tinymce默认按钮的动作
【发布时间】:2015-09-03 10:59:39
【问题描述】:

我正在尝试自定义前景色(文本颜色更改)按钮的默认操作。默认情况下,它添加一个带有内联 css 的跨度标记。但我也想将内联 css 添加到它的父元素。有什么办法可以自定义按钮的默认操作。有关更多信息,我正在使用内联编辑器。

【问题讨论】:

    标签: javascript jquery web tinymce wysiwyg


    【解决方案1】:

    希望本文对您有帮助 您可以使用 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>  
    

    【讨论】:

    • 我希望有用,否则请不要完整描述
    • 我需要检查是否存在任何具有特定类的父对象,然后为该对象添加一些内联样式。
    猜你喜欢
    • 2017-06-14
    • 1970-01-01
    • 1970-01-01
    • 2017-11-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-26
    相关资源
    最近更新 更多