WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/20/2017 04:38:35 PM (4 years ago)
Author:
westonruter
Message:

Code Editor: Improve ability to create Customizer CodeEditorControl instances in JS, lessening PHP dependencies.

Allow CodeEditorControl to be instantiated with a editor_settings param which is merged with wp.codeEditor.defaultSettings.

Also:

  • Turn redundant "CSS Code" control label into screen reader text for Additional CSS.
  • Remove code-editor as script dependency for custom-html-widgets since enqueueing is determined by wp_enqueue_code_editor().
  • Remove useless exporting of code_type param to JS in WP_Customize_Code_Editor_Control.
  • Add disabled class to Custom HTML widget's Save button when linting errors are present.
  • Remove redundant span inside CodeEditorControl's label.

See #41897, #12423, #41872.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/customize/class-wp-customize-code-editor-control.php

    r41586 r41957  
    7070    public function json() {
    7171        $json = parent::json();
    72         $json['code_type'] = $this->code_type;
    7372        $json['editor_settings'] = $this->editor_settings;
    7473        $json['input_attrs'] = $this->input_attrs;
     
    9291        <# var elementIdPrefix = 'el' + String( Math.random() ); #>
    9392        <# 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 }}
    9695            </label>
    9796        <# } #>
Note: See TracChangeset for help on using the changeset viewer.