如何在CodeIgniter中使用CKeditor4.4.4保留段落格式?

时间:2014-10-07 06:04:41

标签: javascript html codeigniter ckeditor django-ckeditor

我目前在CodeIniter中使用内联CKEditor 4.4.4。当我使用CKEditor将数据插入数据库并将其接收回来时,如何保留段落格式?

这是我的CKEditor插件的JavaScript代码并配置:

<script>
CKEDITOR.inline('skill', {
    toolbar: [
        { name: 'document', groups: [ 'mode', 'document', 'doctools' ], items: [ 'Source', '-', 'Save','Preview', 'Print' ] },
        { name: 'clipboard', groups: [ 'clipboard', 'undo' ], items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo','Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak','Styles', 'Format', 'Font', 'FontSize' ] },
        '/', 
        { name: 'clipboard', groups: [ 'clipboard', 'undo' ], items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat','NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl'] },
    ]
});
</script>  

这是HTML表单

<li>
    <span class="cvspan">Description:</span><?php echo form_textarea('we_dis',set_value('skill',$property->skill));?>
</li>

enter image description here

当我将文本提交到数据库并获得没有格式的结果时,文本显示为图像2

enter image description here

1 个答案:

答案 0 :(得分:0)

现在,当我通过自己制作CSS作为下面的代码时,对我来说是有用的,所以如果有人想在视图中组成他们的CKeditor,你应该编写自己的CSS来构成html标签

.cke_textarea_inline
        {
            padding:0px;
            min-height:100px;
            height: auto;
            overflow: auto; 
            border: 1px solid gray;
            -webkit-appearance: textfield;
        }
.cke_textarea_inline ol{
    padding-left:2em;
    list-style-position:inside;
    list-style:decimal
}
.cke_textarea_inline ol li{
    padding-left:0em;
    list-style-position:inside;
    list-style:decimal
}
.cke_textarea_inline ol li ol{
    padding-left:2em;
    list-style-position:inside;
    list-style:decimal
}
.cke_textarea_inline ul{
    padding-left:3.2em;
    list-style-position:inside;
    list-style:disc;
}
.cke_textarea_inline ul li{
    padding-left:.8em;
    list-style-position:inside;
    list-style:disc;
}
.cke_textarea_inline ul li ul{
    padding-left:1em;
    list-style-position:inside;
    list-style:disc;
}
.cke_textarea_inline ul li ul li{
    padding-left:.6em;
    list-style-position:inside;
    list-style:disc;
}