Make WordPress Core


Ignore:
Timestamp:
09/28/2011 07:26:34 AM (14 years ago)
Author:
azaozz
Message:

Fix enqueueing of the right scripts when more than one instance of the editor, fix inserting images in full screen mode, see #17144

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-editor.php

    r18766 r18799  
    2626    var $this_tinymce = false;
    2727    var $this_quicktags = false;
     28    var $has_tinymce = false;
     29    var $has_quicktags = false;
     30    var $has_medialib = false;
    2831
    2932    function __construct() {
     
    6871        if ( $this->this_quicktags && $this->this_tinymce ) {
    6972            $switch_class = 'html-active';
     73            $this->has_tinymce = $this->has_quicktags = true;
    7074
    7175            if ( 'html' == $this->default_editor ) {
     
    7882            $buttons .= '<a id="' . $editor_id . '-html" class="hide-if-no-js wp-switch-editor switch-html" onclick="switchEditors.go(this);return false;">' . __('HTML') . "</a>\n";
    7983            $buttons .= '<a id="' . $editor_id . '-tmce" class="hide-if-no-js wp-switch-editor switch-tmce" onclick="switchEditors.go(this);return false;">' . __('Visual') . "</a>\n";
     84        } else {
     85            if ( $this->this_tinymce )
     86                $this->has_tinymce = true;
     87
     88            if ( $this->this_quicktags )
     89                $this->has_quicktags = true;
    8090        }
    8191
     
    90100
    91101            if ( $set['media_buttons'] ) {
     102                $this->has_medialib = true;
     103
    92104                if ( !function_exists('media_buttons') )
    93105                    include(ABSPATH . 'wp-admin/includes/media.php');
     
    443455        wp_enqueue_style('editor-buttons');
    444456
    445         if ( $this->this_tinymce )
     457        if ( $this->has_tinymce )
    446458            wp_enqueue_script('editor');
    447459
    448         if ( $this->this_quicktags )
     460        if ( $this->has_quicktags )
    449461            wp_enqueue_script('quicktags');
    450462
     
    458470            wp_enqueue_script('wp-fullscreen');
    459471
    460         add_thickbox();
    461         wp_enqueue_script('media-upload');
     472        if ( $this->has_medialib ) {
     473            add_thickbox();
     474            wp_enqueue_script('media-upload');
     475        }
    462476    }
    463477
     
    801815}
    802816
    803 
Note: See TracChangeset for help on using the changeset viewer.