Make WordPress Core


Ignore:
Timestamp:
02/18/2008 05:11:12 PM (18 years ago)
Author:
ryan
Message:

TinyMCE config enhancements from azaozz. fixes #5896 #5888

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/general-template.php

    r6767 r6894  
    924924        $rows = 12;
    925925
    926     $rows = "rows='$rows'";
    927 
    928     if ( user_can_richedit() ) :
    929         $wp_default_editor = wp_default_editor();
    930         $active = " class='active'";
    931         $inactive = " onclick='switchEditors.go(\"$id\");'";
    932 
    933         if ( 'tinymce' == $wp_default_editor )
    934             add_filter('the_editor_content', 'wp_richedit_pre');
    935         else if ( 'html' == $wp_default_editor )
    936             add_filter('the_editor_content', 'wp_htmledit_pre');
    937 
    938         //  The following line moves the border so that the active button "attaches" to the toolbar. Only IE needs it.
    939         ?>
    940     <style type="text/css">
    941         #postdivrich table, #postdivrich #quicktags {border-top: none;}
    942         #quicktags {border-bottom: none; padding-bottom: 2px; margin-bottom: -1px;}
    943     </style>
    944 
    945     <div id='editor-toolbar' style='display:none;'>
    946         <div class='zerosize'><input accesskey='e' type='button' onclick='switchEditors.go("<?php echo $id; ?>")' /></div>
    947         <a id='edButtonHTML'<?php echo 'html' == $wp_default_editor ? $active : $inactive; ?>><?php _e('HTML'); ?></a>
    948             <a id='edButtonPreview'<?php echo 'tinymce' == $wp_default_editor ? $active : $inactive; ?>><?php _e('Visual'); ?></a>
    949 
    950             <div id="media-buttons">
    951             <?php _e('Add media:'); ?>
    952             <?php do_action( 'media_buttons'); ?>
    953             </div>
     926    $rows = "rows='$rows'"; ?>
     927    <div id="editor-toolbar">
     928    <?php if ( user_can_richedit() ) {
     929        $wp_default_editor = wp_default_editor(); ?>
     930        <div class="zerosize"><input accesskey="e" type="button" onclick="switchEditors.go('<?php echo $id; ?>')" /></div>
     931        <?php if ( 'tinymce' == $wp_default_editor ) {
     932            add_filter('the_editor_content', 'wp_richedit_pre'); ?>
     933            <a id="edButtonHTML" onclick="switchEditors.go('<?php echo $id; ?>');"><?php _e('HTML'); ?></a>
     934            <a id="edButtonPreview" class="active"><?php _e('Visual'); ?></a>
     935        <?php } elseif ( 'html' == $wp_default_editor ) {
     936            add_filter('the_editor_content', 'wp_htmledit_pre'); ?>
     937            <a id="edButtonHTML" class="active"><?php _e('HTML'); ?></a>
     938            <a id="edButtonPreview" onclick="switchEditors.go('<?php echo $id; ?>');"><?php _e('Visual'); ?></a>
     939        <?php }
     940    } ?>
     941        <div id="media-buttons">
     942        <?php _e('Add media:'); ?>
     943        <?php do_action( 'media_buttons'); ?>
     944        </div>
    954945    </div>
    955 
    956     <script type="text/javascript">
    957     // <![CDATA[
    958         if ( typeof tinyMCE != "undefined" )
    959             document.getElementById('editor-toolbar').style.display = 'block';
    960     // ]]>
    961     </script>
    962    
    963     <?php else: // Rich editor is disabled in profile but we still need the media buttons   ?>
    964        
    965     <div id='editor-toolbar' style='display:block;'>
    966             <div id="media-buttons">
    967             <?php _e('Add media:'); ?>
    968             <?php do_action( 'media_buttons'); ?>
    969             </div>
    970     </div>
    971 
    972     <?php endif; // user_can_richedit() ?>
    973946
    974947    <div id="quicktags">
     
    977950    </div>
    978951
    979     <?php if ( 'html' != $wp_default_editor ) : ?>
    980     <script type="text/javascript">
    981     // <![CDATA[
    982         if ( typeof tinyMCE != "undefined" )
    983             document.getElementById("quicktags").style.display="none";
    984     // ]]>
    985     </script>
    986     <?php endif; // 'html' != $wp_default_editor
     952    <?php if ( 'html' != $wp_default_editor ) : ?>
     953    <script type="text/javascript">
     954    // <![CDATA[
     955        if ( typeof tinyMCE != "undefined" )
     956            document.getElementById("quicktags").style.display="none";
     957    // ]]>
     958    </script>
     959    <?php endif; // 'html' != $wp_default_editor
    987960
    988961    $the_editor = apply_filters('the_editor', "<div id='editorcontainer'><textarea class='' $rows cols='40' name='$id' tabindex='2' id='$id'>%s</textarea></div>\n");
     
    992965
    993966    ?>
    994     <script type="text/javascript">
    995     //<!--
    996     edCanvas = document.getElementById('<?php echo $id; ?>');
    997     <?php if ( $prev_id && user_can_richedit() ) : ?>
    998     // If tinyMCE is defined.
    999     if ( typeof tinyMCE != 'undefined' ) {
    1000     // This code is meant to allow tabbing from Title to Post (TinyMCE).
     967    <script type="text/javascript">
     968    // <![CDATA[
     969    edCanvas = document.getElementById('<?php echo $id; ?>');
     970    <?php if ( $prev_id && user_can_richedit() ) : ?>
     971    // If tinyMCE is defined.
     972    if ( typeof tinyMCE != 'undefined' ) {
     973    // This code is meant to allow tabbing from Title to Post (TinyMCE).
    1001974        document.getElementById('<?php echo $prev_id; ?>').onkeydown = function (e) {
    1002975            e = e || window.event;
     
    1011984            }
    1012985        }
    1013     }
    1014     <?php endif; ?>
    1015     //-->
    1016     </script>
    1017     <?php
     986    }
     987    <?php endif; ?>
     988    // ]]>
     989    </script>
     990    <?php
    1018991}
    1019992
Note: See TracChangeset for help on using the changeset viewer.