Make WordPress Core

Changeset 18766


Ignore:
Timestamp:
09/24/2011 04:43:19 AM (13 years ago)
Author:
azaozz
Message:

Fix wplink when TinyMCE is not loaded, fix image insertion when wpActiveEditor is not set, see #17144

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/js/media-upload.dev.js

    r18516 r18766  
    44
    55function send_to_editor(h) {
    6     var ed;
     6    var ed, mce = typeof(tinymce) != 'undefined', qt = typeof(QTags) != 'undefined';
    77
    88    if ( !wpActiveEditor ) {
    9         if ( typeof(tinymce) != 'undefined' && tinymce.activeEditor ) {
     9        if ( mce && tinymce.activeEditor ) {
    1010            ed = tinymce.activeEditor;
    1111            wpActiveEditor = ed.id;
    12         } else {
     12        } else if ( !qt ) {
    1313            return false;
    1414        }
    1515    }
    1616
    17     if ( !ed && typeof(tinymce) != 'undefined' && wpActiveEditor )
     17    if ( !ed && mce && wpActiveEditor )
    1818        ed = tinymce.get(wpActiveEditor);
    1919
     
    3535
    3636        ed.execCommand('mceInsertContent', false, h);
    37     } else if ( typeof(QTags) != 'undefined' ) {
     37    } else if ( qt ) {
    3838        QTags.insertContent(h);
    3939    } else {
     
    4141    }
    4242
    43     tb_remove();
     43    try{tb_remove();}catch(e){};
    4444}
    4545
  • trunk/wp-admin/js/media-upload.js

    r18516 r18766  
    1 var wpActiveEditor;function send_to_editor(b){var a;if(!wpActiveEditor){if(typeof(tinymce)!="undefined"&&tinymce.activeEditor){a=tinymce.activeEditor;wpActiveEditor=a.id}else{return false}}if(!a&&typeof(tinymce)!="undefined"&&wpActiveEditor){a=tinymce.get(wpActiveEditor)}if(a&&!a.isHidden()){if(tinymce.isIE&&a.windowManager.insertimagebookmark){a.selection.moveToBookmark(a.windowManager.insertimagebookmark)}if(b.indexOf("[caption")===0){if(a.plugins.wpeditimage){b=a.plugins.wpeditimage._do_shcode(b)}}else{if(b.indexOf("[gallery")===0){if(a.plugins.wpgallery){b=a.plugins.wpgallery._do_gallery(b)}}else{if(b.indexOf("[embed")===0){if(a.plugins.wordpress){b=a.plugins.wordpress._setEmbed(b)}}}}a.execCommand("mceInsertContent",false,b)}else{if(typeof(QTags)!="undefined"){QTags.insertContent(b)}else{document.getElementById(wpActiveEditor).value+=b}}tb_remove()}var tb_position;(function(a){tb_position=function(){var f=a("#TB_window"),e=a(window).width(),d=a(window).height(),c=(720<e)?720:e,b=0;if(a("body.admin-bar").length){b=28}if(f.size()){f.width(c-50).height(d-45-b);a("#TB_iframeContent").width(c-50).height(d-75-b);f.css({"margin-left":"-"+parseInt(((c-50)/2),10)+"px"});if(typeof document.body.style.maxWidth!="undefined"){f.css({top:20+b+"px","margin-top":"0"})}}return a("a.thickbox").each(function(){var g=a(this).attr("href");if(!g){return}g=g.replace(/&width=[0-9]+/g,"");g=g.replace(/&height=[0-9]+/g,"");a(this).attr("href",g+"&width="+(c-80)+"&height="+(d-85-b))})};a(window).resize(function(){tb_position()});a(document).ready(function(b){b("a.thickbox").click(function(){var c;if(typeof(tinymce)!="undefined"&&tinymce.isIE&&(c=tinymce.get(wpActiveEditor))&&!c.isHidden()){c.focus();c.windowManager.insertimagebookmark=c.selection.getBookmark()}})})})(jQuery);
     1var wpActiveEditor;function send_to_editor(c){var b,a=typeof(tinymce)!="undefined",f=typeof(QTags)!="undefined";if(!wpActiveEditor){if(a&&tinymce.activeEditor){b=tinymce.activeEditor;wpActiveEditor=b.id}else{if(!f){return false}}}if(!b&&a&&wpActiveEditor){b=tinymce.get(wpActiveEditor)}if(b&&!b.isHidden()){if(tinymce.isIE&&b.windowManager.insertimagebookmark){b.selection.moveToBookmark(b.windowManager.insertimagebookmark)}if(c.indexOf("[caption")===0){if(b.plugins.wpeditimage){c=b.plugins.wpeditimage._do_shcode(c)}}else{if(c.indexOf("[gallery")===0){if(b.plugins.wpgallery){c=b.plugins.wpgallery._do_gallery(c)}}else{if(c.indexOf("[embed")===0){if(b.plugins.wordpress){c=b.plugins.wordpress._setEmbed(c)}}}}b.execCommand("mceInsertContent",false,c)}else{if(f){QTags.insertContent(c)}else{document.getElementById(wpActiveEditor).value+=c}}try{tb_remove()}catch(d){}}var tb_position;(function(a){tb_position=function(){var f=a("#TB_window"),e=a(window).width(),d=a(window).height(),c=(720<e)?720:e,b=0;if(a("body.admin-bar").length){b=28}if(f.size()){f.width(c-50).height(d-45-b);a("#TB_iframeContent").width(c-50).height(d-75-b);f.css({"margin-left":"-"+parseInt(((c-50)/2),10)+"px"});if(typeof document.body.style.maxWidth!="undefined"){f.css({top:20+b+"px","margin-top":"0"})}}return a("a.thickbox").each(function(){var g=a(this).attr("href");if(!g){return}g=g.replace(/&width=[0-9]+/g,"");g=g.replace(/&height=[0-9]+/g,"");a(this).attr("href",g+"&width="+(c-80)+"&height="+(d-85-b))})};a(window).resize(function(){tb_position()});a(document).ready(function(b){b("a.thickbox").click(function(){var c;if(typeof(tinymce)!="undefined"&&tinymce.isIE&&(c=tinymce.get(wpActiveEditor))&&!c.isHidden()){c.focus();c.windowManager.insertimagebookmark=c.selection.getBookmark()}})})})(jQuery);
  • trunk/wp-includes/class-wp-editor.php

    r18753 r18766  
    11<?php
    22/**
    3  * Adds the TinyMCE editor used on the Write and Edit screens.
     3 * Adds the WordPress editor used on the Write and Edit screens.
    44 *
    55 * @package WordPress
     
    1717    var $qt_settings = array();
    1818    var $plugins = array();
     19    var $qt_buttons = array();
    1920    var $mce_locale;
    2021    var $ext_plugins;
     
    4950            'editor_class' => '', // add extra class(es) to the editor textarea
    5051            'teeny' => false, // output the minimal editor config used in Press This
    51             'dfw' => false, // replace the default fullscreen with DFW (needs specific css)
     52            'dfw' => false, // replace the default fullscreen with DFW (needs specific DOM elements and css)
    5253            'tinymce' => true, // load TinyMCE, can be used to pass settings directly to TinyMCE using an array()
    5354            'quicktags' => true // load Quicktags, can be used to pass settings directly to Quicktags using an array()
     
    6566            $set['media_buttons'] = false;
    6667
    67         if ( $this->can_richedit && $this->this_quicktags && $this->this_tinymce ) {
     68        if ( $this->this_quicktags && $this->this_tinymce ) {
    6869            $switch_class = 'html-active';
    6970
     
    99100        }
    100101
    101         $the_editor = apply_filters('the_editor', '<div id="wp-' . $editor_id . '-editor-container" class="wp-editor-container"><textarea' . $editor_class . $rows . $tabindex . '" cols="40" name="' . $set['textarea_name'] . '" id="' . $editor_id . '">%s</textarea></div>');
     102        $the_editor = apply_filters('the_editor', '<div id="wp-' . $editor_id . '-editor-container" class="wp-editor-container"><textarea' . $editor_class . $rows . $tabindex . ' cols="40" name="' . $set['textarea_name'] . '" id="' . $editor_id . '">%s</textarea></div>');
    102103        $content = apply_filters('the_editor_content', $content);
    103104
     
    115116    }
    116117
    117     function editor_settings($editor_id, $settings) {
     118    function editor_settings($editor_id, $set) {
    118119        global $editor_styles;
    119120        $first_run = false;
    120121
    121122        if ( $this->this_quicktags ) {
    122             $qtbuttons = apply_filters( 'quicktags_buttons', array(), $editor_id );
    123             $qtbuttons_disabled = apply_filters( 'quicktags_disabled_buttons', array(), $editor_id );
     123            $qt_buttons = array();
    124124
    125125            $qtInit = array(
    126126                'id' => $editor_id,
    127                 'buttons' => implode($qtbuttons, ','),
    128                 'disabled_buttons' => implode($qtbuttons_disabled, ',')
     127                'buttons' => '',
     128                'disabled_buttons' => ''
    129129            );
    130130
    131             if ( is_array($settings['quicktags']) )
    132                 $qtInit = array_merge($qtInit, $settings['quicktags']);
     131            if ( is_array($set['quicktags']) )
     132                $qtInit = array_merge($qtInit, $set['quicktags']);
     133
     134            $qtInit = apply_filters( 'quicktags_settings', $qtInit, $editor_id );
    133135
    134136            $this->qt_settings[$editor_id] = $qtInit;
     137
     138            if ( !empty($qtInit['buttons']) || !empty($qtInit['disabled_buttons']) ) {
     139                if ( strpos( ',' . $qtInit['buttons'] . ',', ',link,' ) !== false )
     140                    $qt_buttons[] = 'link';
     141
     142                if ( strpos( ',' . $qtInit['disabled_buttons'] . ',', ',link,' ) !== false )
     143                    $qt_buttons = array();
     144            } else {
     145                $qt_buttons[] = 'link';
     146            }
     147
     148            if ( $set['dfw'] )
     149                $qt_buttons[] = 'fullscreen';
     150
     151            $this->qt_buttons = array_merge( $this->qt_buttons, $qt_buttons );
    135152        }
    136153
     
    144161                $first_run = true;
    145162
    146                 if ( $settings['teeny'] ) {
     163                if ( $set['teeny'] ) {
    147164                    $this->plugins = $plugins = apply_filters( 'teeny_mce_plugins', array('inlinepopups', 'fullscreen', 'wordpress', 'wplink', 'wpdialogs'), $editor_id );
    148165                    $ext_plugins = '';
     
    193210                            $strings = $str1 = $str2 = '';
    194211                            if ( ! in_array($name, $loaded_langs) ) {
    195                                 $path = str_replace( WP_CONTENT_URL, '', $plugurl );
     212                                $path = str_replace( content_url(), '', $plugurl );
    196213                                $path = WP_CONTENT_DIR . $path . '/langs/';
    197214
     
    231248                }
    232249
    233                 if ( $settings['dfw'] )
     250                if ( $set['dfw'] )
    234251                    $plugins[] = 'wpfullscreen';
    235252
     
    326343            }
    327344
    328             if ( $settings['teeny'] ) {
     345            if ( $set['teeny'] ) {
    329346                $mce_buttons = apply_filters( 'teeny_mce_buttons', array('bold', 'italic', 'underline', 'blockquote', 'separator', 'strikethrough', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'undo', 'redo', 'link', 'unlink', 'fullscreen'), $editor_id );
    330347                $mce_buttons_2 = $mce_buttons_3 = $mce_buttons_4 = array();
     
    336353            }
    337354
    338             if ( $settings['dfw'] ) {
     355            if ( $set['dfw'] ) {
    339356                function replace_fullscreen(&$val) {
    340357                    if ( $val == 'fullscreen' )
     
    350367            $mceInit = array (
    351368                'elements' => $editor_id,
    352                 'wpautop' => (bool) $settings['wpautop'],
    353                 'remove_linebreaks' => (bool) $settings['wpautop'],
    354                 'apply_source_formatting' => (bool) !$settings['wpautop'],
     369                'wpautop' => (bool) $set['wpautop'],
     370                'remove_linebreaks' => (bool) $set['wpautop'],
     371                'apply_source_formatting' => (bool) !$set['wpautop'],
    355372                'theme_advanced_buttons1' => implode($mce_buttons, ','),
    356373                'theme_advanced_buttons2' => implode($mce_buttons_2, ','),
     
    362379                $mceInit = array_merge($this->first_init, $mceInit);
    363380
    364             if ( is_array($settings['tinymce']) )
    365                 $mceInit = array_merge($mceInit, $settings['tinymce']);
     381            if ( is_array($set['tinymce']) )
     382                $mceInit = array_merge($mceInit, $set['tinymce']);
    366383
    367384            // For people who really REALLY know what they're doing with TinyMCE
     
    369386            // Setting "valid_elements", "invalid_elements" and "extended_valid_elements" can be done through this filter.
    370387            // Best is to use the default cleanup by not specifying valid_elements, as TinyMCE contains full set of XHTML 1.0.
    371             if ( $settings['teeny'] ) {
     388            if ( $set['teeny'] ) {
    372389                $mceInit = apply_filters('teeny_mce_before_init', $mceInit, $editor_id);
    373390            } else {
     
    423440
    424441    function enqueue_scripts() {
    425         wp_enqueue_script('quicktags');
    426442        wp_enqueue_script('word-count');
    427         wp_enqueue_script('wplink');
    428         wp_enqueue_script('editor');
    429443        wp_enqueue_style('editor-buttons');
    430444
    431         wp_enqueue_script('wpdialogs-popup');
    432         wp_enqueue_style('wp-jquery-ui-dialog');
    433 
    434         if ( in_array('wpfullscreen', $this->plugins, true) )
     445        if ( $this->this_tinymce )
     446            wp_enqueue_script('editor');
     447
     448        if ( $this->this_quicktags )
     449            wp_enqueue_script('quicktags');
     450
     451        if ( in_array('wplink', $this->plugins, true) || in_array('link', $this->qt_buttons, true) ) {
     452            wp_enqueue_script('wplink');
     453            wp_enqueue_script('wpdialogs-popup');
     454            wp_enqueue_style('wp-jquery-ui-dialog');
     455        }
     456
     457        if ( in_array('wpfullscreen', $this->plugins, true) || in_array('fullscreen', $this->qt_buttons, true) )
    435458            wp_enqueue_script('wp-fullscreen');
    436459
     
    465488            foreach ( $this->mce_settings as $editor_id => $init ) {
    466489                $options = $this->_parse_init( $init );
    467                 $mceInit .= "'$editor_id':{$options},\n";
    468             }
    469             $mceInit = '{' . trim($mceInit, '\n,') . '}';
     490                $mceInit .= "'$editor_id':{$options},";
     491            }
     492            $mceInit = '{' . trim($mceInit, ',') . '}';
    470493        } else {
    471494            $mceInit = '{}';
     
    475498            foreach ( $this->qt_settings as $editor_id => $init ) {
    476499                $options = $this->_parse_init( $init );
    477                 $qtInit .= "'$editor_id':{$options},\n";
    478             }
    479             $qtInit = '{' . trim($qtInit, '\n,') . '}';
     500                $qtInit .= "'$editor_id':{$options},";
     501            }
     502            $qtInit = '{' . trim($qtInit, ',') . '}';
    480503        } else {
    481504            $qtInit = '{}';
     
    564587<?php
    565588
    566         if ( in_array( 'wplink', $this->plugins, true ) )
     589        if ( in_array('wplink', $this->plugins, true) || in_array('link', $this->qt_buttons, true) )
    567590            $this->wp_link_dialog();
    568591
    569         if ( in_array( 'wpfullscreen', $this->plugins, true ) )
     592        if ( in_array('wpfullscreen', $this->plugins, true) || in_array('fullscreen', $this->qt_buttons, true) )
    570593            $this->wp_fullscreen_html();
    571594
  • trunk/wp-includes/js/quicktags.dev.js

    r18727 r18766  
    2727// http://www.alexking.org/
    2828
    29 var QTags, edButtons = [], edCanvas;
    30 
    31 /**
    32  * Initialize new instance of the Quicktags editor
    33  */
    34 function quicktags(settings) {
    35     return new QTags(settings);
    36 }
    37 
    38 /**
    39  * Inderts content at the caret in the active editor (textarea)
    40  *
    41  * Added for back compatibility
    42  * @see QTags.insertContent()
    43  */
    44 function edInsertContent(bah, txt) {
    45     return QTags.insertContent(txt);
    46 }
    47 
    48 /**
    49  * Adds a button to all instances of the editor
    50  *
    51  * Added for back compatibility, use QTags.addButton() as it gives more flexibility like type of button, button placement, etc.
    52  * @see QTags.addButton()
    53  */
    54 function edButton(id, display, tagStart, tagEnd, access, open) {
    55     return QTags.addButton( id, display, tagStart, tagEnd, access, '', -1 );   
    56 }
     29var QTags, edButtons = [], edCanvas,
    5730
    5831/**
     
    6134 * Define all former global functions so plugins that hack quicktags.js directly don't cause fatal errors.
    6235 */
    63 var edAddTag = function(){},
     36edAddTag = function(){},
    6437edCheckOpenTags = function(){},
    6538edCloseAllTags = function(){},
     
    7447edSpell = function(){},
    7548edToolbar = function(){};
     49
     50/**
     51 * Initialize new instance of the Quicktags editor
     52 */
     53function quicktags(settings) {
     54    return new QTags(settings);
     55}
     56
     57/**
     58 * Inderts content at the caret in the active editor (textarea)
     59 *
     60 * Added for back compatibility
     61 * @see QTags.insertContent()
     62 */
     63function edInsertContent(bah, txt) {
     64    return QTags.insertContent(txt);
     65}
     66
     67/**
     68 * Adds a button to all instances of the editor
     69 *
     70 * Added for back compatibility, use QTags.addButton() as it gives more flexibility like type of button, button placement, etc.
     71 * @see QTags.addButton()
     72 */
     73function edButton(id, display, tagStart, tagEnd, access, open) {
     74    return QTags.addButton( id, display, tagStart, tagEnd, access, '', -1 );   
     75}
    7676
    7777(function(){
  • trunk/wp-includes/js/quicktags.js

    r18727 r18766  
    1 var QTags,edButtons=[],edCanvas;function quicktags(a){return new QTags(a)}function edInsertContent(b,a){return QTags.insertContent(a)}function edButton(f,e,c,b,a,d){return QTags.addButton(f,e,c,b,a,"",-1)}var edAddTag=function(){},edCheckOpenTags=function(){},edCloseAllTags=function(){},edInsertImage=function(){},edInsertLink=function(){},edInsertTag=function(){},edLink=function(){},edQuickLink=function(){},edRemoveTag=function(){},edShowButton=function(){},edShowLinks=function(){},edSpell=function(){},edToolbar=function(){};(function(){var c=function(h){var g,f,e;if(typeof jQuery!="undefined"){jQuery(document).ready(h)}else{g=c;g.funcs=[];g.ready=function(){if(!g.isReady){g.isReady=true;for(f=0;f<g.funcs.length;f++){g.funcs[f]()}}};if(g.isReady){h()}else{g.funcs.push(h)}if(!g.eventAttached){if(document.addEventListener){e=function(){document.removeEventListener("DOMContentLoaded",e,false);g.ready()};document.addEventListener("DOMContentLoaded",e,false);window.addEventListener("load",g.ready,false)}else{if(document.attachEvent){e=function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",e);g.ready()}};document.attachEvent("onreadystatechange",e);window.attachEvent("onload",g.ready);(function(){try{document.documentElement.doScroll("left")}catch(i){setTimeout(arguments.callee,50);return}g.ready()})()}}g.eventAttached=true}}},a=(function(){var e=new Date(),f;f=function(g){var h=g.toString();if(h.length<2){h="0"+h}return h};return e.getUTCFullYear()+"-"+f(e.getUTCMonth()+1)+"-"+f(e.getUTCDate())+"T"+f(e.getUTCHours())+":"+f(e.getUTCMinutes())+":"+f(e.getUTCSeconds())+"+00:00"})(),b={},d;d=QTags=function(k){if(typeof(k)=="string"){k={id:k}}else{if(typeof(k)!="object"){return false}}var j=this,l=k.id,i=document.getElementById(l),h="qt_"+l,e,g,f;if(!l||!i){return false}j.name=h;j.id=l;j.canvas=i;j.settings=k;if(l=="content"&&typeof(adminpage)=="string"&&(adminpage=="post-new-php"||adminpage=="post-php")){edCanvas=i;f="ed_toolbar"}else{f=h+"_toolbar"}e=document.createElement("div");e.id=f;e.className="quicktags-toolbar";i.parentNode.insertBefore(e,i);j.toolbar=e;g=function(o){o=o||window.event;var n=o.target||o.srcElement,m;if(/\s+ed_button\s+/.test(" "+n.className+" ")){j.canvas=i=document.getElementById(l);m=n.id.replace(h+"_","");if(j.theButtons[m]){j.theButtons[m].callback.call(j.theButtons[m],n,i,j)}}};if(e.addEventListener){e.addEventListener("click",g,false)}else{if(e.attachEvent){e.attachEvent("onclick",g)}}j.getButton=function(m){return j.theButtons[m]};j.getButtonElement=function(m){return document.getElementById(h+"_"+m)};d.instances[l]=j;if(!d.instances[0]){d.instances[0]=d.instances[l];c(function(){d._buttonsInit()})}};d.instances={};d.registerButton=function(f,e){b[f]=e};d.getInstance=function(e){return d.instances[e]};d._buttonsInit=function(){var q=this,p,h,e,j,o,n,m,f,l,k,g;for(f in q.instances){if(f==0){continue}p=q.instances[f];h=p.canvas;e=p.name;j=p.settings;m="";o={};n={};for(l in edButtons){if(!edButtons[l]){continue}o[edButtons[l].id]=edButtons[l]}if(f=="content"&&typeof(adminpage)=="string"&&(adminpage=="post-new-php"||adminpage=="post-php")){o.fullscreen=new d.FullscreenButton()}for(l in q._customButtons){if(!o[l]){o[l]=new q._customButtons[l]()}}if(j.buttons){k=j.buttons.split(",");for(l in k){g=k[l];if(o[g]){n[g]=o[g]}}}else{n=o}if(j.disabled_buttons){k=j.disabled_buttons.split(",");for(l in k){g=k[l];if(n[g]){delete (n[g])}}}for(l in n){if(!n[l]||!n[l].html){continue}m+=n[l].html(e+"_")}p.toolbar.innerHTML=m;p.theButtons=n}q.buttonsInitDone=true};d.addButton=function(l,j,f,e,i,k,h){var g;if(!l||!j){return}h=h||0;e=e||"";if(typeof(f)==="function"){g=new d.Button(l,j,i,k);g.callback=f}else{if(typeof(f)==="string"){g=new d.TagButton(l,j,f,e,i,k)}else{return}}if(h==-1){return g}if(h>0){while(typeof(edButtons[h])!="undefined"){h++}edButtons[h]=g}else{edButtons[edButtons.length]=g}if(this.buttonsInitDone){this._buttonsInit()}};d.insertContent=function(h){var i,g,f,j,k,e=document.getElementById(wpActiveEditor);if(!e){return false}if(document.selection){e.focus();i=document.selection.createRange();i.text=h;e.focus()}else{if(e.selectionStart||e.selectionStart=="0"){k=e.value;g=e.selectionStart;f=e.selectionEnd;j=e.scrollTop;e.value=k.substring(0,g)+h+k.substring(f,k.length);e.focus();e.selectionStart=g+h.length;e.selectionEnd=g+h.length;e.scrollTop=j}else{e.value+=h;e.focus()}}return true};d.Button=function(i,g,e,h){var f=this;f.id=i;f.display=g;f.access=e;f.title=h||""};d.Button.prototype.html=function(f){var e=this.access?' accesskey="'+this.access+'"':"";return'<input type="button" id="'+f+this.id+'"'+e+' class="ed_button" title="'+this.title+'" value="'+this.display+'" />'};d.Button.prototype.callback=function(){};d.TagButton=function(k,i,g,f,e,j){var h=this;d.Button.call(h,k,i,e,j);h.tagStart=g;h.tagEnd=f};d.TagButton.prototype=new d.Button();d.TagButton.prototype.openTag=function(h,f){var g=this;if(!f.openTags){f.openTags=[]}if(g.tagEnd){f.openTags.push(g.id);h.value="/"+h.value}};d.TagButton.prototype.closeTag=function(j,f){var h=this,g=h.isOpen(f);if(g!==false){f.openTags.splice(g,1)}j.value=h.display};d.TagButton.prototype.isOpen=function(e){var h=this,g=0,f=false;if(e.openTags){while(f===false&&g<e.openTags.length){f=e.openTags[g]==h.id?g:false;g++}}else{f=false}return f};d.TagButton.prototype.callback=function(p,j,q){var w=this,s,f,n,h,u=j.value,k,e,o,g,m=u?w.tagEnd:"";if(document.selection){j.focus();g=document.selection.createRange();if(g.text.length>0){if(!w.tagEnd){g.text=g.text+w.tagStart}else{g.text=w.tagStart+g.text+m}}else{if(!w.tagEnd){g.text=w.tagStart}else{if(w.isOpen(q)===false){g.text=w.tagStart;w.openTag(p,q)}else{g.text=m;w.closeTag(p,q)}}}j.focus()}else{if(j.selectionStart||j.selectionStart=="0"){s=j.selectionStart;f=j.selectionEnd;n=f;h=j.scrollTop;k=u.substring(0,s);e=u.substring(f,u.length);o=u.substring(s,f);if(s!=f){if(!w.tagEnd){j.value=k+o+w.tagStart+e;n+=w.tagStart.length}else{j.value=k+w.tagStart+o+m+e;n+=w.tagStart.length+m.length}}else{if(!w.tagEnd){j.value=k+w.tagStart+e;n=s+w.tagStart.length}else{if(w.isOpen(q)===false){j.value=k+w.tagStart+e;w.openTag(p,q);n=s+w.tagStart.length}else{j.value=k+m+e;n=s+m.length;w.closeTag(p,q)}}}j.focus();j.selectionStart=n;j.selectionEnd=n;j.scrollTop=h}else{if(!m){j.value+=w.tagStart}else{if(w.isOpen(q)!==false){j.value+=w.tagStart;w.openTag(p,q)}else{j.value+=m;w.closeTag(p,q)}}j.focus()}}};d.SpellButton=function(){d.Button.call(this,"spell",quicktagsL10n.lookup,"",quicktagsL10n.dictionaryLookup)};d.SpellButton.prototype=new d.Button();d.SpellButton.prototype.callback=function(i,h,e){var k="",j,g,f;if(document.selection){h.focus();j=document.selection.createRange();if(j.text.length>0){k=j.text}}else{if(h.selectionStart||h.selectionStart=="0"){g=h.selectionStart;f=h.selectionEnd;if(g!=f){k=h.value.substring(g,f)}}}if(k===""){k=prompt(quicktagsL10n.wordLookup,"")}if(k!==null&&/^\w[\w ]*$/.test(k)){window.open("http://www.answers.com/"+encodeURIComponent(k))}};d.CloseButton=function(){d.Button.call(this,"close",quicktagsL10n.closeTags,"",quicktagsL10n.closeAllOpenTags)};d.CloseButton.prototype=new d.Button();d._close=function(j,k,f){var h,g,i=f.openTags;if(i){while(i.length>0){h=f.getButton(i[i.length-1]);g=document.getElementById(f.name+"_"+h.id);h.callback.call(h,g,k,f)}}};d.CloseButton.prototype.callback=d._close;d.closeAllTags=function(f){var e=this.getInstance(f);d._close("",e.canvas,e)};d.LinkButton=function(){d.TagButton.call(this,"link","link","","</a>","a")};d.LinkButton.prototype=new d.TagButton();d.LinkButton.prototype.callback=function(j,k,h,g){var f,i=this;if(typeof(wpLink)!="undefined"){wpLink.open();return}if(!g){g="http://"}if(i.isOpen(h)===false){f=prompt(quicktagsL10n.enterURL,g);if(f){i.tagStart='<a href="'+f+'">';d.TagButton.prototype.callback.call(i,j,k,h)}}else{d.TagButton.prototype.callback.call(i,j,k,h)}};d.ImgButton=function(){d.TagButton.call(this,"img","img","","","m")};d.ImgButton.prototype=new d.TagButton();d.ImgButton.prototype.callback=function(i,k,g,f){if(!f){f="http://"}var j=prompt(quicktagsL10n.enterImageURL,f),h;if(j){h=prompt(quicktagsL10n.enterImageDescription,"");this.tagStart='<img src="'+j+'" alt="'+h+'" />';d.TagButton.prototype.callback.call(this,i,k,g)}};d.FullscreenButton=function(){d.Button.call(this,"fullscreen",quicktagsL10n.fullscreen,"f",quicktagsL10n.toggleFullscreen)};d.FullscreenButton.prototype=new d.Button();d.FullscreenButton.prototype.callback=function(f,g){if(g.id!="content"||typeof(fullscreen)=="undefined"){return}fullscreen.on()};edButtons[10]=new d.TagButton("strong","b","<strong>","</strong>","b");edButtons[20]=new d.TagButton("em","i","<em>","</em>","i"),edButtons[30]=new d.LinkButton(),edButtons[40]=new d.TagButton("block","b-quote","\n\n<blockquote>","</blockquote>\n\n","q"),edButtons[50]=new d.TagButton("del","del",'<del datetime="'+a+'">',"</del>","d"),edButtons[60]=new d.TagButton("ins","ins",'<ins datetime="'+a+'">',"</ins>","s"),edButtons[70]=new d.ImgButton(),edButtons[80]=new d.TagButton("ul","ul","<ul>\n","</ul>\n\n","u"),edButtons[90]=new d.TagButton("ol","ol","<ol>\n","</ol>\n\n","o"),edButtons[100]=new d.TagButton("li","li","\t<li>","</li>\n","l"),edButtons[110]=new d.TagButton("code","code","<code>","</code>","c"),edButtons[120]=new d.TagButton("more","more","<!--more-->","","t"),edButtons[130]=new d.SpellButton(),edButtons[140]=new d.CloseButton()})();
     1var QTags,edButtons=[],edCanvas,edAddTag=function(){},edCheckOpenTags=function(){},edCloseAllTags=function(){},edInsertImage=function(){},edInsertLink=function(){},edInsertTag=function(){},edLink=function(){},edQuickLink=function(){},edRemoveTag=function(){},edShowButton=function(){},edShowLinks=function(){},edSpell=function(){},edToolbar=function(){};function quicktags(a){return new QTags(a)}function edInsertContent(b,a){return QTags.insertContent(a)}function edButton(f,e,c,b,a,d){return QTags.addButton(f,e,c,b,a,"",-1)}(function(){var c=function(h){var g,f,e;if(typeof jQuery!="undefined"){jQuery(document).ready(h)}else{g=c;g.funcs=[];g.ready=function(){if(!g.isReady){g.isReady=true;for(f=0;f<g.funcs.length;f++){g.funcs[f]()}}};if(g.isReady){h()}else{g.funcs.push(h)}if(!g.eventAttached){if(document.addEventListener){e=function(){document.removeEventListener("DOMContentLoaded",e,false);g.ready()};document.addEventListener("DOMContentLoaded",e,false);window.addEventListener("load",g.ready,false)}else{if(document.attachEvent){e=function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",e);g.ready()}};document.attachEvent("onreadystatechange",e);window.attachEvent("onload",g.ready);(function(){try{document.documentElement.doScroll("left")}catch(i){setTimeout(arguments.callee,50);return}g.ready()})()}}g.eventAttached=true}}},a=(function(){var e=new Date(),f;f=function(g){var h=g.toString();if(h.length<2){h="0"+h}return h};return e.getUTCFullYear()+"-"+f(e.getUTCMonth()+1)+"-"+f(e.getUTCDate())+"T"+f(e.getUTCHours())+":"+f(e.getUTCMinutes())+":"+f(e.getUTCSeconds())+"+00:00"})(),b={},d;d=QTags=function(k){if(typeof(k)=="string"){k={id:k}}else{if(typeof(k)!="object"){return false}}var j=this,l=k.id,i=document.getElementById(l),h="qt_"+l,e,g,f;if(!l||!i){return false}j.name=h;j.id=l;j.canvas=i;j.settings=k;if(l=="content"&&typeof(adminpage)=="string"&&(adminpage=="post-new-php"||adminpage=="post-php")){edCanvas=i;f="ed_toolbar"}else{f=h+"_toolbar"}e=document.createElement("div");e.id=f;e.className="quicktags-toolbar";i.parentNode.insertBefore(e,i);j.toolbar=e;g=function(o){o=o||window.event;var n=o.target||o.srcElement,m;if(/\s+ed_button\s+/.test(" "+n.className+" ")){j.canvas=i=document.getElementById(l);m=n.id.replace(h+"_","");if(j.theButtons[m]){j.theButtons[m].callback.call(j.theButtons[m],n,i,j)}}};if(e.addEventListener){e.addEventListener("click",g,false)}else{if(e.attachEvent){e.attachEvent("onclick",g)}}j.getButton=function(m){return j.theButtons[m]};j.getButtonElement=function(m){return document.getElementById(h+"_"+m)};d.instances[l]=j;if(!d.instances[0]){d.instances[0]=d.instances[l];c(function(){d._buttonsInit()})}};d.instances={};d.registerButton=function(f,e){b[f]=e};d.getInstance=function(e){return d.instances[e]};d._buttonsInit=function(){var q=this,p,h,e,j,o,n,m,f,l,k,g;for(f in q.instances){if(f==0){continue}p=q.instances[f];h=p.canvas;e=p.name;j=p.settings;m="";o={};n={};for(l in edButtons){if(!edButtons[l]){continue}o[edButtons[l].id]=edButtons[l]}if(f=="content"&&typeof(adminpage)=="string"&&(adminpage=="post-new-php"||adminpage=="post-php")){o.fullscreen=new d.FullscreenButton()}for(l in q._customButtons){if(!o[l]){o[l]=new q._customButtons[l]()}}if(j.buttons){k=j.buttons.split(",");for(l in k){g=k[l];if(o[g]){n[g]=o[g]}}}else{n=o}if(j.disabled_buttons){k=j.disabled_buttons.split(",");for(l in k){g=k[l];if(n[g]){delete (n[g])}}}for(l in n){if(!n[l]||!n[l].html){continue}m+=n[l].html(e+"_")}p.toolbar.innerHTML=m;p.theButtons=n}q.buttonsInitDone=true};d.addButton=function(l,j,f,e,i,k,h){var g;if(!l||!j){return}h=h||0;e=e||"";if(typeof(f)==="function"){g=new d.Button(l,j,i,k);g.callback=f}else{if(typeof(f)==="string"){g=new d.TagButton(l,j,f,e,i,k)}else{return}}if(h==-1){return g}if(h>0){while(typeof(edButtons[h])!="undefined"){h++}edButtons[h]=g}else{edButtons[edButtons.length]=g}if(this.buttonsInitDone){this._buttonsInit()}};d.insertContent=function(h){var i,g,f,j,k,e=document.getElementById(wpActiveEditor);if(!e){return false}if(document.selection){e.focus();i=document.selection.createRange();i.text=h;e.focus()}else{if(e.selectionStart||e.selectionStart=="0"){k=e.value;g=e.selectionStart;f=e.selectionEnd;j=e.scrollTop;e.value=k.substring(0,g)+h+k.substring(f,k.length);e.focus();e.selectionStart=g+h.length;e.selectionEnd=g+h.length;e.scrollTop=j}else{e.value+=h;e.focus()}}return true};d.Button=function(i,g,e,h){var f=this;f.id=i;f.display=g;f.access=e;f.title=h||""};d.Button.prototype.html=function(f){var e=this.access?' accesskey="'+this.access+'"':"";return'<input type="button" id="'+f+this.id+'"'+e+' class="ed_button" title="'+this.title+'" value="'+this.display+'" />'};d.Button.prototype.callback=function(){};d.TagButton=function(k,i,g,f,e,j){var h=this;d.Button.call(h,k,i,e,j);h.tagStart=g;h.tagEnd=f};d.TagButton.prototype=new d.Button();d.TagButton.prototype.openTag=function(h,f){var g=this;if(!f.openTags){f.openTags=[]}if(g.tagEnd){f.openTags.push(g.id);h.value="/"+h.value}};d.TagButton.prototype.closeTag=function(j,f){var h=this,g=h.isOpen(f);if(g!==false){f.openTags.splice(g,1)}j.value=h.display};d.TagButton.prototype.isOpen=function(e){var h=this,g=0,f=false;if(e.openTags){while(f===false&&g<e.openTags.length){f=e.openTags[g]==h.id?g:false;g++}}else{f=false}return f};d.TagButton.prototype.callback=function(p,j,q){var w=this,s,f,n,h,u=j.value,k,e,o,g,m=u?w.tagEnd:"";if(document.selection){j.focus();g=document.selection.createRange();if(g.text.length>0){if(!w.tagEnd){g.text=g.text+w.tagStart}else{g.text=w.tagStart+g.text+m}}else{if(!w.tagEnd){g.text=w.tagStart}else{if(w.isOpen(q)===false){g.text=w.tagStart;w.openTag(p,q)}else{g.text=m;w.closeTag(p,q)}}}j.focus()}else{if(j.selectionStart||j.selectionStart=="0"){s=j.selectionStart;f=j.selectionEnd;n=f;h=j.scrollTop;k=u.substring(0,s);e=u.substring(f,u.length);o=u.substring(s,f);if(s!=f){if(!w.tagEnd){j.value=k+o+w.tagStart+e;n+=w.tagStart.length}else{j.value=k+w.tagStart+o+m+e;n+=w.tagStart.length+m.length}}else{if(!w.tagEnd){j.value=k+w.tagStart+e;n=s+w.tagStart.length}else{if(w.isOpen(q)===false){j.value=k+w.tagStart+e;w.openTag(p,q);n=s+w.tagStart.length}else{j.value=k+m+e;n=s+m.length;w.closeTag(p,q)}}}j.focus();j.selectionStart=n;j.selectionEnd=n;j.scrollTop=h}else{if(!m){j.value+=w.tagStart}else{if(w.isOpen(q)!==false){j.value+=w.tagStart;w.openTag(p,q)}else{j.value+=m;w.closeTag(p,q)}}j.focus()}}};d.SpellButton=function(){d.Button.call(this,"spell",quicktagsL10n.lookup,"",quicktagsL10n.dictionaryLookup)};d.SpellButton.prototype=new d.Button();d.SpellButton.prototype.callback=function(i,h,e){var k="",j,g,f;if(document.selection){h.focus();j=document.selection.createRange();if(j.text.length>0){k=j.text}}else{if(h.selectionStart||h.selectionStart=="0"){g=h.selectionStart;f=h.selectionEnd;if(g!=f){k=h.value.substring(g,f)}}}if(k===""){k=prompt(quicktagsL10n.wordLookup,"")}if(k!==null&&/^\w[\w ]*$/.test(k)){window.open("http://www.answers.com/"+encodeURIComponent(k))}};d.CloseButton=function(){d.Button.call(this,"close",quicktagsL10n.closeTags,"",quicktagsL10n.closeAllOpenTags)};d.CloseButton.prototype=new d.Button();d._close=function(j,k,f){var h,g,i=f.openTags;if(i){while(i.length>0){h=f.getButton(i[i.length-1]);g=document.getElementById(f.name+"_"+h.id);h.callback.call(h,g,k,f)}}};d.CloseButton.prototype.callback=d._close;d.closeAllTags=function(f){var e=this.getInstance(f);d._close("",e.canvas,e)};d.LinkButton=function(){d.TagButton.call(this,"link","link","","</a>","a")};d.LinkButton.prototype=new d.TagButton();d.LinkButton.prototype.callback=function(j,k,h,g){var f,i=this;if(typeof(wpLink)!="undefined"){wpLink.open();return}if(!g){g="http://"}if(i.isOpen(h)===false){f=prompt(quicktagsL10n.enterURL,g);if(f){i.tagStart='<a href="'+f+'">';d.TagButton.prototype.callback.call(i,j,k,h)}}else{d.TagButton.prototype.callback.call(i,j,k,h)}};d.ImgButton=function(){d.TagButton.call(this,"img","img","","","m")};d.ImgButton.prototype=new d.TagButton();d.ImgButton.prototype.callback=function(i,k,g,f){if(!f){f="http://"}var j=prompt(quicktagsL10n.enterImageURL,f),h;if(j){h=prompt(quicktagsL10n.enterImageDescription,"");this.tagStart='<img src="'+j+'" alt="'+h+'" />';d.TagButton.prototype.callback.call(this,i,k,g)}};d.FullscreenButton=function(){d.Button.call(this,"fullscreen",quicktagsL10n.fullscreen,"f",quicktagsL10n.toggleFullscreen)};d.FullscreenButton.prototype=new d.Button();d.FullscreenButton.prototype.callback=function(f,g){if(g.id!="content"||typeof(fullscreen)=="undefined"){return}fullscreen.on()};edButtons[10]=new d.TagButton("strong","b","<strong>","</strong>","b");edButtons[20]=new d.TagButton("em","i","<em>","</em>","i"),edButtons[30]=new d.LinkButton(),edButtons[40]=new d.TagButton("block","b-quote","\n\n<blockquote>","</blockquote>\n\n","q"),edButtons[50]=new d.TagButton("del","del",'<del datetime="'+a+'">',"</del>","d"),edButtons[60]=new d.TagButton("ins","ins",'<ins datetime="'+a+'">',"</ins>","s"),edButtons[70]=new d.ImgButton(),edButtons[80]=new d.TagButton("ul","ul","<ul>\n","</ul>\n\n","u"),edButtons[90]=new d.TagButton("ol","ol","<ol>\n","</ol>\n\n","o"),edButtons[100]=new d.TagButton("li","li","\t<li>","</li>\n","l"),edButtons[110]=new d.TagButton("code","code","<code>","</code>","c"),edButtons[120]=new d.TagButton("more","more","<!--more-->","","t"),edButtons[130]=new d.SpellButton(),edButtons[140]=new d.CloseButton()})();
  • trunk/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css

    r18660 r18766  
    6363    background-color: #f3f3f3;
    6464    padding-top: 4px;
    65     margin: 10px;
    66     -moz-border-radius: 3px;
    67     -khtml-border-radius: 3px;
     65    margin: 10px 0;
    6866    -webkit-border-radius: 3px;
    6967    border-radius: 3px;
  • trunk/wp-includes/script-loader.php

    r18762 r18766  
    277277    $scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array( 'jquery' ), '20110515', 1 );
    278278
    279     $scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox' ), '20110805', 1 );
     279    $scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox' ), '20110922', 1 );
    280280
    281281    if ( is_admin() ) {
Note: See TracChangeset for help on using the changeset viewer.