Search code examples
javascripthtmlcssckeditor

Make CKEditor immediately go to source button


I want to make it so when people go to my site that has ckeditor in it, they don't have to click source to go type in HTML code, it just auto-goes there. This what is happening:

<html>
    <head>
        <script src="https://cdn.ckeditor.com/4.10.0/full/ckeditor.js"></script>
        <title>Ckeditor</title>
    </head>
    <body>
        <textarea name="textarea" id="textarea"></textarea>
        <script>CKEDITOR.replace( 'textarea' );</script>
    </body>
</html>

If I want to type in HTML code, I have to first click on source, but I want it so people can just immediately type in HTML code.


Solution

  • Dear friend you should add CKEDITOR.config.startupMode = 'source'; in your script. I found that answer in 2 links First one is How can I use CKEditor, starting with HTML mode in stead of TEXT mode? and second one is CKEditor - want to set "Source" as default