WordPress.org

Plugin Directory

Changeset 1729000


Ignore:
Timestamp:
09/13/17 00:35:06 (10 days ago)
Author:
westonruter
Message:

Committing 0.7.0 to trunk

Location:
better-code-editing/trunk
Files:
3 added
4 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • better-code-editing/trunk/better-code-editing.php

    r1727131 r1729000  
    44 * Plugin URI: https://wordpress.org/plugins/better-code-editing/ 
    55 * Description: Code highlighting and linting, powered by CodeMirror. 
    6  * Version: 0.6.0 
     6 * Version: 0.7.0 
    77 * Author: The WordPress Team 
    88 * Text Domain: better-code-editing 
     
    1111 */ 
    1212 
    13 define( 'BETTER_CODE_EDITING_PLUGIN_VERSION', '0.6.0' ); 
     13define( 'BETTER_CODE_EDITING_PLUGIN_VERSION', '0.7.0' ); 
    1414define( 'BETTER_CODE_EDITING_PLUGIN_FILE', __FILE__ ); 
    1515 
     
    4646 
    4747// Show notice if repo was cloned from source without running npm install. 
    48 if ( ! file_exists( dirname( __FILE__ ) . '/wp-includes/js/codemirror/lib/codemirror.js' ) ) { 
     48if ( ! file_exists( dirname( __FILE__ ) . '/wp-includes/js/codemirror/codemirror.min.js' ) ) { 
    4949    add_action( 'admin_notices', '_better_code_editing_plugin_npm_install_required' ); 
    5050    return; 
  • better-code-editing/trunk/readme.txt

    r1727131 r1729000  
    22Contributors: georgestephanis, westonruter, obenland, melchoyce, wordpressdotorg 
    33Tags: codemirror, syntax-highlighter, linting 
    4 Stable tag: 0.6.0 
     4Stable tag: 0.7.0 
    55Requires at least: 4.7 
    66Tested up to: 4.9-alpha 
     
    1212This project is adding CodeMirror functionality to the Plugin and Theme file editors, as well as the Customizer Custom CSS box and the Custom HTML widget. 
    1313 
    14 This is currently a Work In Progress playground for experimenting with bringing syntax highlighting to WordPress Core. 
    15  
    1614We're working around discussion on a Core ticket, [#12423](https://core.trac.wordpress.org/ticket/12423) 
    1715 
     
    2119 
    2220== Changelog == 
     21 
     22= 0.7.0 - 2017-09-12 = 
     23 
     24* Create minified bundles for CodeMirror assets. See [#92](https://github.com/WordPress/better-code-editing/pull/92). Fixes [#71](https://github.com/WordPress/better-code-editing/issues/71). 
     25* Fix tabbing backward when Additional CSS section description is expanded, to focus on Close link instead of Help toggle. See [#91](https://github.com/WordPress/better-code-editing/pull/91). Fixes [#90](https://github.com/WordPress/better-code-editing/issues/90). 
    2326 
    2427= 0.6.0 - 2017-09-08 = 
  • better-code-editing/trunk/wp-admin/js/code-editor.js

    r1727131 r1729000  
    1 /* global CodeMirror */ 
    21if ( 'undefined' === typeof window.wp ) { 
    32    window.wp = {}; 
     
    6362 
    6463        // Configure JSHint. 
    65         if ( 'javascript' === lintOptions.mode && settings.jshint ) { 
     64        if ( 'javascript' === settings.codemirror.mode && settings.jshint ) { 
    6665            $.extend( lintOptions.options, settings.jshint ); 
    6766        } 
    6867 
    6968        // Configure CSSLint. 
    70         if ( 'css' === lintOptions.mode && settings.csslint ) { 
     69        if ( 'css' === settings.codemirror.mode && settings.csslint ) { 
    7170            $.extend( lintOptions.options, settings.csslint ); 
    7271        } 
    7372 
    7473        // Configure HTMLHint. 
    75         if ( 'htmlmixed' === lintOptions.mode && settings.htmlhint ) { 
     74        if ( 'htmlmixed' === settings.codemirror.mode && settings.htmlhint ) { 
    7675            lintOptions.options.rules = $.extend( {}, settings.htmlhint ); 
    7776 
     
    246245        instanceSettings.codemirror = $.extend( {}, instanceSettings.codemirror ); 
    247246 
    248         codemirror = CodeMirror.fromTextArea( $textarea[0], instanceSettings.codemirror ); 
     247        codemirror = wp.CodeMirror.fromTextArea( $textarea[0], instanceSettings.codemirror ); 
    249248 
    250249        configureLinting( codemirror, instanceSettings ); 
     
    271270                } 
    272271 
    273                 innerMode = CodeMirror.innerMode( codemirror.getMode(), token.state ).mode.name; 
     272                innerMode = wp.CodeMirror.innerMode( codemirror.getMode(), token.state ).mode.name; 
    274273                lineBeforeCursor = codemirror.doc.getLine( codemirror.doc.getCursor().line ).substr( 0, codemirror.doc.getCursor().ch ); 
    275274                if ( 'html' === innerMode || 'xml' === innerMode ) { 
  • better-code-editing/trunk/wp-admin/js/customize-controls-addendum.js

    r1727131 r1729000  
    9090                        controlIndex = controls.indexOf( control ); 
    9191                        if ( 0 === controlIndex ) { 
    92                             section.container.find( '.customize-help-toggle' ).focus(); 
     92                            section.contentContainer.find( '.customize-section-title .customize-help-toggle, .customize-section-title .customize-section-description.open .section-description-close' ).last().focus(); 
    9393                        } else { 
    94                             controls[ controlIndex - 1 ].container.find( ':focusable:first' ).focus(); 
     94                            controls[ controlIndex - 1 ].contentContainer.find( ':focusable:first' ).focus(); 
    9595                        } 
    9696                    }, 
  • better-code-editing/trunk/wp-includes/general-template-addendum.php

    r1727131 r1729000  
    219219 
    220220        if ( ! current_user_can( 'unfiltered_html' ) ) { 
    221             $settings['htmlhint']['rules']['kses'] = wp_kses_allowed_html( 'post' ); 
     221            $settings['htmlhint']['kses'] = wp_kses_allowed_html( 'post' ); 
    222222        } 
    223223    } elseif ( 'text/x-gfm' === $type ) { 
     
    336336    wp_enqueue_style( 'code-editor' ); 
    337337 
    338     // @todo All of the following could be done in JS instead, similar to the post Editor? 
    339338    wp_enqueue_script( 'codemirror' ); 
    340339    wp_enqueue_style( 'codemirror' ); 
    341  
    342     // Enqueue addons. 
    343     $option_asset_mappings = array( 
    344         'showTrailingSpace' => array( 'codemirror-addon-edit-trailingspace' ), 
    345         'styleActiveLine'   => array( 'codemirror-addon-selection-active-line' ), 
    346         'autoCloseBrackets' => array( 'codemirror-addon-edit-closebrackets' ), 
    347         'matchBrackets'     => array( 'codemirror-addon-edit-matchbrackets' ), 
    348         'autoCloseTags'     => array( 'codemirror-addon-edit-closetag' ), 
    349         'matchTags'         => array( 'codemirror-addon-edit-matchtags' ), 
    350         'continueComments'  => array( 'codemirror-addon-comment-continuecomment' ), 
    351         // @todo Add recognition for all of the addon configs. 
    352     ); 
    353     foreach ( $option_asset_mappings as $option => $handles ) { 
    354         if ( ! empty( $settings['codemirror'][ $option ] ) ) { 
    355             foreach ( $handles as $handle ) { 
    356                 wp_enqueue_script( $handle ); 
    357             } 
    358         } 
    359     } 
    360  
    361     wp_enqueue_script( 'codemirror-addon-comment' ); 
    362     wp_enqueue_script( 'codemirror-addon-dialog' ); 
    363     wp_enqueue_style( 'codemirror-addon-dialog' ); 
    364     wp_enqueue_script( 'codemirror-addon-search-searchcursor' ); 
    365     wp_enqueue_script( 'codemirror-addon-search' ); 
    366     wp_enqueue_script( 'codemirror-addon-scroll-annotatescrollbar' ); 
    367     wp_enqueue_script( 'codemirror-addon-search-matchesonscrollbar' ); 
    368     wp_enqueue_script( 'codemirror-addon-search-jump-to-line' ); 
    369340 
    370341    if ( isset( $settings['codemirror']['mode'] ) ) { 
     
    376347        } 
    377348 
    378         switch ( $mode['name'] ) { 
    379             case 'css': 
    380             case 'text/css': 
    381             case 'text/x-scss': 
    382             case 'text/x-less': 
    383                 wp_enqueue_script( 'codemirror-mode-css' ); 
    384                 wp_enqueue_script( 'codemirror-addon-hint-css' ); 
    385                 wp_enqueue_style( 'codemirror-addon-show-hint' ); 
    386  
    387                 if ( ! empty( $settings['codemirror']['lint'] ) ) { 
    388                     wp_enqueue_script( 'codemirror-addon-lint-css' ); 
    389                 } 
    390                 break; 
    391             case 'diff': 
    392             case 'text/x-diff': 
    393                 wp_enqueue_script( 'codemirror-mode-diff' ); 
    394                 break; 
    395             case 'gfm': 
    396             case 'text/x-gfm': 
    397                 wp_enqueue_script( 'codemirror-mode-gfm' ); 
    398                 break; 
    399             case 'htmlmixed': 
    400             case 'text/html': 
    401             case 'php': 
    402             case 'application/x-httpd-php': 
    403             case 'text/x-php': 
    404                 if ( false !== strpos( $mode['name'], 'php' ) ) { 
    405                     wp_enqueue_script( 'codemirror-mode-php' ); 
    406                 } 
    407  
    408                 wp_enqueue_script( 'codemirror-mode-htmlmixed' ); 
    409                 wp_enqueue_script( 'codemirror-addon-hint-html' ); 
    410                 wp_enqueue_script( 'codemirror-addon-hint-javascript' ); 
    411                 wp_enqueue_script( 'codemirror-addon-hint-css' ); 
    412                 wp_enqueue_style( 'codemirror-addon-show-hint' ); 
    413  
    414                 if ( ! empty( $settings['codemirror']['lint'] ) ) { 
     349        if ( ! empty( $settings['codemirror']['lint'] ) ) { 
     350            switch ( $mode['name'] ) { 
     351                case 'css': 
     352                case 'text/css': 
     353                case 'text/x-scss': 
     354                case 'text/x-less': 
     355                    wp_enqueue_script( 'csslint' ); 
     356                    break; 
     357                case 'htmlmixed': 
     358                case 'text/html': 
     359                case 'php': 
     360                case 'application/x-httpd-php': 
     361                case 'text/x-php': 
     362                    wp_enqueue_script( 'htmlhint' ); 
     363                    wp_enqueue_script( 'csslint' ); 
     364                    wp_enqueue_script( 'jshint' ); 
    415365                    if ( ! current_user_can( 'unfiltered_html' ) ) { 
    416366                        wp_enqueue_script( 'htmlhint-kses' ); 
    417367                    } 
    418                     wp_enqueue_script( 'codemirror-addon-lint-html' ); 
    419                 } 
    420                 break; 
    421             case 'http': 
    422             case 'message/http': 
    423                 wp_enqueue_script( 'codemirror-mode-http' ); 
    424                 break; 
    425             case 'javascript': 
    426             case 'application/ecmascript': 
    427             case 'application/json': 
    428             case 'application/javascript': 
    429             case 'application/ld+json': 
    430             case 'text/typescript': 
    431             case 'application/typescript': 
    432                 wp_enqueue_script( 'codemirror-mode-javascript' ); 
    433                 wp_enqueue_script( 'codemirror-addon-hint-javascript' ); 
    434                 wp_enqueue_style( 'codemirror-addon-show-hint' ); 
    435  
    436                 if ( ! empty( $settings['codemirror']['lint'] ) ) { 
    437                     if ( ! empty( $mode['json'] ) || ! empty( $mode['jsonld'] ) ) { 
    438                             wp_enqueue_script( 'codemirror-addon-lint-json' ); 
    439                     } else { 
    440                         wp_enqueue_script( 'codemirror-addon-lint-javascript' ); 
    441                     } 
    442                 } 
    443                 break; 
    444             case 'jsx': 
    445             case 'text/jsx': 
    446             case 'text/typescript-jsx': 
    447                 wp_enqueue_script( 'codemirror-mode-jsx' ); 
    448                 break; 
    449             case 'markdown': 
    450             case 'text/x-markdown': 
    451                 wp_enqueue_script( 'codemirror-mode-markdown' ); 
    452                 break; 
    453             case 'nginx': 
    454             case 'text/nginx': 
    455                 wp_enqueue_script( 'codemirror-mode-nginx' ); 
    456                 break; 
    457             case 'sass': 
    458             case 'text/x-sass': 
    459                 wp_enqueue_script( 'codemirror-mode-sass' ); 
    460                 break; 
    461             case 'sh': 
    462             case 'text/x-sh': 
    463             case 'application/x-sh': 
    464                 wp_enqueue_script( 'codemirror-mode-shell' ); 
    465                 break; 
    466             case 'sql': 
    467             case 'text/x-sql': 
    468             case 'text/x-mysql': 
    469             case 'text/x-mariadb': 
    470             case 'text/x-cassandra': 
    471             case 'text/x-plsql': 
    472             case 'text/x-mssql': 
    473             case 'text/x-hive': 
    474             case 'text/x-pgsql': 
    475             case 'text/x-gql': 
    476             case 'text/x-gpsql': 
    477                 wp_enqueue_script( 'codemirror-mode-sql' ); 
    478                 break; 
    479             case 'xml': 
    480             case 'application/xml': 
    481             case 'application/svg+xml': 
    482                 wp_enqueue_script( 'codemirror-mode-xml' ); 
    483                 break; 
    484             case 'yaml': 
    485             case 'codemirror-mode-yaml': 
    486                 wp_enqueue_script( 'codemirror-mode-yaml' ); 
    487                 break; 
    488         } 
    489  
    490         if ( ! empty( $settings['codemirror']['lint'] ) ) { 
    491             wp_enqueue_style( 'codemirror-addon-lint' ); 
     368                    break; 
     369                case 'javascript': 
     370                case 'application/ecmascript': 
     371                case 'application/json': 
     372                case 'application/javascript': 
     373                case 'application/ld+json': 
     374                case 'text/typescript': 
     375                case 'application/typescript': 
     376                    wp_enqueue_script( 'jshint' ); 
     377                    wp_enqueue_script( 'jsonlint' ); 
     378                    break; 
     379            } 
    492380        } 
    493381    } 
  • better-code-editing/trunk/wp-includes/script-loader-addendum.php

    r1727131 r1729000  
    1515 */ 
    1616function _better_code_editing_default_scripts( WP_Scripts $scripts ) { 
    17     $codemirror_version = '5.29.1-alpha-' . BETTER_CODE_EDITING_PLUGIN_VERSION; 
     17    $codemirror_version = '5.29.1-alpha-ee20357-' . BETTER_CODE_EDITING_PLUGIN_VERSION; 
    1818 
    19     $scripts->add( 'codemirror', plugins_url( 'wp-includes/js/codemirror/lib/codemirror.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array(), $codemirror_version ); 
    20  
    21     $scripts->add( 'codemirror-keymap-emacs',   plugins_url( 'wp-includes/js/codemirror/keymap/emacs.js', BETTER_CODE_EDITING_PLUGIN_FILE ),   array( 'codemirror' ), $codemirror_version ); 
    22     $scripts->add( 'codemirror-keymap-sublime', plugins_url( 'wp-includes/js/codemirror/keymap/sublime.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array( 'codemirror' ), $codemirror_version ); 
    23     $scripts->add( 'codemirror-keymap-vim',     plugins_url( 'wp-includes/js/codemirror/keymap/vim.js', BETTER_CODE_EDITING_PLUGIN_FILE ),    array( 'codemirror' ), $codemirror_version ); 
    24  
    25     $scripts->add( 'codemirror-addon-hint-show',       plugins_url( 'wp-includes/js/codemirror/addon/hint/show-hint.js', BETTER_CODE_EDITING_PLUGIN_FILE ),       array( 'codemirror' ), $codemirror_version ); 
    26     $scripts->add( 'codemirror-addon-hint-anyword',    plugins_url( 'wp-includes/js/codemirror/addon/hint/anyword-hint.js', BETTER_CODE_EDITING_PLUGIN_FILE ),    array( 'codemirror' ), $codemirror_version ); 
    27     $scripts->add( 'codemirror-addon-hint-css',        plugins_url( 'wp-includes/js/codemirror/addon/hint/css-hint.js', BETTER_CODE_EDITING_PLUGIN_FILE ),        array( 'codemirror-addon-hint-show', 'codemirror-mode-css' ), $codemirror_version ); 
    28     $scripts->add( 'codemirror-addon-hint-html',       plugins_url( 'wp-includes/js/codemirror/addon/hint/html-hint.js', BETTER_CODE_EDITING_PLUGIN_FILE ),       array( 'codemirror-addon-hint-show', 'codemirror-addon-hint-xml', 'codemirror-mode-htmlmixed' ), $codemirror_version ); 
    29     $scripts->add( 'codemirror-addon-hint-javascript', plugins_url( 'wp-includes/js/codemirror/addon/hint/javascript-hint.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array( 'codemirror-addon-hint-show', 'codemirror-mode-javascript' ), $codemirror_version ); 
    30     $scripts->add( 'codemirror-addon-hint-sql',        plugins_url( 'wp-includes/js/codemirror/addon/hint/sql-hint.js', BETTER_CODE_EDITING_PLUGIN_FILE ),        array( 'codemirror-addon-hint-show', 'codemirror-mode-sql' ), $codemirror_version ); 
    31     $scripts->add( 'codemirror-addon-hint-xml',        plugins_url( 'wp-includes/js/codemirror/addon/hint/xml-hint.js', BETTER_CODE_EDITING_PLUGIN_FILE ),        array( 'codemirror-addon-hint-show', 'codemirror-mode-xml' ), $codemirror_version ); 
     19    $scripts->add( 'codemirror', plugins_url( 'wp-includes/js/codemirror/codemirror.min.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array(), $codemirror_version ); 
    3220 
    3321    // The linting engines for the lint addons... 
    34     $scripts->add( 'csslint',  plugins_url( 'wp-includes/js/csslint.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array(), '1.0.5' ); 
     22    $scripts->add( 'csslint', plugins_url( 'wp-includes/js/csslint.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array(), '1.0.5' ); 
     23    $scripts->add( 'jshint', plugins_url( 'wp-includes/js/jshint.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array(), '2.9.5' ); 
     24    $scripts->add( 'jsonlint', plugins_url( 'wp-includes/js/jsonlint.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array(), '1.6.2' ); 
    3525    $scripts->add( 'htmlhint', plugins_url( 'wp-includes/js/htmlhint.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array(), '0.9.14-xwp' ); 
    36     $scripts->add( 'jshint',   plugins_url( 'wp-includes/js/jshint.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array(), '2.9.5' ); 
    37     $scripts->add( 'jsonlint', plugins_url( 'wp-includes/js/jsonlint.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array(), '1.6.2' ); 
    38  
    3926    $scripts->add( 'htmlhint-kses', plugins_url( 'wp-includes/js/htmlhint-kses.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array( 'htmlhint' ), BETTER_CODE_EDITING_PLUGIN_VERSION ); 
    40  
    41     $scripts->add( 'codemirror-addon-lint',            plugins_url( 'wp-includes/js/codemirror/addon/lint/lint.js',      BETTER_CODE_EDITING_PLUGIN_FILE ),       array( 'codemirror' ),            $codemirror_version ); 
    42     $scripts->add( 'codemirror-addon-lint-css',        plugins_url( 'wp-includes/js/codemirror/addon/lint/css-lint.js',  BETTER_CODE_EDITING_PLUGIN_FILE ),       array( 'codemirror-addon-lint', 'csslint' ), $codemirror_version ); 
    43     $scripts->add( 'codemirror-addon-lint-html',       plugins_url( 'wp-includes/js/codemirror/addon/lint/html-lint.js', BETTER_CODE_EDITING_PLUGIN_FILE ),       array( 'codemirror-addon-lint', 'htmlhint', 'csslint', 'jshint' ), $codemirror_version ); 
    44     $scripts->add( 'codemirror-addon-lint-javascript', plugins_url( 'wp-includes/js/codemirror/addon/lint/javascript-lint.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array( 'codemirror-addon-lint', 'jshint' ), $codemirror_version ); 
    45     $scripts->add( 'codemirror-addon-lint-json',       plugins_url( 'wp-includes/js/codemirror/addon/lint/json-lint.js', BETTER_CODE_EDITING_PLUGIN_FILE ),       array( 'codemirror-addon-lint', 'jsonlint' ), $codemirror_version ); 
    46  
    47     $scripts->add( 'codemirror-addon-comment',                 plugins_url( 'wp-includes/js/codemirror/addon/comment/comment.js', BETTER_CODE_EDITING_PLUGIN_FILE ),         array( 'codemirror' ), $codemirror_version ); 
    48     $scripts->add( 'codemirror-addon-comment-continuecomment', plugins_url( 'wp-includes/js/codemirror/addon/comment/continuecomment.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array( 'codemirror' ), $codemirror_version ); 
    49     $scripts->add( 'codemirror-addon-fold-xml-fold',           plugins_url( 'wp-includes/js/codemirror/addon/fold/xml-fold.js', BETTER_CODE_EDITING_PLUGIN_FILE ),           array( 'codemirror' ), $codemirror_version ); 
    50     $scripts->add( 'codemirror-addon-mode-overlay',            plugins_url( 'wp-includes/js/codemirror/addon/mode/overlay.js', BETTER_CODE_EDITING_PLUGIN_FILE ),            array( 'codemirror' ), $codemirror_version ); 
    51  
    52     $scripts->add( 'codemirror-addon-edit-closebrackets', plugins_url( 'wp-includes/js/codemirror/addon/edit/closebrackets.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array( 'codemirror' ), $codemirror_version ); 
    53     $scripts->add( 'codemirror-addon-edit-closetag',      plugins_url( 'wp-includes/js/codemirror/addon/edit/closetag.js', BETTER_CODE_EDITING_PLUGIN_FILE ),      array( 'codemirror' ), $codemirror_version ); 
    54     $scripts->add( 'codemirror-addon-edit-continuelist',  plugins_url( 'wp-includes/js/codemirror/addon/edit/continuelist.js', BETTER_CODE_EDITING_PLUGIN_FILE ),  array( 'codemirror' ), $codemirror_version ); 
    55     $scripts->add( 'codemirror-addon-edit-matchbrackets', plugins_url( 'wp-includes/js/codemirror/addon/edit/matchbrackets.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array( 'codemirror' ), $codemirror_version ); 
    56     $scripts->add( 'codemirror-addon-edit-matchtags',     plugins_url( 'wp-includes/js/codemirror/addon/edit/matchtags.js', BETTER_CODE_EDITING_PLUGIN_FILE ),     array( 'codemirror', 'codemirror-addon-fold-xml-fold' ), $codemirror_version ); 
    57     $scripts->add( 'codemirror-addon-edit-trailingspace', plugins_url( 'wp-includes/js/codemirror/addon/edit/trailingspace.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array( 'codemirror' ), $codemirror_version ); 
    58  
    59     $scripts->add( 'codemirror-addon-dialog', plugins_url( 'wp-includes/js/codemirror/addon/dialog/dialog.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array( 'codemirror' ), $codemirror_version ); 
    60  
    61     $scripts->add( 'codemirror-addon-display-autorefresh', plugins_url( 'wp-includes/js/codemirror/addon/display/autorefresh.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array( 'codemirror' ), $codemirror_version ); 
    62     $scripts->add( 'codemirror-addon-display-fullscreen',  plugins_url( 'wp-includes/js/codemirror/addon/display/fullscreen.js', BETTER_CODE_EDITING_PLUGIN_FILE ),  array( 'codemirror' ), $codemirror_version ); 
    63     $scripts->add( 'codemirror-addon-display-panel',       plugins_url( 'wp-includes/js/codemirror/addon/display/panel.js', BETTER_CODE_EDITING_PLUGIN_FILE ),       array( 'codemirror' ), $codemirror_version ); 
    64     $scripts->add( 'codemirror-addon-display-placeholder', plugins_url( 'wp-includes/js/codemirror/addon/display/placeholder.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array( 'codemirror' ), $codemirror_version ); 
    65     $scripts->add( 'codemirror-addon-display-rulers',      plugins_url( 'wp-includes/js/codemirror/addon/display/rulers.js', BETTER_CODE_EDITING_PLUGIN_FILE ),      array( 'codemirror' ), $codemirror_version ); 
    66  
    67     $scripts->add( 'codemirror-addon-fold-brace-fold',    plugins_url( 'wp-includes/js/codemirror/addon/fold/brace-fold.js', BETTER_CODE_EDITING_PLUGIN_FILE ),    array( 'codemirror' ), $codemirror_version ); 
    68     $scripts->add( 'codemirror-addon-fold-comment-fold',  plugins_url( 'wp-includes/js/codemirror/addon/fold/comment-fold.js', BETTER_CODE_EDITING_PLUGIN_FILE ),  array( 'codemirror' ), $codemirror_version ); 
    69     $scripts->add( 'codemirror-addon-fold-foldcode',      plugins_url( 'wp-includes/js/codemirror/addon/fold/foldcode.js', BETTER_CODE_EDITING_PLUGIN_FILE ),      array( 'codemirror' ), $codemirror_version ); 
    70     $scripts->add( 'codemirror-addon-fold-foldgutter',    plugins_url( 'wp-includes/js/codemirror/addon/fold/foldgutter.js', BETTER_CODE_EDITING_PLUGIN_FILE ),    array( 'codemirror' ), $codemirror_version ); 
    71     $scripts->add( 'codemirror-addon-fold-indent-fold',   plugins_url( 'wp-includes/js/codemirror/addon/fold/indent-fold.js', BETTER_CODE_EDITING_PLUGIN_FILE ),   array( 'codemirror' ), $codemirror_version ); 
    72     $scripts->add( 'codemirror-addon-fold-markdown-fold', plugins_url( 'wp-includes/js/codemirror/addon/fold/markdown-fold.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array( 'codemirror' ), $codemirror_version ); 
    73  
    74     $scripts->add( 'codemirror-addon-merge', plugins_url( 'wp-includes/js/codemirror/addon/merge/merge.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array( 'codemirror' ), $codemirror_version ); 
    75  
    76     $scripts->add( 'codemirror-addon-mode-loadmode',  plugins_url( 'wp-includes/js/codemirror/addon/mode/loadmode.js', BETTER_CODE_EDITING_PLUGIN_FILE ),  array( 'codemirror' ), $codemirror_version ); 
    77     $scripts->add( 'codemirror-addon-mode-multiplex', plugins_url( 'wp-includes/js/codemirror/addon/mode/multiplex.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array( 'codemirror' ), $codemirror_version ); 
    78     $scripts->add( 'codemirror-addon-mode-simple',    plugins_url( 'wp-includes/js/codemirror/addon/mode/simple.js', BETTER_CODE_EDITING_PLUGIN_FILE ),    array( 'codemirror' ), $codemirror_version ); 
    79  
    80     $scripts->add( 'codemirror-addon-runmode',                    plugins_url( 'wp-includes/js/codemirror/addon/runmode/runmode.js', BETTER_CODE_EDITING_PLUGIN_FILE ),            array( 'codemirror' ), $codemirror_version ); 
    81     $scripts->add( 'codemirror-addon-runmode-colorize',           plugins_url( 'wp-includes/js/codemirror/addon/runmode/colorize.js', BETTER_CODE_EDITING_PLUGIN_FILE ),           array( 'codemirror' ), $codemirror_version ); 
    82     $scripts->add( 'codemirror-addon-runmode-runmode-standalone', plugins_url( 'wp-includes/js/codemirror/addon/runmode/runmode-standalone.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array( 'codemirror' ), $codemirror_version ); 
    83  
    84     $scripts->add( 'codemirror-addon-scroll-annotatescrollbar', plugins_url( 'wp-includes/js/codemirror/addon/scroll/annotatescrollbar.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array( 'codemirror' ), $codemirror_version ); 
    85     $scripts->add( 'codemirror-addon-scroll-scrollpastend'    , plugins_url( 'wp-includes/js/codemirror/addon/scroll/scrollpastend.js', BETTER_CODE_EDITING_PLUGIN_FILE ),     array( 'codemirror' ), $codemirror_version ); 
    86     $scripts->add( 'codemirror-addon-scroll-simplescrollbars',  plugins_url( 'wp-includes/js/codemirror/addon/scroll/simplescrollbars.js', BETTER_CODE_EDITING_PLUGIN_FILE ),  array( 'codemirror' ), $codemirror_version ); 
    87  
    88     $scripts->add( 'codemirror-addon-search',                    plugins_url( 'wp-includes/js/codemirror/addon/search/search.js', BETTER_CODE_EDITING_PLUGIN_FILE ),             array( 'codemirror' ), $codemirror_version ); 
    89     $scripts->add( 'codemirror-addon-search-jump-to-line',       plugins_url( 'wp-includes/js/codemirror/addon/search/jump-to-line.js', BETTER_CODE_EDITING_PLUGIN_FILE ),       array( 'codemirror' ), $codemirror_version ); 
    90     $scripts->add( 'codemirror-addon-search-match-highlighter',  plugins_url( 'wp-includes/js/codemirror/addon/search/match-highlighter.js', BETTER_CODE_EDITING_PLUGIN_FILE ),  array( 'codemirror' ), $codemirror_version ); 
    91     $scripts->add( 'codemirror-addon-search-matchesonscrollbar', plugins_url( 'wp-includes/js/codemirror/addon/search/matchesonscrollbar.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array( 'codemirror' ), $codemirror_version ); 
    92     $scripts->add( 'codemirror-addon-search-searchcursor',       plugins_url( 'wp-includes/js/codemirror/addon/search/searchcursor.js', BETTER_CODE_EDITING_PLUGIN_FILE ),       array( 'codemirror' ), $codemirror_version ); 
    93  
    94     $scripts->add( 'codemirror-addon-tern',        plugins_url( 'wp-includes/js/codemirror/addon/tern/tern.js', BETTER_CODE_EDITING_PLUGIN_FILE ),   array( 'codemirror' ), $codemirror_version ); 
    95     $scripts->add( 'codemirror-addon-tern-worker', plugins_url( 'wp-includes/js/codemirror/addon/tern/worker.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array( 'codemirror' ), $codemirror_version ); 
    96  
    97     $scripts->add( 'codemirror-addon-wrap-hardwrap', plugins_url( 'wp-includes/js/codemirror/addon/wrap/hardwrap.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array( 'codemirror' ), $codemirror_version ); 
    98  
    99     $scripts->add( 'codemirror-addon-selection-active-line',    plugins_url( 'wp-includes/js/codemirror/addon/selection/active-line.js', BETTER_CODE_EDITING_PLUGIN_FILE ),       array( 'codemirror' ), $codemirror_version ); 
    100     $scripts->add( 'codemirror-addon-selection-mark-selection', plugins_url( 'wp-includes/js/codemirror/addon/selection/mark-selection.js', BETTER_CODE_EDITING_PLUGIN_FILE ),    array( 'codemirror' ), $codemirror_version ); 
    101     $scripts->add( 'codemirror-addon-selection-pointer',        plugins_url( 'wp-includes/js/codemirror/addon/selection/selection-pointer.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array( 'codemirror' ), $codemirror_version ); 
    102  
    103     $scripts->add( 'codemirror-mode-meta',       plugins_url( 'wp-includes/js/codemirror/mode/meta.js', BETTER_CODE_EDITING_PLUGIN_FILE ),                   array( 'codemirror' ), $codemirror_version ); 
    104     $scripts->add( 'codemirror-mode-clike',      plugins_url( 'wp-includes/js/codemirror/mode/clike/clike.js', BETTER_CODE_EDITING_PLUGIN_FILE ),           array( 'codemirror' ), $codemirror_version ); 
    105     $scripts->add( 'codemirror-mode-css',        plugins_url( 'wp-includes/js/codemirror/mode/css/css.js', BETTER_CODE_EDITING_PLUGIN_FILE ),               array( 'codemirror' ), $codemirror_version ); 
    106     $scripts->add( 'codemirror-mode-diff',       plugins_url( 'wp-includes/js/codemirror/mode/diff/diff.js', BETTER_CODE_EDITING_PLUGIN_FILE ),             array( 'codemirror' ), $codemirror_version ); 
    107     $scripts->add( 'codemirror-mode-htmlmixed',  plugins_url( 'wp-includes/js/codemirror/mode/htmlmixed/htmlmixed.js', BETTER_CODE_EDITING_PLUGIN_FILE ),   array( 'codemirror', 'codemirror-mode-css', 'codemirror-mode-javascript', 'codemirror-mode-xml' ), $codemirror_version ); 
    108     $scripts->add( 'codemirror-mode-http',       plugins_url( 'wp-includes/js/codemirror/mode/http/http.js', BETTER_CODE_EDITING_PLUGIN_FILE ),             array( 'codemirror' ), $codemirror_version ); 
    109     $scripts->add( 'codemirror-mode-javascript', plugins_url( 'wp-includes/js/codemirror/mode/javascript/javascript.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array( 'codemirror' ), $codemirror_version ); 
    110     $scripts->add( 'codemirror-mode-jsx',        plugins_url( 'wp-includes/js/codemirror/mode/jsx/jsx.js', BETTER_CODE_EDITING_PLUGIN_FILE ),               array( 'codemirror', 'codemirror-mode-javascript', 'codemirror-mode-xml' ), $codemirror_version ); 
    111     $scripts->add( 'codemirror-mode-markdown',   plugins_url( 'wp-includes/js/codemirror/mode/markdown/markdown.js', BETTER_CODE_EDITING_PLUGIN_FILE ),     array( 'codemirror', 'codemirror-mode-xml' ), $codemirror_version ); 
    112     $scripts->add( 'codemirror-mode-gfm',        plugins_url( 'wp-includes/js/codemirror/mode/gfm/gfm.js', BETTER_CODE_EDITING_PLUGIN_FILE ),               array( 'codemirror', 'codemirror-addon-mode-overlay', 'codemirror-mode-markdown' ), $codemirror_version ); 
    113     $scripts->add( 'codemirror-mode-nginx',      plugins_url( 'wp-includes/js/codemirror/mode/nginx/nginx.js', BETTER_CODE_EDITING_PLUGIN_FILE ),           array( 'codemirror' ), $codemirror_version ); 
    114     $scripts->add( 'codemirror-mode-php',        plugins_url( 'wp-includes/js/codemirror/mode/php/php.js', BETTER_CODE_EDITING_PLUGIN_FILE ),               array( 'codemirror-mode-clike', 'codemirror-mode-xml', 'codemirror-mode-javascript', 'codemirror-mode-css', 'codemirror-mode-htmlmixed' ), $codemirror_version ); 
    115     $scripts->add( 'codemirror-mode-sass',       plugins_url( 'wp-includes/js/codemirror/mode/sass/sass.js', BETTER_CODE_EDITING_PLUGIN_FILE ),             array( 'codemirror', 'codemirror-mode-css' ), $codemirror_version ); 
    116     $scripts->add( 'codemirror-mode-shell',      plugins_url( 'wp-includes/js/codemirror/mode/shell/shell.js', BETTER_CODE_EDITING_PLUGIN_FILE ),           array( 'codemirror' ), $codemirror_version ); 
    117     $scripts->add( 'codemirror-mode-sql',        plugins_url( 'wp-includes/js/codemirror/mode/sql/sql.js', BETTER_CODE_EDITING_PLUGIN_FILE ),               array( 'codemirror' ), $codemirror_version ); 
    118     $scripts->add( 'codemirror-mode-xml',        plugins_url( 'wp-includes/js/codemirror/mode/xml/xml.js', BETTER_CODE_EDITING_PLUGIN_FILE ),               array( 'codemirror' ), $codemirror_version ); 
    119     $scripts->add( 'codemirror-mode-yaml',       plugins_url( 'wp-includes/js/codemirror/mode/yaml/yaml.js', BETTER_CODE_EDITING_PLUGIN_FILE ),             array( 'codemirror' ), $codemirror_version ); 
    12027 
    12128    $scripts->add( 'code-editor', plugins_url( 'wp-admin/js/code-editor.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array( 'jquery', 'codemirror' ), BETTER_CODE_EDITING_PLUGIN_VERSION ); 
     
    12330    $scripts->add( 'custom-html-widgets', plugins_url( 'wp-admin/js/widgets/custom-html-widgets.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array( 'code-editor', 'jquery', 'backbone', 'wp-util', 'jquery-ui-core', 'wp-a11y' ), BETTER_CODE_EDITING_PLUGIN_VERSION ); 
    12431    $scripts->add( 'wp-theme-plugin-editor', plugins_url( 'wp-admin/js/theme-plugin-editor.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array( 'code-editor', 'jquery', 'jquery-ui-core', 'wp-a11y', 'underscore' ), BETTER_CODE_EDITING_PLUGIN_VERSION ); 
    125  
    126     if ( defined( 'SCRIPT_DEBUG' ) ) { 
    127         _better_code_editing_report_asset_errors( $scripts ); 
    128     } 
    12932} 
    13033 
     
    13538 */ 
    13639function _better_code_editing_register_styles( WP_Styles $styles ) { 
    137     $codemirror_version = '5.29.1-alpha-' . BETTER_CODE_EDITING_PLUGIN_VERSION; 
     40    $codemirror_version = '5.29.1-alpha-ee20357-' . BETTER_CODE_EDITING_PLUGIN_VERSION; 
    13841 
    13942    /* 
     
    14447    unset( $styles->registered['common']->extra['suffix'] ); // Prevent minified version from being attempted. 
    14548 
    146     $styles->add( 'codemirror',                                 plugins_url( 'wp-includes/js/codemirror/lib/codemirror.css', BETTER_CODE_EDITING_PLUGIN_FILE ),                  array(),               $codemirror_version ); 
    147     $styles->add( 'codemirror-addon-show-hint',                 plugins_url( 'wp-includes/js/codemirror/addon/hint/show-hint.css', BETTER_CODE_EDITING_PLUGIN_FILE ),            array( 'codemirror' ), $codemirror_version ); 
    148     $styles->add( 'codemirror-addon-lint',                      plugins_url( 'wp-includes/js/codemirror/addon/lint/lint.css', BETTER_CODE_EDITING_PLUGIN_FILE ),                 array( 'codemirror' ), $codemirror_version ); 
    149     $styles->add( 'codemirror-addon-dialog',                    plugins_url( 'wp-includes/js/codemirror/addon/dialog/dialog.css', BETTER_CODE_EDITING_PLUGIN_FILE ),             array( 'codemirror' ), $codemirror_version ); 
    150     $styles->add( 'codemirror-addon-display-fullscreen',        plugins_url( 'wp-includes/js/codemirror/addon/display/fullscreen.css', BETTER_CODE_EDITING_PLUGIN_FILE ),        array( 'codemirror' ), $codemirror_version ); 
    151     $styles->add( 'codemirror-addon-fold-foldgutter',           plugins_url( 'wp-includes/js/codemirror/addon/fold/foldgutter.css', BETTER_CODE_EDITING_PLUGIN_FILE ),           array( 'codemirror' ), $codemirror_version ); 
    152     $styles->add( 'codemirror-addon-merge',                     plugins_url( 'wp-includes/js/codemirror/addon/merge/merge.css', BETTER_CODE_EDITING_PLUGIN_FILE ),               array( 'codemirror' ), $codemirror_version ); 
    153     $styles->add( 'codemirror-addon-scroll-simplescrollbars',   plugins_url( 'wp-includes/js/codemirror/addon/scroll/simplescrollbars.css', BETTER_CODE_EDITING_PLUGIN_FILE ),   array( 'codemirror' ), $codemirror_version ); 
    154     $styles->add( 'codemirror-addon-search-matchesonscrollbar', plugins_url( 'wp-includes/js/codemirror/addon/search/matchesonscrollbar.css', BETTER_CODE_EDITING_PLUGIN_FILE ), array( 'codemirror' ), $codemirror_version ); 
    155     $styles->add( 'codemirror-addon-tern',                      plugins_url( 'wp-includes/js/codemirror/addon/tern/tern.css', BETTER_CODE_EDITING_PLUGIN_FILE ),                 array( 'codemirror' ), $codemirror_version ); 
    156  
     49    $styles->add( 'codemirror', plugins_url( 'wp-includes/js/codemirror/codemirror.min.css', BETTER_CODE_EDITING_PLUGIN_FILE ), array(), $codemirror_version ); 
    15750    $styles->add( 'code-editor', plugins_url( 'wp-admin/css/code-editor.css', BETTER_CODE_EDITING_PLUGIN_FILE ), array( 'codemirror' ), BETTER_CODE_EDITING_PLUGIN_VERSION ); 
    15851 
     
    17366    $styles->add_inline_style( 'widgets', file_get_contents( dirname( BETTER_CODE_EDITING_PLUGIN_FILE ) . '/wp-admin/css/widgets-addendum' . $suffix ) ); 
    17467    $styles->add_inline_style( 'customize-controls', file_get_contents( dirname( BETTER_CODE_EDITING_PLUGIN_FILE ) . '/wp-admin/css/customize-controls-addendum' . $suffix ) ); 
    175  
    176     if ( defined( 'SCRIPT_DEBUG' ) ) { 
    177         _better_code_editing_report_asset_errors( $styles ); 
    178     } 
    17968} 
    180  
    181 /** 
    182  * Make sure all CodeMirror assets present are registered. 
    183  * 
    184  * This will not be included in core merge. 
    185  * 
    186  * @param WP_Scripts|WP_Styles $dependencies Dependencies. 
    187  */ 
    188 function _better_code_editing_report_asset_errors( $dependencies ) { 
    189     $plugin_dir_url = plugins_url( '', BETTER_CODE_EDITING_PLUGIN_FILE ); 
    190     $codemirror_path = 'wp-includes/js/codemirror'; 
    191     $codemirror_registered_paths = array(); 
    192     $plugin_dir_path = plugin_dir_path( BETTER_CODE_EDITING_PLUGIN_FILE ); 
    193     $type = $dependencies instanceof WP_Styles ? 'style' : 'script'; 
    194  
    195     foreach ( $dependencies->registered as $handle => $style ) { 
    196         if ( 'common' === $handle ) { 
    197             continue; 
    198         } 
    199  
    200         if ( 0 === strpos( $style->src, $plugin_dir_url ) ) { 
    201             $path = substr( $style->src, strlen( $plugin_dir_url ) + 1 ); 
    202             if ( ! file_exists( $plugin_dir_path . $path ) ) { 
    203                 trigger_error( "Missing '$handle' $type src: $path'", E_USER_WARNING ); 
    204             } 
    205             if ( 0 === strpos( $path, $codemirror_path ) ) { 
    206                 $codemirror_registered_paths[] = $path; 
    207             } 
    208         } 
    209     } 
    210  
    211     $directory = new RecursiveDirectoryIterator( $plugin_dir_path . $codemirror_path ); 
    212     $iterator = new RecursiveIteratorIterator( $directory ); 
    213     $file_iterator = new RegexIterator( $iterator, $dependencies instanceof WP_Styles ? '#\.css$#' : '#\.js$#' ); 
    214  
    215     $codemirror_existing_paths = array(); 
    216     foreach ( $file_iterator as $js_file ) { 
    217         $codemirror_existing_paths[] = substr( $js_file->getPathname(), strlen( $plugin_dir_path ) ); 
    218     } 
    219     $unregistered_assets = array_diff( $codemirror_existing_paths, $codemirror_registered_paths ); 
    220     if ( ! empty( $unregistered_assets ) ) { 
    221         trigger_error( 
    222             sprintf( 
    223                 'There are %d %s assets from CodeMirror that are not registered: %s', 
    224                 count( $unregistered_assets ), 
    225                 $type, 
    226                 join( ', ', $unregistered_assets ) 
    227             ), 
    228             E_USER_WARNING 
    229         ); 
    230     } 
    231  
    232 } 
Note: See TracChangeset for help on using the changeset viewer.