Tabbed editor fixes from skeltoac. #2829

git-svn-id: http://svn.automattic.com/wordpress/trunk@4210 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-09-22 22:24:50 +00:00
parent 6e9539c22c
commit a855814939
4 changed files with 20 additions and 15 deletions

View File

@ -1963,16 +1963,6 @@ function wp_import_handle_upload() {
return array('file' => $file, 'id' => $id); return array('file' => $file, 'id' => $id);
} }
function user_can_richedit() {
if ( 'true' != get_user_option('rich_editing') )
return false;
if ( preg_match('!opera[ /][2-8]|konqueror|safari!i', $_SERVER['HTTP_USER_AGENT']) )
return false;
return true; // Best guess
}
function the_attachment_links($id = false) { function the_attachment_links($id = false) {
$id = (int) $id; $id = (int) $id;
$post = & get_post($id); $post = & get_post($id);

View File

@ -12,8 +12,7 @@ if ( isset( $_POST['deletecomment'] ) )
switch($action) { switch($action) {
case 'editcomment': case 'editcomment':
$title = __('Edit Comment'); $title = __('Edit Comment');
if ( user_can_richedit() )
wp_enqueue_script( 'wp_tiny_mce' );
require_once ('admin-header.php'); require_once ('admin-header.php');
$comment = (int) $_GET['comment']; $comment = (int) $_GET['comment'];

View File

@ -735,6 +735,15 @@ function noindex() {
echo "<meta name='robots' content='noindex,nofollow' />\n"; echo "<meta name='robots' content='noindex,nofollow' />\n";
} }
function user_can_richedit() {
$can = true;
if ( 'true' != get_user_option('rich_editing') || preg_match('!opera[ /][2-8]|konqueror|safari!i', $_SERVER['HTTP_USER_AGENT']) )
$can = false;
return apply_filters('user_can_richedit', $can);
}
function the_editor($content, $id = 'content', $prev_id = 'title') { function the_editor($content, $id = 'content', $prev_id = 'title') {
$rows = get_option('default_post_edit_rows'); $rows = get_option('default_post_edit_rows');
if (($rows < 3) || ($rows > 100)) if (($rows < 3) || ($rows > 100))
@ -747,11 +756,11 @@ function the_editor($content, $id = 'content', $prev_id = 'title') {
// The following line moves the border so that the active button "attaches" to the toolbar. Only IE needs it. // The following line moves the border so that the active button "attaches" to the toolbar. Only IE needs it.
?> ?>
<!--[if IE]><style type="text/css"> <style type="text/css">
#postdivrich table, #postdivrich #quicktags {border-top: none;} #postdivrich table, #postdivrich #quicktags {border-top: none;}
#quicktags {border-bottom: none; padding-bottom: 2px; margin-bottom: -1px;} #quicktags {border-bottom: none; padding-bottom: 2px; margin-bottom: -1px;}
#edButtons {border-bottom: 1px solid #ccc;} #edButtons {border-bottom: 1px solid #ccc;}
</style><![endif]--> </style>
<div id='edButtons' style='display:none;'> <div id='edButtons' style='display:none;'>
<div class='zerosize'><input accesskey='e' type='button' onclick='switchEditors("<?php echo $id; ?>")' /></div> <div class='zerosize'><input accesskey='e' type='button' onclick='switchEditors("<?php echo $id; ?>")' /></div>
<input id='edButtonPreview' class='edButtonFore' type='button' value='<?php _e('Compose'); ?>' /> <input id='edButtonPreview' class='edButtonFore' type='button' value='<?php _e('Compose'); ?>' />

View File

@ -473,8 +473,8 @@ function switchEditors(id) {
var qt = document.getElementById('quicktags'); var qt = document.getElementById('quicktags');
var H = document.getElementById('edButtonHTML'); var H = document.getElementById('edButtonHTML');
var P = document.getElementById('edButtonPreview'); var P = document.getElementById('edButtonPreview');
var pdr = document.getElementById('postdivrich');
var ta = document.getElementById(id); var ta = document.getElementById(id);
var pdr = ta.parentNode;
if ( inst ) { if ( inst ) {
edToggle(H, P); edToggle(H, P);
@ -492,6 +492,13 @@ function switchEditors(id) {
var table = document.getElementById(inst.editorId + '_parent').getElementsByTagName('table')[0]; var table = document.getElementById(inst.editorId + '_parent').getElementsByTagName('table')[0];
var y1 = table.offsetTop + table.offsetHeight; var y1 = table.offsetTop + table.offsetHeight;
if ( TinyMCE_AdvancedTheme._getCookie("TinyMCE_" + inst.editorId + "_height") == null ) {
var expires = new Date();
expires.setTime(expires.getTime() + 3600000 * 24 * 30);
var offset = tinyMCE.isMSIE ? 1 : 2;
TinyMCE_AdvancedTheme._setCookie("TinyMCE_" + inst.editorId + "_height", "" + (table.offsetHeight - offset), expires);
}
// Unload the rich editor // Unload the rich editor
inst.triggerSave(false, false); inst.triggerSave(false, false);
htm = inst.formElement.value; htm = inst.formElement.value;