Skip to content
This repository has been archived by the owner on Dec 11, 2017. It is now read-only.

Show errors on small screens. #39

Merged
merged 4 commits into from
Aug 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 6 additions & 17 deletions codemirror-wp.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ public static function register_scripts( WP_Scripts $scripts ) {
* @param WP_Styles $styles Styles.
*/
public static function register_styles( WP_Styles $styles ) {
/*
* Override common.css with patched version that has proper styling for CodeMirror and textarea.
*/
$styles->registered['common']->src = plugins_url( 'wp-admin/css/common.css', __FILE__ );
$styles->registered['common']->ver = self::VERSION;

$styles->add( 'codemirror', plugins_url( 'wp-includes/js/codemirror/lib/codemirror.css', __FILE__ ), array(), self::CODEMIRROR_VERSION );
$styles->add( 'codemirror-addon-show-hint', plugins_url( 'wp-includes/js/codemirror/addon/hint/show-hint.css', __FILE__ ), array( 'codemirror' ), self::CODEMIRROR_VERSION );
$styles->add( 'codemirror-addon-lint', plugins_url( 'wp-includes/js/codemirror/addon/lint/lint.css', __FILE__ ), array( 'codemirror' ), self::CODEMIRROR_VERSION );
Expand Down Expand Up @@ -284,23 +290,6 @@ public static function load_plugin_editor_php() {
*/
public static function do_codemirror_admin_editor() {
?>
<style>
#template div {
margin-right: 0;
}
#template > div {
margin-right: 190px;
}
@media screen and (max-width: 782px) {
#template > div {
margin-right: 0;
}
}
.CodeMirror {
height: calc( 100vh - 220px );
width: 97%;
}
</style>
<script>
jQuery( function() {
wp.codemirror = window.CodeMirror.fromTextArea( document.getElementById( 'newcontent' ), <?php echo json_encode( self::$options ); ?> );
Expand Down
Loading