Search code examples
fontssceditor

SCEditor - make the default font Arial


How can SCEditor be forced to start with Arial as its default font when it is empty? The default appears to be a Serif font - perhaps Times.


Solution

  • The default style of WYSIWYG content is the browsers default style.

    It can be changed by setting the style option in the constructor. It's recommended to use (or base your style on) the content/default.min.css style as it contains some other important CSS. Something like:

    sceditor.create(textarea, {
        // other options here
        // ...
    
        // Set the style for the content of the editor
        style: 'https://cdn.jsdelivr.net/npm/sceditor@3/minified/themes/content/default.min.css'
    });
    

    or it can be set via the css() method, e.g.:

    instance.css('body { font-family: Arial, sans-serif; }');