Ticket #16695: 16695.2.diff

File 16695.2.diff, 4.0 KB (added by filosofo, 2 years ago)
  • wp-includes/js/quicktags.dev.js

     
    44 
    55var edButtons = new Array(), edLinks = new Array(), edOpenTags = new Array(), now = new Date(), datetime; 
    66 
     7// cross browser dom ready 
     8(function(func,w) { 
     9        if (typeof jQuery != 'undefined') { 
     10                jQuery(func); 
     11        } else { 
     12                if ( w.addEventListener ) 
     13                        w.addEventListener('load', func, false); 
     14                else if ( w.attachEvent ) 
     15                        w.attachEvent( 'onload', func ); 
     16        } 
     17})(edToolbar,window); 
     18 
    719function edButton(id, display, tagStart, tagEnd, access, open) { 
    820        this.id = id;                           // used to name the toolbar button 
    921        this.display = display;         // label on button 
     
    154166 
    155167function edShowButton(button, i) { 
    156168        if (button.id == 'ed_img') { 
    157                 document.write('<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertImage(edCanvas);" value="' + button.display + '" />'); 
     169                return '<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertImage(edCanvas);" value="' + button.display + '" />'; 
    158170        } 
    159171        else if (button.id == 'ed_link') { 
    160                 document.write('<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertLink(edCanvas, ' + i + ');" value="' + button.display + '" />'); 
     172                return '<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertLink(edCanvas, ' + i + ');" value="' + button.display + '" />'; 
    161173        } 
    162174        else { 
    163                 document.write('<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertTag(edCanvas, ' + i + ');" value="' + button.display + '"  />'); 
     175                return '<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertTag(edCanvas, ' + i + ');" value="' + button.display + '"  />'; 
    164176        } 
    165177} 
    166178 
     
    170182                tempStr += '<option value="' + i + '">' + edLinks[i].display + '</option>'; 
    171183        } 
    172184        tempStr += '</select>'; 
    173         document.write(tempStr); 
     185        return tempStr; 
    174186} 
    175187 
    176188function edAddTag(button) { 
     
    253265} 
    254266 
    255267function edToolbar() { 
    256         document.write('<div id="ed_toolbar">'); 
     268        var tb = document.getElementById('ed_toolbar'), html = ''; 
     269 
    257270        for (var i = 0; i < edButtons.length; i++) { 
    258                 edShowButton(edButtons[i], i); 
     271                html += edShowButton(edButtons[i], i); 
    259272        } 
    260         document.write('<input type="button" id="ed_spell" class="ed_button" onclick="edSpell(edCanvas);" title="' + quicktagsL10n.dictionaryLookup + '" value="' + quicktagsL10n.lookup + '" />'); 
    261         document.write('<input type="button" id="ed_close" class="ed_button" onclick="edCloseAllTags();" title="' + quicktagsL10n.closeAllOpenTags + '" value="' + quicktagsL10n.closeTags + '" />'); 
    262 //      edShowLinks(); // disabled by default 
    263         document.write('</div>'); 
     273         
     274        html += '<input type="button" id="ed_spell" class="ed_button" onclick="edSpell(edCanvas);" title="' + quicktagsL10n.dictionaryLookup + '" value="' + quicktagsL10n.lookup + '" />'; 
     275        html += '<input type="button" id="ed_close" class="ed_button" onclick="edCloseAllTags();" title="' + quicktagsL10n.closeAllOpenTags + '" value="' + quicktagsL10n.closeTags + '" />'; 
     276 
     277        // html += edShowLinks(); // disabled by default 
     278        tb.innerHTML = html; 
    264279} 
    265280 
    266281// insertion code 
  • wp-includes/general-template.php

     
    18271827?> 
    18281828        <div id="quicktags"><?php 
    18291829        wp_print_scripts( 'quicktags' ); ?> 
    1830         <script type="text/javascript">edToolbar()</script> 
     1830        <div id="ed_toolbar"> 
    18311831        </div> 
     1832        </div> 
    18321833 
    18331834<?php 
    18341835        $the_editor = apply_filters('the_editor', "<div id='editorcontainer'><textarea rows='$rows'$class cols='40' name='$id' tabindex='$tab_index' id='$id'>%s</textarea></div>\n");