简体   繁体   English

更改<span style>ckeditor的</span>

[英]change the <span style> of ckeditor

i use ckeditor in texareas of my form, but the background of the site is black so i want to change the default style. 我在表单的德克萨斯州使用ckeditor,但网站的背景为黑色,因此我想更改默认样式。 i have the basic toolbar: 我有基本的工具栏:

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

 });

the span style that i want to change is (the default): 我要更改的跨度样式为(默认):

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

where I can change the default values?? 在哪里可以更改默认值?

What you want to do is use a custom style: 您要做的是使用自定义样式:

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

See: http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Styles 参见: http : //docs.cksource.com/CKEditor_3.x/Developers_Guide/Styles

<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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM