Prevent CKEditor from formatting code in source mode

前端 未结 5 719
没有蜡笔的小新
没有蜡笔的小新 2021-02-05 07:31

How can you prevent any automatic formatting when in CKEditor when viewing in source mode?

I like to edit HTML source code directly instead of using the WYSIWYG

5条回答
  •  执念已碎
    2021-02-05 07:43

    I solved this problem by simply surrounding the back-end output of edit form page with a conditional on a $_GET variable - when you click on "Expert Mode" it loads a plain textarea instead of the ckeditor system. Your invocation of the ckeditor object will vary depending on your setup. ( I have a custom class that calls/builds the editor object )

                    \n";
        print "\n";
    }
    else
    {
        print "\n";
        require_once( 'admin/editor.class.php' );
        $aDoc['content'] = str_replace( "\r", '', str_replace( "\n", '', nl2br( $aDoc['content'] ) ) );
        $oEditor = new setEditor( $aDoc['content'], $nEwidth, "400", 'content' );
        $oEditor->ShowEditor();
    }
    ?>
                    

提交回复
热议问题