1

I want to set default font family "Arial" in the CKeditor 4. The below changes have been done. But not working.

In config.js,

config.defaultFontLabel = "Arial";
selvan
  • 1,183
  • 3
  • 16
  • 24
  • 1
    Does this answer your question? [CKEditor 4 - How to set default font?](https://stackoverflow.com/questions/16339258/ckeditor-4-how-to-set-default-font) – E13 Dec 13 '19 at 11:06
  • I already tried this. But not working. – selvan Dec 13 '19 at 11:12

1 Answers1

1

You can create your own css files and put the styles for the editor in there. So create a stylesheet called MyStyle.css and put this in there. Then save it somewhere, perhaps in the same location as the CKEditor files.

body {
    font-family: Arial;
    font-size: 14px;
    color: red;
}

Then put the following line in the config.js and point to the correct path to the css file.

config.contentsCss = '/ckeditor/MyStyle.css';

Or if you want different styles per instance, use this

<textarea id="CKEditor1" class="CKEditor"></textarea>

<script src="/ckeditor/ckeditor.js"></script>
<script>
    $('.CKEditor').each(function () {
        CKEDITOR.replace($(this).prop('id'));

        CKEDITOR.config.contentsCss = '/ckeditor/MyStyle.css';
    });
</script>
VDWWD
  • 35,079
  • 22
  • 62
  • 79