Changeset 41957
- Timestamp:
- 10/20/2017 04:38:35 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/customize-controls.js
r41952 r41957 5153 5153 */ 5154 5154 initEditor: function() { 5155 var control = this, element; 5155 var control = this, element, editorSettings = false; 5156 5157 // Obtain editorSettings for instantiation. 5158 if ( wp.codeEditor && ( _.isUndefined( control.params.editor_settings ) || false !== control.params.editor_settings ) ) { 5159 5160 // Obtain default editor settings. 5161 editorSettings = wp.codeEditor.defaultSettings ? _.clone( wp.codeEditor.defaultSettings ) : {}; 5162 editorSettings.codemirror = _.extend( 5163 {}, 5164 editorSettings.codemirror, 5165 { 5166 indentUnit: 2, 5167 tabSize: 2 5168 } 5169 ); 5170 5171 // Merge editor_settings param on top of defaults. 5172 if ( _.isObject( control.params.editor_settings ) ) { 5173 _.each( control.params.editor_settings, function( value, key ) { 5174 if ( _.isObject( value ) ) { 5175 editorSettings[ key ] = _.extend( 5176 {}, 5177 editorSettings[ key ], 5178 value 5179 ); 5180 } 5181 } ); 5182 } 5183 } 5156 5184 5157 5185 element = new api.Element( control.container.find( 'textarea' ) ); … … 5160 5188 element.set( control.setting() ); 5161 5189 5162 if ( control.params.editor_settings ) {5163 control.initSyntaxHighlightingEditor( control.params.editor_settings );5190 if ( editorSettings ) { 5191 control.initSyntaxHighlightingEditor( editorSettings ); 5164 5192 } else { 5165 5193 control.initPlainTextareaEditor(); … … 8840 8868 var control = api.control( 'custom_css' ); 8841 8869 8870 // Hide redundant label for visual users. 8871 control.container.find( '.customize-control-title:first' ).addClass( 'screen-reader-text' ); 8872 8842 8873 // Close the section description when clicking the close button. 8843 8874 section.container.find( '.section-description-buttons .section-description-close' ).on( 'click', function() { -
trunk/src/wp-admin/js/widgets/custom-html-widgets.js
r41586 r41957 205 205 */ 206 206 onUpdateErrorNotice: function onUpdateErrorNotice( errorAnnotations ) { 207 control.saveButton.toggleClass( 'validation-blocked ', errorAnnotations.length );207 control.saveButton.toggleClass( 'validation-blocked disabled', errorAnnotations.length ); 208 208 control.updateErrorNotice( errorAnnotations ); 209 209 } -
trunk/src/wp-includes/customize/class-wp-customize-code-editor-control.php
r41586 r41957 70 70 public function json() { 71 71 $json = parent::json(); 72 $json['code_type'] = $this->code_type;73 72 $json['editor_settings'] = $this->editor_settings; 74 73 $json['input_attrs'] = $this->input_attrs; … … 92 91 <# var elementIdPrefix = 'el' + String( Math.random() ); #> 93 92 <# if ( data.label ) { #> 94 <label for="{{ elementIdPrefix }}_editor" >95 <span class="customize-control-title">{{ data.label }}</span>93 <label for="{{ elementIdPrefix }}_editor" class="customize-control-title"> 94 {{ data.label }} 96 95 </label> 97 96 <# } #> -
trunk/src/wp-includes/script-loader.php
r41905 r41957 721 721 $scripts->add( 'media-video-widget', "/wp-admin/js/widgets/media-video-widget$suffix.js", array( 'media-widgets', 'media-audiovideo', 'wp-api-request' ) ); 722 722 $scripts->add( 'text-widgets', "/wp-admin/js/widgets/text-widgets$suffix.js", array( 'jquery', 'backbone', 'editor', 'wp-util', 'wp-a11y' ) ); 723 $scripts->add( 'custom-html-widgets', "/wp-admin/js/widgets/custom-html-widgets$suffix.js", array( ' code-editor', 'jquery', 'backbone', 'wp-util', 'jquery-ui-core', 'wp-a11y' ) );723 $scripts->add( 'custom-html-widgets', "/wp-admin/js/widgets/custom-html-widgets$suffix.js", array( 'jquery', 'backbone', 'wp-util', 'jquery-ui-core', 'wp-a11y' ) ); 724 724 725 725 $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'wp-backbone', 'wp-a11y', 'customize-base' ), false, 1 ); -
trunk/tests/phpunit/tests/widgets/custom-html-widget.php
r41858 r41957 264 264 265 265 $this->assertTrue( wp_script_is( 'custom-html-widgets', 'enqueued' ) ); 266 $this->assert True( wp_script_is( 'code-editor', 'enqueued' ) );267 $this->assert True( wp_script_is( 'wp-codemirror', 'enqueued' ) );266 $this->assertFalse( wp_script_is( 'code-editor', 'enqueued' ) ); 267 $this->assertFalse( wp_script_is( 'wp-codemirror', 'enqueued' ) ); 268 268 $this->assertFalse( wp_script_is( 'csslint', 'enqueued' ) ); 269 269 $this->assertFalse( wp_script_is( 'jshint', 'enqueued' ) );
Note: See TracChangeset
for help on using the changeset viewer.