├── .dev-lib ├── .editorconfig ├── .eslintrc ├── .gitattributes ├── .gitignore ├── .gitmodules ├── .jscsrc ├── .jshintignore ├── .jshintrc ├── .svnignore ├── .travis.yml ├── Gruntfile.js ├── better-code-editing.php ├── bin └── verify-version-consistency.php ├── composer.json ├── composer.lock ├── contributing.md ├── core-commit-message.txt ├── package-lock.json ├── package.json ├── phpcs.xml ├── readme.md ├── readme.txt ├── wp-admin ├── css │ ├── code-editor.css │ ├── common.css │ ├── customize-controls-addendum.css │ └── widgets-addendum.css ├── file-editor-addendum.php ├── includes │ └── user.php ├── js │ ├── code-editor.js │ ├── customize-controls-addendum.js │ ├── theme-plugin-editor.js │ └── widgets │ │ └── custom-html-widgets.js └── user-edit-addendum.php ├── wp-assets ├── icon-256.png └── icon.svg └── wp-includes ├── customize-manager-addendum.php ├── general-template-addendum.php ├── js ├── codemirror │ └── codemirror.manifest.js └── htmlhint-kses.js ├── script-loader-addendum.php ├── widgets-addendum.php └── widgets └── class-wp-widget-custom-html-codemirror.php /.dev-lib: -------------------------------------------------------------------------------- 1 | CHECK_SCOPE=changed-files 2 | WPCS_GIT_TREE=develop 3 | 4 | if [[ ${TRAVIS_PHP_VERSION:0:3} == "5.2" ]]; then 5 | DEV_LIB_SKIP="phpcs,$DEV_LIB_SKIP" 6 | fi 7 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | dev-lib/.editorconfig -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | dev-lib/.eslintrc -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # CodeMirror sources 3 | wp-includes/js/codemirror/*.min.css 4 | wp-includes/js/codemirror/*.min.js 5 | wp-includes/js/codemirror/codemirror.js 6 | wp-includes/js/codemirror/codemirror.css 7 | wp-includes/js/csslint.js 8 | wp-includes/js/htmlhint.js 9 | wp-includes/js/jsonlint.js 10 | wp-includes/js/jshint.js 11 | 12 | build 13 | *.zip 14 | *-rtl.css 15 | ~* 16 | 17 | # Windows image file caches 18 | Thumbs.db 19 | ehthumbs.db 20 | 21 | # Folder config file 22 | Desktop.ini 23 | 24 | # Recycle Bin used on file shares 25 | $RECYCLE.BIN/ 26 | 27 | # Windows Installer files 28 | *.cab 29 | *.msi 30 | *.msm 31 | *.msp 32 | 33 | # Windows shortcuts 34 | *.lnk 35 | 36 | # ========================= 37 | # Operating System Files 38 | # ========================= 39 | 40 | # OSX 41 | # ========================= 42 | 43 | .DS_Store 44 | .AppleDouble 45 | .LSOverride 46 | 47 | # Thumbnails 48 | ._* 49 | 50 | # Files that might appear in the root of a volume 51 | .DocumentRevisions-V100 52 | .fseventsd 53 | .Spotlight-V100 54 | .TemporaryItems 55 | .Trashes 56 | .VolumeIcon.icns 57 | 58 | # Directories potentially created on remote AFP share 59 | .AppleDB 60 | .AppleDesktop 61 | Network Trash Folder 62 | Temporary Items 63 | .apdisk 64 | node_modules 65 | 66 | /vendor/ 67 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "dev-lib"] 2 | path = dev-lib 3 | url = https://github.com/xwp/wp-dev-lib.git 4 | branch = master 5 | -------------------------------------------------------------------------------- /.jscsrc: -------------------------------------------------------------------------------- 1 | dev-lib/.jscsrc -------------------------------------------------------------------------------- /.jshintignore: -------------------------------------------------------------------------------- 1 | **/*.min.js 2 | **/node_modules/** 3 | **/vendor/** 4 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | dev-lib/.jshintrc -------------------------------------------------------------------------------- /.svnignore: -------------------------------------------------------------------------------- 1 | .git 2 | .gitattributes 3 | .gitignore 4 | .gitmodules 5 | .svnignore 6 | README.md 7 | bin 8 | node_modules 9 | .dev-lib 10 | .distignore 11 | .editorconfig 12 | .eslintrc 13 | .jscsrc 14 | .jshintignore 15 | .jshintrc 16 | .travis.yml 17 | dev-lib 18 | package-lock.json 19 | package.json 20 | phpcs.xml 21 | readme.md 22 | *.zip 23 | build 24 | contributing.md 25 | ~* 26 | Gruntfile.js 27 | .DS_Store 28 | wp-assets 29 | vendor 30 | composer.json 31 | composer.lock 32 | core-commit-message.txt 33 | wp-includes/js/codemirror/codemirror.js 34 | wp-includes/js/codemirror/codemirror.css 35 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | dist: precise 3 | 4 | notifications: 5 | email: 6 | on_success: never 7 | on_failure: change 8 | 9 | cache: 10 | directories: 11 | - node_modules 12 | - vendor 13 | - $HOME/phpunit-bin 14 | 15 | language: 16 | - php 17 | - node_js 18 | 19 | php: 20 | - 5.2 21 | - 5.6 22 | - 7.0 23 | 24 | env: 25 | - WP_VERSION=trunk WP_MULTISITE=0 26 | - WP_VERSION=trunk WP_MULTISITE=1 27 | 28 | install: 29 | - nvm install 6 && nvm use 6 30 | - export DEV_LIB_PATH=dev-lib 31 | - if [ ! -e "$DEV_LIB_PATH" ] && [ -L .travis.yml ]; then export DEV_LIB_PATH=$( dirname $( readlink .travis.yml ) ); fi 32 | - if [ ! -e "$DEV_LIB_PATH" ]; then git clone https://github.com/xwp/wp-dev-lib.git $DEV_LIB_PATH; fi 33 | - source $DEV_LIB_PATH/travis.install.sh 34 | 35 | script: 36 | - source $DEV_LIB_PATH/travis.script.sh 37 | 38 | after_script: 39 | - source $DEV_LIB_PATH/travis.after_script.sh 40 | -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | /* eslint-env node */ 2 | /* jshint node:true */ 3 | /* eslint-disable no-param-reassign */ 4 | 5 | module.exports = function( grunt ) { 6 | 'use strict'; 7 | 8 | grunt.initConfig( { 9 | 10 | pkg: grunt.file.readJSON( 'package.json' ), 11 | pkgLock: grunt.file.readJSON( 'package-lock.json' ), 12 | codemirrorLicenseBlock: grunt.file.read( 'node_modules/codemirror/lib/codemirror.js' ).replace( /\(function(.|\s)+$/, '' ).replace( /(^|\n)\/\/ */g, '$1' ).trim(), 13 | 14 | browserify: { 15 | codemirror: { 16 | options: { 17 | banner: '/*! This file is auto-generated from CodeMirror - <%= pkgLock.dependencies.codemirror.version %>\n\n<%= codemirrorLicenseBlock %>\n*/\n\n' 18 | }, 19 | src: 'wp-includes/js/codemirror/codemirror.manifest.js', 20 | dest: 'wp-includes/js/codemirror/codemirror.js' 21 | } 22 | }, 23 | 24 | uglify: { 25 | options: { 26 | ASCIIOnly: true, 27 | screwIE8: false 28 | }, 29 | codemirror: { 30 | options: { 31 | 32 | // Preserve comments that start with a bang. 33 | preserveComments: /^!/ 34 | }, 35 | src: 'wp-includes/js/codemirror/codemirror.js', 36 | dest: 'wp-includes/js/codemirror/codemirror.min.js' 37 | } 38 | }, 39 | 40 | concat: { 41 | codemirror: { 42 | options: { 43 | banner: '/*! This file is auto-generated from CodeMirror - <%= pkgLock.dependencies.codemirror.version %>\n\n<%= codemirrorLicenseBlock %>\n*/\n\n', 44 | separator: '\n', 45 | process: function( src, filepath ) { 46 | return '/* Source: ' + filepath.replace( 'node_modules/', '' ) + '*/\n' + src; 47 | } 48 | }, 49 | src: [ 50 | 'node_modules/codemirror/lib/codemirror.css', 51 | 'node_modules/codemirror/addon/hint/show-hint.css', 52 | 'node_modules/codemirror/addon/lint/lint.css', 53 | 'node_modules/codemirror/addon/dialog/dialog.css', 54 | 'node_modules/codemirror/addon/display/fullscreen.css', 55 | 'node_modules/codemirror/addon/fold/foldgutter.css', 56 | 'node_modules/codemirror/addon/merge/merge.css', 57 | 'node_modules/codemirror/addon/scroll/simplescrollbars.css', 58 | 'node_modules/codemirror/addon/search/matchesonscrollbar.css', 59 | 'node_modules/codemirror/addon/tern/tern.css' 60 | ], 61 | dest: 'wp-includes/js/codemirror/codemirror.css' 62 | } 63 | }, 64 | 65 | cssmin: { 66 | options: { 67 | compatibility: 'ie7' 68 | }, 69 | codemirror: { 70 | expand: true, 71 | ext: '.min.css', 72 | src: [ 73 | 'wp-includes/js/codemirror/codemirror.css' 74 | ] 75 | } 76 | }, 77 | 78 | copy: { 79 | csslint: { 80 | src: 'node_modules/csslint/dist/csslint.js', 81 | dest: 'wp-includes/js/csslint.js' 82 | }, 83 | htmlhint: { 84 | src: 'node_modules/htmlhint/lib/htmlhint.js', 85 | dest: 'wp-includes/js/htmlhint.js' 86 | }, 87 | jshint: { 88 | src: 'node_modules/jshint/dist/jshint.js', 89 | dest: 'wp-includes/js/jshint.js' 90 | }, 91 | jsonlint: { 92 | src: 'node_modules/jsonlint/lib/jsonlint.js', 93 | dest: 'wp-includes/js/jsonlint.js' 94 | } 95 | }, 96 | 97 | rtlcss: { 98 | options: { 99 | opts: { 100 | clean: false, 101 | processUrls: { atrule: true, decl: false }, 102 | stringMap: [ 103 | { 104 | name: 'import-rtl-stylesheet', 105 | priority: 10, 106 | exclusive: true, 107 | search: [ '.css' ], 108 | replace: [ '-rtl.css' ], 109 | options: { 110 | scope: 'url', 111 | ignoreCase: false 112 | } 113 | } 114 | ] 115 | }, 116 | saveUnmodified: true, 117 | plugins: [ 118 | { 119 | name: 'swap-dashicons-left-right-arrows', 120 | priority: 10, 121 | directives: { 122 | control: {}, 123 | value: [] 124 | }, 125 | processors: [ 126 | { 127 | expr: /content/im, 128 | action: function( prop, value ) { 129 | if ( '"\\f141"' === value ) { // Glyph: dashicons-arrow-left. 130 | value = '"\\f139"'; 131 | } else if ( '"\\f340"' === value ) { // Glyph: dashicons-arrow-left-alt. 132 | value = '"\\f344"'; 133 | } else if ( '"\\f341"' === value ) { // Glyph: dashicons-arrow-left-alt2. 134 | value = '"\\f345"'; 135 | } else if ( '"\\f139"' === value ) { // Glyph: dashicons-arrow-right. 136 | value = '"\\f141"'; 137 | } else if ( '"\\f344"' === value ) { // Glyph: dashicons-arrow-right-alt. 138 | value = '"\\f340"'; 139 | } else if ( '"\\f345"' === value ) { // Glyph: dashicons-arrow-right-alt2. 140 | value = '"\\f341"'; 141 | } 142 | return { prop: prop, value: value }; 143 | } 144 | } 145 | ] 146 | } 147 | ] 148 | }, 149 | core: { 150 | expand: true, 151 | ext: '-rtl.css', 152 | src: [ 153 | 'wp-admin/css/*.css', 154 | '!wp-admin/css/*-rtl.css' 155 | ] 156 | } 157 | }, 158 | 159 | // Clean up the build 160 | clean: { 161 | build: { 162 | src: [ 'build' ] 163 | } 164 | }, 165 | 166 | // Shell actions 167 | shell: { 168 | options: { 169 | stdout: true, 170 | stderr: true 171 | }, 172 | readme: { 173 | command: 'php dev-lib/generate-markdown-readme' // Generate the readme.md 174 | }, 175 | lint: { 176 | command: 'CHECK_SCOPE=all bash dev-lib/pre-commit' 177 | }, 178 | build_release_zip: { 179 | command: 'if [ -e build ]; then rm -r build; fi; mkdir build; rsync -avz ./ build/ --exclude-from=.svnignore; if [ -e better-code-editing.zip ]; then rm better-code-editing.zip; fi; cd build; zip -r ../better-code-editing.zip .; cd ..; echo; echo "Please see: $(pwd)/better-code-editing.zip"' 180 | }, 181 | verify_matching_versions: { 182 | command: 'php bin/verify-version-consistency.php' 183 | } 184 | }, 185 | 186 | // Deploys a git Repo to the WordPress SVN repo 187 | wp_deploy: { 188 | deploy: { 189 | options: { 190 | plugin_slug: '<%= pkg.name %>', 191 | build_dir: 'build', 192 | assets_dir: 'wp-assets' 193 | } 194 | } 195 | } 196 | 197 | } ); 198 | 199 | // Load tasks 200 | grunt.loadNpmTasks( 'grunt-contrib-clean' ); 201 | grunt.loadNpmTasks( 'grunt-contrib-copy' ); 202 | grunt.loadNpmTasks( 'grunt-shell' ); 203 | grunt.loadNpmTasks( 'grunt-wp-deploy' ); 204 | grunt.loadNpmTasks( 'grunt-rtlcss' ); 205 | grunt.loadNpmTasks( 'grunt-browserify' ); 206 | grunt.loadNpmTasks( 'grunt-contrib-concat' ); 207 | grunt.loadNpmTasks( 'grunt-contrib-uglify' ); 208 | grunt.loadNpmTasks( 'grunt-contrib-cssmin' ); 209 | 210 | grunt.registerTask( 'rtl', [ 'rtlcss:core' ] ); 211 | 212 | // Register tasks 213 | grunt.registerTask( 'default', [ 214 | 'build' 215 | ] ); 216 | 217 | grunt.registerTask( 'readme', [ 218 | 'shell:readme' 219 | ] ); 220 | 221 | grunt.registerTask( 'build', [ 222 | 'readme', 223 | 'copy', 224 | 'shell:verify_matching_versions', 225 | 'shell:lint', 226 | 227 | 'browserify', 228 | 'uglify', 229 | 230 | 'concat', 231 | 'cssmin', 232 | 'rtl' 233 | ] ); 234 | 235 | grunt.registerTask( 'build-release-zip', [ 236 | 'build', 237 | 'shell:build_release_zip' 238 | ] ); 239 | 240 | grunt.registerTask( 'deploy', [ 241 | 'build', 242 | 'shell:build_release_zip', 243 | 'wp_deploy', 244 | 'clean' 245 | ] ); 246 | 247 | }; 248 | -------------------------------------------------------------------------------- /better-code-editing.php: -------------------------------------------------------------------------------- 1 | base ) { 21 | return; 22 | } 23 | ?> 24 |
25 |

26 |
27 | 35 |
36 |

npm install from the command line. Otherwise, please install the plugin from WordPress.org or via a ZIP from the GitHub releases page..', 'better-code-editing' ); ?>

37 |
38 | version; 12 | $versions['package-lock.json'] = json_decode( file_get_contents( dirname( __FILE__ ) . '/../package-lock.json' ) )->version; 13 | $versions['composer.json'] = json_decode( file_get_contents( dirname( __FILE__ ) . '/../composer.json' ) )->version; 14 | 15 | $readme_txt = file_get_contents( dirname( __FILE__ ) . '/../readme.txt' ); 16 | if ( ! preg_match( '/Stable tag:\s+(?P\S+)/i', $readme_txt, $matches ) ) { 17 | echo "Could not find stable tag in readme\n"; 18 | exit( 1 ); 19 | } 20 | $versions['readme.txt#stable-tag'] = $matches['version']; 21 | 22 | if ( ! preg_match( '/== Changelog ==\s+=\s+(?P\d+\.\d+(?:.\d+)?)/', $readme_txt, $matches ) ) { 23 | echo "Could not find version in readme.txt changelog\n"; 24 | exit( 1 ); 25 | } 26 | $versions['readme.txt#changelog'] = $matches['version']; 27 | 28 | $readme_md = file_get_contents( dirname( __FILE__ ) . '/../readme.md' ); 29 | if ( ! preg_match( '/## Changelog ##\s+###\s+(?P\d+\.\d+(?:.\d+)?)/', $readme_md, $matches ) ) { 30 | echo "Could not find version in readme.md changelog\n"; 31 | exit( 1 ); 32 | } 33 | $versions['readme.md#changelog'] = $matches['version']; 34 | 35 | $plugin_file = file_get_contents( dirname( __FILE__ ) . '/../better-code-editing.php' ); 36 | if ( ! preg_match( '/\*\s*Version:\s*(?P\d+\.\d+(?:.\d+)?)/', $plugin_file, $matches ) ) { 37 | echo "Could not find version in readme metadata\n"; 38 | exit( 1 ); 39 | } 40 | $versions['better-code-editing.php#metadata'] = $matches['version']; 41 | 42 | if ( ! preg_match( '/define\( \'BETTER_CODE_EDITING_PLUGIN_VERSION\', \'(?P\d+\.\d+(?:.\d+)?)\'/', $plugin_file, $matches ) ) { 43 | echo "Could not find version in BETTER_CODE_EDITING_PLUGIN_VERSION constant\n"; 44 | exit( 1 ); 45 | } 46 | $versions['BETTER_CODE_EDITING_PLUGIN_VERSION'] = $matches['version']; 47 | 48 | echo "Version references:\n"; 49 | print_r( $versions ); 50 | 51 | if ( 1 !== count( array_unique( $versions ) ) ) { 52 | echo "Not all version references have been updated\n."; 53 | exit( 1 ); 54 | } 55 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "wordpress/better-code-editing", 3 | "version": "0.7.0", 4 | "description": "Adding CodeMirror functionality to the Plugin and Theme file editors, as well as the Customizer Custom CSS box and Custom HTML widget.", 5 | "homepage": "https://github.com/WordPress/better-code-editing/", 6 | "type": "wordpress-plugin", 7 | "license": "GPL-2.0", 8 | "repositories": [ 9 | { 10 | "type": "git", 11 | "url": "https://github.com/WordPress/better-code-editing.git" 12 | } 13 | ], 14 | "require": { 15 | "php": ">=5.2" 16 | }, 17 | "require-dev": { 18 | "wp-coding-standards/wpcs": "*", 19 | "wimg/php-compatibility": "*", 20 | "dealerdirect/phpcodesniffer-composer-installer": "^0.4.2" 21 | }, 22 | "dist": { 23 | "url": "https://downloads.wordpress.org/plugin/better-code-editing.zip", 24 | "type": "zip" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "5a9063efcbeb166cbbf16b017996aade", 8 | "packages": [], 9 | "packages-dev": [ 10 | { 11 | "name": "dealerdirect/phpcodesniffer-composer-installer", 12 | "version": "v0.4.2", 13 | "source": { 14 | "type": "git", 15 | "url": "https://github.com/DealerDirect/phpcodesniffer-composer-installer.git", 16 | "reference": "17130f536db62570bcfc5cce59464b36e82eb092" 17 | }, 18 | "dist": { 19 | "type": "zip", 20 | "url": "https://api.github.com/repos/DealerDirect/phpcodesniffer-composer-installer/zipball/17130f536db62570bcfc5cce59464b36e82eb092", 21 | "reference": "17130f536db62570bcfc5cce59464b36e82eb092", 22 | "shasum": "" 23 | }, 24 | "require": { 25 | "composer-plugin-api": "^1.0", 26 | "squizlabs/php_codesniffer": "*" 27 | }, 28 | "require-dev": { 29 | "composer/composer": "*" 30 | }, 31 | "suggest": { 32 | "dealerdirect/qa-tools": "All the PHP QA tools you'll need" 33 | }, 34 | "type": "composer-plugin", 35 | "extra": { 36 | "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" 37 | }, 38 | "autoload": { 39 | "psr-4": { 40 | "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" 41 | } 42 | }, 43 | "notification-url": "https://packagist.org/downloads/", 44 | "license": [ 45 | "MIT" 46 | ], 47 | "authors": [ 48 | { 49 | "name": "Franck Nijhof", 50 | "email": "f.nijhof@dealerdirect.nl", 51 | "homepage": "http://workingatdealerdirect.eu", 52 | "role": "Developer" 53 | } 54 | ], 55 | "description": "PHP_CodeSniffer Standards Composer Installer Plugin", 56 | "homepage": "http://workingatdealerdirect.eu", 57 | "keywords": [ 58 | "PHPCodeSniffer", 59 | "PHP_CodeSniffer", 60 | "code quality", 61 | "codesniffer", 62 | "composer", 63 | "installer", 64 | "phpcs", 65 | "plugin", 66 | "qa", 67 | "quality", 68 | "standard", 69 | "standards", 70 | "style guide", 71 | "stylecheck", 72 | "tests" 73 | ], 74 | "time": "2017-08-16T10:25:17+00:00" 75 | }, 76 | { 77 | "name": "squizlabs/php_codesniffer", 78 | "version": "3.0.2", 79 | "source": { 80 | "type": "git", 81 | "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", 82 | "reference": "c7594a88ae75401e8f8d0bd4deb8431b39045c51" 83 | }, 84 | "dist": { 85 | "type": "zip", 86 | "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/c7594a88ae75401e8f8d0bd4deb8431b39045c51", 87 | "reference": "c7594a88ae75401e8f8d0bd4deb8431b39045c51", 88 | "shasum": "" 89 | }, 90 | "require": { 91 | "ext-simplexml": "*", 92 | "ext-tokenizer": "*", 93 | "ext-xmlwriter": "*", 94 | "php": ">=5.4.0" 95 | }, 96 | "require-dev": { 97 | "phpunit/phpunit": "~4.0" 98 | }, 99 | "bin": [ 100 | "bin/phpcs", 101 | "bin/phpcbf" 102 | ], 103 | "type": "library", 104 | "extra": { 105 | "branch-alias": { 106 | "dev-master": "3.x-dev" 107 | } 108 | }, 109 | "notification-url": "https://packagist.org/downloads/", 110 | "license": [ 111 | "BSD-3-Clause" 112 | ], 113 | "authors": [ 114 | { 115 | "name": "Greg Sherwood", 116 | "role": "lead" 117 | } 118 | ], 119 | "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", 120 | "homepage": "http://www.squizlabs.com/php-codesniffer", 121 | "keywords": [ 122 | "phpcs", 123 | "standards" 124 | ], 125 | "time": "2017-07-18T01:12:32+00:00" 126 | }, 127 | { 128 | "name": "wimg/php-compatibility", 129 | "version": "8.0.1", 130 | "source": { 131 | "type": "git", 132 | "url": "https://github.com/wimg/PHPCompatibility.git", 133 | "reference": "4c4385fb891dff0501009670f988d4fe36785249" 134 | }, 135 | "dist": { 136 | "type": "zip", 137 | "url": "https://api.github.com/repos/wimg/PHPCompatibility/zipball/4c4385fb891dff0501009670f988d4fe36785249", 138 | "reference": "4c4385fb891dff0501009670f988d4fe36785249", 139 | "shasum": "" 140 | }, 141 | "require": { 142 | "php": ">=5.3", 143 | "squizlabs/php_codesniffer": "^2.2 || ^3.0.2" 144 | }, 145 | "conflict": { 146 | "squizlabs/php_codesniffer": "2.6.2" 147 | }, 148 | "require-dev": { 149 | "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0" 150 | }, 151 | "suggest": { 152 | "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1" 153 | }, 154 | "type": "phpcodesniffer-standard", 155 | "autoload": { 156 | "psr-4": { 157 | "PHPCompatibility\\": "PHPCompatibility/" 158 | } 159 | }, 160 | "notification-url": "https://packagist.org/downloads/", 161 | "license": [ 162 | "LGPL-3.0" 163 | ], 164 | "authors": [ 165 | { 166 | "name": "Wim Godden", 167 | "role": "lead" 168 | } 169 | ], 170 | "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP version compatibility.", 171 | "homepage": "http://techblog.wimgodden.be/tag/codesniffer/", 172 | "keywords": [ 173 | "compatibility", 174 | "phpcs", 175 | "standards" 176 | ], 177 | "time": "2017-08-07T19:39:05+00:00" 178 | }, 179 | { 180 | "name": "wp-coding-standards/wpcs", 181 | "version": "0.13.1", 182 | "source": { 183 | "type": "git", 184 | "url": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git", 185 | "reference": "1f64b1a0b5b789822d0303436ee4e30e0135e4dc" 186 | }, 187 | "dist": { 188 | "type": "zip", 189 | "url": "https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/zipball/1f64b1a0b5b789822d0303436ee4e30e0135e4dc", 190 | "reference": "1f64b1a0b5b789822d0303436ee4e30e0135e4dc", 191 | "shasum": "" 192 | }, 193 | "require": { 194 | "php": ">=5.3", 195 | "squizlabs/php_codesniffer": "^2.9.0 || ^3.0.2" 196 | }, 197 | "suggest": { 198 | "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1" 199 | }, 200 | "type": "phpcodesniffer-standard", 201 | "notification-url": "https://packagist.org/downloads/", 202 | "license": [ 203 | "MIT" 204 | ], 205 | "authors": [ 206 | { 207 | "name": "Contributors", 208 | "homepage": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/graphs/contributors" 209 | } 210 | ], 211 | "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions", 212 | "keywords": [ 213 | "phpcs", 214 | "standards", 215 | "wordpress" 216 | ], 217 | "time": "2017-08-05T16:08:58+00:00" 218 | } 219 | ], 220 | "aliases": [], 221 | "minimum-stability": "stable", 222 | "stability-flags": [], 223 | "prefer-stable": false, 224 | "prefer-lowest": false, 225 | "platform": { 226 | "php": ">=5.2" 227 | }, 228 | "platform-dev": [] 229 | } 230 | -------------------------------------------------------------------------------- /contributing.md: -------------------------------------------------------------------------------- 1 | # Getting Started 2 | 3 | You can locate a ZIP for this plugin on the [releases page](https://github.com/WordPress/better-code-editing/releases) on GitHub. To install, simply go to your WP Admin and Plugins > Add New. Then click "Upload Plugin" and select the `better-code-editing.zip` you downloaded from the releases page. Then click "Install Now" and on the next screen click "Activate Plugin". _Note on upgrading:_ If you want to update the plugin from a previous version, you must first deactivate it and uninstall it completely and then re-install and re-activate the new version (see [#9757](https://core.trac.wordpress.org/ticket/9757) for fixing this). 4 | 5 | Otherwise, to set up the plugin for development: clone this repository and run `npm install` to download CodeMirror and other assets. 6 | 7 | ```bash 8 | cd wp-content/plugins/ 9 | git clone --recursive https://github.com/WordPress/better-code-editing.git 10 | cd better-code-editing 11 | npm install 12 | ``` 13 | 14 | Also install the pre-commit hook via: 15 | 16 | ```bash 17 | cd .git/hooks && ln -s ../../dev-lib/pre-commit pre-commit && cd - 18 | ``` 19 | 20 | # Creating a Release 21 | 22 | Contributors who want to make a new release, follow these steps: 23 | 24 | 1. Bump plugin versions in `package.json` (×1), `package-lock.json` (×1, just do `npm install` first), `composer.json` (×1), and in `better-code-editing.php` (×2: the metadata block in the header and also the `BETTER_CODE_EDITING_PLUGIN_VERSION` constant). 25 | 2. Run `grunt deploy` to create a `better-code-editing.zip` in the plugin's root directory and to commit the plugin to WordPress.org. 26 | 3. [Create new release](https://github.com/WordPress/better-code-editing/releases/new) on GitHub targeting `master`, with the new plugin version as the tag and release title, and upload the `better-code-editing.zip` as the associated binary. Publish the release. 27 | -------------------------------------------------------------------------------- /core-commit-message.txt: -------------------------------------------------------------------------------- 1 | Editor: Add CodeMirror-powered code editor with syntax highlighting, linting, and auto-completion. 2 | 3 | * Code editor is integrated into the Theme/Plugin Editor, Additional CSS in Customizer, and Custom HTML widget. 4 | * The CodeMirror component in the Custom HTML widget is integrated in a similar way to TinyMCE being integrated into the Text widget, adopting the same approach for integrating dynamic JavaScript-initialized fields. 5 | * Linting is performed for JS, CSS, HTML, and JSON via JSHint, CSSLint, HTMLHint, and JSONLint respectively. Linting is not yet supported for PHP. 6 | * When user lacks `unfiltered_html` the capability, the Custom HTML widget will report any Kses-invalid elements and attributes as errors via a custom Kses rule for HTMLHint. 7 | * When linting errors are detected, the user will be prevented from saving the code until the errors are fixed, reducing instances of broken websites. 8 | * Code editor is not yet integrated into the post editor. 9 | * Placeholder value is removed from Custom CSS in favor of a fleshed-out section description which now auto-expands when the CSS field is empty. See #39892. 10 | * Introduces `wp.codeEditor.initialize()` in JS to convert a `textarea` into CodeMirror, with a `wp_enqueue_code_editor()` function in PHP to manage enqueueing the assets and settings needed to edit a given type of code. 11 | * User preference is added to manage whether or not "syntax highlighting" is enabled. The feature is opt-out, being enabled by default. 12 | * Update allowed file extensions in theme and plugin editors to include formats which CodeMirror has modes for: `conf`, `css`, `diff`, `patch`, `html`, `htm`, `http`, `js`, `json`, `jsx`, `less`, `md`, `php`, `phtml`, `php3`, `php4`, `php5`, `php7`, `phps`, `scss`, `sass`, `sh`, `bash`, `sql`, `svg`, `xml`, `yml`, `yaml`, `txt`. 13 | 14 | Props westonruter, georgestephanis, obenland, melchoyce, pixolin, mizejewski, michelleweber. 15 | See #38707. 16 | Fixes #12423, #39892. 17 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "better-code-editing", 3 | "version": "0.7.0", 4 | "description": "Adding CodeMirror functionality to the Plugin and Theme file editors, as well as the Customizer Custom CSS box and Custom HTML widget.", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1", 7 | "postinstall": "composer install; grunt build" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/WordPress/better-code-editing.git" 12 | }, 13 | "author": "WordPress Contributors", 14 | "license": "GPL-2.0", 15 | "bugs": { 16 | "url": "https://github.com/WordPress/better-code-editing/issues" 17 | }, 18 | "browserify": { 19 | "transform": [ 20 | "browserify-shim" 21 | ] 22 | }, 23 | "browserify-shim": { 24 | "htmlhint": "global:HTMLHint", 25 | "jshint": "global:JSHINT", 26 | "csslint": "global:CSSLint", 27 | "jsonlint": "global:JSONLint" 28 | }, 29 | "homepage": "https://github.com/WordPress/better-code-editing#readme", 30 | "devDependencies": { 31 | "browserify-shim": "^3.8.14", 32 | "eslint": "^4.5.0", 33 | "grunt": "^1.0.1", 34 | "grunt-browserify": "^5.2.0", 35 | "grunt-cli": "^1.2.0", 36 | "grunt-contrib-clean": "^1.1.0", 37 | "grunt-contrib-concat": "^1.0.1", 38 | "grunt-contrib-copy": "^1.0.0", 39 | "grunt-contrib-cssmin": "~1.0.2", 40 | "grunt-contrib-uglify": "~2.0.0", 41 | "grunt-rtlcss": "^2.0.1", 42 | "grunt-shell": "^2.1.0", 43 | "grunt-wp-deploy": "^1.2.1", 44 | "jscs": "^3.0.7" 45 | }, 46 | "dependencies": { 47 | "codemirror": "github:codemirror/CodeMirror", 48 | "csslint": "1.0.5", 49 | "htmlhint": "github:xwp/HTMLHint", 50 | "jshint": "^2.9.5", 51 | "jsonlint": "1.6.2" 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /phpcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Generally-applicable sniffs for WordPress plugins 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | . 23 | 24 | 25 | 0 26 | 27 | 28 | */dev-lib/* 29 | */node_modules/* 30 | */vendor/* 31 | 32 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | 2 | # Better Code Editing 3 | 4 | Adding CodeMirror functionality to the Plugin and Theme file editors, as well as the Customizer Custom CSS box and Custom HTML widget. 5 | 6 | **Contributors:** [georgestephanis](https://profiles.wordpress.org/georgestephanis), [westonruter](https://profiles.wordpress.org/westonruter), [obenland](https://profiles.wordpress.org/obenland), [melchoyce](https://profiles.wordpress.org/melchoyce), [wordpressdotorg](https://profiles.wordpress.org/wordpressdotorg) 7 | **Tags:** [codemirror](https://wordpress.org/plugins/tags/codemirror), [syntax-highlighter](https://wordpress.org/plugins/tags/syntax-highlighter), [linting](https://wordpress.org/plugins/tags/linting) 8 | **Requires at least:** 4.7 9 | **Tested up to:** 4.9-alpha 10 | **Stable tag:** 0.7.0 11 | 12 | [![Build Status](https://travis-ci.org/WordPress/better-code-editing.svg?branch=master)](https://travis-ci.org/WordPress/better-code-editing) [![Built with Grunt](https://cdn.gruntjs.com/builtwith.svg)](http://gruntjs.com) 13 | 14 | ## Description ## 15 | 16 | *Notice*: This feature plugin has been merged into core via [r41376](https://core.trac.wordpress.org/changeset/41376). Please test on WordPress 4.9-alpha in a non-production environment. Read more about [beta testing](https://make.wordpress.org/core/handbook/testing/beta/). This plugin will do nothing on a nightly release. 17 | 18 | *** 19 | 20 | This 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. 21 | 22 | We're working around discussion on a Core ticket, [#12423](https://core.trac.wordpress.org/ticket/12423) 23 | 24 | Any questions, reach out to #core-customize on WordPress.org Slack or better open an issue on GitHub! See [contributing](https://github.com/WordPress/better-code-editing/blob/master/contributing.md). 25 | 26 | **Development of this plugin is done [on GitHub](https://github.com/WordPress/better-code-editing). Pull requests welcome. Please see [issues](https://github.com/WordPress/better-code-editing/issues) reported there.** 27 | 28 | ## Changelog ## 29 | 30 | ### 0.7.0 - 2017-09-12 ### 31 | * 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). 32 | * 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). 33 | 34 | ### 0.6.0 - 2017-09-08 ### 35 | * Improve frequency for when linting error notifications are shown and remove some overly-strict rules. See [#86](https://github.com/WordPress/better-code-editing/pull/86). Fixes [#13](https://github.com/WordPress/better-code-editing/pull/13). 36 | * Improve disabling of save button for Custom HTML widget. See [#87](https://github.com/WordPress/better-code-editing/pull/87). 37 | * Enable search addon so that attempting to do a find inside the editor will search contents of file and not use browser find dialog. See [#76](https://github.com/WordPress/better-code-editing/pull/76). Fixes [#75](https://github.com/WordPress/better-code-editing/pull/75). 38 | * Auto-show Custom CSS section description when value is empty, add close link to bottom of description, and remove default placeholder value for Custom CSS field. See [#84](https://github.com/WordPress/better-code-editing/pull/84). Fixes [#79](https://github.com/WordPress/better-code-editing/pull/79) and [core#39892](https://core.trac.wordpress.org/ticket/39892). 39 | * Improve passing of linting rulesets to CodeMirror and update CodeMirror to 5.29.1-alpha. See [#59](https://github.com/WordPress/better-code-editing/pull/59). 40 | * Merge `wp_code_editor_settings()` into `wp_enqueue_code_editor()`. See [#81](https://github.com/WordPress/better-code-editing/pull/81). Fixes [#55](https://github.com/WordPress/better-code-editing/pull/55). 41 | * Add support for RTL languages. See [#80](https://github.com/WordPress/better-code-editing/pull/80). Fixes [#72](https://github.com/WordPress/better-code-editing/pull/72). 42 | * Add admin notice to instruct `npm install` when plugin installed from source. See [#74](https://github.com/WordPress/better-code-editing/pull/74). Fixes [#73](https://github.com/WordPress/better-code-editing/pull/73). 43 | * Update dev-lib to use local tools and add PHPCompatibility sniffs. See [#82](https://github.com/WordPress/better-code-editing/pull/82). 44 | * See full commit log and diff: [0.5.0...0.6.0](https://github.com/WordPress/better-code-editing/compare/0.5.0...0.6.0). 45 | 46 | ### 0.5.0 - 2017-08-30 ### 47 | * Prevent saving when lint errors present. See [#69](https://github.com/WordPress/better-code-editing/pull/69). Fixes [#69](https://github.com/WordPress/better-code-editing/issues/69). 48 | * Remove unused assets; register likely-used assets; allow recognized file types to be edited; allow passing type when getting settings in addition to file. See [#66](https://github.com/WordPress/better-code-editing/pull/66). Fixes [#4](https://github.com/WordPress/better-code-editing/issues/4). 49 | * Add recognition for JSON mode. 50 | * Align styling matchbracket with matchtag. See [#63](https://github.com/WordPress/better-code-editing/pull/63). Fixes [#56](https://github.com/WordPress/better-code-editing/issues/56). 51 | * Redesign warning/error messages. See [#62](https://github.com/WordPress/better-code-editing/pull/62). Fixes [#44](https://github.com/WordPress/better-code-editing/issues/44), [#45](https://github.com/WordPress/better-code-editing/issues/45). 52 | * Improve help text in widgets admin screen and Additional CSS in Customizer. See [#65](https://github.com/WordPress/better-code-editing/pull/65). Fixes [#36](https://github.com/WordPress/better-code-editing/issues/36). 53 | * Add `wp_enqueue_code_editor` action. See [#68](https://github.com/WordPress/better-code-editing/pull/68). 54 | * See full commit log and diff: [0.4.0...0.5.0](https://github.com/WordPress/better-code-editing/compare/0.4.0...0.5.0) 55 | 56 | ### 0.4.0 - 2017-08-28 ### 57 | * Enable addon many goodies to improve UX and reduce accidental errors. See [#52](https://github.com/WordPress/better-code-editing/pull/52). 58 | * Add autocomplete hinting. See [#51](https://github.com/WordPress/better-code-editing/pull/51) and [#50](https://github.com/WordPress/better-code-editing/issues/50). 59 | * Improve mixed-mode autocomplete hints, including PHP. See [#58](https://github.com/WordPress/better-code-editing/issues/58). 60 | * Configure HTMLHint including KSES rule. See [#47](https://github.com/WordPress/better-code-editing/pull/47). 61 | * Configure JSHint with same rules as core. See [#46](https://github.com/WordPress/better-code-editing/pull/46). 62 | * Limit CSSLint rules. See [#38](https://github.com/WordPress/better-code-editing/pull/38) and [#26](https://github.com/WordPress/better-code-editing/issues/26). 63 | * Add tab trap escaping for CodeMirror in Custom HTML widget and theme/plugin editors. See [#43](https://github.com/WordPress/better-code-editing/pull/43) and [#37](https://github.com/WordPress/better-code-editing/issues/37). 64 | * Rename codemirror-wp to better-code-editing. See [#42](https://github.com/WordPress/better-code-editing/pull/42). 65 | * Add plugin icon. See [#40](https://github.com/WordPress/better-code-editing/pull/40). 66 | * Fix errors on small screens. See [#39](https://github.com/WordPress/better-code-editing/pull/39) and [#11](https://github.com/WordPress/better-code-editing/issues/11). 67 | * Refactor plugin class into include files to facilitate core patch creation. See [#54](https://github.com/WordPress/better-code-editing/pull/54). 68 | * Add admin notice when plugin is obsolete. See [#57](https://github.com/WordPress/better-code-editing/pull/57). 69 | * Upgrade CodeMirror to 5.29.0. 70 | * See full commit log and diff: [0.3.0...0.4.0](https://github.com/WordPress/better-code-editing/compare/0.3.0...0.4.0) 71 | 72 | ### 0.3.0 - 2017-08-18 ### 73 | * Enable line-wrapping and constrain width for file editor to match `textarea`. See [#33](https://github.com/WordPress/better-code-editing/pull/33), [#5](https://github.com/WordPress/better-code-editing/issues/5), [#32](https://github.com/WordPress/better-code-editing/issues/32). 74 | * Improve accessibility of CodeMirror in Customizer's Additional CSS, including escape method from Tab trap. See [#34](https://github.com/WordPress/better-code-editing/pull/34) and [#29](https://github.com/WordPress/better-code-editing/issues/29). 75 | * Improve file organization to prepare for core merge. 76 | * See full commit log and diff: [0.2.0...0.3.0](https://github.com/WordPress/better-code-editing/compare/0.2.0...0.3.0) 77 | 78 | ### 0.2.0 - 2017-08-16 ### 79 | * Add user setting for disabling Syntax Highlighting. See [#31](https://github.com/WordPress/better-code-editing/pull/31). 80 | * Improve release builds. 81 | * See full commit log and diff: [0.1.0...0.2.0](https://github.com/WordPress/better-code-editing/compare/0.1.0...0.2.0) 82 | 83 | ### 0.1.0 - 2017-08-14 ### 84 | Initial release. 85 | 86 | 87 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | === Better Code Editing === 2 | Contributors: georgestephanis, westonruter, obenland, melchoyce, wordpressdotorg 3 | Tags: codemirror, syntax-highlighter, linting 4 | Stable tag: 0.7.0 5 | Requires at least: 4.7 6 | Tested up to: 4.9-alpha 7 | 8 | Adding CodeMirror functionality to the Plugin and Theme file editors, as well as the Customizer Custom CSS box and Custom HTML widget. 9 | 10 | == Description == 11 | 12 | *Notice*: This feature plugin has been merged into core via [r41376](https://core.trac.wordpress.org/changeset/41376). Please test on WordPress 4.9-alpha in a non-production environment. Read more about [beta testing](https://make.wordpress.org/core/handbook/testing/beta/). This plugin will do nothing on a nightly release. 13 | 14 | *** 15 | 16 | This 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. 17 | 18 | We're working around discussion on a Core ticket, [#12423](https://core.trac.wordpress.org/ticket/12423) 19 | 20 | Any questions, reach out to #core-customize on WordPress.org Slack or better open an issue on GitHub! See [contributing](https://github.com/WordPress/better-code-editing/blob/master/contributing.md). 21 | 22 | **Development of this plugin is done [on GitHub](https://github.com/WordPress/better-code-editing). Pull requests welcome. Please see [issues](https://github.com/WordPress/better-code-editing/issues) reported there.** 23 | 24 | == Changelog == 25 | 26 | = 0.7.0 - 2017-09-12 = 27 | 28 | * 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). 29 | * 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). 30 | 31 | = 0.6.0 - 2017-09-08 = 32 | 33 | * Improve frequency for when linting error notifications are shown and remove some overly-strict rules. See [#86](https://github.com/WordPress/better-code-editing/pull/86). Fixes [#13](https://github.com/WordPress/better-code-editing/pull/13). 34 | * Improve disabling of save button for Custom HTML widget. See [#87](https://github.com/WordPress/better-code-editing/pull/87). 35 | * Enable search addon so that attempting to do a find inside the editor will search contents of file and not use browser find dialog. See [#76](https://github.com/WordPress/better-code-editing/pull/76). Fixes [#75](https://github.com/WordPress/better-code-editing/pull/75). 36 | * Auto-show Custom CSS section description when value is empty, add close link to bottom of description, and remove default placeholder value for Custom CSS field. See [#84](https://github.com/WordPress/better-code-editing/pull/84). Fixes [#79](https://github.com/WordPress/better-code-editing/pull/79) and [core#39892](https://core.trac.wordpress.org/ticket/39892). 37 | * Improve passing of linting rulesets to CodeMirror and update CodeMirror to 5.29.1-alpha. See [#59](https://github.com/WordPress/better-code-editing/pull/59). 38 | * Merge `wp_code_editor_settings()` into `wp_enqueue_code_editor()`. See [#81](https://github.com/WordPress/better-code-editing/pull/81). Fixes [#55](https://github.com/WordPress/better-code-editing/pull/55). 39 | * Add support for RTL languages. See [#80](https://github.com/WordPress/better-code-editing/pull/80). Fixes [#72](https://github.com/WordPress/better-code-editing/pull/72). 40 | * Add admin notice to instruct `npm install` when plugin installed from source. See [#74](https://github.com/WordPress/better-code-editing/pull/74). Fixes [#73](https://github.com/WordPress/better-code-editing/pull/73). 41 | * Update dev-lib to use local tools and add PHPCompatibility sniffs. See [#82](https://github.com/WordPress/better-code-editing/pull/82). 42 | * See full commit log and diff: [0.5.0...0.6.0](https://github.com/WordPress/better-code-editing/compare/0.5.0...0.6.0). 43 | 44 | = 0.5.0 - 2017-08-30 = 45 | 46 | * Prevent saving when lint errors present. See [#69](https://github.com/WordPress/better-code-editing/pull/69). Fixes [#69](https://github.com/WordPress/better-code-editing/issues/69). 47 | * Remove unused assets; register likely-used assets; allow recognized file types to be edited; allow passing type when getting settings in addition to file. See [#66](https://github.com/WordPress/better-code-editing/pull/66). Fixes [#4](https://github.com/WordPress/better-code-editing/issues/4). 48 | * Add recognition for JSON mode. 49 | * Align styling matchbracket with matchtag. See [#63](https://github.com/WordPress/better-code-editing/pull/63). Fixes [#56](https://github.com/WordPress/better-code-editing/issues/56). 50 | * Redesign warning/error messages. See [#62](https://github.com/WordPress/better-code-editing/pull/62). Fixes [#44](https://github.com/WordPress/better-code-editing/issues/44), [#45](https://github.com/WordPress/better-code-editing/issues/45). 51 | * Improve help text in widgets admin screen and Additional CSS in Customizer. See [#65](https://github.com/WordPress/better-code-editing/pull/65). Fixes [#36](https://github.com/WordPress/better-code-editing/issues/36). 52 | * Add `wp_enqueue_code_editor` action. See [#68](https://github.com/WordPress/better-code-editing/pull/68). 53 | * See full commit log and diff: [0.4.0...0.5.0](https://github.com/WordPress/better-code-editing/compare/0.4.0...0.5.0) 54 | 55 | = 0.4.0 - 2017-08-28 = 56 | 57 | * Enable addon many goodies to improve UX and reduce accidental errors. See [#52](https://github.com/WordPress/better-code-editing/pull/52). 58 | * Add autocomplete hinting. See [#51](https://github.com/WordPress/better-code-editing/pull/51) and [#50](https://github.com/WordPress/better-code-editing/issues/50). 59 | * Improve mixed-mode autocomplete hints, including PHP. See [#58](https://github.com/WordPress/better-code-editing/issues/58). 60 | * Configure HTMLHint including KSES rule. See [#47](https://github.com/WordPress/better-code-editing/pull/47). 61 | * Configure JSHint with same rules as core. See [#46](https://github.com/WordPress/better-code-editing/pull/46). 62 | * Limit CSSLint rules. See [#38](https://github.com/WordPress/better-code-editing/pull/38) and [#26](https://github.com/WordPress/better-code-editing/issues/26). 63 | * Add tab trap escaping for CodeMirror in Custom HTML widget and theme/plugin editors. See [#43](https://github.com/WordPress/better-code-editing/pull/43) and [#37](https://github.com/WordPress/better-code-editing/issues/37). 64 | * Rename codemirror-wp to better-code-editing. See [#42](https://github.com/WordPress/better-code-editing/pull/42). 65 | * Add plugin icon. See [#40](https://github.com/WordPress/better-code-editing/pull/40). 66 | * Fix errors on small screens. See [#39](https://github.com/WordPress/better-code-editing/pull/39) and [#11](https://github.com/WordPress/better-code-editing/issues/11). 67 | * Refactor plugin class into include files to facilitate core patch creation. See [#54](https://github.com/WordPress/better-code-editing/pull/54). 68 | * Add admin notice when plugin is obsolete. See [#57](https://github.com/WordPress/better-code-editing/pull/57). 69 | * Upgrade CodeMirror to 5.29.0. 70 | * See full commit log and diff: [0.3.0...0.4.0](https://github.com/WordPress/better-code-editing/compare/0.3.0...0.4.0) 71 | 72 | = 0.3.0 - 2017-08-18 = 73 | 74 | * Enable line-wrapping and constrain width for file editor to match `textarea`. See [#33](https://github.com/WordPress/better-code-editing/pull/33), [#5](https://github.com/WordPress/better-code-editing/issues/5), [#32](https://github.com/WordPress/better-code-editing/issues/32). 75 | * Improve accessibility of CodeMirror in Customizer's Additional CSS, including escape method from Tab trap. See [#34](https://github.com/WordPress/better-code-editing/pull/34) and [#29](https://github.com/WordPress/better-code-editing/issues/29). 76 | * Improve file organization to prepare for core merge. 77 | * See full commit log and diff: [0.2.0...0.3.0](https://github.com/WordPress/better-code-editing/compare/0.2.0...0.3.0) 78 | 79 | = 0.2.0 - 2017-08-16 = 80 | 81 | * Add user setting for disabling Syntax Highlighting. See [#31](https://github.com/WordPress/better-code-editing/pull/31). 82 | * Improve release builds. 83 | * See full commit log and diff: [0.1.0...0.2.0](https://github.com/WordPress/better-code-editing/compare/0.1.0...0.2.0) 84 | 85 | = 0.1.0 - 2017-08-14 = 86 | 87 | Initial release. 88 | -------------------------------------------------------------------------------- /wp-admin/css/code-editor.css: -------------------------------------------------------------------------------- 1 | .cm-trailingspace { 2 | background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAACCAYAAAB/qH1jAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QUXCToH00Y1UgAAACFJREFUCNdjPMDBUc/AwNDAAAFMTAwMDA0OP34wQgX/AQBYgwYEx4f9lQAAAABJRU5ErkJggg==) repeat-x bottom left; 3 | } 4 | 5 | .wrap [class*="CodeMirror-lint-marker"], 6 | .wp-core-ui [class*="CodeMirror-lint-message"], 7 | .wrap .CodeMirror-lint-marker-multiple { 8 | background-image: none; 9 | } 10 | 11 | .wrap [class*="CodeMirror-lint-marker"]:before { 12 | font: normal 18px/1 dashicons; 13 | position: relative; 14 | top: -2px; 15 | } 16 | 17 | /*rtl:ignore*/ 18 | .wp-core-ui [class*="CodeMirror-lint-message"]:before { 19 | font: normal 16px/1 dashicons; 20 | left: 16px; 21 | position: absolute; 22 | } 23 | 24 | /*rtl:ignore*/ 25 | .wp-core-ui .CodeMirror-lint-message-error, 26 | .wp-core-ui .CodeMirror-lint-message-warning { 27 | box-shadow: 0 1px 1px 0 rgba( 0, 0, 0, 0.1 ); 28 | margin: 5px 0 2px; 29 | padding: 3px 12px 3px 28px; 30 | } 31 | 32 | /*rtl:ignore*/ 33 | .wp-core-ui .CodeMirror-lint-message-warning { 34 | background-color: #fff8e5; 35 | border-left: 4px solid #ffb900; 36 | } 37 | 38 | /* rtl:ignore */ 39 | .wrap .CodeMirror-lint-marker-warning:before, 40 | .wp-core-ui .CodeMirror-lint-message-warning:before { 41 | content: "\f534"; 42 | color: #f6a306; 43 | } 44 | 45 | /*rtl:ignore*/ 46 | .wp-core-ui .CodeMirror-lint-message-error { 47 | background-color: #fbeaea; 48 | border-left: 4px solid #dc3232; 49 | } 50 | 51 | /* rtl:ignore */ 52 | .wrap .CodeMirror-lint-marker-error:before, 53 | .wp-core-ui .CodeMirror-lint-message-error:before { 54 | content: "\f153"; 55 | color: #dc3232; 56 | } 57 | 58 | /* rtl:ignore */ 59 | .wp-core-ui .CodeMirror-lint-tooltip { 60 | background: none; 61 | border: none; 62 | border-radius: 0; 63 | direction: ltr; 64 | } 65 | 66 | .wrap .CodeMirror .CodeMirror-matchingbracket { 67 | background: rgba(255, 150, 0, .3); 68 | color: inherit; 69 | } 70 | /* rtl:ignore */ 71 | .CodeMirror { 72 | text-align: left; 73 | } 74 | -------------------------------------------------------------------------------- /wp-admin/css/common.css: -------------------------------------------------------------------------------- 1 | /* 2 column liquid layout */ 2 | #wpwrap { 3 | height: auto; 4 | min-height: 100%; 5 | width: 100%; 6 | position: relative; 7 | -webkit-font-smoothing: subpixel-antialiased; 8 | } 9 | 10 | #wpcontent { 11 | height: 100%; 12 | padding-left: 20px; 13 | } 14 | 15 | #wpcontent, 16 | #wpfooter { 17 | margin-left: 160px; 18 | } 19 | 20 | .folded #wpcontent, 21 | .folded #wpfooter { 22 | margin-left: 36px; 23 | } 24 | 25 | #wpbody-content { 26 | padding-bottom: 65px; 27 | float: left; 28 | width: 100%; 29 | overflow: visible !important; 30 | } 31 | 32 | /* inner 2 column liquid layout */ 33 | 34 | .inner-sidebar { 35 | float: right; 36 | clear: right; 37 | display: none; 38 | width: 281px; 39 | position: relative; 40 | } 41 | 42 | .columns-2 .inner-sidebar { 43 | margin-right: auto; 44 | width: 286px; 45 | display: block; 46 | } 47 | 48 | .inner-sidebar #side-sortables, 49 | .columns-2 .inner-sidebar #side-sortables { 50 | min-height: 300px; 51 | width: 280px; 52 | padding: 0; 53 | } 54 | 55 | .has-right-sidebar .inner-sidebar { 56 | display: block; 57 | } 58 | 59 | .has-right-sidebar #post-body { 60 | float: left; 61 | clear: left; 62 | width: 100%; 63 | margin-right: -2000px; 64 | } 65 | 66 | .has-right-sidebar #post-body-content { 67 | margin-right: 300px; 68 | float: none; 69 | width: auto; 70 | } 71 | 72 | /* 2 columns main area */ 73 | 74 | #col-left { 75 | float: left; 76 | width: 35%; 77 | } 78 | 79 | #col-right { 80 | float: right; 81 | width: 65%; 82 | } 83 | 84 | #col-left .col-wrap { 85 | padding: 0 6px 0 0; 86 | } 87 | 88 | #col-right .col-wrap { 89 | padding: 0 0 0 6px; 90 | } 91 | 92 | /* utility classes */ 93 | .alignleft { 94 | float: left; 95 | } 96 | 97 | .alignright { 98 | float: right; 99 | } 100 | 101 | .textleft { 102 | text-align: left; 103 | } 104 | 105 | .textright { 106 | text-align: right; 107 | } 108 | 109 | .clear { 110 | clear: both; 111 | } 112 | 113 | /* modern clearfix */ 114 | .wp-clearfix:after { 115 | content: ""; 116 | display: table; 117 | clear: both; 118 | } 119 | 120 | /* Hide visually but not from screen readers */ 121 | .screen-reader-text, 122 | .screen-reader-text span, 123 | .ui-helper-hidden-accessible { 124 | position: absolute; 125 | margin: -1px; 126 | padding: 0; 127 | height: 1px; 128 | width: 1px; 129 | overflow: hidden; 130 | clip: rect(0 0 0 0); 131 | border: 0; 132 | word-wrap: normal !important; /* many screen reader and browser combinations announce broken words as they would appear visually */ 133 | } 134 | 135 | .screen-reader-shortcut { 136 | position: absolute; 137 | top: -1000em; 138 | } 139 | 140 | .screen-reader-shortcut:focus { 141 | left: 6px; 142 | top: -25px; 143 | height: auto; 144 | width: auto; 145 | display: block; 146 | font-size: 14px; 147 | font-weight: 600; 148 | padding: 15px 23px 14px; 149 | background: #f1f1f1; 150 | color: #0073aa; 151 | z-index: 100000; 152 | line-height: normal; 153 | box-shadow: 0 0 2px 2px rgba(0,0,0,.6); 154 | text-decoration: none; 155 | outline: none; 156 | } 157 | 158 | .hidden, 159 | .js .closed .inside, 160 | .js .hide-if-js, 161 | .no-js .hide-if-no-js, 162 | .js.wp-core-ui .hide-if-js, 163 | .js .wp-core-ui .hide-if-js, 164 | .no-js.wp-core-ui .hide-if-no-js, 165 | .no-js .wp-core-ui .hide-if-no-js { 166 | display: none; 167 | } 168 | 169 | /* @todo: Take a second look. Large chunks of shared color, from the colors.css merge */ 170 | .widget-top, 171 | .menu-item-handle, 172 | .widget-inside, 173 | #menu-settings-column .accordion-container, 174 | #menu-management .menu-edit, 175 | .manage-menus, 176 | table.widefat, 177 | .stuffbox, 178 | p.popular-tags, 179 | .widgets-holder-wrap, 180 | .wp-editor-container, 181 | .popular-tags, 182 | .feature-filter, 183 | .imgedit-group, 184 | .comment-ays { 185 | border: 1px solid #e5e5e5; 186 | box-shadow: 0 1px 1px rgba(0,0,0,0.04); 187 | } 188 | 189 | table.widefat, 190 | .wp-editor-container, 191 | .stuffbox, 192 | p.popular-tags, 193 | .widgets-holder-wrap, 194 | .popular-tags, 195 | .feature-filter, 196 | .imgedit-group, 197 | .comment-ays { 198 | background: #fff; 199 | } 200 | 201 | /* general */ 202 | html, 203 | body { 204 | height: 100%; 205 | margin: 0; 206 | padding: 0; 207 | } 208 | 209 | body { 210 | background: #f1f1f1; 211 | color: #444; 212 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; 213 | font-size: 13px; 214 | line-height: 1.4em; 215 | min-width: 600px; 216 | } 217 | 218 | body.iframe { 219 | min-width: 0; 220 | padding-top: 1px; 221 | } 222 | 223 | body.modal-open { 224 | overflow: hidden; 225 | } 226 | 227 | body.mobile.modal-open #wpwrap { 228 | overflow: hidden; 229 | position: fixed; 230 | height: 100%; 231 | } 232 | 233 | iframe, 234 | img { 235 | border: 0; 236 | } 237 | 238 | td { 239 | font-family: inherit; 240 | font-size: inherit; 241 | font-weight: inherit; 242 | line-height: inherit; 243 | } 244 | 245 | /* Any change to the default link style must be applied to button-link too. */ 246 | a { 247 | color: #0073aa; 248 | transition-property: border, background, color; 249 | transition-duration: .05s; 250 | transition-timing-function: ease-in-out; 251 | } 252 | 253 | a, 254 | div { 255 | outline: 0; 256 | } 257 | 258 | a:hover, 259 | a:active { 260 | color: #00a0d2; 261 | } 262 | 263 | a:focus, 264 | a:focus .media-icon img, 265 | .wp-person a:focus .gravatar { 266 | color: #124964; 267 | box-shadow: 268 | 0 0 0 1px #5b9dd9, 269 | 0 0 2px 1px rgba(30, 140, 190, .8); 270 | } 271 | 272 | .ie8 a:focus { 273 | outline: #5b9dd9 solid 1px; 274 | } 275 | 276 | #adminmenu a:focus, 277 | .screen-reader-text:focus { 278 | box-shadow: none; 279 | outline: none; 280 | } 281 | 282 | blockquote, 283 | q { 284 | quotes: none; 285 | } 286 | 287 | blockquote:before, 288 | blockquote:after, 289 | q:before, 290 | q:after { 291 | content: ""; 292 | content: none; 293 | } 294 | 295 | p { 296 | font-size: 13px; 297 | line-height: 1.5; 298 | margin: 1em 0; 299 | } 300 | 301 | blockquote { 302 | margin: 1em; 303 | } 304 | 305 | li, 306 | dd { 307 | margin-bottom: 6px; 308 | } 309 | 310 | h1, 311 | h2, 312 | h3, 313 | h4, 314 | h5, 315 | h6 { 316 | display: block; 317 | font-weight: 600; 318 | } 319 | 320 | h1 { 321 | color: #23282d; 322 | font-size: 2em; 323 | margin: .67em 0; 324 | } 325 | 326 | h2, 327 | h3 { 328 | color: #23282d; 329 | font-size: 1.3em; 330 | margin: 1em 0; 331 | } 332 | 333 | .update-core-php h2 { 334 | margin-top: 2em; 335 | } 336 | 337 | .update-php h2, 338 | .update-messages h2, 339 | h4 { 340 | font-size: 1em; 341 | margin: 1.33em 0; 342 | } 343 | 344 | h5 { 345 | font-size: 0.83em; 346 | margin: 1.67em 0; 347 | } 348 | 349 | h6 { 350 | font-size: 0.67em; 351 | margin: 2.33em 0; 352 | } 353 | 354 | ul, 355 | ol { 356 | padding: 0; 357 | } 358 | 359 | ul { 360 | list-style: none; 361 | } 362 | 363 | ol { 364 | list-style-type: decimal; 365 | margin-left: 2em; 366 | } 367 | 368 | ul.ul-disc { 369 | list-style: disc outside; 370 | } 371 | 372 | ul.ul-square { 373 | list-style: square outside; 374 | } 375 | 376 | ol.ol-decimal { 377 | list-style: decimal outside; 378 | } 379 | 380 | ul.ul-disc, 381 | ul.ul-square, 382 | ol.ol-decimal { 383 | margin-left: 1.8em; 384 | } 385 | 386 | ul.ul-disc > li, 387 | ul.ul-square > li, 388 | ol.ol-decimal > li { 389 | margin: 0 0 0.5em; 390 | } 391 | 392 | /* rtl:ignore */ 393 | .ltr { 394 | direction: ltr; 395 | } 396 | 397 | /* rtl:ignore */ 398 | .code, 399 | code { 400 | font-family: Consolas, Monaco, monospace; 401 | direction: ltr; 402 | unicode-bidi: embed; 403 | } 404 | 405 | kbd, 406 | code { 407 | padding: 3px 5px 2px 5px; 408 | margin: 0 1px; 409 | background: #eaeaea; 410 | background: rgba(0,0,0,0.07); 411 | font-size: 13px; 412 | } 413 | 414 | .subsubsub { 415 | list-style: none; 416 | margin: 8px 0 0; 417 | padding: 0; 418 | font-size: 13px; 419 | float: left; 420 | color: #666; 421 | } 422 | 423 | .subsubsub a { 424 | line-height: 2; 425 | padding: .2em; 426 | text-decoration: none; 427 | } 428 | 429 | .subsubsub a .count, 430 | .subsubsub a.current .count { 431 | color: #555d66; /* #f1f1f1 background */ 432 | font-weight: 400; 433 | } 434 | 435 | .subsubsub a.current { 436 | font-weight: 600; 437 | border: none; 438 | } 439 | 440 | .subsubsub li { 441 | display: inline-block; 442 | margin: 0; 443 | padding: 0; 444 | white-space: nowrap; 445 | } 446 | 447 | /* .widefat - main style for tables */ 448 | .widefat { 449 | border-spacing: 0; 450 | width: 100%; 451 | clear: both; 452 | margin: 0; 453 | } 454 | 455 | .widefat * { 456 | word-wrap: break-word; 457 | } 458 | 459 | .widefat a, 460 | .widefat button.button-link { 461 | text-decoration: none; 462 | } 463 | 464 | .widefat td, 465 | .widefat th { 466 | padding: 8px 10px; 467 | } 468 | 469 | .widefat thead th, 470 | .widefat thead td { 471 | border-bottom: 1px solid #e1e1e1; 472 | } 473 | 474 | .widefat tfoot th, 475 | .widefat tfoot td { 476 | border-top: 1px solid #e1e1e1; 477 | border-bottom: none; 478 | } 479 | 480 | .widefat .no-items td { 481 | border-bottom-width: 0; 482 | } 483 | 484 | .widefat td { 485 | vertical-align: top; 486 | } 487 | 488 | .widefat td, 489 | .widefat td p, 490 | .widefat td ol, 491 | .widefat td ul { 492 | font-size: 13px; 493 | line-height: 1.5em; 494 | } 495 | 496 | .widefat th, 497 | .widefat thead td, 498 | .widefat tfoot td { 499 | text-align: left; 500 | line-height: 1.3em; 501 | font-size: 14px; 502 | } 503 | 504 | .widefat th input, 505 | .updates-table td input, 506 | .widefat thead td input, 507 | .widefat tfoot td input { 508 | margin: 0 0 0 8px; 509 | padding: 0; 510 | vertical-align: text-top; 511 | } 512 | 513 | .widefat .check-column { 514 | width: 2.2em; 515 | padding: 6px 0 25px; 516 | vertical-align: top; 517 | } 518 | 519 | .widefat tbody th.check-column { 520 | padding: 9px 0 22px; 521 | } 522 | 523 | .widefat thead td.check-column, 524 | .widefat tbody th.check-column, 525 | .updates-table tbody td.check-column, 526 | .widefat tfoot td.check-column { 527 | padding: 11px 0 0 3px; 528 | } 529 | 530 | .widefat thead td.check-column, 531 | .widefat tfoot td.check-column { 532 | padding-top: 4px; 533 | vertical-align: middle; 534 | } 535 | 536 | .update-php div.updated, 537 | .update-php div.error { 538 | margin-left: 0; 539 | } 540 | 541 | .no-js .widefat thead .check-column input, 542 | .no-js .widefat tfoot .check-column input { 543 | display: none; 544 | } 545 | 546 | .widefat .num, 547 | .column-comments, 548 | .column-links, 549 | .column-posts { 550 | text-align: center; 551 | } 552 | 553 | .widefat th#comments { 554 | vertical-align: middle; 555 | } 556 | 557 | .wrap { 558 | margin: 10px 20px 0 2px; 559 | } 560 | 561 | .wrap > h2:first-child, /* Back-compat for pre-4.4 */ 562 | .wrap [class$="icon32"] + h2, /* Back-compat for pre-4.4 */ 563 | .postbox .inside h2, /* Back-compat for pre-4.4 */ 564 | .wrap h1 { 565 | font-size: 23px; 566 | font-weight: 400; 567 | margin: 0; 568 | padding: 9px 0 4px 0; 569 | line-height: 29px; 570 | } 571 | 572 | .wrap h1.wp-heading-inline { 573 | display: inline-block; 574 | margin-right: 5px; 575 | } 576 | 577 | .wp-header-end { 578 | visibility: hidden; 579 | margin: -2px 0 0; 580 | } 581 | 582 | .subtitle { 583 | margin: 0; 584 | padding-left: 25px; 585 | color: #555d66; 586 | font-size: 14px; 587 | font-weight: 400; 588 | line-height: 1; 589 | } 590 | 591 | .wrap .add-new-h2, /* deprecated */ 592 | .wrap .add-new-h2:active, /* deprecated */ 593 | .wrap .page-title-action, 594 | .wrap .page-title-action:active { 595 | margin-left: 4px; 596 | padding: 4px 8px; 597 | position: relative; 598 | top: -3px; 599 | text-decoration: none; 600 | border: none; 601 | border: 1px solid #ccc; 602 | border-radius: 2px; 603 | background: #f7f7f7; 604 | text-shadow: none; 605 | font-weight: 600; 606 | font-size: 13px; 607 | line-height: normal; /* IE8-IE11 need this for buttons */ 608 | color: #0073aa; /* some of these controls are button elements and don't inherit from links */ 609 | cursor: pointer; 610 | outline: 0; 611 | } 612 | 613 | .wrap .wp-heading-inline + .page-title-action { 614 | margin-left: 0; 615 | } 616 | 617 | .wrap .add-new-h2:hover, /* deprecated */ 618 | .wrap .page-title-action:hover { 619 | border-color: #008EC2; 620 | background: #00a0d2; 621 | color: #fff; 622 | } 623 | 624 | /* lower specificity: color needs to be overridden by :hover and :active */ 625 | .page-title-action:focus { 626 | color: #124964; 627 | } 628 | 629 | .wrap .page-title-action:focus { 630 | border-color: #5b9dd9; 631 | box-shadow: 0 0 2px rgba( 30, 140, 190, 0.8 ); 632 | } 633 | 634 | .wrap h1.long-header { 635 | padding-right: 0; 636 | } 637 | 638 | .wp-dialog { 639 | background-color: #fff; 640 | } 641 | 642 | .widgets-chooser ul, 643 | #widgets-left .widget-in-question .widget-top, 644 | #available-widgets .widget-top:hover, 645 | div#widgets-right .widget-top:hover, 646 | #widgets-left .widget-top:hover { 647 | border-color: #999; 648 | box-shadow: 0 1px 2px rgba(0,0,0,0.1); 649 | } 650 | 651 | .sorthelper { 652 | background-color: #ccf3fa; 653 | } 654 | 655 | .ac_match, 656 | .subsubsub a.current { 657 | color: #000; 658 | } 659 | 660 | .striped > tbody > :nth-child(odd), 661 | ul.striped > :nth-child(odd), 662 | .alternate { 663 | background-color: #f9f9f9; 664 | } 665 | 666 | .bar { 667 | background-color: #e8e8e8; 668 | border-right-color: #99d; 669 | } 670 | 671 | /* Helper classes for plugins to leverage the active WordPress color scheme */ 672 | 673 | .highlight { 674 | background-color: #e4f2fd; 675 | color: #000; 676 | } 677 | 678 | .wp-ui-primary { 679 | color: #fff; 680 | background-color: #32373c; 681 | } 682 | .wp-ui-text-primary { 683 | color: #32373c; 684 | } 685 | 686 | .wp-ui-highlight { 687 | color: #fff; 688 | background-color: #1e8cbe; 689 | } 690 | .wp-ui-text-highlight { 691 | color: #1e8cbe; 692 | } 693 | 694 | .wp-ui-notification { 695 | color: #fff; 696 | background-color: #d54e21; 697 | } 698 | .wp-ui-text-notification { 699 | color: #d54e21; 700 | } 701 | 702 | .wp-ui-text-icon { 703 | color: #82878c; /* same as new icons */ 704 | } 705 | 706 | /* For emoji replacement images */ 707 | img.emoji { 708 | display: inline !important; 709 | border: none !important; 710 | height: 1em !important; 711 | width: 1em !important; 712 | margin: 0 .07em !important; 713 | vertical-align: -0.1em !important; 714 | background: none !important; 715 | padding: 0 !important; 716 | box-shadow: none !important; 717 | } 718 | 719 | /*------------------------------------------------------------------------------ 720 | 1.0 - Text Styles 721 | ------------------------------------------------------------------------------*/ 722 | 723 | .widget .widget-top, 724 | .postbox .hndle, 725 | .stuffbox .hndle, 726 | .control-section .accordion-section-title, 727 | .sidebar-name, 728 | #nav-menu-header, 729 | #nav-menu-footer, 730 | .menu-item-handle, 731 | .checkbox, 732 | .side-info, 733 | #your-profile #rich_editing, 734 | .widefat thead th, 735 | .widefat thead td, 736 | .widefat tfoot th, 737 | .widefat tfoot td { 738 | line-height: 1.4em; 739 | } 740 | 741 | .widget .widget-top, 742 | .menu-item-handle { 743 | background: #fafafa; 744 | color: #23282d; 745 | } 746 | 747 | .postbox .hndle, 748 | .stuffbox .hndle { 749 | border-bottom: 1px solid #eee; 750 | } 751 | 752 | .quicktags, 753 | .search { 754 | background-color: #ccc; 755 | color: #000; 756 | font-size: 12px; 757 | } 758 | 759 | .icon32 { 760 | display: none; 761 | } 762 | 763 | /* @todo can we combine these into a class or use an existing dashicon one? */ 764 | .welcome-panel .welcome-panel-close:before, 765 | .tagchecklist .ntdelbutton .remove-tag-icon:before, 766 | #bulk-titles div a:before, 767 | .notice-dismiss:before { 768 | background: none; 769 | color: #72777c; 770 | content: "\f153"; 771 | display: block; 772 | font: normal 16px/20px dashicons; 773 | speak: none; 774 | height: 20px; 775 | text-align: center; 776 | width: 20px; 777 | -webkit-font-smoothing: antialiased; 778 | -moz-osx-font-smoothing: grayscale; 779 | } 780 | 781 | .welcome-panel .welcome-panel-close:before { 782 | margin: 0; 783 | } 784 | 785 | #bulk-titles div a:before { 786 | margin: 1px 0; 787 | } 788 | 789 | .tagchecklist .ntdelbutton .remove-tag-icon:before { 790 | margin-left: 2px; 791 | border-radius: 50%; 792 | color: #0073aa; 793 | /* vertically center the icon cross browsers */ 794 | line-height: 1.28; 795 | } 796 | 797 | .tagchecklist .ntdelbutton:focus { 798 | outline: 0; 799 | } 800 | 801 | .welcome-panel .welcome-panel-close:hover:before, 802 | .welcome-panel .welcome-panel-close:focus:before, 803 | .tagchecklist .ntdelbutton:hover .remove-tag-icon:before, 804 | .tagchecklist .ntdelbutton:focus .remove-tag-icon:before, 805 | #bulk-titles div a:hover:before, 806 | #bulk-titles div a:focus:before { 807 | color: #c00; 808 | } 809 | 810 | .tagchecklist .ntdelbutton:focus .remove-tag-icon:before { 811 | box-shadow: 812 | 0 0 0 1px #5b9dd9, 813 | 0 0 2px 1px rgba(30, 140, 190, .8); 814 | } 815 | 816 | .key-labels label { 817 | line-height: 24px; 818 | } 819 | 820 | strong, b { 821 | font-weight: 600; 822 | } 823 | 824 | .pre { 825 | /* https://developer.mozilla.org/en-US/docs/CSS/white-space */ 826 | white-space: pre-wrap; /* css-3 */ 827 | word-wrap: break-word; /* IE 5.5 - 7 */ 828 | } 829 | 830 | .howto { 831 | color: #666; 832 | font-style: italic; 833 | display: block; 834 | } 835 | 836 | p.install-help { 837 | margin: 8px 0; 838 | font-style: italic; 839 | } 840 | 841 | .no-break { 842 | white-space: nowrap; 843 | } 844 | 845 | hr { 846 | border: 0; 847 | border-top: 1px solid #ddd; 848 | border-bottom: 1px solid #fafafa; 849 | } 850 | 851 | .row-actions span.delete a, 852 | .row-actions span.trash a, 853 | .row-actions span.spam a, 854 | .plugins a.delete, 855 | #all-plugins-table .plugins a.delete, 856 | #search-plugins-table .plugins a.delete, 857 | .submitbox .submitdelete, 858 | #media-items a.delete, 859 | #media-items a.delete-permanently, 860 | #nav-menu-footer .menu-delete, 861 | #delete-link a.delete { 862 | color: #a00; 863 | } 864 | 865 | abbr.required, 866 | span.required, 867 | .file-error, 868 | .row-actions .delete a:hover, 869 | .row-actions .trash a:hover, 870 | .row-actions .spam a:hover, 871 | .plugins a.delete:hover, 872 | #all-plugins-table .plugins a.delete:hover, 873 | #search-plugins-table .plugins a.delete:hover, 874 | .submitbox .submitdelete:hover, 875 | #media-items a.delete:hover, 876 | #media-items a.delete-permanently:hover, 877 | #nav-menu-footer .menu-delete:hover, 878 | #delete-link a.delete:hover { 879 | color: #dc3232; 880 | border: none; 881 | } 882 | 883 | /*------------------------------------------------------------------------------ 884 | 3.0 - Actions 885 | ------------------------------------------------------------------------------*/ 886 | 887 | #major-publishing-actions { 888 | padding: 10px; 889 | clear: both; 890 | border-top: 1px solid #ddd; 891 | background: #f5f5f5; 892 | } 893 | 894 | #delete-action { 895 | float: left; 896 | line-height: 28px; 897 | } 898 | 899 | #delete-link { 900 | line-height: 28px; 901 | vertical-align: middle; 902 | text-align: left; 903 | margin-left: 8px; 904 | } 905 | 906 | #delete-link a { 907 | text-decoration: none; 908 | } 909 | 910 | #publishing-action { 911 | text-align: right; 912 | float: right; 913 | line-height: 23px; 914 | } 915 | 916 | #publishing-action .spinner { 917 | float: left; 918 | } 919 | 920 | #misc-publishing-actions { 921 | padding: 6px 0 0; 922 | } 923 | 924 | .misc-pub-section { 925 | padding: 6px 10px 8px; 926 | } 927 | 928 | .misc-pub-filename { 929 | word-wrap: break-word; 930 | } 931 | 932 | #minor-publishing-actions { 933 | padding: 10px 10px 0 10px; 934 | text-align: right; 935 | } 936 | 937 | #save-post { 938 | float: left; 939 | } 940 | 941 | .preview { 942 | float: right; 943 | } 944 | 945 | #sticky-span { 946 | margin-left: 18px; 947 | } 948 | 949 | .approve, 950 | .unapproved .unapprove { 951 | display: none; 952 | } 953 | 954 | .unapproved .approve, 955 | .spam .approve, 956 | .trash .approve { 957 | display: inline; 958 | } 959 | 960 | td.action-links, 961 | th.action-links { 962 | text-align: right; 963 | } 964 | 965 | /* Filter bar */ 966 | .wp-filter { 967 | display: inline-block; 968 | position: relative; 969 | box-sizing: border-box; 970 | margin: 12px 0 25px; 971 | padding: 0 10px; 972 | width: 100%; 973 | box-shadow: 0 1px 1px rgba(0,0,0,0.04); 974 | border: 1px solid #e5e5e5; 975 | background: #fff; 976 | color: #555; 977 | font-size: 13px; 978 | } 979 | 980 | .wp-filter a { 981 | text-decoration: none; 982 | } 983 | 984 | .filter-count { 985 | display: inline-block; 986 | vertical-align: middle; 987 | min-width: 4em; 988 | } 989 | 990 | .title-count, 991 | .filter-count .count { 992 | display: inline-block; 993 | position: relative; 994 | top: -1px; 995 | padding: 4px 10px; 996 | border-radius: 30px; 997 | background: #72777c; 998 | color: #fff; 999 | font-size: 14px; 1000 | font-weight: 600; 1001 | } 1002 | 1003 | /* not a part of filter bar, but derived from it, so here for now */ 1004 | .title-count { 1005 | display: inline; 1006 | top: -3px; 1007 | margin-left: 5px; 1008 | margin-right: 20px; 1009 | } 1010 | 1011 | .filter-items { 1012 | float: left; 1013 | } 1014 | 1015 | .filter-links { 1016 | display: inline-block; 1017 | margin: 0; 1018 | } 1019 | 1020 | .filter-links li { 1021 | display: inline-block; 1022 | margin: 0; 1023 | } 1024 | 1025 | .filter-links li > a { 1026 | display: inline-block; 1027 | margin: 0 10px; 1028 | padding: 15px 0; 1029 | border-bottom: 4px solid #fff; 1030 | color: #666; 1031 | cursor: pointer; 1032 | } 1033 | 1034 | .filter-links .current { 1035 | box-shadow: none; 1036 | border-bottom: 4px solid #666; 1037 | color: #23282d; 1038 | } 1039 | 1040 | .filter-links li > a:hover, 1041 | .filter-links li > a:focus, 1042 | .show-filters .filter-links a.current:hover, 1043 | .show-filters .filter-links a.current:focus { 1044 | color: #00a0d2; 1045 | } 1046 | 1047 | .wp-filter .search-form { 1048 | float: right; 1049 | margin: 10px 0; 1050 | } 1051 | 1052 | .wp-filter .search-form input[type="search"] { 1053 | margin: 0; 1054 | padding: 3px 5px; 1055 | width: 280px; 1056 | max-width: 100%; 1057 | font-size: 16px; 1058 | font-weight: 300; 1059 | line-height: 1.5; 1060 | } 1061 | 1062 | .wp-filter .search-form select { 1063 | margin: 0; 1064 | height: 32px; 1065 | vertical-align: top; 1066 | } 1067 | 1068 | .wp-filter .search-form.search-plugins { 1069 | display: inline-block; 1070 | } 1071 | 1072 | .wp-filter .button.drawer-toggle { 1073 | margin: 10px 9px 0; 1074 | padding: 0 10px 0 6px; 1075 | border-color: transparent; 1076 | background-color: transparent; 1077 | color: #666; 1078 | vertical-align: baseline; 1079 | box-shadow: none; 1080 | } 1081 | 1082 | .wp-filter .drawer-toggle:before { 1083 | content: "\f111"; 1084 | margin: 0 5px 0 0; 1085 | color: #72777c; 1086 | font: normal 16px/1 dashicons; 1087 | vertical-align: text-bottom; 1088 | -webkit-font-smoothing: antialiased; 1089 | -moz-osx-font-smoothing: grayscale; 1090 | } 1091 | 1092 | .wp-filter .button.drawer-toggle:hover, 1093 | .wp-filter .drawer-toggle:hover:before, 1094 | .wp-filter .button.drawer-toggle:focus, 1095 | .wp-filter .drawer-toggle:focus:before { 1096 | background-color: transparent; 1097 | color: #00a0d2; 1098 | } 1099 | 1100 | .wp-filter .button.drawer-toggle:hover, 1101 | .wp-filter .button.drawer-toggle:focus:active { 1102 | border-color: transparent; 1103 | } 1104 | 1105 | .wp-filter .button.drawer-toggle:focus { 1106 | border-color: #5b9dd9; 1107 | } 1108 | 1109 | .wp-filter .button.drawer-toggle:active { 1110 | background: transparent; 1111 | box-shadow: none; 1112 | -webkit-transform: none; 1113 | transform: none; 1114 | } 1115 | 1116 | .wp-filter .drawer-toggle.current:before { 1117 | color: #fff; 1118 | } 1119 | 1120 | .filter-drawer, 1121 | .wp-filter .favorites-form { 1122 | display: none; 1123 | margin: 0 -10px 0 -20px; 1124 | padding: 20px; 1125 | border-top: 1px solid #eee; 1126 | background: #fafafa; 1127 | overflow: hidden; 1128 | } 1129 | 1130 | .show-filters .filter-drawer, 1131 | .show-favorites-form .favorites-form { 1132 | display: block; 1133 | } 1134 | 1135 | .show-filters .filter-links a.current { 1136 | border-bottom: none; 1137 | } 1138 | 1139 | .show-filters .wp-filter .button.drawer-toggle { 1140 | border-radius: 2px; 1141 | background: #72777c; 1142 | color: #fff; 1143 | } 1144 | 1145 | .show-filters .wp-filter .drawer-toggle:hover, 1146 | .show-filters .wp-filter .drawer-toggle:focus { 1147 | background: rgb(46, 162, 204); 1148 | } 1149 | 1150 | .show-filters .wp-filter .drawer-toggle:before { 1151 | color: #fff; 1152 | } 1153 | 1154 | .filter-group { 1155 | box-sizing: border-box; 1156 | position: relative; 1157 | float: left; 1158 | margin: 0 1% 0 0; 1159 | padding: 20px 10px 10px; 1160 | width: 24%; 1161 | background: #fff; 1162 | border: 1px solid #e5e5e5; 1163 | box-shadow: 0 1px 1px rgba(0,0,0,0.04); 1164 | } 1165 | 1166 | .filter-group legend { 1167 | position: absolute; 1168 | top: 10px; 1169 | display: block; 1170 | margin: 0; 1171 | padding: 0; 1172 | font-size: 1em; 1173 | font-weight: 600; 1174 | } 1175 | 1176 | .filter-drawer .filter-group-feature { 1177 | margin: 28px 0 0; 1178 | list-style-type: none; 1179 | font-size: 12px; 1180 | } 1181 | 1182 | .filter-drawer .filter-group-feature input, 1183 | .filter-drawer .filter-group-feature label { 1184 | display: inline-block; 1185 | margin: 7px 4px 7px 0; 1186 | line-height: 16px; 1187 | } 1188 | 1189 | .filter-drawer .buttons { 1190 | clear: both; 1191 | margin-bottom: 20px; 1192 | } 1193 | 1194 | .filter-drawer .filter-group + .buttons { 1195 | margin-bottom: 0; 1196 | padding-top: 20px; 1197 | } 1198 | 1199 | .filter-drawer .buttons .button span { 1200 | display: inline-block; 1201 | opacity: 0.8; 1202 | font-size: 12px; 1203 | text-indent: 10px; 1204 | } 1205 | 1206 | .wp-filter .button.clear-filters { 1207 | display: none; 1208 | margin-left: 10px; 1209 | } 1210 | 1211 | .wp-filter .button-link.edit-filters { 1212 | padding: 0 5px; 1213 | line-height: 28px; 1214 | } 1215 | 1216 | .filtered-by { 1217 | display: none; 1218 | margin: 0; 1219 | } 1220 | 1221 | .filtered-by > span { 1222 | font-weight: 600; 1223 | } 1224 | 1225 | .filtered-by a { 1226 | margin-left: 10px; 1227 | } 1228 | 1229 | .filtered-by .tags { 1230 | display: inline; 1231 | } 1232 | 1233 | .filtered-by .tag { 1234 | margin: 0 5px; 1235 | padding: 4px 8px; 1236 | border: 1px solid #e5e5e5; 1237 | box-shadow: 0 1px 1px rgba(0,0,0,0.04); 1238 | background: #fff; 1239 | font-size: 11px; 1240 | } 1241 | 1242 | .filters-applied .filter-group, 1243 | .filters-applied .filter-drawer .buttons, 1244 | .filters-applied .filter-drawer br { 1245 | display: none !important; 1246 | } 1247 | 1248 | .filters-applied .filtered-by { 1249 | display: block; 1250 | } 1251 | 1252 | .filters-applied .filter-drawer { 1253 | padding: 20px; 1254 | } 1255 | 1256 | .show-filters .favorites-form, 1257 | .show-filters .content-filterable, 1258 | .show-filters.filters-applied.loading-content .content-filterable, 1259 | .loading-content .content-filterable, 1260 | .error .content-filterable { 1261 | display: none; 1262 | } 1263 | 1264 | .show-filters.filters-applied .content-filterable { 1265 | display: block; 1266 | } 1267 | 1268 | .loading-content .spinner { 1269 | display: block; 1270 | margin: 40px auto 0; 1271 | float: none; 1272 | } 1273 | 1274 | @media only screen and (max-width: 1120px) { 1275 | .filter-drawer { 1276 | border-bottom: 1px solid #eee; 1277 | } 1278 | 1279 | .filter-group { 1280 | margin-bottom: 0; 1281 | margin-top: 5px; 1282 | width: 100%; 1283 | } 1284 | 1285 | .filter-group li { 1286 | margin: 10px 0; 1287 | } 1288 | } 1289 | 1290 | @media only screen and (max-width: 1000px) { 1291 | .filter-items { 1292 | float: none; 1293 | } 1294 | 1295 | .wp-filter .media-toolbar-primary, 1296 | .wp-filter .media-toolbar-secondary, 1297 | .wp-filter .search-form { 1298 | float: none; /* Remove float from media-views.css */ 1299 | position: relative; 1300 | max-width: 100%; 1301 | } 1302 | } 1303 | 1304 | @media only screen and (max-width: 782px) { 1305 | .filter-group li { 1306 | padding: 0; 1307 | width: 50%; 1308 | } 1309 | } 1310 | 1311 | @media only screen and (max-width: 320px) { 1312 | .filter-count { 1313 | display: none; 1314 | } 1315 | 1316 | .wp-filter .drawer-toggle { 1317 | margin: 10px 0; 1318 | } 1319 | 1320 | .filter-group li, 1321 | .wp-filter .search-form input[type="search"] { 1322 | width: 100%; 1323 | } 1324 | } 1325 | 1326 | /*------------------------------------------------------------------------------ 1327 | 4.0 - Notifications 1328 | ------------------------------------------------------------------------------*/ 1329 | 1330 | .notice, 1331 | div.updated, 1332 | div.error { 1333 | background: #fff; 1334 | border-left: 4px solid #fff; 1335 | box-shadow: 0 1px 1px 0 rgba( 0, 0, 0, 0.1 ); 1336 | margin: 5px 15px 2px; 1337 | padding: 1px 12px; 1338 | } 1339 | 1340 | div[class="update-message"] { /* back-compat for pre-4.6 */ 1341 | padding: 0.5em 12px 0.5em 0; 1342 | } 1343 | 1344 | .notice p, 1345 | .notice-title, 1346 | div.updated p, 1347 | div.error p, 1348 | .form-table td .notice p { 1349 | margin: 0.5em 0; 1350 | padding: 2px; 1351 | } 1352 | 1353 | .error a { 1354 | text-decoration: underline; 1355 | } 1356 | 1357 | .updated a { 1358 | padding-bottom: 2px; 1359 | } 1360 | 1361 | .notice-alt { 1362 | box-shadow: none; 1363 | } 1364 | 1365 | .notice-large { 1366 | padding: 10px 20px; 1367 | } 1368 | 1369 | .notice-title { 1370 | display: inline-block; 1371 | color: #23282d; 1372 | font-size: 18px; 1373 | } 1374 | 1375 | .wp-core-ui .notice.is-dismissible { 1376 | padding-right: 38px; 1377 | position: relative; 1378 | } 1379 | 1380 | .notice-dismiss { 1381 | position: absolute; 1382 | top: 0; 1383 | right: 1px; 1384 | border: none; 1385 | margin: 0; 1386 | padding: 9px; 1387 | background: none; 1388 | color: #72777c; 1389 | cursor: pointer; 1390 | } 1391 | 1392 | .notice-dismiss:hover:before, 1393 | .notice-dismiss:active:before, 1394 | .notice-dismiss:focus:before { 1395 | color: #c00; 1396 | } 1397 | 1398 | .notice-dismiss:focus { 1399 | outline: none; 1400 | box-shadow: 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, .8); 1401 | } 1402 | 1403 | .ie8 .notice-dismiss:focus { 1404 | outline: 1px solid #5b9dd9; 1405 | } 1406 | 1407 | .notice-success, 1408 | div.updated { 1409 | border-left-color: #46b450; 1410 | } 1411 | 1412 | .notice-success.notice-alt { 1413 | background-color: #ecf7ed; 1414 | } 1415 | 1416 | .notice-warning { 1417 | border-left-color: #ffb900; 1418 | } 1419 | 1420 | .notice-warning.notice-alt { 1421 | background-color: #fff8e5; 1422 | } 1423 | 1424 | .notice-error, 1425 | div.error { 1426 | border-left-color: #dc3232; 1427 | } 1428 | 1429 | .notice-error.notice-alt { 1430 | background-color: #fbeaea; 1431 | } 1432 | 1433 | .notice-info { 1434 | border-left-color: #00a0d2; 1435 | } 1436 | 1437 | .notice-info.notice-alt { 1438 | background-color: #e5f5fa; 1439 | } 1440 | 1441 | .update-message p:before, 1442 | .updating-message p:before, 1443 | .updated-message p:before, 1444 | .import-php .updating-message:before, 1445 | .button.updating-message:before, 1446 | .button.updated-message:before, 1447 | .button.installed:before, 1448 | .button.installing:before { 1449 | display: inline-block; 1450 | font: normal 20px/1 'dashicons'; 1451 | -webkit-font-smoothing: antialiased; 1452 | -moz-osx-font-smoothing: grayscale; 1453 | vertical-align: top; 1454 | } 1455 | 1456 | .wrap .notice, 1457 | .wrap div.updated, 1458 | .wrap div.error, 1459 | .media-upload-form .notice, 1460 | .media-upload-form div.error { 1461 | margin: 5px 0 15px; 1462 | } 1463 | 1464 | /* Update icon. */ 1465 | .update-message p:before, 1466 | .updating-message p:before, 1467 | .import-php .updating-message:before, 1468 | .button.updating-message:before, 1469 | .button.installing:before { 1470 | color: #f56e28; 1471 | content: "\f463"; 1472 | } 1473 | 1474 | /* Spins the update icon. */ 1475 | .updating-message p:before, 1476 | .import-php .updating-message:before, 1477 | .button.updating-message:before, 1478 | .button.installing:before { 1479 | -webkit-animation: rotation 2s infinite linear; 1480 | animation: rotation 2s infinite linear; 1481 | } 1482 | 1483 | /* Updated icon (check mark). */ 1484 | .updated-message p:before, 1485 | .installed p:before, 1486 | .button.updated-message:before { 1487 | color: #79ba49; 1488 | content: '\f147'; 1489 | } 1490 | 1491 | /* Error icon. */ 1492 | .update-message.notice-error p:before { 1493 | color: #dc3232; 1494 | content: "\f534"; 1495 | } 1496 | 1497 | .wrap .notice p:before, 1498 | .import-php .updating-message:before { 1499 | margin-right: 6px; 1500 | vertical-align: bottom; 1501 | } 1502 | 1503 | #update-nag, 1504 | .update-nag { 1505 | display: inline-block; 1506 | line-height: 19px; 1507 | padding: 11px 15px; 1508 | font-size: 14px; 1509 | text-align: left; 1510 | margin: 25px 20px 0 2px; 1511 | background-color: #fff; 1512 | border-left: 4px solid #ffba00; 1513 | box-shadow: 0 1px 1px 0 rgba(0,0,0,0.1); 1514 | } 1515 | 1516 | ul#dismissed-updates { 1517 | display: none; 1518 | } 1519 | 1520 | form.upgrade { 1521 | margin-top: 8px; 1522 | } 1523 | 1524 | form.upgrade .hint { 1525 | font-style: italic; 1526 | font-size: 85%; 1527 | margin: -0.5em 0 2em 0; 1528 | } 1529 | 1530 | .update-php .spinner { 1531 | float: none; 1532 | margin: -4px 0; 1533 | } 1534 | 1535 | #ajax-loading, 1536 | .ajax-loading, 1537 | .ajax-feedback, 1538 | .imgedit-wait-spin, 1539 | .list-ajax-loading { /* deprecated */ 1540 | visibility: hidden; 1541 | } 1542 | 1543 | #ajax-response.alignleft { 1544 | margin-left: 2em; 1545 | } 1546 | 1547 | .button.updating-message:before, 1548 | .button.updated-message:before, 1549 | .button.installed:before, 1550 | .button.installing:before { 1551 | margin: 3px 5px 0 -2px; 1552 | } 1553 | 1554 | .button-primary.updating-message:before { 1555 | color: #fff; 1556 | } 1557 | 1558 | .button-primary.updated-message:before { 1559 | color: #66c6e4; 1560 | } 1561 | 1562 | .button.updated-message { 1563 | transition-property: border, background, color; 1564 | transition-duration: .05s; 1565 | transition-timing-function: ease-in-out; 1566 | } 1567 | 1568 | @media aural { 1569 | .wrap .notice p:before, 1570 | .button.installing:before, 1571 | .button.installed:before, 1572 | .update-message p:before { 1573 | speak: none; 1574 | } 1575 | } 1576 | 1577 | 1578 | /* @todo: this does not need its own section anymore */ 1579 | /*------------------------------------------------------------------------------ 1580 | 6.0 - Admin Header 1581 | ------------------------------------------------------------------------------*/ 1582 | #adminmenu a, 1583 | #taglist a, 1584 | #catlist a { 1585 | text-decoration: none; 1586 | } 1587 | 1588 | /*------------------------------------------------------------------------------ 1589 | 6.1 - Screen Options Tabs 1590 | ------------------------------------------------------------------------------*/ 1591 | 1592 | #screen-options-wrap, 1593 | #contextual-help-wrap { 1594 | margin: 0; 1595 | padding: 8px 20px 12px; 1596 | position: relative; 1597 | } 1598 | 1599 | #contextual-help-wrap { 1600 | overflow: auto; 1601 | margin-left: 0 !important; 1602 | } 1603 | 1604 | #screen-meta .screen-reader-text { 1605 | visibility: hidden; 1606 | } 1607 | 1608 | #screen-meta-links { 1609 | margin: 0 20px 0 0; 1610 | } 1611 | 1612 | /* screen options and help tabs revert */ 1613 | #screen-meta { 1614 | display: none; 1615 | margin: 0 20px -1px 0px; 1616 | position: relative; 1617 | background-color: #fff; 1618 | border: 1px solid #ddd; 1619 | border-top: none; 1620 | box-shadow: 0 1px 0 rgba(0,0,0,.025); 1621 | } 1622 | 1623 | #screen-options-link-wrap, 1624 | #contextual-help-link-wrap { 1625 | float: right; 1626 | height: 28px; 1627 | margin: 0 0 0 6px; 1628 | border: 1px solid #ddd; 1629 | border-top: none; 1630 | background: #fff; 1631 | box-shadow: 0 1px 1px -1px rgba(0,0,0,0.1); 1632 | } 1633 | 1634 | #screen-meta-links .screen-meta-toggle { 1635 | position: relative; 1636 | top: 0; 1637 | } 1638 | 1639 | #screen-meta-links .show-settings { 1640 | border: 0; 1641 | background: none; 1642 | border-radius: 0; 1643 | color: #72777c; 1644 | line-height: 1.7; 1645 | padding: 3px 6px 3px 16px; 1646 | } 1647 | 1648 | #screen-meta-links .show-settings:hover, 1649 | #screen-meta-links .show-settings:active, 1650 | #screen-meta-links .show-settings:focus { 1651 | color: #32373c; 1652 | } 1653 | 1654 | #screen-meta-links .show-settings:active { 1655 | box-shadow: none; 1656 | -webkit-transform: none; 1657 | transform: none; 1658 | } 1659 | 1660 | #screen-meta-links .show-settings:after { 1661 | right: 0; 1662 | content: "\f140"; 1663 | font: normal 20px/1 dashicons; 1664 | speak: none; 1665 | display: inline-block; 1666 | padding: 0 5px 0 0; 1667 | bottom: 2px; 1668 | position: relative; 1669 | vertical-align: bottom; 1670 | -webkit-font-smoothing: antialiased; 1671 | -moz-osx-font-smoothing: grayscale; 1672 | text-decoration: none !important; 1673 | color: #72777c; 1674 | } 1675 | 1676 | #screen-meta-links .screen-meta-active:after { 1677 | content: "\f142"; 1678 | } 1679 | 1680 | /* end screen options and help tabs */ 1681 | 1682 | .toggle-arrow { 1683 | background-repeat: no-repeat; 1684 | background-position: top left; 1685 | background-color: transparent; 1686 | height: 22px; 1687 | line-height: 22px; 1688 | display: block; 1689 | } 1690 | 1691 | .toggle-arrow-active { 1692 | background-position: bottom left; 1693 | } 1694 | 1695 | #screen-options-wrap h5, /* Back-compat for old plugins */ 1696 | #screen-options-wrap legend, 1697 | #contextual-help-wrap h5 { 1698 | margin: 0; 1699 | padding: 8px 0; 1700 | font-size: 13px; 1701 | font-weight: 600; 1702 | } 1703 | 1704 | .ie8 #screen-options-wrap legend { 1705 | color: inherit; 1706 | } 1707 | 1708 | .metabox-prefs label { 1709 | display: inline-block; 1710 | padding-right: 15px; 1711 | line-height: 30px; 1712 | } 1713 | 1714 | #number-of-columns { 1715 | display: inline-block; 1716 | vertical-align: middle; 1717 | line-height: 30px; 1718 | } 1719 | 1720 | .metabox-prefs input[type=checkbox] { 1721 | margin-top: 0; 1722 | margin-right: 6px; 1723 | } 1724 | 1725 | .metabox-prefs label input, 1726 | .metabox-prefs label input[type=checkbox] { 1727 | margin: -4px 5px 0 0; 1728 | } 1729 | 1730 | .metabox-prefs .columns-prefs label input { 1731 | margin: -1px 2px 0 0; 1732 | } 1733 | 1734 | .metabox-prefs label a { 1735 | display: none; 1736 | } 1737 | 1738 | .metabox-prefs .screen-options input, 1739 | .metabox-prefs .screen-options label { 1740 | margin-top: 0; 1741 | margin-bottom: 0; 1742 | vertical-align: middle; 1743 | } 1744 | 1745 | .metabox-prefs .screen-options .screen-per-page { 1746 | margin-right: 15px; 1747 | } 1748 | 1749 | .metabox-prefs .screen-options label { 1750 | line-height: 28px; 1751 | padding-right: 0; 1752 | } 1753 | 1754 | .screen-options + .screen-options { 1755 | margin-top: 10px; 1756 | } 1757 | 1758 | .metabox-prefs .submit { 1759 | margin-top: 1em; 1760 | padding: 0; 1761 | } 1762 | 1763 | /*------------------------------------------------------------------------------ 1764 | 6.2 - Help Menu 1765 | ------------------------------------------------------------------------------*/ 1766 | 1767 | #contextual-help-wrap { 1768 | padding: 0; 1769 | } 1770 | 1771 | #contextual-help-columns { 1772 | position: relative; 1773 | } 1774 | 1775 | #contextual-help-back { 1776 | position: absolute; 1777 | top: 0; 1778 | bottom: 0; 1779 | left: 150px; 1780 | right: 170px; 1781 | border: 1px solid #e1e1e1; 1782 | border-top: none; 1783 | border-bottom: none; 1784 | background: #f6fbfd; 1785 | } 1786 | 1787 | #contextual-help-wrap.no-sidebar #contextual-help-back { 1788 | right: 0; 1789 | border-right-width: 0; 1790 | border-bottom-right-radius: 2px; 1791 | } 1792 | 1793 | .contextual-help-tabs { 1794 | float: left; 1795 | width: 150px; 1796 | margin: 0; 1797 | } 1798 | 1799 | .contextual-help-tabs ul { 1800 | margin: 1em 0; 1801 | } 1802 | 1803 | .contextual-help-tabs li { 1804 | margin-bottom: 0; 1805 | list-style-type: none; 1806 | border-style: solid; 1807 | border-width: 0 0 0 2px; 1808 | border-color: transparent; 1809 | } 1810 | 1811 | .contextual-help-tabs a { 1812 | display: block; 1813 | padding: 5px 5px 5px 12px; 1814 | line-height: 18px; 1815 | text-decoration: none; 1816 | border: 1px solid transparent; 1817 | border-right: none; 1818 | border-left: none; 1819 | } 1820 | 1821 | .contextual-help-tabs a:hover { 1822 | color: #32373c; 1823 | } 1824 | 1825 | .contextual-help-tabs .active { 1826 | padding: 0; 1827 | margin: 0 -1px 0 0; 1828 | border-left: 2px solid #00a0d2; 1829 | background: #f6fbfd; 1830 | box-shadow: 0 2px 0 rgba(0,0,0,0.02), 0 1px 0 rgba(0,0,0,0.02); 1831 | } 1832 | 1833 | .contextual-help-tabs .active a { 1834 | border-color: #e1e1e1; 1835 | color: #32373c; 1836 | } 1837 | 1838 | .contextual-help-tabs-wrap { 1839 | padding: 0 20px; 1840 | overflow: auto; 1841 | } 1842 | 1843 | .help-tab-content { 1844 | display: none; 1845 | margin: 0 22px 12px 0; 1846 | line-height: 1.6em; 1847 | } 1848 | 1849 | .help-tab-content.active { 1850 | display: block; 1851 | } 1852 | 1853 | .help-tab-content ul li { 1854 | list-style-type: disc; 1855 | margin-left: 18px; 1856 | } 1857 | 1858 | .contextual-help-sidebar { 1859 | width: 150px; 1860 | float: right; 1861 | padding: 0 8px 0 12px; 1862 | overflow: auto; 1863 | } 1864 | 1865 | /*------------------------------------------------------------------------------ 1866 | 8.0 - Layout Blocks 1867 | ------------------------------------------------------------------------------*/ 1868 | 1869 | html.wp-toolbar { 1870 | padding-top: 32px; 1871 | box-sizing: border-box; 1872 | } 1873 | 1874 | .widefat th, 1875 | .widefat td { 1876 | color: #555; 1877 | } 1878 | 1879 | .widefat th, 1880 | .widefat thead td, 1881 | .widefat tfoot td { 1882 | font-weight: 400; 1883 | } 1884 | 1885 | .widefat thead tr th, 1886 | .widefat thead tr td, 1887 | .widefat tfoot tr th, 1888 | .widefat tfoot tr td { 1889 | color: #32373c; 1890 | } 1891 | 1892 | .widefat td p { 1893 | margin: 2px 0 0.8em; 1894 | } 1895 | 1896 | .widefat p, 1897 | .widefat ol, 1898 | .widefat ul { 1899 | color: #32373c; 1900 | } 1901 | 1902 | .widefat .column-comment p { 1903 | margin: 0.6em 0; 1904 | } 1905 | 1906 | .widefat .column-comment ul { 1907 | list-style: initial; 1908 | margin-left: 2em; 1909 | } 1910 | 1911 | /* Screens with postboxes */ 1912 | .postbox-container { 1913 | float: left; 1914 | } 1915 | 1916 | .postbox-container .meta-box-sortables { 1917 | box-sizing: border-box; 1918 | } 1919 | 1920 | #wpbody-content .metabox-holder { 1921 | padding-top: 10px; 1922 | } 1923 | 1924 | .metabox-holder .postbox-container .empty-container { 1925 | border: 3px dashed #b4b9be; 1926 | height: 250px; 1927 | position: relative; 1928 | } 1929 | 1930 | .metabox-holder .postbox-container .empty-container:after { 1931 | content: attr(data-emptystring); 1932 | margin: auto; 1933 | position: absolute; 1934 | top: 0; 1935 | left: 0; 1936 | bottom: 0; 1937 | right: 0; 1938 | height: 1em; 1939 | width: 200px; 1940 | text-align: center; 1941 | color: #ccc; 1942 | font-size:18px; 1943 | display: none; 1944 | } 1945 | 1946 | .metabox-holder.columns-1 .postbox-container .empty-container, 1947 | .columns-2 #postbox-container-3 .empty-container, 1948 | .columns-2 #postbox-container-4 .empty-container, 1949 | .columns-3 #postbox-container-4 .empty-container { 1950 | border: 0 none; 1951 | height: 0; 1952 | min-height: 0; 1953 | } 1954 | 1955 | #post-body-content { 1956 | width: 100%; 1957 | min-width: 463px; 1958 | float: left; 1959 | } 1960 | 1961 | #post-body.columns-2 #postbox-container-1 { 1962 | float: right; 1963 | margin-right: -300px; 1964 | width: 280px; 1965 | } 1966 | 1967 | #post-body.columns-2 #side-sortables { 1968 | min-height: 250px; 1969 | } 1970 | 1971 | /* one column on the dash */ 1972 | @media only screen and (max-width: 799px) { 1973 | #wpbody-content .metabox-holder .postbox-container .empty-container { 1974 | border: 0 none; 1975 | height: 0; 1976 | min-height: 0; 1977 | } 1978 | } 1979 | 1980 | .js .widget .widget-top, 1981 | .js .postbox .hndle { 1982 | cursor: move; 1983 | } 1984 | 1985 | .hndle a { 1986 | font-size: 11px; 1987 | font-weight: 400; 1988 | } 1989 | 1990 | .postbox .handlediv { 1991 | display: none; 1992 | float: right; 1993 | width: 36px; 1994 | height: 36px; 1995 | margin: 0; 1996 | padding: 0; 1997 | border: 0; 1998 | background: none; 1999 | cursor: pointer; 2000 | } 2001 | 2002 | .js .postbox .handlediv { 2003 | display: block; 2004 | } 2005 | 2006 | .sortable-placeholder { 2007 | border: 1px dashed #b4b9be; 2008 | margin-bottom: 20px; 2009 | } 2010 | 2011 | .postbox, 2012 | .stuffbox { 2013 | margin-bottom: 20px; 2014 | padding: 0; 2015 | line-height: 1; 2016 | } 2017 | 2018 | /* user-select is not a part of the CSS standard - may change behavior in the future */ 2019 | .postbox .hndle, 2020 | .stuffbox .hndle { 2021 | -webkit-user-select: none; 2022 | -moz-user-select: none; 2023 | -ms-user-select: none; 2024 | user-select: none; 2025 | } 2026 | 2027 | .postbox .inside, 2028 | .stuffbox .inside { 2029 | padding: 0 12px 12px; 2030 | line-height: 1.4em; 2031 | font-size: 13px; 2032 | } 2033 | 2034 | .postbox .inside { 2035 | margin: 11px 0; 2036 | position: relative; 2037 | } 2038 | 2039 | .postbox .inside > p:last-child, 2040 | .rss-widget ul li:last-child { 2041 | margin-bottom: 1px !important; 2042 | } 2043 | 2044 | .postbox.closed h3 { 2045 | border: none; 2046 | box-shadow: none; 2047 | } 2048 | 2049 | .postbox table.form-table { 2050 | margin-bottom: 0; 2051 | } 2052 | 2053 | .postbox table.widefat { 2054 | box-shadow: none; 2055 | } 2056 | 2057 | .temp-border { 2058 | border: 1px dotted #ccc; 2059 | } 2060 | 2061 | .columns-prefs label { 2062 | padding: 0 10px 0 0; 2063 | } 2064 | 2065 | /* @todo: what is this doing here */ 2066 | #dashboard_right_now .versions .b, 2067 | #post-status-display, 2068 | #post-visibility-display, 2069 | #adminmenu .wp-submenu li.current, 2070 | #adminmenu .wp-submenu li.current a, 2071 | #adminmenu .wp-submenu li.current a:hover, 2072 | .media-item .percent, 2073 | .plugins .name, 2074 | #pass-strength-result.strong, 2075 | #pass-strength-result.short, 2076 | #ed_reply_toolbar #ed_reply_strong, 2077 | .item-controls .item-order a, 2078 | .feature-filter .feature-name { 2079 | font-weight: 600; 2080 | } 2081 | 2082 | /*------------------------------------------------------------------------------ 2083 | 21.0 - Admin Footer 2084 | ------------------------------------------------------------------------------*/ 2085 | 2086 | #wpfooter { 2087 | position: absolute; 2088 | bottom: 0; 2089 | left: 0; 2090 | right: 0; 2091 | padding: 10px 20px; 2092 | color: #555d66; 2093 | } 2094 | 2095 | #wpfooter p { 2096 | font-size: 13px; 2097 | margin: 0; 2098 | line-height: 20px; 2099 | } 2100 | 2101 | #footer-thankyou { 2102 | font-style: italic; 2103 | } 2104 | 2105 | /*------------------------------------------------------------------------------ 2106 | 25.0 - Tabbed Admin Screen Interface (Experimental) 2107 | ------------------------------------------------------------------------------*/ 2108 | 2109 | .nav-tab { 2110 | float: left; 2111 | border: 1px solid #ccc; 2112 | border-bottom: none; 2113 | margin-left: 0.5em; /* half the font size so set the font size properly */ 2114 | padding: 5px 10px; 2115 | font-size: 14px; 2116 | line-height: 24px; 2117 | font-weight: 600; 2118 | background: #e5e5e5; 2119 | color: #555; 2120 | text-decoration: none; 2121 | white-space: nowrap; 2122 | } 2123 | 2124 | h3 .nav-tab, /* Back-compat for pre-4.4 */ 2125 | .nav-tab-small .nav-tab { 2126 | padding: 5px 14px; 2127 | font-size: 12px; 2128 | line-height: 16px; 2129 | } 2130 | 2131 | .nav-tab:hover, 2132 | .nav-tab:focus { 2133 | background-color: #fff; 2134 | color: #444; 2135 | } 2136 | 2137 | .nav-tab-active, 2138 | .nav-tab:focus:active { 2139 | box-shadow: none; 2140 | } 2141 | 2142 | .nav-tab-active { 2143 | margin-bottom: -1px; 2144 | color: #444; 2145 | } 2146 | 2147 | .nav-tab-active, 2148 | .nav-tab-active:hover, 2149 | .nav-tab-active:focus, 2150 | .nav-tab-active:focus:active { 2151 | border-bottom: 1px solid #f1f1f1; 2152 | background: #f1f1f1; 2153 | color: #000; 2154 | } 2155 | 2156 | h1.nav-tab-wrapper, /* Back-compat for pre-4.4 */ 2157 | .wrap h2.nav-tab-wrapper, /* higher specificity to override .wrap > h2:first-child */ 2158 | .nav-tab-wrapper { 2159 | border-bottom: 1px solid #ccc; 2160 | margin: 0; 2161 | padding-top: 9px; 2162 | padding-bottom: 0; 2163 | line-height: inherit; 2164 | } 2165 | 2166 | /* Back-compat for plugins. Deprecated. Use .wp-clearfix instead. */ 2167 | .nav-tab-wrapper:not(.wp-clearfix):after { 2168 | content: ""; 2169 | display: table; 2170 | clear: both; 2171 | } 2172 | 2173 | .ie8 .nav-tab-wrapper { 2174 | /* contain floats establishing a new block formatting context */ 2175 | display: inline-block; 2176 | width: 100%; 2177 | vertical-align: top; 2178 | } 2179 | 2180 | /*------------------------------------------------------------------------------ 2181 | 26.0 - Misc 2182 | ------------------------------------------------------------------------------*/ 2183 | 2184 | .spinner { 2185 | background: url(../../../../../wp-admin/images/spinner.gif) no-repeat; 2186 | background-size: 20px 20px; 2187 | display: inline-block; 2188 | visibility: hidden; 2189 | float: right; 2190 | vertical-align: middle; 2191 | opacity: 0.7; 2192 | filter: alpha(opacity=70); 2193 | width: 20px; 2194 | height: 20px; 2195 | margin: 4px 10px 0; 2196 | } 2197 | 2198 | .spinner.is-active, 2199 | .loading-content .spinner { 2200 | visibility: visible; 2201 | } 2202 | 2203 | #template > div { 2204 | margin-right: 190px; 2205 | } 2206 | 2207 | .metabox-holder .stuffbox > h3, /* Back-compat for pre-4.4 */ 2208 | .metabox-holder .postbox > h3, /* Back-compat for pre-4.4 */ 2209 | .metabox-holder h3.hndle, /* Back-compat for pre-4.4 */ 2210 | .metabox-holder h2.hndle { 2211 | font-size: 14px; 2212 | padding: 8px 12px; 2213 | margin: 0; 2214 | line-height: 1.4; 2215 | } 2216 | 2217 | /* Back-compat for nav-menus screen */ 2218 | .nav-menus-php .metabox-holder h3 { 2219 | padding: 10px 10px 11px 14px; 2220 | line-height: 21px; 2221 | } 2222 | 2223 | #templateside ul li a { 2224 | text-decoration: none; 2225 | } 2226 | 2227 | .plugin-install #description, 2228 | .plugin-install-network #description { 2229 | width: 60%; 2230 | } 2231 | 2232 | table .vers, 2233 | table .column-visible, 2234 | table .column-rating { 2235 | text-align: left; 2236 | } 2237 | 2238 | .attention, 2239 | .error-message { 2240 | color: red; 2241 | font-weight: 600; 2242 | } 2243 | 2244 | /* Scrollbar fix for bulk upgrade iframe */ 2245 | body.iframe { 2246 | height: 98%; 2247 | } 2248 | 2249 | /* Upgrader styles, Specific to Language Packs */ 2250 | .lp-show-latest p { 2251 | display: none; 2252 | } 2253 | .lp-show-latest p:last-child, 2254 | .lp-show-latest .lp-error p { 2255 | display: block; 2256 | } 2257 | 2258 | /* - Only used once or twice in all of WP - deprecate for global style 2259 | ------------------------------------------------------------------------------*/ 2260 | .media-icon { 2261 | width: 62px; /* icon + border */ 2262 | text-align: center; 2263 | } 2264 | 2265 | .media-icon img { 2266 | border: 1px solid #e5e5e5; 2267 | border: 1px solid rgba(0, 0, 0, 0.07); 2268 | } 2269 | 2270 | #howto { 2271 | font-size: 11px; 2272 | margin: 0 5px; 2273 | display: block; 2274 | } 2275 | 2276 | .importers { 2277 | font-size: 16px; 2278 | width: auto; 2279 | } 2280 | 2281 | .importers td { 2282 | padding-right: 14px; 2283 | line-height: 1.5em; 2284 | } 2285 | 2286 | .importers .import-system { 2287 | max-width: 250px; 2288 | } 2289 | 2290 | .importers td.desc { 2291 | max-width: 500px; 2292 | } 2293 | 2294 | .importer-title, 2295 | .importer-desc, 2296 | .importer-action { 2297 | display: block; 2298 | } 2299 | 2300 | .importer-title { 2301 | color: #000; 2302 | font-size: 14px; 2303 | font-weight: 400; 2304 | margin-bottom: .2em; 2305 | } 2306 | 2307 | .importer-action { 2308 | line-height: 20px; /* Same as with .updating-message */ 2309 | color: #555; 2310 | margin-bottom: 1em; 2311 | } 2312 | 2313 | #post-body #post-body-content #namediv h3, /* Back-compat for pre-4.4 */ 2314 | #post-body #post-body-content #namediv h2 { 2315 | margin-top: 0; 2316 | } 2317 | 2318 | .edit-comment-author { 2319 | font-size: 14px; 2320 | line-height: 1.4; 2321 | font-weight: 600; 2322 | color: #222; 2323 | margin: 2px 0 0 9px; 2324 | } 2325 | 2326 | #namediv h3 label, /* Back-compat for pre-4.4 */ 2327 | #namediv h2 label { 2328 | vertical-align: baseline; 2329 | } 2330 | 2331 | #namediv table { 2332 | width: 100%; 2333 | } 2334 | 2335 | #namediv td.first { 2336 | width: 10px; 2337 | white-space: nowrap; 2338 | } 2339 | 2340 | #namediv input { 2341 | width: 98%; 2342 | } 2343 | 2344 | #namediv p { 2345 | margin: 10px 0; 2346 | } 2347 | 2348 | #submitdiv h3 { 2349 | margin-bottom: 0 !important; 2350 | } 2351 | 2352 | /* - Used - but could/should be deprecated with a CSS reset 2353 | ------------------------------------------------------------------------------*/ 2354 | .zerosize { 2355 | height: 0; 2356 | width: 0; 2357 | margin: 0; 2358 | border: 0; 2359 | padding: 0; 2360 | overflow: hidden; 2361 | position: absolute; 2362 | } 2363 | 2364 | br.clear { 2365 | height: 2px; 2366 | line-height: 2px; 2367 | } 2368 | 2369 | .checkbox { 2370 | border: none; 2371 | margin: 0; 2372 | padding: 0; 2373 | } 2374 | 2375 | fieldset { 2376 | border: 0; 2377 | padding: 0; 2378 | margin: 0; 2379 | } 2380 | 2381 | .post-categories { 2382 | display: inline; 2383 | margin: 0; 2384 | padding: 0; 2385 | } 2386 | 2387 | .post-categories li { 2388 | display: inline; 2389 | } 2390 | 2391 | /* Star Ratings - Back-compat for pre-3.8 */ 2392 | div.star-holder { 2393 | position: relative; 2394 | height: 17px; 2395 | width: 100px; 2396 | background: url(../images/stars.png?ver=20121108) repeat-x bottom left; 2397 | } 2398 | 2399 | div.star-holder .star-rating { 2400 | background: url(../images/stars.png?ver=20121108) repeat-x top left; 2401 | height: 17px; 2402 | float: left; 2403 | } 2404 | 2405 | /* Star Ratings */ 2406 | .star-rating { 2407 | white-space: nowrap; 2408 | } 2409 | .star-rating .star { 2410 | display: inline-block; 2411 | width: 20px; 2412 | height: 20px; 2413 | -webkit-font-smoothing: antialiased; 2414 | font-size: 20px; 2415 | line-height: 1; 2416 | font-family: dashicons; 2417 | text-decoration: inherit; 2418 | font-weight: 400; 2419 | font-style: normal; 2420 | vertical-align: top; 2421 | transition: color .1s ease-in 0; 2422 | text-align: center; 2423 | color: #ffb900; 2424 | } 2425 | 2426 | .star-rating .star-full:before { 2427 | content: "\f155"; 2428 | } 2429 | 2430 | .star-rating .star-half:before { 2431 | content: "\f459"; 2432 | } 2433 | 2434 | .rtl .star-rating .star-half { 2435 | -webkit-transform: rotateY(180deg); 2436 | transform: rotateY(180deg); 2437 | } 2438 | 2439 | .star-rating .star-empty:before { 2440 | content: "\f154"; 2441 | } 2442 | 2443 | div.action-links { 2444 | font-weight: 400; 2445 | margin: 6px 0 0; 2446 | } 2447 | 2448 | /* Plugin install thickbox */ 2449 | #plugin-information { 2450 | background: #fff; 2451 | position: fixed; 2452 | top: 0; 2453 | right: 0; 2454 | bottom: 0; 2455 | left: 0; 2456 | height: 100%; 2457 | padding: 0; 2458 | } 2459 | 2460 | #plugin-information-scrollable { 2461 | overflow: auto; 2462 | -webkit-overflow-scrolling: touch; 2463 | height: 100%; 2464 | } 2465 | 2466 | #plugin-information-title { 2467 | padding: 0 26px; 2468 | background: #f5f5f5; 2469 | font-size: 22px; 2470 | font-weight: 600; 2471 | line-height: 56px; 2472 | position: relative; 2473 | height: 56px; 2474 | } 2475 | 2476 | #plugin-information-title.with-banner { 2477 | margin-right: 0; 2478 | height: 250px; 2479 | background-size: cover; 2480 | } 2481 | 2482 | #plugin-information-title h2 { 2483 | font-size: 1em; 2484 | font-weight: 600; 2485 | padding: 0; 2486 | margin: 0; 2487 | overflow: hidden; 2488 | text-overflow: ellipsis; 2489 | white-space: nowrap; 2490 | } 2491 | 2492 | #plugin-information-title.with-banner h2 { 2493 | position: relative; 2494 | font-family: "Helvetica Neue", sans-serif; 2495 | display: inline-block; 2496 | font-size: 30px; 2497 | line-height: 50px; 2498 | box-sizing: border-box; 2499 | max-width: 100%; 2500 | padding: 0 15px; 2501 | margin-top: 174px; 2502 | color: #fff; 2503 | background: rgba( 30, 30, 30, 0.9 ); 2504 | text-shadow: 0 1px 3px rgba( 0, 0, 0, 0.4 ); 2505 | box-shadow: 0 0 30px rgba( 255, 255, 255, 0.1 ); 2506 | border-radius: 8px; 2507 | } 2508 | 2509 | #plugin-information-title div.vignette { 2510 | display: none; 2511 | } 2512 | 2513 | #plugin-information-title.with-banner div.vignette { 2514 | position: absolute; 2515 | display: block; 2516 | top: 0; 2517 | left: 0; 2518 | height: 250px; 2519 | width: 100%; 2520 | background: transparent; 2521 | box-shadow: inset 0 0 50px 4px rgba( 0, 0, 0, 0.2 ), inset 0 -1px 0 rgba( 0, 0, 0, 0.1 ); 2522 | } 2523 | 2524 | #plugin-information-tabs { 2525 | padding: 0 16px; 2526 | position: relative; 2527 | right: 0; 2528 | left: 0; 2529 | min-height: 36px; 2530 | font-size: 0; 2531 | z-index: 1; 2532 | border-bottom: 1px solid #ddd; 2533 | background: #f3f3f3; 2534 | } 2535 | 2536 | #plugin-information-tabs a { 2537 | position: relative; 2538 | display: inline-block; 2539 | padding: 9px 10px; 2540 | margin: 0; 2541 | height: 18px; 2542 | line-height: 18px; 2543 | font-size: 14px; 2544 | text-decoration: none; 2545 | transition: none; 2546 | } 2547 | 2548 | #plugin-information-tabs a.current { 2549 | margin: 0 -1px -1px; 2550 | background: #fff; 2551 | border: 1px solid #ddd; 2552 | border-bottom-color: #fff; 2553 | padding-top: 8px; 2554 | color: #32373c; 2555 | } 2556 | 2557 | #plugin-information-tabs.with-banner a.current { 2558 | border-top: none; 2559 | padding-top: 9px; 2560 | } 2561 | 2562 | #plugin-information-tabs a:active, 2563 | #plugin-information-tabs a:focus { 2564 | outline: none; 2565 | } 2566 | 2567 | #plugin-information-content { 2568 | overflow: hidden; /* equal height column trick */ 2569 | background: #fff; 2570 | position: relative; 2571 | top: 0; 2572 | right: 0; 2573 | left: 0; 2574 | min-height: 100%; 2575 | /* Height of title + tabs + install now */ 2576 | min-height: calc( 100% - 152px ); 2577 | } 2578 | 2579 | #plugin-information-content.with-banner { 2580 | /* Height of banner + tabs + install now */ 2581 | min-height: calc( 100% - 346px ); 2582 | } 2583 | 2584 | #section-holder { 2585 | position: relative; 2586 | top: 0; 2587 | right: 250px; 2588 | bottom: 0; 2589 | left: 0; 2590 | margin-right: 250px; /* FYI box */ 2591 | padding: 10px 26px; 2592 | margin-bottom: -99939px; /* 60px less than the padding below to accommodate footer */ 2593 | padding-bottom: 99999px; /* equal height column trick */ 2594 | } 2595 | 2596 | #section-holder .updated { 2597 | margin: 16px 0; 2598 | } 2599 | 2600 | #plugin-information .fyi { 2601 | float: right; 2602 | position: relative; 2603 | top: 0; 2604 | right: 0; 2605 | padding: 16px; 2606 | margin-bottom: -99939px; /* 60px less than the padding below to accommodate footer */ 2607 | padding-bottom: 99999px; /* equal height column trick */ 2608 | width: 217px; 2609 | border-left: 1px solid #ddd; 2610 | background: #f3f3f3; 2611 | color: #666; 2612 | } 2613 | 2614 | #plugin-information .fyi strong { 2615 | color: #444; 2616 | } 2617 | 2618 | #plugin-information .fyi h3 { 2619 | font-weight: 600; 2620 | text-transform: uppercase; 2621 | font-size: 12px; 2622 | color: #666; 2623 | margin: 24px 0 8px; 2624 | } 2625 | 2626 | #plugin-information .fyi h2 { 2627 | font-size: 0.9em; 2628 | margin-bottom: 0; 2629 | margin-right: 0; 2630 | } 2631 | 2632 | #plugin-information .fyi ul { 2633 | padding: 0; 2634 | margin: 0; 2635 | list-style: none; 2636 | } 2637 | 2638 | #plugin-information .fyi li { 2639 | margin: 0 0 10px; 2640 | } 2641 | 2642 | #plugin-information .fyi-description { 2643 | margin-top: 0; 2644 | } 2645 | 2646 | #plugin-information .counter-container { 2647 | margin: 3px 0; 2648 | } 2649 | 2650 | #plugin-information .counter-label { 2651 | float: left; 2652 | margin-right: 5px; 2653 | min-width: 55px; 2654 | } 2655 | 2656 | #plugin-information .counter-back { 2657 | height: 17px; 2658 | width: 92px; 2659 | background-color: #e5e5e5; 2660 | float: left; 2661 | } 2662 | 2663 | #plugin-information .counter-bar { 2664 | height: 17px; 2665 | background-color: #ffc733; /* slightly lighter than stars due to larger expanse */ 2666 | float: left; 2667 | } 2668 | 2669 | #plugin-information .counter-count { 2670 | margin-left: 5px; 2671 | } 2672 | 2673 | #plugin-information .fyi ul.contributors { 2674 | margin-top: 10px; 2675 | } 2676 | 2677 | #plugin-information .fyi ul.contributors li { 2678 | display: inline-block; 2679 | margin-right: 8px; 2680 | vertical-align: middle; 2681 | } 2682 | 2683 | #plugin-information .fyi ul.contributors li { 2684 | display: inline-block; 2685 | margin-right: 8px; 2686 | vertical-align: middle; 2687 | } 2688 | 2689 | #plugin-information .fyi ul.contributors li img { 2690 | vertical-align: middle; 2691 | margin-right: 4px; 2692 | } 2693 | 2694 | #plugin-information-footer { 2695 | padding: 13px 16px; 2696 | position: absolute; 2697 | right: 0; 2698 | bottom: 0; 2699 | left: 0; 2700 | height: 33px; /* 33+13+13+1=60 */ 2701 | border-top: 1px solid #ddd; 2702 | background: #f3f3f3; 2703 | } 2704 | 2705 | /* rtl:ignore */ 2706 | #plugin-information .section { 2707 | direction: ltr; 2708 | } 2709 | 2710 | /* rtl:ignore */ 2711 | #plugin-information .section ul, 2712 | #plugin-information .section ol { 2713 | list-style-type: disc; 2714 | margin-left: 24px; 2715 | } 2716 | 2717 | #plugin-information .section, 2718 | #plugin-information .section p { 2719 | font-size: 14px; 2720 | line-height: 1.7; 2721 | } 2722 | 2723 | #plugin-information #section-screenshots ol { 2724 | list-style: none; 2725 | margin: 0; 2726 | } 2727 | 2728 | #plugin-information #section-screenshots li img { 2729 | vertical-align: text-top; 2730 | margin-top: 16px; 2731 | max-width: 100%; 2732 | width: auto; 2733 | height: auto; 2734 | box-shadow: 0 1px 2px rgba( 0, 0, 0, 0.3 ); 2735 | } 2736 | 2737 | /* rtl:ignore */ 2738 | #plugin-information #section-screenshots li p { 2739 | font-style: italic; 2740 | padding-left: 20px; 2741 | } 2742 | 2743 | #plugin-information pre { 2744 | padding: 7px; 2745 | overflow: auto; 2746 | border: 1px solid #ccc; 2747 | } 2748 | 2749 | #plugin-information blockquote { 2750 | border-left: 2px solid #ddd; 2751 | color: #666; 2752 | font-style: italic; 2753 | margin: 1em 0; 2754 | padding: 0 0 0 1em; 2755 | } 2756 | 2757 | /* rtl:ignore */ 2758 | #plugin-information .review { 2759 | overflow: hidden; /* clearfix */ 2760 | width: 100%; 2761 | margin-bottom: 20px; 2762 | border-bottom: 1px solid #e5e5e5; 2763 | } 2764 | 2765 | #plugin-information .review-title-section { 2766 | overflow: hidden; /* clearfix */ 2767 | } 2768 | 2769 | /* rtl:ignore */ 2770 | #plugin-information .review-title-section h4 { 2771 | display: inline-block; 2772 | float: left; 2773 | margin: 0 6px 0 0; 2774 | } 2775 | 2776 | #plugin-information .reviewer-info p { 2777 | clear: both; 2778 | margin: 0; 2779 | padding-top: 2px; 2780 | } 2781 | 2782 | /* rtl:ignore */ 2783 | #plugin-information .reviewer-info .avatar { 2784 | float: left; 2785 | margin: 4px 6px 0 0; 2786 | } 2787 | 2788 | /* rtl:ignore */ 2789 | #plugin-information .reviewer-info .star-rating { 2790 | float: left; 2791 | } 2792 | 2793 | /* rtl:ignore */ 2794 | #plugin-information .review-meta { 2795 | float: left; 2796 | margin-left: 0.75em; 2797 | } 2798 | 2799 | /* rtl:ignore */ 2800 | #plugin-information .review-body { 2801 | float: left; 2802 | width: 100%; 2803 | } 2804 | 2805 | .plugin-version-author-uri { 2806 | font-size: 13px; 2807 | } 2808 | 2809 | /* For non-js plugin installation screen ticket #36430. */ 2810 | .update-php .button.button-primary { 2811 | margin-right: 1em; 2812 | } 2813 | 2814 | @media screen and ( max-width: 771px ) { 2815 | #plugin-information-title.with-banner { 2816 | height: 100px; 2817 | } 2818 | 2819 | #plugin-information-title.with-banner h2 { 2820 | margin-top: 30px; 2821 | font-size: 20px; 2822 | line-height: 40px; 2823 | max-width: 85%; 2824 | } 2825 | 2826 | #plugin-information-title.with-banner div.vignette { 2827 | height: 100px; 2828 | } 2829 | 2830 | #plugin-information-tabs { 2831 | overflow: hidden; /* clearfix */ 2832 | padding: 0; 2833 | height: auto; /* let tabs wrap */ 2834 | } 2835 | 2836 | #plugin-information-tabs a.current { 2837 | margin-bottom: 0; 2838 | border-bottom: none; 2839 | } 2840 | 2841 | #plugin-information .fyi { 2842 | float: none; 2843 | border: 1px solid #ddd; 2844 | position: static; 2845 | width: auto; 2846 | margin: 26px 26px 0; 2847 | padding-bottom: 0; /* reset from the two column height fix */ 2848 | } 2849 | 2850 | #section-holder { 2851 | position: static; 2852 | margin: 0; 2853 | padding-bottom: 70px; /* reset from the two column height fix, plus accommodate footer */ 2854 | } 2855 | 2856 | #plugin-information .fyi h3, 2857 | #plugin-information .fyi small { 2858 | display: none; 2859 | } 2860 | 2861 | #plugin-information-footer { 2862 | padding: 12px 16px 0; 2863 | height: 46px; 2864 | } 2865 | } 2866 | 2867 | /* Thickbox for Plugin Install screen */ 2868 | body.about-php #TB_window, 2869 | body.plugin-install-php #TB_window, 2870 | body.import-php #TB_window, 2871 | body.plugins-php #TB_window, 2872 | body.update-core-php #TB_window, 2873 | body.index-php #TB_window { 2874 | background: #fcfcfc; 2875 | } 2876 | 2877 | /* IE 8 needs a change in the pseudo element content */ 2878 | .ie8 body.about-php #TB_window:before, 2879 | .ie8 body.plugin-install-php #TB_window:before, 2880 | .ie8 body.import-php #TB_window:before, 2881 | .ie8 body.plugins-php #TB_window:before, 2882 | .ie8 body.update-core-php #TB_window:before, 2883 | .ie8 body.index-php #TB_window:before { 2884 | content: " "; 2885 | background: none; 2886 | } 2887 | 2888 | body.about-php #TB_window.thickbox-loading:before, 2889 | body.plugin-install-php #TB_window.thickbox-loading:before, 2890 | body.import-php #TB_window.thickbox-loading:before, 2891 | body.plugins-php #TB_window.thickbox-loading:before, 2892 | body.update-core-php #TB_window.thickbox-loading:before, 2893 | body.index-php #TB_window.thickbox-loading:before { 2894 | content: ""; 2895 | display: block; 2896 | width: 20px; 2897 | height: 20px; 2898 | position: absolute; 2899 | left: 50%; 2900 | top: 50%; 2901 | z-index: -1; 2902 | margin: -10px 0 0 -10px; 2903 | background: #fcfcfc url(../../../../../wp-admin/images/spinner.gif) no-repeat center; 2904 | background-size: 20px 20px; 2905 | -webkit-transform: translateZ(0); 2906 | transform: translateZ(0); 2907 | } 2908 | 2909 | @media print, 2910 | (-webkit-min-device-pixel-ratio: 1.25), 2911 | (min-resolution: 120dpi) { 2912 | 2913 | body.about-php #TB_window.thickbox-loading:before, 2914 | body.plugin-install-php #TB_window.thickbox-loading:before, 2915 | body.import-php #TB_window.thickbox-loading:before, 2916 | body.plugins-php #TB_window.thickbox-loading:before, 2917 | body.update-core-php #TB_window.thickbox-loading:before, 2918 | body.index-php #TB_window.thickbox-loading:before { 2919 | background-image: url(../../../../../wp-admin/images/spinner-2x.gif); 2920 | } 2921 | } 2922 | 2923 | body.about-php #TB_title, 2924 | body.plugin-install-php #TB_title, 2925 | body.import-php #TB_title, 2926 | body.plugins-php #TB_title, 2927 | body.update-core-php #TB_title, 2928 | body.index-php #TB_title { 2929 | float: left; 2930 | height: 1px; 2931 | } 2932 | 2933 | body.about-php #TB_ajaxWindowTitle, 2934 | body.plugin-install-php #TB_ajaxWindowTitle, 2935 | body.import-php #TB_ajaxWindowTitle, 2936 | body.plugins-php #TB_ajaxWindowTitle, 2937 | body.update-core-php #TB_ajaxWindowTitle, 2938 | body.index-php #TB_ajaxWindowTitle { 2939 | display: none; 2940 | } 2941 | 2942 | /* only on these screens */ 2943 | .about-php #TB_closeWindowButton, 2944 | .plugin-install-php #TB_closeWindowButton, 2945 | .import-php #TB_closeWindowButton, 2946 | .plugins-php #TB_closeWindowButton, 2947 | .update-core-php #TB_closeWindowButton, 2948 | .index-php #TB_closeWindowButton { 2949 | left: auto; 2950 | right: -30px; 2951 | color: #eee; 2952 | } 2953 | 2954 | 2955 | body.about-php #TB_closeWindowButton:hover, 2956 | body.about-php #TB_closeWindowButton:focus, 2957 | body.plugin-install-php #TB_closeWindowButton:hover, 2958 | body.plugin-install-php #TB_closeWindowButton:focus, 2959 | body.import-php #TB_closeWindowButton:hover, 2960 | body.import-php #TB_closeWindowButton:focus, 2961 | body.plugins-php #TB_closeWindowButton:hover, 2962 | body.plugins-php #TB_closeWindowButton:focus, 2963 | body.update-core-php #TB_closeWindowButton:hover, 2964 | body.update-core-php #TB_closeWindowButton:focus, 2965 | body.index-php #TB_closeWindowButton:hover, 2966 | body.index-php #TB_closeWindowButton:focus { 2967 | color: #00a0d2; 2968 | outline: none; 2969 | box-shadow: none; 2970 | } 2971 | 2972 | body.about-php .tb-close-icon, 2973 | body.plugin-install-php .tb-close-icon, 2974 | body.import-php .tb-close-icon, 2975 | body.plugins-php .tb-close-icon, 2976 | body.update-core-php .tb-close-icon, 2977 | body.index-php .tb-close-icon { 2978 | display: none; 2979 | } 2980 | 2981 | body.about-php #TB_closeWindowButton:after, 2982 | body.plugin-install-php #TB_closeWindowButton:after, 2983 | body.import-php #TB_closeWindowButton:after, 2984 | body.plugins-php #TB_closeWindowButton:after, 2985 | body.update-core-php #TB_closeWindowButton:after, 2986 | body.index-php #TB_closeWindowButton:after { 2987 | content: "\f335"; 2988 | font: normal 32px/29px 'dashicons'; 2989 | speak: none; 2990 | -webkit-font-smoothing: antialiased; 2991 | -moz-osx-font-smoothing: grayscale; 2992 | } 2993 | 2994 | /* move plugin install close icon to top on narrow screens */ 2995 | @media screen and ( max-width: 830px ) { 2996 | body.about-php #TB_closeWindowButton, 2997 | body.plugin-install-php #TB_closeWindowButton, 2998 | body.import-php #TB_closeWindowButton, 2999 | body.plugins-php #TB_closeWindowButton, 3000 | body.update-core-php #TB_closeWindowButton, 3001 | body.index-php #TB_closeWindowButton { 3002 | right: 0; 3003 | top: -30px; 3004 | } 3005 | } 3006 | 3007 | /* @todo: move this. */ 3008 | img { 3009 | border: none; 3010 | } 3011 | 3012 | /* Metabox collapse arrow indicators */ 3013 | .js .sidebar-name .sidebar-name-arrow:before, 3014 | .js .meta-box-sortables .postbox .toggle-indicator:before, 3015 | .bulk-action-notice .toggle-indicator:before { 3016 | content: "\f142"; 3017 | display: inline-block; 3018 | font: normal 20px/1 dashicons; 3019 | speak: none; 3020 | -webkit-font-smoothing: antialiased; 3021 | -moz-osx-font-smoothing: grayscale; 3022 | text-decoration: none !important; 3023 | } 3024 | 3025 | .js .widgets-holder-wrap.closed .sidebar-name-arrow:before, 3026 | .js .meta-box-sortables .postbox.closed .handlediv .toggle-indicator:before, 3027 | .bulk-action-notice .bulk-action-errors-collapsed .toggle-indicator:before { 3028 | content: "\f140"; 3029 | } 3030 | 3031 | .js .sidebar-name .sidebar-name-arrow:before { 3032 | padding: 10px; 3033 | left: 0; 3034 | } 3035 | 3036 | .js #widgets-left .sidebar-name .sidebar-name-arrow { 3037 | display: none; 3038 | } 3039 | 3040 | .js #widgets-left .widgets-holder-wrap.closed .sidebar-name .sidebar-name-arrow, 3041 | .js #widgets-left .sidebar-name:hover .sidebar-name-arrow { 3042 | display: block; 3043 | } 3044 | 3045 | .js .postbox .handlediv .toggle-indicator:before { 3046 | margin-top: 4px; 3047 | width: 20px; 3048 | border-radius: 50%; 3049 | text-indent: -1px; /* account for the dashicon alignment */ 3050 | } 3051 | 3052 | .rtl.js .postbox .handlediv .toggle-indicator:before { 3053 | text-indent: 1px; /* account for the dashicon alignment */ 3054 | } 3055 | 3056 | .bulk-action-notice .toggle-indicator:before { 3057 | line-height: 16px; 3058 | vertical-align: top; 3059 | color: #72777c; 3060 | } 3061 | 3062 | .js .postbox .handlediv:focus { 3063 | box-shadow: none; 3064 | outline: none; 3065 | } 3066 | 3067 | .js .postbox .handlediv:focus .toggle-indicator:before { 3068 | box-shadow: 3069 | 0 0 0 1px #5b9dd9, 3070 | 0 0 2px 1px rgba(30, 140, 190, .8); 3071 | } 3072 | 3073 | /* @todo: appears to be Press This only and overridden */ 3074 | #photo-add-url-div input[type="text"] { 3075 | width: 300px; 3076 | } 3077 | 3078 | /* Theme/Plugin Editor */ 3079 | .alignleft h2 { 3080 | margin: 0; 3081 | } 3082 | 3083 | #template textarea { 3084 | font-family: Consolas, Monaco, monospace; 3085 | font-size: 13px; 3086 | background: #f9f9f9; 3087 | -moz-tab-size: 4; 3088 | -o-tab-size: 4; 3089 | tab-size: 4; 3090 | } 3091 | 3092 | #template textarea, 3093 | #template .CodeMirror { 3094 | width: 97%; 3095 | height: calc( 100vh - 220px ); 3096 | } 3097 | 3098 | /* rtl:ignore */ 3099 | #template textarea, 3100 | #docs-list { 3101 | direction: ltr; 3102 | } 3103 | 3104 | #template p { 3105 | width: 97%; 3106 | } 3107 | 3108 | #file-editor-linting-error { 3109 | margin-top: 1em; 3110 | margin-bottom: 1em; 3111 | } 3112 | #file-editor-linting-error > .notice { 3113 | margin: 0; 3114 | display: inline-block; 3115 | } 3116 | #file-editor-linting-error > .notice > p { 3117 | width: auto; 3118 | } 3119 | #template .submit { 3120 | margin-top: 1em; 3121 | padding: 0; 3122 | } 3123 | 3124 | #template .submit input[type=submit][disabled] { 3125 | cursor: not-allowed; 3126 | } 3127 | #templateside { 3128 | float: right; 3129 | width: 190px; 3130 | word-wrap: break-word; 3131 | } 3132 | 3133 | #templateside h2, 3134 | #postcustomstuff p.submit { 3135 | margin: 0; 3136 | } 3137 | 3138 | #templateside h4 { 3139 | margin: 1em 0 0; 3140 | } 3141 | 3142 | #templateside ol, 3143 | #templateside ul { 3144 | margin: .5em 0; 3145 | padding: 0; 3146 | } 3147 | 3148 | #templateside li { 3149 | margin: 4px 0; 3150 | } 3151 | 3152 | #templateside li a, 3153 | .theme-editor-php .highlight { 3154 | display: block; 3155 | padding: 3px 3px 3px 12px; 3156 | text-decoration: none; 3157 | } 3158 | 3159 | .theme-editor-php .highlight { 3160 | margin: -3px 3px -3px -12px; 3161 | } 3162 | 3163 | #templateside .highlight { 3164 | border: none; 3165 | font-weight: 600; 3166 | } 3167 | 3168 | .nonessential { 3169 | color: #666; 3170 | font-size: 11px; 3171 | font-style: italic; 3172 | padding-left: 12px; 3173 | } 3174 | 3175 | #documentation { 3176 | margin-top: 10px; 3177 | } 3178 | 3179 | #documentation label { 3180 | line-height: 22px; 3181 | vertical-align: baseline; 3182 | font-weight: 600; 3183 | } 3184 | 3185 | .fileedit-sub { 3186 | padding: 10px 0 8px; 3187 | line-height: 180%; 3188 | } 3189 | 3190 | /* @todo: can we use a common class for these? */ 3191 | .nav-menus-php .item-edit:before, 3192 | .widget-top .widget-action .toggle-indicator:before, 3193 | .control-section .accordion-section-title:after, 3194 | .accordion-section-title:after { 3195 | content: "\f140"; 3196 | font: normal 20px/1 dashicons; 3197 | speak: none; 3198 | display: block; 3199 | -webkit-font-smoothing: antialiased; 3200 | -moz-osx-font-smoothing: grayscale; 3201 | text-decoration: none !important; 3202 | } 3203 | 3204 | .widget-top .widget-action .toggle-indicator:before { 3205 | padding: 1px 2px 1px 0px; 3206 | border-radius: 50%; 3207 | } 3208 | 3209 | .handlediv, 3210 | .postbox .handlediv.button-link, 3211 | .item-edit, 3212 | .sidebar-name-arrow, 3213 | .accordion-section-title:after { 3214 | color: #72777c; 3215 | } 3216 | 3217 | .widget-action { 3218 | color: #555d66; /* #fafafa background in the Widgets screen */ 3219 | } 3220 | 3221 | .widget-top:hover .widget-action, 3222 | .widget-action:focus, 3223 | .handlediv:hover, 3224 | .handlediv:focus, 3225 | .postbox .handlediv.button-link:hover, 3226 | .postbox .handlediv.button-link:focus, 3227 | .item-edit:hover, 3228 | .item-edit:focus, 3229 | .sidebar-name:hover .sidebar-name-arrow, 3230 | .accordion-section-title:hover:after { 3231 | color: #23282d; 3232 | } 3233 | 3234 | .widget-top .widget-action:focus .toggle-indicator:before { 3235 | box-shadow: 3236 | 0 0 0 1px #5b9dd9, 3237 | 0 0 2px 1px rgba(30,140,190,.8); 3238 | } 3239 | 3240 | .control-section .accordion-section-title:after, 3241 | .accordion-section-title:after { 3242 | float: right; 3243 | right: 20px; 3244 | top: -2px; 3245 | } 3246 | 3247 | .control-section.open .accordion-section-title:after, 3248 | #customize-info.open .accordion-section-title:after, 3249 | .nav-menus-php .menu-item-edit-active .item-edit:before, 3250 | .widget.open .widget-top .widget-action .toggle-indicator:before { 3251 | content: "\f142"; 3252 | } 3253 | 3254 | /*! 3255 | * jQuery UI Draggable/Sortable 1.11.4 3256 | * http://jqueryui.com 3257 | * 3258 | * Copyright jQuery Foundation and other contributors 3259 | * Released under the MIT license. 3260 | * http://jquery.org/license 3261 | */ 3262 | .ui-draggable-handle, 3263 | .ui-sortable-handle { 3264 | touch-action: none; 3265 | } 3266 | 3267 | /* Accordion */ 3268 | .accordion-section { 3269 | border-bottom: 1px solid #ddd; 3270 | margin: 0; 3271 | } 3272 | 3273 | .accordion-section.open .accordion-section-content, 3274 | .no-js .accordion-section .accordion-section-content { 3275 | display: block; 3276 | } 3277 | 3278 | .accordion-section.open:hover { 3279 | border-bottom-color: #ddd; 3280 | } 3281 | 3282 | .accordion-section-content { 3283 | display: none; 3284 | padding: 10px 20px 15px; 3285 | overflow: hidden; 3286 | background: #fff; 3287 | } 3288 | 3289 | .accordion-section-title { 3290 | margin: 0; 3291 | padding: 12px 15px 15px; 3292 | position: relative; 3293 | border-left: 1px solid #ddd; 3294 | border-right: 1px solid #ddd; 3295 | -webkit-user-select: none; 3296 | -moz-user-select: none; 3297 | -ms-user-select: none; 3298 | user-select: none; 3299 | } 3300 | 3301 | .js .accordion-section-title { 3302 | cursor: pointer; 3303 | } 3304 | 3305 | .js .accordion-section-title:after { 3306 | position: absolute; 3307 | top: 12px; 3308 | right: 10px; 3309 | z-index: 1; 3310 | } 3311 | 3312 | .accordion-section-title:focus { 3313 | outline: none; 3314 | } 3315 | 3316 | .accordion-section-title:hover:after, 3317 | .accordion-section-title:focus:after { 3318 | border-color: #a0a5aa transparent; 3319 | } 3320 | 3321 | .cannot-expand .accordion-section-title { 3322 | cursor: auto; 3323 | } 3324 | 3325 | .cannot-expand .accordion-section-title:after { 3326 | display: none; 3327 | } 3328 | 3329 | .control-section .accordion-section-title, 3330 | .customize-pane-child .accordion-section-title { 3331 | border-left: none; 3332 | border-right: none; 3333 | padding: 10px 10px 11px 14px; 3334 | line-height: 21px; 3335 | background: #fff; 3336 | } 3337 | 3338 | .control-section .accordion-section-title:after, 3339 | .customize-pane-child .accordion-section-title:after { 3340 | top: 11px; 3341 | } 3342 | 3343 | .js .control-section:hover .accordion-section-title, 3344 | .js .control-section .accordion-section-title:hover, 3345 | .js .control-section.open .accordion-section-title, 3346 | .js .control-section .accordion-section-title:focus { 3347 | color: #23282d; 3348 | background: #f5f5f5; 3349 | } 3350 | 3351 | .control-section.open .accordion-section-title { 3352 | /* When expanded */ 3353 | border-bottom: 1px solid #ddd; 3354 | } 3355 | 3356 | /* Edit Site */ 3357 | .network-admin .edit-site-actions { 3358 | margin-top: 0; 3359 | } 3360 | 3361 | /* My Sites */ 3362 | .my-sites { 3363 | display: block; 3364 | overflow: auto; 3365 | zoom: 1; 3366 | } 3367 | 3368 | .my-sites li { 3369 | display: block; 3370 | padding: 8px 3%; 3371 | min-height: 130px; 3372 | margin: 0; 3373 | } 3374 | 3375 | @media only screen and (max-width: 599px) { 3376 | .my-sites li { 3377 | min-height: 0; 3378 | } 3379 | } 3380 | 3381 | @media only screen and (min-width: 600px) { 3382 | .my-sites.striped li { 3383 | background-color: #fff; 3384 | position: relative; 3385 | } 3386 | .my-sites.striped li:after { 3387 | content: ""; 3388 | width: 1px; 3389 | height: 100%; 3390 | position: absolute; 3391 | top: 0; 3392 | right: 0; 3393 | background: #ccc; 3394 | } 3395 | 3396 | } 3397 | @media only screen and (min-width: 600px) and (max-width: 699px) { 3398 | .my-sites li{ 3399 | float: left; 3400 | width: 44%; 3401 | } 3402 | .my-sites.striped li { 3403 | background-color: #fff; 3404 | } 3405 | .my-sites.striped li:nth-of-type(2n+1) { 3406 | clear: left; 3407 | } 3408 | .my-sites.striped li:nth-of-type(2n+2):after { 3409 | content: none; 3410 | } 3411 | .my-sites li:nth-of-type(4n+1), 3412 | .my-sites li:nth-of-type(4n+2) { 3413 | background-color: #f9f9f9; 3414 | } 3415 | 3416 | } 3417 | 3418 | @media only screen and (min-width: 700px) and (max-width: 1199px) { 3419 | .my-sites li { 3420 | float: left; 3421 | width: 27.333333%; 3422 | background-color: #fff; 3423 | } 3424 | .my-sites.striped li:nth-of-type(3n+3):after { 3425 | content: none; 3426 | } 3427 | .my-sites li:nth-of-type(6n+1), 3428 | .my-sites li:nth-of-type(6n+2), 3429 | .my-sites li:nth-of-type(6n+3) { 3430 | background-color: #f9f9f9; 3431 | } 3432 | } 3433 | 3434 | @media only screen and (min-width: 1200px) and (max-width: 1399px) { 3435 | .my-sites li { 3436 | float: left; 3437 | width: 21%; 3438 | padding: 8px 2%; 3439 | background-color: #fff; 3440 | } 3441 | .my-sites.striped li:nth-of-type(4n+1) { 3442 | clear: left; 3443 | } 3444 | .my-sites.striped li:nth-of-type(4n+4):after { 3445 | content: none; 3446 | } 3447 | .my-sites li:nth-of-type(8n+1), 3448 | .my-sites li:nth-of-type(8n+2), 3449 | .my-sites li:nth-of-type(8n+3), 3450 | .my-sites li:nth-of-type(8n+4) { 3451 | background-color: #f9f9f9; 3452 | } 3453 | } 3454 | 3455 | @media only screen and (min-width: 1400px) and (max-width: 1599px) { 3456 | .my-sites li { 3457 | float: left; 3458 | width: 16%; 3459 | padding: 8px 2%; 3460 | background-color: #fff; 3461 | } 3462 | .my-sites.striped li:nth-of-type(5n+1) { 3463 | clear: left; 3464 | } 3465 | .my-sites.striped li:nth-of-type(5n+5):after { 3466 | content: none; 3467 | } 3468 | .my-sites li:nth-of-type(10n+1), 3469 | .my-sites li:nth-of-type(10n+2), 3470 | .my-sites li:nth-of-type(10n+3), 3471 | .my-sites li:nth-of-type(10n+4), 3472 | .my-sites li:nth-of-type(10n+5) { 3473 | background-color: #f9f9f9; 3474 | } 3475 | } 3476 | 3477 | @media only screen and (min-width: 1600px) { 3478 | .my-sites li { 3479 | float: left; 3480 | width: 12.666666%; 3481 | padding: 8px 2%; 3482 | background-color: #fff; 3483 | } 3484 | .my-sites.striped li:nth-of-type(6n+1) { 3485 | clear: left; 3486 | } 3487 | .my-sites.striped li:nth-of-type(6n+6):after { 3488 | content: none; 3489 | } 3490 | .my-sites li:nth-of-type(12n+1), 3491 | .my-sites li:nth-of-type(12n+2), 3492 | .my-sites li:nth-of-type(12n+3), 3493 | .my-sites li:nth-of-type(12n+4), 3494 | .my-sites li:nth-of-type(12n+5), 3495 | .my-sites li:nth-of-type(12n+6) { 3496 | background-color: #f9f9f9; 3497 | } 3498 | } 3499 | 3500 | .my-sites li a { 3501 | text-decoration: none; 3502 | } 3503 | 3504 | /* =Media Queries 3505 | -------------------------------------------------------------- */ 3506 | 3507 | /** 3508 | * HiDPI Displays 3509 | */ 3510 | @media print, 3511 | (-webkit-min-device-pixel-ratio: 1.25), 3512 | (min-resolution: 120dpi) { 3513 | /* Back-compat for pre-3.8 */ 3514 | div.star-holder, 3515 | div.star-holder .star-rating { 3516 | background: url(../images/stars-2x.png?ver=20121108) repeat-x bottom left; 3517 | background-size: 21px 37px; 3518 | } 3519 | 3520 | .spinner { 3521 | background-image: url(../../../../../wp-admin/images/spinner-2x.gif); 3522 | } 3523 | 3524 | /* @todo: evaluate - most of these were likely replaced by dashicons */ 3525 | .curtime #timestamp, 3526 | #screen-meta-links a.show-settings, 3527 | .widget-top .widget-action, 3528 | .widget-top .widget-action:hover, 3529 | .sidebar-name-arrow, 3530 | .sidebar-name:hover .sidebar-name-arrow, 3531 | .meta-box-sortables .postbox:hover .handlediv, 3532 | #bulk-titles div a, 3533 | #bulk-titles div a:hover { 3534 | background: none !important; 3535 | } 3536 | 3537 | } 3538 | 3539 | @-ms-viewport { 3540 | width: device-width; 3541 | } 3542 | 3543 | @media screen and ( max-width: 782px ) { 3544 | html.wp-toolbar { 3545 | padding-top: 46px; 3546 | } 3547 | 3548 | body { 3549 | min-width: 240px; 3550 | overflow-x: hidden; 3551 | } 3552 | 3553 | body * { 3554 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important; 3555 | } 3556 | 3557 | #wpcontent { 3558 | position: relative; 3559 | margin-left: 0; 3560 | padding-left: 10px; 3561 | } 3562 | 3563 | #wpbody-content { 3564 | padding-bottom: 100px; 3565 | } 3566 | 3567 | .wrap { 3568 | margin-right: 12px; 3569 | margin-left: 0; 3570 | } 3571 | 3572 | /* categories */ 3573 | #col-left, 3574 | #col-right { 3575 | float: none; 3576 | width: auto; 3577 | } 3578 | 3579 | #col-left .col-wrap, 3580 | #col-right .col-wrap { 3581 | padding: 0; 3582 | } 3583 | 3584 | /* Hidden Elements */ 3585 | #screen-meta, 3586 | #screen-meta-links, 3587 | #collapse-menu, 3588 | .post-format-select { 3589 | display: none !important; 3590 | } 3591 | 3592 | .wrap h1.wp-heading-inline { 3593 | margin-bottom: 0.5em; 3594 | } 3595 | 3596 | .wrap .add-new-h2, /* deprecated */ 3597 | .wrap .add-new-h2:active, /* deprecated */ 3598 | .wrap .page-title-action, 3599 | .wrap .page-title-action:active { 3600 | padding: 10px 15px; 3601 | font-size: 14px; 3602 | white-space: nowrap; 3603 | } 3604 | 3605 | .wp-color-result { 3606 | height: auto; 3607 | padding-left: 45px; 3608 | } 3609 | 3610 | .wp-color-result:after { 3611 | font-size: 14px; 3612 | height: auto; 3613 | padding: 6px 14px; 3614 | } 3615 | 3616 | /* Feedback Messages */ 3617 | .notice, 3618 | .wrap div.updated, 3619 | .wrap div.error, 3620 | .media-upload-form div.error { 3621 | margin: 20px 0 10px 0; 3622 | padding: 5px 10px; 3623 | font-size: 14px; 3624 | line-height: 175%; 3625 | } 3626 | 3627 | .wp-core-ui .notice.is-dismissible { 3628 | padding-right: 46px; 3629 | } 3630 | 3631 | .notice-dismiss { 3632 | padding: 13px; 3633 | } 3634 | 3635 | .wrap .icon32 + h2 { 3636 | margin-top: -2px; 3637 | } 3638 | 3639 | .wp-responsive-open #wpbody { 3640 | right: -190px; 3641 | } 3642 | 3643 | code { 3644 | word-wrap: break-word; 3645 | } 3646 | 3647 | /* General Metabox */ 3648 | .postbox { 3649 | font-size: 14px; 3650 | } 3651 | 3652 | .metabox-holder h3.hndle, /* Back-compat for pre-4.4 */ 3653 | .metabox-holder .stuffbox > h3, /* Back-compat for pre-4.4 */ 3654 | .metabox-holder .postbox > h3, /* Back-compat for pre-4.4 */ 3655 | .metabox-holder h2 { 3656 | padding: 12px; 3657 | } 3658 | 3659 | .postbox .handlediv { 3660 | margin-top: 3px; 3661 | } 3662 | 3663 | /* Subsubsub Nav */ 3664 | .subsubsub { 3665 | font-size: 16px; 3666 | text-align: center; 3667 | margin-bottom: 15px; 3668 | } 3669 | 3670 | /* Theme/Plugin File Editor */ 3671 | #templateside { 3672 | float: none; 3673 | width: auto; 3674 | } 3675 | 3676 | #templateside li { 3677 | margin: 0; 3678 | } 3679 | 3680 | #templateside li a { 3681 | display: block; 3682 | padding: 5px; 3683 | } 3684 | 3685 | #templateside .highlight { 3686 | padding: 5px; 3687 | margin-left: -5px; 3688 | margin-top: -5px; 3689 | } 3690 | 3691 | #template > div { 3692 | float: none; 3693 | margin: 0; 3694 | width: auto; 3695 | } 3696 | 3697 | #template .CodeMirror, 3698 | #template textarea { 3699 | width: 100%; 3700 | } 3701 | 3702 | .fileedit-sub .alignright { 3703 | margin-top: 15px; 3704 | } 3705 | 3706 | #wpfooter { 3707 | display: none; 3708 | } 3709 | 3710 | #comments-form .checkforspam { 3711 | display: none; 3712 | } 3713 | 3714 | .edit-comment-author { 3715 | margin: 2px 0 0; 3716 | } 3717 | 3718 | .filter-drawer .filter-group-feature input, 3719 | .filter-drawer .filter-group-feature label { 3720 | line-height: 25px; 3721 | } 3722 | 3723 | .wp-filter .button.drawer-toggle { 3724 | font-size: 13px; 3725 | line-height: 26px; 3726 | height: 28px; 3727 | } 3728 | } 3729 | 3730 | /* Smartphone */ 3731 | @media screen and (max-width: 600px) { 3732 | /* Disable horizontal scroll when responsive menu is open 3733 | since we push the main content off to the right. */ 3734 | #wpwrap.wp-responsive-open { 3735 | overflow-x: hidden; 3736 | } 3737 | 3738 | html.wp-toolbar { 3739 | padding-top: 0; 3740 | } 3741 | 3742 | #wpbody { 3743 | padding-top: 46px; 3744 | } 3745 | 3746 | /* Keep full-width boxes on Edit Post page from causing horizontal scroll */ 3747 | div#post-body.metabox-holder.columns-1 { 3748 | overflow-x: hidden; 3749 | } 3750 | 3751 | h1.nav-tab-wrapper, 3752 | .wrap h2.nav-tab-wrapper, 3753 | .nav-tab-wrapper { 3754 | border-bottom: 0; 3755 | } 3756 | 3757 | h1 .nav-tab, 3758 | h2 .nav-tab, 3759 | h3 .nav-tab { 3760 | margin: 10px 10px 0 0; 3761 | border-bottom: 1px solid #ccc; 3762 | } 3763 | } 3764 | 3765 | @media screen and (max-width: 320px) { 3766 | /* Prevent default center alignment and larger font for the Right Now widget when 3767 | the network dashboard is viewed on a small mobile device. */ 3768 | #network_dashboard_right_now .subsubsub { 3769 | font-size: 14px; 3770 | text-align: left; 3771 | } 3772 | } 3773 | -------------------------------------------------------------------------------- /wp-admin/css/customize-controls-addendum.css: -------------------------------------------------------------------------------- 1 | .customize-section-description-container + #customize-control-custom_css:last-child .CodeMirror { 2 | height: calc( 100vh - 185px ); 3 | } 4 | .CodeMirror-lint-tooltip, 5 | .CodeMirror-hints { 6 | z-index: 500000 !important; 7 | } 8 | 9 | .customize-section-description ul { 10 | margin-left: 1em; 11 | } 12 | .customize-section-description ul > li { 13 | list-style: disc; 14 | } 15 | 16 | .customize-section-description-container + #customize-control-custom_css:last-child .customize-control-notifications-container { 17 | margin-left: 12px; 18 | margin-right: 12px; 19 | } 20 | 21 | .section-description-buttons { 22 | text-align: right; 23 | } 24 | 25 | .section-description-buttons button.button-link { 26 | color: #0073aa; /* @todo Color scheme? */ 27 | text-decoration: underline; 28 | } 29 | -------------------------------------------------------------------------------- /wp-admin/css/widgets-addendum.css: -------------------------------------------------------------------------------- 1 | /* To be added under "Specific widget styling" */ 2 | 3 | .custom-html-widget-fields > p > .CodeMirror { 4 | border: 1px solid #e5e5e5; 5 | } 6 | .custom-html-widget-fields code { 7 | padding-top: 1px; 8 | padding-bottom: 1px; 9 | } 10 | ul.CodeMirror-hints { 11 | z-index: 101; /* Due to z-index 100 set on .widget.open */ 12 | } 13 | .widget-control-actions .custom-html-widget-save-button.button.validation-blocked { 14 | cursor: not-allowed; 15 | } 16 | -------------------------------------------------------------------------------- /wp-admin/file-editor-addendum.php: -------------------------------------------------------------------------------- 1 | errors() ) { 69 | wp_die( $theme->errors()->get_error_message() ); 70 | } 71 | 72 | if ( isset( $_REQUEST['file'] ) ) { 73 | $args['file'] = sanitize_text_field( wp_unslash( $_REQUEST['file'] ) ); 74 | } else { 75 | $args['file'] = 'style.css'; 76 | } 77 | } elseif ( 'plugin-editor.php' === $hook ) { 78 | $args['plugin'] = isset( $_REQUEST['plugin'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['plugin'] ) ) : ''; 79 | $args['file'] = isset( $_REQUEST['file'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['file'] ) ) : ''; 80 | 81 | if ( empty( $args['plugin'] ) ) { 82 | $file_paths = array_keys( get_plugins() ); 83 | $args['plugin'] = $args['file'] ? $args['file'] : array_shift( $file_paths ); 84 | } elseif ( 0 !== validate_file( $args['plugin'] ) ) { 85 | wp_die( __( 'Sorry, that file cannot be edited.', 'better-code-editing' ) ); 86 | } 87 | 88 | $plugin_files = get_plugin_files( $args['plugin'] ); 89 | if ( empty( $args['file'] ) ) { 90 | $args['file'] = $plugin_files[0]; 91 | } 92 | 93 | $args['file'] = validate_file_to_edit( $args['file'], $plugin_files ); 94 | } 95 | 96 | $settings = wp_enqueue_code_editor( $args ); 97 | if ( empty( $settings ) ) { 98 | return; 99 | } 100 | 101 | wp_enqueue_script( 'wp-theme-plugin-editor' ); 102 | 103 | $l10n = wp_array_slice_assoc( 104 | /* translators: placeholder is error count */ 105 | _n_noop( 'There is %d error which must be fixed before you can save.', 'There are %d errors which must be fixed before you can save.', 'better-code-editing' ), 106 | array( 'singular', 'plural' ) 107 | ); 108 | wp_add_inline_script( 'wp-theme-plugin-editor', sprintf( 'wp.themePluginEditor.l10n = %s;', wp_json_encode( $l10n ) ) ); 109 | wp_add_inline_script( 'wp-theme-plugin-editor', sprintf( 'jQuery( function() { wp.themePluginEditor.init( %s ); } )', wp_json_encode( $settings ) ) ); 110 | } 111 | -------------------------------------------------------------------------------- /wp-admin/includes/user.php: -------------------------------------------------------------------------------- 1 | . 59 | if ( ! lintOptions.options ) { 60 | lintOptions.options = {}; 61 | } 62 | 63 | // Configure JSHint. 64 | if ( 'javascript' === settings.codemirror.mode && settings.jshint ) { 65 | $.extend( lintOptions.options, settings.jshint ); 66 | } 67 | 68 | // Configure CSSLint. 69 | if ( 'css' === settings.codemirror.mode && settings.csslint ) { 70 | $.extend( lintOptions.options, settings.csslint ); 71 | } 72 | 73 | // Configure HTMLHint. 74 | if ( 'htmlmixed' === settings.codemirror.mode && settings.htmlhint ) { 75 | lintOptions.options.rules = $.extend( {}, settings.htmlhint ); 76 | 77 | if ( settings.jshint ) { 78 | lintOptions.options.rules.jshint = settings.jshint; 79 | } 80 | if ( settings.csslint ) { 81 | lintOptions.options.rules.csslint = settings.csslint; 82 | } 83 | } 84 | 85 | /** 86 | * Call the onUpdateErrorNotice if there are new errors to show. 87 | * 88 | * @returns {void} 89 | */ 90 | updateErrorNotice = function() { 91 | if ( settings.onUpdateErrorNotice && ! _.isEqual( currentErrorAnnotations, previouslyShownErrorAnnotations ) ) { 92 | settings.onUpdateErrorNotice( currentErrorAnnotations, editor ); 93 | previouslyShownErrorAnnotations = currentErrorAnnotations; 94 | } 95 | }; 96 | 97 | // Wrap the onUpdateLinting CodeMirror event to route to onChangeLintingErrors and onUpdateErrorNotice. 98 | lintOptions.onUpdateLinting = (function( onUpdateLintingOverridden ) { 99 | return function( annotations, annotationsSorted, cm ) { 100 | var errorAnnotations = _.filter( annotations, function( annotation ) { 101 | return 'error' === annotation.severity; 102 | } ); 103 | 104 | if ( onUpdateLintingOverridden ) { 105 | onUpdateLintingOverridden.apply( annotations, annotationsSorted, cm ); 106 | } 107 | 108 | // Skip if there are no changes to the errors. 109 | if ( _.isEqual( errorAnnotations, currentErrorAnnotations ) ) { 110 | return; 111 | } 112 | 113 | currentErrorAnnotations = errorAnnotations; 114 | 115 | if ( settings.onChangeLintingErrors ) { 116 | settings.onChangeLintingErrors( errorAnnotations, annotations, annotationsSorted, cm ); 117 | } 118 | 119 | /* 120 | * Update notifications when the editor is not focused to prevent error message 121 | * from overwhelming the user during input, unless there are now no errors or there 122 | * were previously errors shown. In these cases, update immediately so they can know 123 | * that they fixed the errors. 124 | */ 125 | if ( ! cm.state.focused || 0 === currentErrorAnnotations.length || previouslyShownErrorAnnotations.length > 0 ) { 126 | updateErrorNotice(); 127 | } 128 | }; 129 | })( lintOptions.onUpdateLinting ); 130 | 131 | editor.setOption( 'lint', lintOptions ); 132 | 133 | // Update error notice when leaving the editor. 134 | editor.on( 'blur', updateErrorNotice ); 135 | 136 | // Work around hint selection with mouse causing focus to leave editor. 137 | editor.on( 'startCompletion', function() { 138 | editor.off( 'blur', updateErrorNotice ); 139 | } ); 140 | editor.on( 'endCompletion', function() { 141 | var editorRefocusWait = 500; 142 | editor.on( 'blur', updateErrorNotice ); 143 | 144 | // Wait for editor to possibly get re-focused after selection. 145 | _.delay( function() { 146 | if ( ! editor.state.focused ) { 147 | updateErrorNotice(); 148 | } 149 | }, editorRefocusWait ); 150 | }); 151 | 152 | /* 153 | * Make sure setting validities are set if the user tries to click Publish 154 | * while an autocomplete dropdown is still open. The Customizer will block 155 | * saving when a setting has an error notifications on it. This is only 156 | * necessary for mouse interactions because keyboards will have already 157 | * blurred the field and cause onUpdateErrorNotice to have already been 158 | * called. 159 | */ 160 | $( document.body ).on( 'mousedown', function( event ) { 161 | if ( editor.state.focused && ! $.contains( editor.display.wrapper, event.target ) && ! $( event.target ).hasClass( 'CodeMirror-hint' ) ) { 162 | updateErrorNotice(); 163 | } 164 | }); 165 | } 166 | 167 | /** 168 | * Configure tabbing. 169 | * 170 | * @param {CodeMirror} codemirror - Editor. 171 | * @param {object} settings - Code editor settings. 172 | * @param {object} settings.codeMirror - Settings for CodeMirror. 173 | * @param {Function} settings.onTabNext - Callback to handle tabbing to the next tabbable element. 174 | * @param {Function} settings.onTabPrevious - Callback to handle tabbing to the previous tabbable element. 175 | * @returns {void} 176 | */ 177 | function configureTabbing( codemirror, settings ) { 178 | var $textarea = $( codemirror.getTextArea() ); 179 | 180 | codemirror.on( 'blur', function() { 181 | $textarea.data( 'next-tab-blurs', false ); 182 | }); 183 | codemirror.on( 'focus', function() { 184 | if ( codemirror.display.wrapper.scrollIntoViewIfNeeded ) { 185 | codemirror.display.wrapper.scrollIntoViewIfNeeded(); 186 | } else { 187 | codemirror.display.wrapper.scrollIntoView(); 188 | } 189 | }); 190 | codemirror.on( 'keydown', function onKeydown( editor, event ) { 191 | var tabKeyCode = 9, escKeyCode = 27; 192 | 193 | // Take note of the ESC keypress so that the next TAB can focus outside the editor. 194 | if ( escKeyCode === event.keyCode ) { 195 | $textarea.data( 'next-tab-blurs', true ); 196 | return; 197 | } 198 | 199 | // Short-circuit if tab key is not being pressed or the tab key press should move focus. 200 | if ( tabKeyCode !== event.keyCode || ! $textarea.data( 'next-tab-blurs' ) ) { 201 | return; 202 | } 203 | 204 | // Focus on previous or next focusable item. 205 | if ( event.shiftKey ) { 206 | settings.onTabPrevious( codemirror, event ); 207 | } else { 208 | settings.onTabNext( codemirror, event ); 209 | } 210 | 211 | // Reset tab state. 212 | $textarea.data( 'next-tab-blurs', false ); 213 | 214 | // Prevent tab character from being added. 215 | event.preventDefault(); 216 | }); 217 | } 218 | 219 | /** 220 | * Initialize Code Editor (CodeMirror) for an existing textarea. 221 | * 222 | * @since 4.9.0 223 | * 224 | * @param {string|jQuery|Element} textarea - The HTML id, jQuery object, or DOM Element for the textarea that is used for the editor. 225 | * @param {object} [settings] - Settings to override defaults. 226 | * @param {Function} [settings.onChangeLintingErrors] - Callback for when the linting errors have changed. 227 | * @param {Function} [settings.onUpdateErrorNotice] - Callback for when error notice should be displayed. 228 | * @param {Function} [settings.onTabPrevious] - Callback to handle tabbing to the previous tabbable element. 229 | * @param {Function} [settings.onTabNext] - Callback to handle tabbing to the next tabbable element. 230 | * @param {object} [settings.codemirror] - Options for CodeMirror. 231 | * @param {object} [settings.csslint] - Rules for CSSLint. 232 | * @param {object} [settings.htmlhint] - Rules for HTMLHint. 233 | * @param {object} [settings.jshint] - Rules for JSHint. 234 | * @returns {CodeMirror} CodeMirror instance. 235 | */ 236 | wp.codeEditor.initialize = function initialize( textarea, settings ) { 237 | var $textarea, codemirror, instanceSettings, instance; 238 | if ( 'string' === typeof textarea ) { 239 | $textarea = $( '#' + textarea ); 240 | } else { 241 | $textarea = $( textarea ); 242 | } 243 | 244 | instanceSettings = $.extend( {}, wp.codeEditor.defaultSettings, settings ); 245 | instanceSettings.codemirror = $.extend( {}, instanceSettings.codemirror ); 246 | 247 | codemirror = wp.CodeMirror.fromTextArea( $textarea[0], instanceSettings.codemirror ); 248 | 249 | configureLinting( codemirror, instanceSettings ); 250 | 251 | instance = { 252 | settings: instanceSettings, 253 | codemirror: codemirror 254 | }; 255 | 256 | // Keep track of the instances that have been created. 257 | wp.codeEditor.instances.push( instance ); 258 | 259 | if ( codemirror.showHint ) { 260 | codemirror.on( 'keyup', function( editor, event ) { // eslint-disable-line complexity 261 | var shouldAutocomplete, isAlphaKey = /^[a-zA-Z]$/.test( event.key ), lineBeforeCursor, innerMode, token; 262 | if ( codemirror.state.completionActive && isAlphaKey ) { 263 | return; 264 | } 265 | 266 | // Prevent autocompletion in string literals or comments. 267 | token = codemirror.getTokenAt( codemirror.getCursor() ); 268 | if ( 'string' === token.type || 'comment' === token.type ) { 269 | return; 270 | } 271 | 272 | innerMode = wp.CodeMirror.innerMode( codemirror.getMode(), token.state ).mode.name; 273 | lineBeforeCursor = codemirror.doc.getLine( codemirror.doc.getCursor().line ).substr( 0, codemirror.doc.getCursor().ch ); 274 | if ( 'html' === innerMode || 'xml' === innerMode ) { 275 | shouldAutocomplete = 276 | '<' === event.key || 277 | '/' === event.key && 'tag' === token.type || 278 | isAlphaKey && 'tag' === token.type || 279 | isAlphaKey && 'attribute' === token.type || 280 | '=' === token.string && token.state.htmlState && token.state.htmlState.tagName; 281 | } else if ( 'css' === innerMode ) { 282 | shouldAutocomplete = 283 | isAlphaKey || 284 | ':' === event.key || 285 | ' ' === event.key && /:\s+$/.test( lineBeforeCursor ); 286 | } else if ( 'javascript' === innerMode ) { 287 | shouldAutocomplete = isAlphaKey || '.' === event.key; 288 | } else if ( 'clike' === innerMode && 'application/x-httpd-php' === codemirror.options.mode ) { 289 | shouldAutocomplete = 'keyword' === token.type || 'variable' === token.type; 290 | } 291 | if ( shouldAutocomplete ) { 292 | codemirror.showHint( { completeSingle: false } ); 293 | } 294 | }); 295 | } 296 | 297 | // Facilitate tabbing out of the editor. 298 | configureTabbing( codemirror, settings ); 299 | 300 | return instance; 301 | }; 302 | 303 | })( window.jQuery, window.wp ); 304 | -------------------------------------------------------------------------------- /wp-admin/js/customize-controls-addendum.js: -------------------------------------------------------------------------------- 1 | /* eslint no-magic-numbers: ["error", { "ignore": [0, 1] }] */ 2 | (function( api, $ ) { 3 | 'use strict'; 4 | 5 | api.section( 'custom_css', function( section ) { 6 | if ( ! api.settings.customCss ) { 7 | return; 8 | } 9 | 10 | // Close the section description when clicking the close button. 11 | section.container.find( '.section-description-buttons .section-description-close' ).on( 'click', function() { 12 | section.container.find( '.section-meta .customize-section-description:first' ) 13 | .removeClass( 'open' ) 14 | .slideUp() 15 | .attr( 'aria-expanded', 'false' ); 16 | }); 17 | 18 | api.control( 'custom_css', function( control ) { 19 | var onceExpanded, onExpandedChange; 20 | 21 | // Abort if CodeMirror disabled via customizer_custom_css_codemirror_opts filter. 22 | if ( ! api.settings.customCss.codeEditor ) { 23 | return; 24 | } 25 | 26 | // Workaround for disabling server-sent syntax checking notifications. This can be removed from core in the merge. 27 | control.setting.notifications.add = (function( originalAdd ) { // eslint-disable-line max-nested-callbacks 28 | return function( id, notification ) { // eslint-disable-line max-nested-callbacks 29 | if ( 'imbalanced_curly_brackets' === id && notification.fromServer ) { 30 | return null; 31 | } else { 32 | return originalAdd.call( this, id, notification ); 33 | } 34 | }; 35 | })( control.setting.notifications.add ); 36 | 37 | // Make sure editor gets focused when control is focused. 38 | control.focus = (function( originalFocus ) { // eslint-disable-line max-nested-callbacks 39 | return function( params ) { // eslint-disable-line max-nested-callbacks 40 | var extendedParams = _.extend( {}, params ), originalCompleteCallback; 41 | originalCompleteCallback = extendedParams.completeCallback; 42 | extendedParams.completeCallback = function() { 43 | if ( originalCompleteCallback ) { 44 | originalCompleteCallback(); 45 | } 46 | if ( control.editor ) { 47 | control.editor.codemirror.focus(); 48 | } 49 | }; 50 | originalFocus.call( this, extendedParams ); 51 | }; 52 | })( control.focus ); 53 | 54 | onceExpanded = function() { 55 | var $textarea = control.container.find( 'textarea' ), settings, suspendEditorUpdate = false; 56 | 57 | if ( ! control.setting.get() ) { 58 | section.container.find( '.section-meta .customize-section-description:first' ) 59 | .addClass( 'open' ) 60 | .show() 61 | .attr( 'aria-expanded', 'true' ); 62 | } 63 | 64 | settings = _.extend( {}, api.settings.customCss.codeEditor, { 65 | 66 | /** 67 | * Handle tabbing to the field after the editor. 68 | * 69 | * @returns {void} 70 | */ 71 | onTabNext: function onTabNext() { 72 | var controls, controlIndex; 73 | controls = section.controls(); 74 | controlIndex = controls.indexOf( control ); 75 | if ( controls.length === controlIndex + 1 ) { 76 | $( '#customize-footer-actions .collapse-sidebar' ).focus(); 77 | } else { 78 | controls[ controlIndex + 1 ].container.find( ':focusable:first' ).focus(); 79 | } 80 | }, 81 | 82 | /** 83 | * Handle tabbing to the field before the editor. 84 | * 85 | * @returns {void} 86 | */ 87 | onTabPrevious: function onTabPrevious() { 88 | var controls, controlIndex; 89 | controls = section.controls(); 90 | controlIndex = controls.indexOf( control ); 91 | if ( 0 === controlIndex ) { 92 | section.contentContainer.find( '.customize-section-title .customize-help-toggle, .customize-section-title .customize-section-description.open .section-description-close' ).last().focus(); 93 | } else { 94 | controls[ controlIndex - 1 ].contentContainer.find( ':focusable:first' ).focus(); 95 | } 96 | }, 97 | 98 | /** 99 | * Update error notice. 100 | * 101 | * @param {Array} errorAnnotations - Error annotations. 102 | * @returns {void} 103 | */ 104 | onUpdateErrorNotice: function onUpdateErrorNotice( errorAnnotations ) { 105 | var message; 106 | control.setting.notifications.remove( 'csslint_error' ); 107 | 108 | if ( 0 !== errorAnnotations.length ) { 109 | if ( 1 === errorAnnotations.length ) { 110 | message = api.l10n.customCssErrorNotice.singular.replace( '%d', '1' ); 111 | } else { 112 | message = api.l10n.customCssErrorNotice.plural.replace( '%d', String( errorAnnotations.length ) ); 113 | } 114 | control.setting.notifications.add( 'csslint_error', new api.Notification( 'csslint_error', { 115 | message: message, 116 | type: 'error' 117 | } ) ); 118 | } 119 | } 120 | }); 121 | 122 | control.editor = wp.codeEditor.initialize( $textarea, settings ); 123 | 124 | // Refresh when receiving focus. 125 | control.editor.codemirror.on( 'focus', function( codemirror ) { 126 | codemirror.refresh(); 127 | }); 128 | 129 | /* 130 | * When the CodeMirror instance changes, mirror to the textarea, 131 | * where we have our "true" change event handler bound. 132 | */ 133 | control.editor.codemirror.on( 'change', function( codemirror ) { 134 | suspendEditorUpdate = true; 135 | $textarea.val( codemirror.getValue() ).trigger( 'change' ); 136 | suspendEditorUpdate = false; 137 | }); 138 | 139 | // Update CodeMirror when the setting is changed by another plugin. 140 | control.setting.bind( function( value ) { 141 | if ( ! suspendEditorUpdate ) { 142 | control.editor.codemirror.setValue( value ); 143 | } 144 | }); 145 | 146 | // Prevent collapsing section when hitting Esc to tab out of editor. 147 | control.editor.codemirror.on( 'keydown', function onKeydown( codemirror, event ) { 148 | var escKeyCode = 27; 149 | if ( escKeyCode === event.keyCode ) { 150 | event.stopPropagation(); 151 | } 152 | }); 153 | }; 154 | 155 | onExpandedChange = function( isExpanded ) { 156 | if ( isExpanded ) { 157 | onceExpanded(); 158 | section.expanded.unbind( onExpandedChange ); 159 | } 160 | }; 161 | control.deferred.embedded.done( function() { 162 | if ( section.expanded() ) { 163 | onceExpanded(); 164 | } else { 165 | section.expanded.bind( onExpandedChange ); 166 | } 167 | }); 168 | }); 169 | }); 170 | })( wp.customize, jQuery ); 171 | -------------------------------------------------------------------------------- /wp-admin/js/theme-plugin-editor.js: -------------------------------------------------------------------------------- 1 | /* eslint no-magic-numbers: ["error", { "ignore": [-1, 0, 1] }] */ 2 | 3 | if ( ! window.wp ) { 4 | window.wp = {}; 5 | } 6 | 7 | wp.themePluginEditor = (function( $ ) { 8 | 'use strict'; 9 | 10 | var component = { 11 | l10n: { 12 | lintError: { 13 | singular: '', 14 | plural: '' 15 | } 16 | }, 17 | instance: null 18 | }; 19 | 20 | /** 21 | * Initialize component. 22 | * 23 | * @param {object} settings Settings. 24 | * @returns {void} 25 | */ 26 | component.init = function( settings ) { 27 | var codeEditorSettings, noticeContainer, errorNotice = [], editor; 28 | 29 | codeEditorSettings = $.extend( {}, settings ); 30 | 31 | /** 32 | * Handle tabbing to the field before the editor. 33 | * 34 | * @returns {void} 35 | */ 36 | codeEditorSettings.onTabPrevious = function() { 37 | $( '#templateside' ).find( ':tabbable' ).last().focus(); 38 | }; 39 | 40 | /** 41 | * Handle tabbing to the field after the editor. 42 | * 43 | * @returns {void} 44 | */ 45 | codeEditorSettings.onTabNext = function() { 46 | $( '#template' ).find( ':tabbable:not(.CodeMirror-code)' ).first().focus(); 47 | }; 48 | 49 | // Create the error notice container. 50 | noticeContainer = $( '
' ); 51 | errorNotice = $( '
' ); 52 | noticeContainer.append( errorNotice ); 53 | noticeContainer.hide(); 54 | $( 'p.submit' ).before( noticeContainer ); 55 | 56 | /** 57 | * Update error notice. 58 | * 59 | * @param {Array} errorAnnotations - Error annotations. 60 | * @returns {void} 61 | */ 62 | codeEditorSettings.onUpdateErrorNotice = function onUpdateErrorNotice( errorAnnotations ) { 63 | var message; 64 | 65 | $( '#submit' ).prop( 'disabled', 0 !== errorAnnotations.length ); 66 | 67 | if ( 0 !== errorAnnotations.length ) { 68 | errorNotice.empty(); 69 | if ( 1 === errorAnnotations.length ) { 70 | message = component.l10n.singular.replace( '%d', '1' ); 71 | } else { 72 | message = component.l10n.plural.replace( '%d', String( errorAnnotations.length ) ); 73 | } 74 | errorNotice.append( $( '

', { 75 | text: message 76 | } ) ); 77 | noticeContainer.slideDown( 'fast' ); 78 | wp.a11y.speak( message ); 79 | } else { 80 | noticeContainer.slideUp( 'fast' ); 81 | } 82 | }; 83 | 84 | editor = wp.codeEditor.initialize( $( '#newcontent' ), codeEditorSettings ); 85 | 86 | component.instance = editor; 87 | }; 88 | 89 | return component; 90 | })( jQuery ); 91 | -------------------------------------------------------------------------------- /wp-admin/js/widgets/custom-html-widgets.js: -------------------------------------------------------------------------------- 1 | /* global wp */ 2 | /* eslint consistent-this: [ "error", "control" ] */ 3 | /* eslint no-magic-numbers: ["error", { "ignore": [0,1,-1] }] */ 4 | wp.customHtmlWidgets = ( function( $ ) { 5 | 'use strict'; 6 | 7 | var component = { 8 | idBases: [ 'custom_html' ], 9 | codeEditorSettings: {}, 10 | l10n: { 11 | errorNotice: { 12 | singular: '', 13 | plural: '' 14 | } 15 | } 16 | }; 17 | 18 | /** 19 | * Text widget control. 20 | * 21 | * @class CustomHtmlWidgetControl 22 | * @constructor 23 | * @abstract 24 | */ 25 | component.CustomHtmlWidgetControl = Backbone.View.extend({ 26 | 27 | /** 28 | * View events. 29 | * 30 | * @type {Object} 31 | */ 32 | events: {}, 33 | 34 | /** 35 | * Initialize. 36 | * 37 | * @param {Object} options - Options. 38 | * @param {jQuery} options.el - Control field container element. 39 | * @param {jQuery} options.syncContainer - Container element where fields are synced for the server. 40 | * @returns {void} 41 | */ 42 | initialize: function initialize( options ) { 43 | var control = this; 44 | 45 | if ( ! options.el ) { 46 | throw new Error( 'Missing options.el' ); 47 | } 48 | if ( ! options.syncContainer ) { 49 | throw new Error( 'Missing options.syncContainer' ); 50 | } 51 | 52 | Backbone.View.prototype.initialize.call( control, options ); 53 | control.syncContainer = options.syncContainer; 54 | control.widgetIdBase = control.syncContainer.parent().find( '.id_base' ).val(); 55 | control.widgetNumber = control.syncContainer.parent().find( '.widget_number' ).val(); 56 | control.customizeSettingId = 'widget_' + control.widgetIdBase + '[' + String( control.widgetNumber ) + ']'; 57 | 58 | control.$el.addClass( 'custom-html-widget-fields' ); 59 | control.$el.html( wp.template( 'widget-custom-html-control-fields' )( { codeEditorDisabled: component.codeEditorSettings.disabled } ) ); 60 | 61 | control.errorNoticeContainer = control.$el.find( '.code-editor-error-container' ); 62 | control.currentErrorAnnotations = []; 63 | control.saveButton = control.syncContainer.add( control.syncContainer.parent().find( '.widget-control-actions' ) ).find( '.widget-control-save, #savewidget' ); 64 | control.saveButton.addClass( 'custom-html-widget-save-button' ); // To facilitate style targeting. 65 | 66 | control.fields = { 67 | title: control.$el.find( '.title' ), 68 | content: control.$el.find( '.content' ) 69 | }; 70 | 71 | // Sync input fields to hidden sync fields which actually get sent to the server. 72 | _.each( control.fields, function( fieldInput, fieldName ) { 73 | fieldInput.on( 'input change', function updateSyncField() { 74 | var syncInput = control.syncContainer.find( '.sync-input.' + fieldName ); 75 | if ( syncInput.val() !== fieldInput.val() ) { 76 | syncInput.val( fieldInput.val() ); 77 | syncInput.trigger( 'change' ); 78 | } 79 | }); 80 | 81 | // Note that syncInput cannot be re-used because it will be destroyed with each widget-updated event. 82 | fieldInput.val( control.syncContainer.find( '.sync-input.' + fieldName ).val() ); 83 | }); 84 | }, 85 | 86 | /** 87 | * Update input fields from the sync fields. 88 | * 89 | * This function is called at the widget-updated and widget-synced events. 90 | * A field will only be updated if it is not currently focused, to avoid 91 | * overwriting content that the user is entering. 92 | * 93 | * @returns {void} 94 | */ 95 | updateFields: function updateFields() { 96 | var control = this, syncInput; 97 | 98 | if ( ! control.fields.title.is( document.activeElement ) ) { 99 | syncInput = control.syncContainer.find( '.sync-input.title' ); 100 | control.fields.title.val( syncInput.val() ); 101 | } 102 | 103 | /* 104 | * Prevent updating content when the editor is focused or if there are current error annotations, 105 | * to prevent the editor's contents from getting sanitized as soon as a user removes focus from 106 | * the editor. This is particularly important for users who cannot unfiltered_html. 107 | */ 108 | control.contentUpdateBypassed = control.fields.content.is( document.activeElement ) || control.editor && control.editor.codemirror.state.focused || 0 !== control.currentErrorAnnotations; 109 | if ( ! control.contentUpdateBypassed ) { 110 | syncInput = control.syncContainer.find( '.sync-input.content' ); 111 | control.fields.content.val( syncInput.val() ).trigger( 'change' ); 112 | } 113 | }, 114 | 115 | /** 116 | * Show linting error notice. 117 | * 118 | * @param {Array} errorAnnotations - Error annotations. 119 | * @returns {void} 120 | */ 121 | updateErrorNotice: function( errorAnnotations ) { 122 | var control = this, errorNotice, message = '', customizeSetting; 123 | 124 | if ( 1 === errorAnnotations.length ) { 125 | message = component.l10n.errorNotice.singular.replace( '%d', '1' ); 126 | } else if ( errorAnnotations.length > 1 ) { 127 | message = component.l10n.errorNotice.plural.replace( '%d', String( errorAnnotations.length ) ); 128 | } 129 | 130 | if ( control.fields.content[0].setCustomValidity ) { 131 | control.fields.content[0].setCustomValidity( message ); 132 | } 133 | 134 | if ( wp.customize && wp.customize.has( control.customizeSettingId ) ) { 135 | customizeSetting = wp.customize( control.customizeSettingId ); 136 | customizeSetting.notifications.remove( 'htmlhint_error' ); 137 | if ( 0 !== errorAnnotations.length ) { 138 | customizeSetting.notifications.add( 'htmlhint_error', new wp.customize.Notification( 'htmlhint_error', { 139 | message: message, 140 | type: 'error' 141 | } ) ); 142 | } 143 | } else if ( 0 !== errorAnnotations.length ) { 144 | errorNotice = $( '
' ); 145 | errorNotice.append( $( '

', { 146 | text: message 147 | } ) ); 148 | control.errorNoticeContainer.empty(); 149 | control.errorNoticeContainer.append( errorNotice ); 150 | control.errorNoticeContainer.slideDown( 'fast' ); 151 | wp.a11y.speak( message ); 152 | } else { 153 | control.errorNoticeContainer.slideUp( 'fast' ); 154 | } 155 | }, 156 | 157 | /** 158 | * Initialize editor. 159 | * 160 | * @returns {void} 161 | */ 162 | initializeEditor: function initializeEditor() { 163 | var control = this, settings; 164 | 165 | if ( component.codeEditorSettings.disabled ) { 166 | return; 167 | } 168 | 169 | settings = _.extend( {}, component.codeEditorSettings, { 170 | 171 | /** 172 | * Handle tabbing to the field before the editor. 173 | * 174 | * @returns {void} 175 | */ 176 | onTabPrevious: function onTabPrevious() { 177 | control.fields.title.focus(); 178 | }, 179 | 180 | /** 181 | * Handle tabbing to the field after the editor. 182 | * 183 | * @returns {void} 184 | */ 185 | onTabNext: function onTabNext() { 186 | var tabbables = control.syncContainer.add( control.syncContainer.parent().find( '.widget-position, .widget-control-actions' ) ).find( ':tabbable' ); 187 | tabbables.first().focus(); 188 | }, 189 | 190 | /** 191 | * Disable save button and store linting errors for use in updateFields. 192 | * 193 | * @param {Array} errorAnnotations - Error notifications. 194 | * @returns {void} 195 | */ 196 | onChangeLintingErrors: function onChangeLintingErrors( errorAnnotations ) { 197 | control.currentErrorAnnotations = errorAnnotations; 198 | }, 199 | 200 | /** 201 | * Update error notice. 202 | * 203 | * @param {Array} errorAnnotations - Error annotations. 204 | * @returns {void} 205 | */ 206 | onUpdateErrorNotice: function onUpdateErrorNotice( errorAnnotations ) { 207 | control.saveButton.toggleClass( 'validation-blocked', errorAnnotations.length ); 208 | control.updateErrorNotice( errorAnnotations ); 209 | } 210 | }); 211 | 212 | control.editor = wp.codeEditor.initialize( control.fields.content, settings ); 213 | control.fields.content.on( 'change', function() { 214 | if ( this.value !== control.editor.codemirror.getValue() ) { 215 | control.editor.codemirror.setValue( this.value ); 216 | } 217 | }); 218 | control.editor.codemirror.on( 'change', function() { 219 | var value = control.editor.codemirror.getValue(); 220 | if ( value !== control.fields.content.val() ) { 221 | control.fields.content.val( value ).trigger( 'change' ); 222 | } 223 | }); 224 | 225 | // Make sure the editor gets updated if the content was updated on the server (sanitization) but not updated in the editor since it was focused. 226 | control.editor.codemirror.on( 'blur', function() { 227 | if ( control.contentUpdateBypassed ) { 228 | control.syncContainer.find( '.sync-input.content' ).trigger( 'change' ); 229 | } 230 | }); 231 | 232 | // Prevent hitting Esc from collapsing the widget control. 233 | if ( wp.customize ) { 234 | control.editor.codemirror.on( 'keydown', function onKeydown( codemirror, event ) { 235 | var escKeyCode = 27; 236 | if ( escKeyCode === event.keyCode ) { 237 | event.stopPropagation(); 238 | } 239 | }); 240 | } 241 | } 242 | }); 243 | 244 | /** 245 | * Mapping of widget ID to instances of CustomHtmlWidgetControl subclasses. 246 | * 247 | * @type {Object.} 248 | */ 249 | component.widgetControls = {}; 250 | 251 | /** 252 | * Handle widget being added or initialized for the first time at the widget-added event. 253 | * 254 | * @param {jQuery.Event} event - Event. 255 | * @param {jQuery} widgetContainer - Widget container element. 256 | * @returns {void} 257 | */ 258 | component.handleWidgetAdded = function handleWidgetAdded( event, widgetContainer ) { 259 | var widgetForm, idBase, widgetControl, widgetId, animatedCheckDelay = 50, renderWhenAnimationDone, fieldContainer, syncContainer; 260 | widgetForm = widgetContainer.find( '> .widget-inside > .form, > .widget-inside > form' ); // Note: '.form' appears in the customizer, whereas 'form' on the widgets admin screen. 261 | 262 | idBase = widgetForm.find( '> .id_base' ).val(); 263 | if ( -1 === component.idBases.indexOf( idBase ) ) { 264 | return; 265 | } 266 | 267 | // Prevent initializing already-added widgets. 268 | widgetId = widgetForm.find( '.widget-id' ).val(); 269 | if ( component.widgetControls[ widgetId ] ) { 270 | return; 271 | } 272 | 273 | /* 274 | * Create a container element for the widget control fields. 275 | * This is inserted into the DOM immediately before the the .widget-content 276 | * element because the contents of this element are essentially "managed" 277 | * by PHP, where each widget update cause the entire element to be emptied 278 | * and replaced with the rendered output of WP_Widget::form() which is 279 | * sent back in Ajax request made to save/update the widget instance. 280 | * To prevent a "flash of replaced DOM elements and re-initialized JS 281 | * components", the JS template is rendered outside of the normal form 282 | * container. 283 | */ 284 | fieldContainer = $( '
' ); 285 | syncContainer = widgetContainer.find( '.widget-content:first' ); 286 | syncContainer.before( fieldContainer ); 287 | 288 | widgetControl = new component.CustomHtmlWidgetControl({ 289 | el: fieldContainer, 290 | syncContainer: syncContainer 291 | }); 292 | 293 | component.widgetControls[ widgetId ] = widgetControl; 294 | 295 | /* 296 | * Render the widget once the widget parent's container finishes animating, 297 | * as the widget-added event fires with a slideDown of the container. 298 | * This ensures that the textarea is visible and the editor can be initialized. 299 | */ 300 | renderWhenAnimationDone = function() { 301 | if ( ! ( wp.customize ? widgetContainer.parent().hasClass( 'expanded' ) : widgetContainer.hasClass( 'open' ) ) ) { // Core merge: The wp.customize condition can be eliminated with this change being in core: https://github.com/xwp/wordpress-develop/pull/247/commits/5322387d 302 | setTimeout( renderWhenAnimationDone, animatedCheckDelay ); 303 | } else { 304 | widgetControl.initializeEditor(); 305 | } 306 | }; 307 | renderWhenAnimationDone(); 308 | }; 309 | 310 | /** 311 | * Setup widget in accessibility mode. 312 | * 313 | * @returns {void} 314 | */ 315 | component.setupAccessibleMode = function setupAccessibleMode() { 316 | var widgetForm, idBase, widgetControl, fieldContainer, syncContainer; 317 | widgetForm = $( '.editwidget > form' ); 318 | if ( 0 === widgetForm.length ) { 319 | return; 320 | } 321 | 322 | idBase = widgetForm.find( '> .widget-control-actions > .id_base' ).val(); 323 | if ( -1 === component.idBases.indexOf( idBase ) ) { 324 | return; 325 | } 326 | 327 | fieldContainer = $( '
' ); 328 | syncContainer = widgetForm.find( '> .widget-inside' ); 329 | syncContainer.before( fieldContainer ); 330 | 331 | widgetControl = new component.CustomHtmlWidgetControl({ 332 | el: fieldContainer, 333 | syncContainer: syncContainer 334 | }); 335 | 336 | widgetControl.initializeEditor(); 337 | }; 338 | 339 | /** 340 | * Sync widget instance data sanitized from server back onto widget model. 341 | * 342 | * This gets called via the 'widget-updated' event when saving a widget from 343 | * the widgets admin screen and also via the 'widget-synced' event when making 344 | * a change to a widget in the customizer. 345 | * 346 | * @param {jQuery.Event} event - Event. 347 | * @param {jQuery} widgetContainer - Widget container element. 348 | * @returns {void} 349 | */ 350 | component.handleWidgetUpdated = function handleWidgetUpdated( event, widgetContainer ) { 351 | var widgetForm, widgetId, widgetControl, idBase; 352 | widgetForm = widgetContainer.find( '> .widget-inside > .form, > .widget-inside > form' ); 353 | 354 | idBase = widgetForm.find( '> .id_base' ).val(); 355 | if ( -1 === component.idBases.indexOf( idBase ) ) { 356 | return; 357 | } 358 | 359 | widgetId = widgetForm.find( '> .widget-id' ).val(); 360 | widgetControl = component.widgetControls[ widgetId ]; 361 | if ( ! widgetControl ) { 362 | return; 363 | } 364 | 365 | widgetControl.updateFields(); 366 | }; 367 | 368 | /** 369 | * Initialize functionality. 370 | * 371 | * This function exists to prevent the JS file from having to boot itself. 372 | * When WordPress enqueues this script, it should have an inline script 373 | * attached which calls wp.textWidgets.init(). 374 | * 375 | * @param {object} settings - Options for code editor, exported from PHP. 376 | * @returns {void} 377 | */ 378 | component.init = function init( settings ) { 379 | var $document = $( document ); 380 | _.extend( component.codeEditorSettings, settings ); 381 | 382 | $document.on( 'widget-added', component.handleWidgetAdded ); 383 | $document.on( 'widget-synced widget-updated', component.handleWidgetUpdated ); 384 | 385 | /* 386 | * Manually trigger widget-added events for media widgets on the admin 387 | * screen once they are expanded. The widget-added event is not triggered 388 | * for each pre-existing widget on the widgets admin screen like it is 389 | * on the customizer. Likewise, the customizer only triggers widget-added 390 | * when the widget is expanded to just-in-time construct the widget form 391 | * when it is actually going to be displayed. So the following implements 392 | * the same for the widgets admin screen, to invoke the widget-added 393 | * handler when a pre-existing media widget is expanded. 394 | */ 395 | $( function initializeExistingWidgetContainers() { 396 | var widgetContainers; 397 | if ( 'widgets' !== window.pagenow ) { 398 | return; 399 | } 400 | widgetContainers = $( '.widgets-holder-wrap:not(#available-widgets)' ).find( 'div.widget' ); 401 | widgetContainers.one( 'click.toggle-widget-expanded', function toggleWidgetExpanded() { 402 | var widgetContainer = $( this ); 403 | component.handleWidgetAdded( new jQuery.Event( 'widget-added' ), widgetContainer ); 404 | }); 405 | 406 | // Accessibility mode. 407 | $( window ).on( 'load', function() { 408 | component.setupAccessibleMode(); 409 | }); 410 | }); 411 | }; 412 | 413 | return component; 414 | })( jQuery ); 415 | -------------------------------------------------------------------------------- /wp-admin/user-edit-addendum.php: -------------------------------------------------------------------------------- 1 | 32 | 33 | 34 | 35 | 36 | 42 | 43 | 44 | 2 | 3 | 4 | Artboard 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /wp-includes/customize-manager-addendum.php: -------------------------------------------------------------------------------- 1 | syntax_highlighting ) { 19 | return; 20 | } 21 | 22 | $section = $wp_customize->get_section( 'custom_css' ); 23 | if ( ! $section ) { 24 | return; 25 | } 26 | 27 | // Remove default value from Custom CSS setting. 28 | foreach ( $wp_customize->settings() as $setting ) { 29 | if ( $setting instanceof WP_Customize_Custom_CSS_Setting ) { 30 | $setting->default = ''; 31 | } 32 | } 33 | 34 | $section->description = '

'; 35 | $section->description .= __( 'Add your own CSS code here to customize the appearance and layout of your site.', 'better-code-editing' ); 36 | $section->description .= sprintf( 37 | ' %2$s%3$s', 38 | esc_url( __( 'https://codex.wordpress.org/CSS', 'default' ) ), 39 | __( 'Learn more about CSS', 'default' ), 40 | /* translators: accessibility text */ 41 | __( '(opens in a new window)', 'default' ) 42 | ); 43 | $section->description .= '

'; 44 | 45 | $section->description .= '

' . __( 'When using a keyboard to navigate:', 'better-code-editing' ) . '

'; 46 | $section->description .= '
    '; 47 | $section->description .= '
  • ' . __( 'In the CSS edit field, Tab enters a tab character.', 'better-code-editing' ) . '
  • '; 48 | $section->description .= '
  • ' . __( 'To move keyboard focus, press Esc then Tab for the next element, or Esc then Shift+Tab for the previous element.', 'better-code-editing' ) . '
  • '; 49 | $section->description .= '
'; 50 | 51 | $section->description .= '

'; 52 | $section->description .= sprintf( 53 | /* translators: placeholder is link to user profile */ 54 | __( 'The edit field automatically highlights code syntax. You can disable this in your %s to work in plain text mode.', 'better-code-editing' ), 55 | sprintf( 56 | ' %2$s%3$s', 57 | esc_url( get_edit_profile_url() . '#syntax_highlighting' ), 58 | __( 'user profile', 'better-code-editing' ), 59 | /* translators: accessibility text */ 60 | __( '(opens in a new window)', 'default' ) 61 | ) 62 | ); 63 | $section->description .= '

'; 64 | 65 | $section->description .= '

'; 66 | $section->description .= ''; 67 | $section->description .= '

'; 68 | } 69 | 70 | /** 71 | * Enqueue assets for Customizer. 72 | * 73 | * @global WP_Customize_Manager $wp_customize 74 | */ 75 | function _better_code_editing_customize_controls_enqueue_scripts() { 76 | global $wp_customize; 77 | $wp_customize->custom_css_code_editor_settings = wp_enqueue_code_editor( array( 78 | 'type' => 'text/css', 79 | ) ); 80 | wp_add_inline_script( 'customize-controls', file_get_contents( dirname( BETTER_CODE_EDITING_PLUGIN_FILE ) . '/wp-admin/js/customize-controls-addendum.js' ) ); 81 | } 82 | 83 | /** 84 | * Add Customizer integration. 85 | * 86 | * @see WP_Customize_Manager::customize_pane_settings() 87 | * @global WP_Customize_Manager $wp_customize 88 | */ 89 | function _better_code_editing_amend_customize_pane_settings() { 90 | global $wp_customize; 91 | if ( empty( $wp_customize->custom_css_code_editor_settings ) ) { 92 | return; 93 | } 94 | $custom_css_setting = $wp_customize->get_setting( sprintf( 'custom_css[%s]', get_stylesheet() ) ); 95 | if ( ! $custom_css_setting ) { 96 | return; 97 | } 98 | 99 | $settings = array( 100 | 'codeEditor' => $wp_customize->custom_css_code_editor_settings, 101 | ); 102 | 103 | printf( ';', wp_json_encode( $settings ) ); 104 | 105 | /* translators: placeholder is error count */ 106 | $l10n = _n_noop( 'There is %d error which must be fixed before you can save.', 'There are %d errors which must be fixed before you can save.', 'better-code-editing' ); 107 | printf( ';', wp_json_encode( wp_array_slice_assoc( $l10n, array( 'singular', 'plural' ) ) ) ); 108 | } 109 | -------------------------------------------------------------------------------- /wp-includes/general-template-addendum.php: -------------------------------------------------------------------------------- 1 | syntax_highlighting ) { 29 | return false; 30 | } 31 | 32 | $settings = array( 33 | 'codemirror' => array( 34 | 'indentUnit' => 4, 35 | 'indentWithTabs' => true, 36 | 'inputStyle' => 'contenteditable', 37 | 'lineNumbers' => true, 38 | 'lineWrapping' => true, 39 | 'styleActiveLine' => true, 40 | 'continueComments' => true, 41 | 'extraKeys' => array( 42 | 'Ctrl-Space' => 'autocomplete', 43 | 'Ctrl-/' => 'toggleComment', 44 | 'Cmd-/' => 'toggleComment', 45 | 'Alt-F' => 'findPersistent', 46 | ), 47 | 'direction' => 'ltr', // Code is shown in LTR even in RTL languages. 48 | ), 49 | 'csslint' => array( 50 | 'errors' => true, // Parsing errors. 51 | 'box-model' => true, 52 | 'display-property-grouping' => true, 53 | 'duplicate-properties' => true, 54 | 'known-properties' => true, 55 | 'outline-none' => true, 56 | ), 57 | 'jshint' => array( 58 | // The following are copied from . 59 | 'boss' => true, 60 | 'curly' => true, 61 | 'eqeqeq' => true, 62 | 'eqnull' => true, 63 | 'es3' => true, 64 | 'expr' => true, 65 | 'immed' => true, 66 | 'noarg' => true, 67 | 'nonbsp' => true, 68 | 'onevar' => true, 69 | 'quotmark' => 'single', 70 | 'trailing' => true, 71 | 'undef' => true, 72 | 'unused' => true, 73 | 74 | 'browser' => true, 75 | 76 | 'globals' => array( 77 | '_' => false, 78 | 'Backbone' => false, 79 | 'jQuery' => false, 80 | 'JSON' => false, 81 | 'wp' => false, 82 | ), 83 | ), 84 | 'htmlhint' => array( 85 | 'tagname-lowercase' => true, 86 | 'attr-lowercase' => true, 87 | 'attr-value-double-quotes' => true, 88 | 'doctype-first' => false, 89 | 'tag-pair' => true, 90 | 'spec-char-escape' => true, 91 | 'id-unique' => true, 92 | 'src-not-empty' => true, 93 | 'attr-no-duplication' => true, 94 | 'alt-require' => true, 95 | 'space-tab-mixed-disabled' => 'tab', 96 | 'attr-unsafe-chars' => true, 97 | ), 98 | ); 99 | 100 | $type = ''; 101 | if ( isset( $args['type'] ) ) { 102 | $type = $args['type']; 103 | 104 | // Remap MIME types to ones that CodeMirror modes will recognize. 105 | if ( 'application/x-patch' === $type || 'text/x-patch' === $type ) { 106 | $type = 'text/x-diff'; 107 | } 108 | } elseif ( isset( $args['file'] ) && false !== strpos( basename( $args['file'] ), '.' ) ) { 109 | $extension = strtolower( pathinfo( $args['file'], PATHINFO_EXTENSION ) ); 110 | foreach ( wp_get_mime_types() as $exts => $mime ) { 111 | if ( preg_match( '!^(' . $exts . ')$!i', $extension ) ) { 112 | $type = $mime; 113 | break; 114 | } 115 | } 116 | 117 | // Supply any types that are not matched by wp_get_mime_types(). 118 | if ( empty( $type ) ) { 119 | switch ( $extension ) { 120 | case 'conf': 121 | $type = 'text/nginx'; 122 | break; 123 | case 'css': 124 | $type = 'text/css'; 125 | break; 126 | case 'diff': 127 | case 'patch': 128 | $type = 'text/x-diff'; 129 | break; 130 | case 'html': 131 | case 'htm': 132 | $type = 'text/html'; 133 | break; 134 | case 'http': 135 | $type = 'message/http'; 136 | break; 137 | case 'js': 138 | $type = 'text/javascript'; 139 | break; 140 | case 'json': 141 | $type = 'application/json'; 142 | break; 143 | case 'jsx': 144 | $type = 'text/jsx'; 145 | break; 146 | case 'less': 147 | $type = 'text/x-less'; 148 | break; 149 | case 'md': 150 | $type = 'text/x-gfm'; 151 | break; 152 | case 'php': 153 | case 'phtml': 154 | case 'php3': 155 | case 'php4': 156 | case 'php5': 157 | case 'php7': 158 | case 'phps': 159 | $type = 'application/x-httpd-php'; 160 | break; 161 | case 'scss': 162 | $type = 'text/x-scss'; 163 | break; 164 | case 'sass': 165 | $type = 'text/x-sass'; 166 | break; 167 | case 'sh': 168 | case 'bash': 169 | $type = 'text/x-sh'; 170 | break; 171 | case 'sql': 172 | $type = 'text/x-sql'; 173 | break; 174 | case 'svg': 175 | $type = 'application/svg+xml'; 176 | break; 177 | case 'xml': 178 | $type = 'text/xml'; 179 | break; 180 | case 'yml': 181 | case 'yaml': 182 | $type = 'text/x-yaml'; 183 | break; 184 | case 'txt': 185 | default: 186 | $type = 'text/plain'; 187 | break; 188 | } 189 | } 190 | } 191 | 192 | if ( 'text/css' === $type ) { 193 | $settings['codemirror'] = array_merge( $settings['codemirror'], array( 194 | 'mode' => 'css', 195 | 'lint' => true, 196 | 'autoCloseBrackets' => true, 197 | 'matchBrackets' => true, 198 | ) ); 199 | } elseif ( 'text/x-scss' === $type || 'text/x-less' === $type || 'text/x-sass' === $type ) { 200 | $settings['codemirror'] = array_merge( $settings['codemirror'], array( 201 | 'mode' => $type, 202 | 'autoCloseBrackets' => true, 203 | 'matchBrackets' => true, 204 | ) ); 205 | } elseif ( 'text/x-diff' === $type ) { 206 | $settings['codemirror'] = array_merge( $settings['codemirror'], array( 207 | 'mode' => 'diff', 208 | ) ); 209 | } elseif ( 'text/html' === $type ) { 210 | $settings['codemirror'] = array_merge( $settings['codemirror'], array( 211 | 'mode' => 'htmlmixed', 212 | 'lint' => true, 213 | 'autoCloseBrackets' => true, 214 | 'autoCloseTags' => true, 215 | 'matchTags' => array( 216 | 'bothTags' => true, 217 | ), 218 | ) ); 219 | 220 | if ( ! current_user_can( 'unfiltered_html' ) ) { 221 | $settings['htmlhint']['kses'] = wp_kses_allowed_html( 'post' ); 222 | } 223 | } elseif ( 'text/x-gfm' === $type ) { 224 | $settings['codemirror'] = array_merge( $settings['codemirror'], array( 225 | 'mode' => 'gfm', 226 | 'highlightFormatting' => true, 227 | ) ); 228 | } elseif ( 'application/javascript' === $type || 'text/javascript' === $type ) { 229 | $settings['codemirror'] = array_merge( $settings['codemirror'], array( 230 | 'mode' => 'javascript', 231 | 'lint' => true, 232 | 'autoCloseBrackets' => true, 233 | 'matchBrackets' => true, 234 | ) ); 235 | } elseif ( false !== strpos( $type, 'json' ) ) { 236 | $settings['codemirror'] = array_merge( $settings['codemirror'], array( 237 | 'mode' => array( 238 | 'name' => 'javascript', 239 | ), 240 | 'lint' => true, 241 | 'autoCloseBrackets' => true, 242 | 'matchBrackets' => true, 243 | ) ); 244 | if ( 'application/ld+json' === $type ) { 245 | $settings['codemirror']['mode']['jsonld'] = true; 246 | } else { 247 | $settings['codemirror']['mode']['json'] = true; 248 | } 249 | } elseif ( false !== strpos( $type, 'jsx' ) ) { 250 | $settings['codemirror'] = array_merge( $settings['codemirror'], array( 251 | 'mode' => 'jsx', 252 | 'autoCloseBrackets' => true, 253 | 'matchBrackets' => true, 254 | ) ); 255 | } elseif ( 'text/x-markdown' === $type ) { 256 | $settings['codemirror'] = array_merge( $settings['codemirror'], array( 257 | 'mode' => 'markdown', 258 | 'highlightFormatting' => true, 259 | ) ); 260 | } elseif ( 'text/nginx' === $type ) { 261 | $settings['codemirror'] = array_merge( $settings['codemirror'], array( 262 | 'mode' => 'nginx', 263 | ) ); 264 | } elseif ( 'application/x-httpd-php' === $type ) { 265 | $settings['codemirror'] = array_merge( $settings['codemirror'], array( 266 | 'mode' => 'php', 267 | 'autoCloseBrackets' => true, 268 | 'autoCloseTags' => true, 269 | 'matchBrackets' => true, 270 | 'matchTags' => array( 271 | 'bothTags' => true, 272 | ), 273 | ) ); 274 | } elseif ( 'text/x-sql' === $type || 'text/x-mysql' === $type ) { 275 | $settings['codemirror'] = array_merge( $settings['codemirror'], array( 276 | 'mode' => 'sql', 277 | 'autoCloseBrackets' => true, 278 | 'matchBrackets' => true, 279 | ) ); 280 | } elseif ( false !== strpos( $type, 'xml' ) ) { 281 | $settings['codemirror'] = array_merge( $settings['codemirror'], array( 282 | 'mode' => 'xml', 283 | 'autoCloseBrackets' => true, 284 | 'autoCloseTags' => true, 285 | 'matchTags' => array( 286 | 'bothTags' => true, 287 | ), 288 | ) ); 289 | } elseif ( 'text/x-yaml' === $type ) { 290 | $settings['codemirror'] = array_merge( $settings['codemirror'], array( 291 | 'mode' => 'yaml', 292 | ) ); 293 | } else { 294 | $settings['codemirror']['mode'] = $type; 295 | } 296 | 297 | if ( ! empty( $settings['codemirror']['lint'] ) ) { 298 | $settings['codemirror']['gutters'][] = 'CodeMirror-lint-markers'; 299 | } 300 | 301 | // Let settings supplied via args override any defaults. 302 | if ( isset( $args['settings'] ) ) { 303 | foreach ( $args['settings'] as $key => $value ) { 304 | $settings[ $key ] = array_merge( 305 | $settings[ $key ], 306 | $value 307 | ); 308 | } 309 | } 310 | 311 | /** 312 | * Filters settings that are passed into the code editor. 313 | * 314 | * Returning a falsey value will disable the syntax-highlighting code editor. 315 | * 316 | * @since 4.9.0 317 | * 318 | * @param array $settings The array of settings passed to the code editor. A falsey value disables the editor. 319 | * @param array $args { 320 | * Args passed when calling `wp_enqueue_code_editor()`. 321 | * 322 | * @type string $type The MIME type of the file to be edited. 323 | * @type string $file Filename being edited. 324 | * @type array $settings Settings to merge on top of defaults which derive from `$type` or `$file` args. 325 | * @type WP_Theme $theme Theme being edited when on theme editor. 326 | * @type string $plugin Plugin being edited when on plugin editor. 327 | * } 328 | */ 329 | $settings = apply_filters( 'wp_code_editor_settings', $settings, $args ); 330 | 331 | if ( empty( $settings ) || empty( $settings['codemirror'] ) ) { 332 | return false; 333 | } 334 | 335 | wp_enqueue_script( 'code-editor' ); 336 | wp_enqueue_style( 'code-editor' ); 337 | 338 | wp_enqueue_script( 'codemirror' ); 339 | wp_enqueue_style( 'codemirror' ); 340 | 341 | if ( isset( $settings['codemirror']['mode'] ) ) { 342 | $mode = $settings['codemirror']['mode']; 343 | if ( is_string( $mode ) ) { 344 | $mode = array( 345 | 'name' => $mode, 346 | ); 347 | } 348 | 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' ); 365 | if ( ! current_user_can( 'unfiltered_html' ) ) { 366 | wp_enqueue_script( 'htmlhint-kses' ); 367 | } 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 | } 380 | } 381 | } 382 | 383 | wp_add_inline_script( 'code-editor', sprintf( 'jQuery.extend( wp.codeEditor.defaultSettings, %s );', wp_json_encode( $settings ) ) ); 384 | 385 | /** 386 | * Fires when scripts and styles are enqueued for the code editor. 387 | * 388 | * @since 4.9.0 389 | * 390 | * @param array $settings Settings for the enqueued code editor. 391 | */ 392 | do_action( 'wp_enqueue_code_editor', $settings ); 393 | 394 | return $settings; 395 | } 396 | -------------------------------------------------------------------------------- /wp-includes/js/codemirror/codemirror.manifest.js: -------------------------------------------------------------------------------- 1 | /* global require */ 2 | 3 | var CodeMirror = require( '../../../node_modules/codemirror/lib/codemirror' ); 4 | 5 | require( '../../../node_modules/codemirror/lib/codemirror.js' ); 6 | require( '../../../node_modules/codemirror/keymap/emacs.js' ); 7 | require( '../../../node_modules/codemirror/keymap/sublime.js' ); 8 | require( '../../../node_modules/codemirror/keymap/vim.js' ); 9 | require( '../../../node_modules/codemirror/addon/hint/show-hint.js' ); 10 | require( '../../../node_modules/codemirror/addon/hint/anyword-hint.js' ); 11 | require( '../../../node_modules/codemirror/addon/hint/css-hint.js' ); 12 | require( '../../../node_modules/codemirror/addon/hint/html-hint.js' ); 13 | require( '../../../node_modules/codemirror/addon/hint/javascript-hint.js' ); 14 | require( '../../../node_modules/codemirror/addon/hint/sql-hint.js' ); 15 | require( '../../../node_modules/codemirror/addon/hint/xml-hint.js' ); 16 | require( '../../../node_modules/codemirror/addon/lint/lint.js' ); 17 | require( '../../../node_modules/codemirror/addon/lint/css-lint.js' ); 18 | require( '../../../node_modules/codemirror/addon/lint/html-lint.js' ); 19 | require( '../../../node_modules/codemirror/addon/lint/javascript-lint.js' ); 20 | require( '../../../node_modules/codemirror/addon/lint/json-lint.js' ); 21 | require( '../../../node_modules/codemirror/addon/comment/comment.js' ); 22 | require( '../../../node_modules/codemirror/addon/comment/continuecomment.js' ); 23 | require( '../../../node_modules/codemirror/addon/fold/xml-fold.js' ); 24 | require( '../../../node_modules/codemirror/addon/mode/overlay.js' ); 25 | require( '../../../node_modules/codemirror/addon/edit/closebrackets.js' ); 26 | require( '../../../node_modules/codemirror/addon/edit/closetag.js' ); 27 | require( '../../../node_modules/codemirror/addon/edit/continuelist.js' ); 28 | require( '../../../node_modules/codemirror/addon/edit/matchbrackets.js' ); 29 | require( '../../../node_modules/codemirror/addon/edit/matchtags.js' ); 30 | require( '../../../node_modules/codemirror/addon/edit/trailingspace.js' ); 31 | require( '../../../node_modules/codemirror/addon/dialog/dialog.js' ); 32 | require( '../../../node_modules/codemirror/addon/display/autorefresh.js' ); 33 | require( '../../../node_modules/codemirror/addon/display/fullscreen.js' ); 34 | require( '../../../node_modules/codemirror/addon/display/panel.js' ); 35 | require( '../../../node_modules/codemirror/addon/display/placeholder.js' ); 36 | require( '../../../node_modules/codemirror/addon/display/rulers.js' ); 37 | require( '../../../node_modules/codemirror/addon/fold/brace-fold.js' ); 38 | require( '../../../node_modules/codemirror/addon/fold/comment-fold.js' ); 39 | require( '../../../node_modules/codemirror/addon/fold/foldcode.js' ); 40 | require( '../../../node_modules/codemirror/addon/fold/foldgutter.js' ); 41 | require( '../../../node_modules/codemirror/addon/fold/indent-fold.js' ); 42 | require( '../../../node_modules/codemirror/addon/fold/markdown-fold.js' ); 43 | require( '../../../node_modules/codemirror/addon/merge/merge.js' ); 44 | require( '../../../node_modules/codemirror/addon/mode/loadmode.js' ); 45 | require( '../../../node_modules/codemirror/addon/mode/multiplex.js' ); 46 | require( '../../../node_modules/codemirror/addon/mode/simple.js' ); 47 | require( '../../../node_modules/codemirror/addon/runmode/runmode.js' ); 48 | require( '../../../node_modules/codemirror/addon/runmode/colorize.js' ); 49 | require( '../../../node_modules/codemirror/addon/runmode/runmode-standalone.js' ); 50 | require( '../../../node_modules/codemirror/addon/scroll/annotatescrollbar.js' ); 51 | require( '../../../node_modules/codemirror/addon/scroll/scrollpastend.js' ); 52 | require( '../../../node_modules/codemirror/addon/scroll/simplescrollbars.js' ); 53 | require( '../../../node_modules/codemirror/addon/search/search.js' ); 54 | require( '../../../node_modules/codemirror/addon/search/jump-to-line.js' ); 55 | require( '../../../node_modules/codemirror/addon/search/match-highlighter.js' ); 56 | require( '../../../node_modules/codemirror/addon/search/matchesonscrollbar.js' ); 57 | require( '../../../node_modules/codemirror/addon/search/searchcursor.js' ); 58 | require( '../../../node_modules/codemirror/addon/tern/tern.js' ); 59 | require( '../../../node_modules/codemirror/addon/tern/worker.js' ); 60 | require( '../../../node_modules/codemirror/addon/wrap/hardwrap.js' ); 61 | require( '../../../node_modules/codemirror/addon/selection/active-line.js' ); 62 | require( '../../../node_modules/codemirror/addon/selection/mark-selection.js' ); 63 | require( '../../../node_modules/codemirror/addon/selection/selection-pointer.js' ); 64 | require( '../../../node_modules/codemirror/mode/meta.js' ); 65 | require( '../../../node_modules/codemirror/mode/clike/clike.js' ); 66 | require( '../../../node_modules/codemirror/mode/css/css.js' ); 67 | require( '../../../node_modules/codemirror/mode/diff/diff.js' ); 68 | require( '../../../node_modules/codemirror/mode/htmlmixed/htmlmixed.js' ); 69 | require( '../../../node_modules/codemirror/mode/http/http.js' ); 70 | require( '../../../node_modules/codemirror/mode/javascript/javascript.js' ); 71 | require( '../../../node_modules/codemirror/mode/jsx/jsx.js' ); 72 | require( '../../../node_modules/codemirror/mode/markdown/markdown.js' ); 73 | require( '../../../node_modules/codemirror/mode/gfm/gfm.js' ); 74 | require( '../../../node_modules/codemirror/mode/nginx/nginx.js' ); 75 | require( '../../../node_modules/codemirror/mode/php/php.js' ); 76 | require( '../../../node_modules/codemirror/mode/sass/sass.js' ); 77 | require( '../../../node_modules/codemirror/mode/shell/shell.js' ); 78 | require( '../../../node_modules/codemirror/mode/sql/sql.js' ); 79 | require( '../../../node_modules/codemirror/mode/xml/xml.js' ); 80 | require( '../../../node_modules/codemirror/mode/yaml/yaml.js' ); 81 | 82 | if ( ! window.wp ) { 83 | window.wp = {}; 84 | } 85 | window.wp.CodeMirror = CodeMirror; 86 | -------------------------------------------------------------------------------- /wp-includes/js/htmlhint-kses.js: -------------------------------------------------------------------------------- 1 | /* global HTMLHint */ 2 | /* eslint no-magic-numbers: ["error", { "ignore": [0, 1] }] */ 3 | HTMLHint.addRule({ 4 | id: 'kses', 5 | description: 'Element or attribute cannot be used.', 6 | init: function( parser, reporter, options ) { 7 | 'use strict'; 8 | 9 | var self = this; 10 | parser.addListener( 'tagstart', function( event ) { 11 | var attr, col, attrName, allowedAttributes, i, len, tagName; 12 | 13 | tagName = event.tagName.toLowerCase(); 14 | if ( ! options[ tagName ] ) { 15 | reporter.error( 'Tag <' + event.tagName + '> is not allowed.', event.line, event.col, self, event.raw ); 16 | return; 17 | } 18 | 19 | allowedAttributes = options[ tagName ]; 20 | col = event.col + event.tagName.length + 1; 21 | for ( i = 0, len = event.attrs.length; i < len; i++ ) { 22 | attr = event.attrs[ i ]; 23 | attrName = attr.name.toLowerCase(); 24 | if ( ! allowedAttributes[ attrName ] ) { 25 | reporter.error( 'Tag attribute [' + attr.raw + ' ] is not allowed.', event.line, col + attr.index, self, attr.raw ); 26 | } 27 | } 28 | }); 29 | } 30 | }); 31 | -------------------------------------------------------------------------------- /wp-includes/script-loader-addendum.php: -------------------------------------------------------------------------------- 1 | add( 'codemirror', plugins_url( 'wp-includes/js/codemirror/codemirror.min.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array(), $codemirror_version ); 20 | 21 | // The linting engines for the lint addons... 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' ); 25 | $scripts->add( 'htmlhint', plugins_url( 'wp-includes/js/htmlhint.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array(), '0.9.14-xwp' ); 26 | $scripts->add( 'htmlhint-kses', plugins_url( 'wp-includes/js/htmlhint-kses.js', BETTER_CODE_EDITING_PLUGIN_FILE ), array( 'htmlhint' ), BETTER_CODE_EDITING_PLUGIN_VERSION ); 27 | 28 | $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 ); 29 | 30 | $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 ); 31 | $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 ); 32 | } 33 | 34 | /** 35 | * Register styles. 36 | * 37 | * @param WP_Styles $styles Styles. 38 | */ 39 | function _better_code_editing_register_styles( WP_Styles $styles ) { 40 | $codemirror_version = '5.29.1-alpha-ee20357-' . BETTER_CODE_EDITING_PLUGIN_VERSION; 41 | 42 | /* 43 | * Override common.css with patched version that has proper styling for CodeMirror and textarea. 44 | */ 45 | $styles->registered['common']->src = plugins_url( 'wp-admin/css/common.css', BETTER_CODE_EDITING_PLUGIN_FILE ); 46 | $styles->registered['common']->ver = BETTER_CODE_EDITING_PLUGIN_VERSION; 47 | unset( $styles->registered['common']->extra['suffix'] ); // Prevent minified version from being attempted. 48 | 49 | $styles->add( 'codemirror', plugins_url( 'wp-includes/js/codemirror/codemirror.min.css', BETTER_CODE_EDITING_PLUGIN_FILE ), array(), $codemirror_version ); 50 | $styles->add( 'code-editor', plugins_url( 'wp-admin/css/code-editor.css', BETTER_CODE_EDITING_PLUGIN_FILE ), array( 'codemirror' ), BETTER_CODE_EDITING_PLUGIN_VERSION ); 51 | 52 | // RTL CSS. 53 | $rtl_styles = array( 54 | 'code-editor', 55 | ); 56 | foreach ( $rtl_styles as $rtl_style ) { 57 | $styles->add_data( $rtl_style, 'rtl', 'replace' ); 58 | } 59 | 60 | // Patch the stylesheets. 61 | if ( function_exists( 'is_rtl' ) && is_rtl() && file_exists( plugin_dir_path( BETTER_CODE_EDITING_PLUGIN_FILE ) . 'wp-admin/css/common-rtl.css' ) ) { 62 | $suffix = '-rtl.css'; 63 | } else { 64 | $suffix = '.css'; 65 | } 66 | $styles->add_inline_style( 'widgets', file_get_contents( dirname( BETTER_CODE_EDITING_PLUGIN_FILE ) . '/wp-admin/css/widgets-addendum' . $suffix ) ); 67 | $styles->add_inline_style( 'customize-controls', file_get_contents( dirname( BETTER_CODE_EDITING_PLUGIN_FILE ) . '/wp-admin/css/customize-controls-addendum' . $suffix ) ); 68 | } 69 | -------------------------------------------------------------------------------- /wp-includes/widgets-addendum.php: -------------------------------------------------------------------------------- 1 | registered ) { 36 | return; 37 | } 38 | $this->registered = true; 39 | 40 | wp_add_inline_script( 'custom-html-widgets', sprintf( 'wp.customHtmlWidgets.idBases.push( %s );', wp_json_encode( $this->id_base ) ) ); 41 | 42 | // Note that the widgets component in the customizer will also do the 'admin_print_scripts-widgets.php' action in WP_Customize_Widgets::print_scripts(). 43 | add_action( 'admin_print_scripts-widgets.php', array( $this, 'enqueue_admin_scripts' ) ); 44 | 45 | // Note that the widgets component in the customizer will also do the 'admin_footer-widgets.php' action in WP_Customize_Widgets::print_footer_scripts(). 46 | add_action( 'admin_footer-widgets.php', array( 'WP_Widget_Custom_HTML_CodeMirror', 'render_control_template_scripts' ) ); 47 | 48 | // Note this action is used to ensure the help text is added to the end. 49 | add_action( 'admin_head-widgets.php', array( 'WP_Widget_Custom_HTML_CodeMirror', 'add_help_text' ) ); 50 | } 51 | 52 | /** 53 | * Loads the required scripts and styles for the widget control. 54 | * 55 | * @since 4.9.0 56 | */ 57 | public function enqueue_admin_scripts() { 58 | $settings = wp_enqueue_code_editor( array( 59 | 'type' => 'text/html', 60 | ) ); 61 | 62 | wp_enqueue_script( 'custom-html-widgets' ); 63 | if ( empty( $settings ) ) { 64 | $settings = array( 65 | 'disabled' => true, 66 | ); 67 | } 68 | wp_add_inline_script( 'custom-html-widgets', sprintf( 'wp.customHtmlWidgets.init( %s );', wp_json_encode( $settings ) ), 'after' ); 69 | 70 | $l10n = array( 71 | 'errorNotice' => wp_array_slice_assoc( 72 | /* translators: placeholder is error count */ 73 | _n_noop( 'There is %d error which must be fixed before you can save.', 'There are %d errors which must be fixed before you can save.', 'better-code-editing' ), 74 | array( 'singular', 'plural' ) 75 | ), 76 | ); 77 | wp_add_inline_script( 'custom-html-widgets', sprintf( 'jQuery.extend( wp.customHtmlWidgets.l10n, %s );', wp_json_encode( $l10n ) ), 'after' ); 78 | } 79 | 80 | /** 81 | * Outputs the Custom HTML widget settings form. 82 | * 83 | * @since 4.8.1 84 | * 85 | * @param array $instance Current instance. 86 | * @returns void 87 | */ 88 | public function form( $instance ) { 89 | $instance = wp_parse_args( (array) $instance, $this->default_instance ); 90 | ?> 91 | 92 | 93 | 103 | 133 | '; 145 | $content .= __( 'Use the Custom HTML widget to add arbitrary HTML code to your widget areas.', 'better-code-editing' ); 146 | $content .= '

'; 147 | 148 | $content .= '

' . __( 'When using a keyboard to navigate:', 'better-code-editing' ) . '

'; 149 | $content .= '
    '; 150 | $content .= '
  • ' . __( 'In the HTML edit field, Tab enters a tab character.', 'better-code-editing' ) . '
  • '; 151 | $content .= '
  • ' . __( 'To move keyboard focus, press Esc then Tab for the next element, or Esc then Shift+Tab for the previous element.', 'better-code-editing' ) . '
  • '; 152 | $content .= '
'; 153 | 154 | $content .= '

'; 155 | $content .= sprintf( 156 | /* translators: placeholder is link to user profile */ 157 | __( 'The edit field automatically highlights code syntax. You can disable this in your %s to work in plan text mode.', 'better-code-editing' ), 158 | sprintf( 159 | ' %2$s%3$s', 160 | esc_url( get_edit_profile_url() . '#syntax_highlighting' ), 161 | __( 'user profile', 'better-code-editing' ), 162 | /* translators: accessibility text */ 163 | __( '(opens in a new window)', 'default' ) 164 | ) 165 | ); 166 | $content .= '

'; 167 | 168 | $screen->add_help_tab( array( 169 | 'id' => 'custom_html_widget', 170 | 'title' => __( 'Custom HTML Widget', 'better-code-editing' ), 171 | 'content' => $content, 172 | ) ); 173 | } 174 | } 175 | --------------------------------------------------------------------------------