0

我在表单的 texareas 中使用 ckeditor,但网站的背景是黑色的,所以我想更改默认样式。我有基本的工具栏:

CKEDITOR.replace( 'editor1',
 {  
    toolbar : [ [ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-',
 'Link', 'Unlink','-']]

 });

我要更改的跨度样式是(默认):

<span style="color: rgb(0, 0, 0); font-family: Arial, Helvetica, sans; font-size: 11px;  
line-height: 14px; text-align: justify; ">

我可以在哪里更改默认值?

4

2 回答 2

1

您想要做的是使用自定义样式:

CKEDITOR.addStyleSet( 'myStyles', [
    {
        name: 'Custom span',
        element: 'span',
        styles:
        {
            'color': 'rgb(0,0,0)',
            'font-family': 'Arial, Helvetica, sans',
            'font-size': '11px',
            'line-height': '14px',
            'text-align': 'justify'
        }
    }
]);

CKEDITOR.replace( 'editor1', { styleSet: 'myStyles:/styles.js' } )

请参阅:http ://docs.cksource.com/CKEditor_3.x/Developers_Guide/Styles

于 2012-09-14T14:33:42.990 回答
0
<textarea cols="100" id="editor1" name="editor1" rows="10">This is some sample text</textarea>

<script type="text/javascript">
    // Replace the <textarea id="editor1"> with an CKEditor instance.
    var editor = CKEDITOR.replace( 'editor1' );
    editor.on( 'instanceReady', function( ev ){
        //set the background properties
                this.document.$.childNodes[1].childNodes[1].style.backgroundColor = 'Blue';

                editor.focus();
        });
</script>
于 2012-09-12T06:36:45.477 回答