Make WordPress Core


Ignore:
Timestamp:
03/30/2006 07:50:33 AM (20 years ago)
Author:
ryan
Message:

tinyMCE 2.0.5 coming at you live. fixes #2598

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions-post.php

    r3663 r3664  
    10291029        generic_ping();
    10301030}
     1031
     1032/**
     1033 * Places two script links in <head>: one to get tinyMCE (big), one to configure and start it (small)
     1034 */
     1035function tinymce_include() {
     1036        $src1 = get_settings('siteurl') . '/wp-includes/js/tinymce/tiny_mce_gzip.php';
     1037        $src2 = get_settings('siteurl') . '/wp-includes/js/tinymce/tiny_mce_config.php';
     1038
     1039        echo "<script type='text/javascript' src='$src1'></script>\n";
     1040        echo "<script type='text/javascript' src='$src2'></script>\n";
     1041}
     1042
     1043/**
     1044 * Places a textarea according to the current user's preferences, filled with $content.
     1045 * Also places a script block that enables tabbing between Title and Content.
     1046 *
     1047 * @param string Editor contents
     1048 * @param string (optional) Previous form field's ID (for tabbing support)
     1049 */
     1050function the_editor($content, $id = 'content', $prev_id = 'title') {
     1051        $rows = get_settings('default_post_edit_rows');
     1052        if (($rows < 3) || ($rows > 100))
     1053                $rows = 12;
     1054
     1055        $rows = "rows='$rows'";
     1056
     1057        the_quicktags();
     1058
     1059        if ( user_can_richedit() )
     1060                add_filter('the_editor_content', 'wp_richedit_pre');
     1061
     1062        $the_editor = apply_filters('the_editor', "<div><textarea class='mceEditor' $rows cols='40' name='$id' tabindex='2' id='$id'>%s</textarea></div>\n");
     1063        $the_editor_content = apply_filters('the_editor_content', $content);
     1064
     1065        printf($the_editor, $the_editor_content);
     1066
     1067        ?>
     1068        <script type="text/javascript">
     1069        //<!--
     1070        edCanvas = document.getElementById('<?php echo $id; ?>');
     1071        <?php if ( user_can_richedit() ) : ?>
     1072        // This code is meant to allow tabbing from Title to Post (TinyMCE).
     1073        if ( tinyMCE.isMSIE )
     1074                document.getElementById('<?php echo $prev_id; ?>').onkeydown = function (e)
     1075                        {
     1076                                e = e ? e : window.event;
     1077                                if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
     1078                                        var i = tinyMCE.selectedInstance;
     1079                                        if(typeof i ==  'undefined')
     1080                                                return true;
     1081                                        tinyMCE.execCommand("mceStartTyping");
     1082                                        this.blur();
     1083                                        i.contentWindow.focus();
     1084                                        e.returnValue = false;
     1085                                        return false;
     1086                                }
     1087                        }
     1088        else
     1089                document.getElementById('<?php echo $prev_id; ?>').onkeypress = function (e)
     1090                        {
     1091                                e = e ? e : window.event;
     1092                                if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
     1093                                        var i = tinyMCE.selectedInstance;
     1094                                        if(typeof i ==  'undefined')
     1095                                                return true;
     1096                                        tinyMCE.execCommand("mceStartTyping");
     1097                                        this.blur();
     1098                                        i.contentWindow.focus();
     1099                                        e.returnValue = false;
     1100                                        return false;
     1101                                }
     1102                        }
     1103        <?php endif; ?>
     1104        //-->
     1105        </script>
     1106        <?php
     1107}
     1108
    10311109?>
Note: See TracChangeset for help on using the changeset viewer.