Ticket #38667: 38667.2.diff
File 38667.2.diff, 5.1 KB (added by , 8 years ago) |
---|
-
src/wp-admin/css/customize-controls.css
diff --git src/wp-admin/css/customize-controls.css src/wp-admin/css/customize-controls.css index 2841557..a057532 100644
p.customize-section-description { 1129 1129 margin-left: 10px; 1130 1130 margin-right: 10px; 1131 1131 } 1132 #customize-theme-controls #sub-accordion-section-custom_css textarea { 1133 tab-size: 4; 1134 } 1132 1135 1133 1136 #sub-accordion-section-custom_css .customize-control-notifications-container { 1134 1137 margin-bottom: 15px; -
src/wp-admin/js/customize-controls.js
diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js index 30e98ea..cb177c6 100644
5234 5234 }); 5235 5235 }); 5236 5236 5237 // Allow tabs to be entered in Custom CSS textarea. 5238 api.control( 'custom_css', function ( control ) { 5239 control.deferred.embedded.done( function allowTabs() { 5240 var $textarea = control.container.find( 'textarea' ), textarea = $textarea[0]; 5241 5242 $textarea.on( 'blur', function() { 5243 $textarea.data( 'next-tab-blurs', false ); 5244 } ); 5245 5246 $textarea.on( 'keydown', function onKeydown( event ) { 5247 var selectionStart, selectionEnd, value, scroll; 5248 5249 if ( 27 === event.keyCode ) { // Escape key. 5250 // When pressing Escape: Opera 12 and 27 blur form fields. 5251 event.preventDefault(); 5252 5253 if ( true !== $textarea.data( 'next-tab-blurs' ) ) { 5254 $textarea.data( 'next-tab-blurs', true ); 5255 event.stopPropagation(); // Prevent collapsing the section. 5256 } 5257 return; 5258 } 5259 5260 // Short-circuit if tab key is not being pressed or if a modifier key *is* being pressed. 5261 if ( 9 !== event.keyCode || event.ctrlKey || event.altKey || event.shiftKey ) { // Tab key. 5262 return; 5263 } 5264 5265 // Prevent capturing Tab characters if Esc was pressed. 5266 if ( $textarea.data( 'next-tab-blurs' ) ) { 5267 return; 5268 } 5269 5270 selectionStart = textarea.selectionStart; 5271 selectionEnd = textarea.selectionEnd; 5272 value = textarea.value; 5273 5274 if ( selectionStart >= 0 ) { 5275 scroll = $textarea.scrollTop; 5276 textarea.value = value.substring( 0, selectionStart ).concat( '\t', value.substring( selectionEnd ) ); 5277 $textarea.selectionStart = textarea.selectionEnd = selectionStart + 1; 5278 textarea.scrollTop = scroll; 5279 } 5280 5281 event.stopPropagation(); 5282 event.preventDefault(); 5283 } ); 5284 } ); 5285 } ); 5286 5237 5287 // Update the setting validities. 5238 5288 api.previewer.bind( 'selective-refresh-setting-validities', function handleSelectiveRefreshedSettingValidities( settingValidities ) { 5239 5289 api._handleSettingValidities( { -
src/wp-includes/class-wp-customize-manager.php
diff --git src/wp-includes/class-wp-customize-manager.php src/wp-includes/class-wp-customize-manager.php index 3058138..8a8a714 100644
final class WP_Customize_Manager { 3590 3590 'priority' => 200, 3591 3591 'description_hidden' => true, 3592 3592 'description' => sprintf( '%s<br /><a href="%s" class="external-link" target="_blank">%s<span class="screen-reader-text">%s</span></a>', 3593 __( 'CSS allows you to customize the appearance and layout of your site with code. Separate CSS is saved for each of your themes. ' ),3593 __( 'CSS allows you to customize the appearance and layout of your site with code. Separate CSS is saved for each of your themes. In the editing area the Tab key enters a tab character. To move below this area by pressing Tab, press the Esc key followed by the Tab key. In some cases the Esc key will need to be pressed twice before the Tab key will allow you to continue.' ), 3594 3594 'https://codex.wordpress.org/Know_Your_Sources#CSS', 3595 3595 __( 'Learn more about CSS' ), 3596 3596 __( '(link opens in a new window)' ) … … final class WP_Customize_Manager { 3599 3599 3600 3600 $custom_css_setting = new WP_Customize_Custom_CSS_Setting( $this, sprintf( 'custom_css[%s]', get_stylesheet() ), array( 3601 3601 'capability' => 'unfiltered_css', 3602 'default' => __( "/*\nYou can add your own CSS here.\n\nClick the help icon above to learn more.\n*/" ), 3602 3603 ) ); 3603 3604 $this->add_setting( $custom_css_setting ); 3604 3605 … … final class WP_Customize_Manager { 3606 3607 'type' => 'textarea', 3607 3608 'section' => 'custom_css', 3608 3609 'settings' => array( 'default' => $custom_css_setting->id ), 3609 'input_attrs' => array(3610 'placeholder' => __( "/*\nYou can add your own CSS here.\n\nClick the help icon above to learn more.\n*/" ),3611 )3612 3610 ) ); 3613 3611 } 3614 3612 -
src/wp-includes/customize/class-wp-customize-custom-css-setting.php
diff --git src/wp-includes/customize/class-wp-customize-custom-css-setting.php src/wp-includes/customize/class-wp-customize-custom-css-setting.php index 2015458..17e01fc 100644
final class WP_Customize_Custom_CSS_Setting extends WP_Customize_Setting { 128 128 * @return string 129 129 */ 130 130 public function value() { 131 return wp_get_custom_css( $this->stylesheet ); 131 $value = wp_get_custom_css( $this->stylesheet ); 132 if ( empty( $value ) ) { 133 $value = $this->default; 134 } 135 return $value; 132 136 } 133 137 134 138 /**