_____/ On Sun 11 Dec 2005 15:43:55 GMT, [Gregory Wild-Smith] wrote : \_____
Roy Schestowitz wrote:Unless Andy has committed some changes, maybe disabling the toolbars undercertain circumstances, t rules out the possibility of AdBlock as the culprit.Do any of the images come up in the RTE under http://www.schestowitz.com/wp2-test/ . It's a public mock-up for automatedscreenshots to be taken; no use in navigating, but the JavaScript should comeup and work properly.Yes, though I get two sets of RTE's, the one at the top is normal size: no images, the one at the bottom looks normal. Not sure what that says about what is going on though, unless it's the same revision.
I don't know what effect recent changes have (see HTML attachment), but try overwriting your WordPress installation with last week's revision. Does that resolve the issue by any chance? http://wordpress.org/download/nightly-builds/wordpress-2005-12-05.tar.gz RoyTitle: [3283] trunk/wp-admin: MCE fix-em-ups from skeltoac.
- Revision
- 3283
- Author
- ryan
- Date
- 2005-12-09 19:24:14 +0000 (Fri, 09 Dec 2005)
Log Message
MCE fix-em-ups from skeltoac. fixes #1962
Modified Paths
- trunk/wp-admin/admin-functions.php
- trunk/wp-admin/admin-header.php
- trunk/wp-admin/edit-form-advanced.php
- trunk/wp-admin/edit-form-comment.php
- trunk/wp-admin/edit-page-form.php
- trunk/wp-admin/inline-uploading.php
- trunk/wp-admin/wp-admin.css
- trunk/wp-includes/js/quicktags.js
- trunk/wp-includes/js/tinymce/tiny_mce.js
Diff
Modified: trunk/wp-admin/admin-functions.php (3282 => 3283)
--- trunk/wp-admin/admin-functions.php 2005-12-09 19:21:39 UTC (rev 3282) +++ trunk/wp-admin/admin-functions.php 2005-12-09 19:24:14 UTC (rev 3283) @@ -1077,14 +1077,40 @@ function the_quicktags() { // Browser detection sucks, but until Safari supports the JS needed for this to work people just assume it's a bug in WP if (!strstr($_SERVER['HTTP_USER_AGENT'], 'Safari')) - : echo ' - <div id="quicktags"> + echo ' + <div id="quicktags"> <script src="" type="text/_javascript_"></script> - <script type="text/_javascript_">edToolbar();</script> - '; - echo '</div>'; - endif; + <script type="text/_javascript_">if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 ) edToolbar();</script> + </div> +'; + else echo ' +<script type="text/_javascript_"> +function edInsertContent(myField, myValue) { + //IE support + if (document.selection) { + myField.focus(); + sel = document.selection.createRange(); + sel.text = myValue; + myField.focus(); + } + //MOZILLA/NETSCAPE support + else if (myField.selectionStart || myField.selectionStart == "0") { + var startPos = myField.selectionStart; + var endPos = myField.selectionEnd; + myField.value = myField.value.substring(0, startPos) + + myValue + + myField.value.substring(endPos, myField.value.length); + myField.focus(); + myField.selectionStart = startPos + myValue.length; + myField.selectionEnd = startPos + myValue.length; + } else { + myField.value += myValue; + myField.focus(); + } } +</script> +'; +} function validate_current_theme() { $theme_loc = 'wp-content/themes'; @@ -1801,4 +1827,14 @@ 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 +} + ?>
Modified: trunk/wp-admin/admin-header.php (3282 => 3283)
--- trunk/wp-admin/admin-header.php 2005-12-09 19:21:39 UTC (rev 3282) +++ trunk/wp-admin/admin-header.php 2005-12-09 19:24:14 UTC (rev 3283) @@ -79,11 +79,13 @@ <script type="text/_javascript_" src=""></script> <script type="text/_javascript_" src=""></script> <?php if ( isset( $editing ) ) : ?> -<?php if ( $editing && 'true' == get_user_option('rich_editing') ) : +<?php if ( $editing && user_can_richedit() ) : $mce_plugins = apply_filters('mce_plugins', array('wordpress', 'autosave', 'wphelp')); $mce_plugins = implode($mce_plugins, ','); $mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'separator', 'bullist', 'numlist', 'outdent', 'indent', 'separator', 'justifyleft', 'justifycenter', 'justifyright' ,'separator', 'link', 'unlink', 'image', 'emotions', 'wordpress', 'separator', 'undo', 'redo', 'code', 'wphelp')); $mce_buttons = implode($mce_buttons, ','); +$mce_buttons_2 = apply_filters('mce_buttons_2', array()); +$mce_buttons_2 = implode($mce_buttons_2, ','); ?> <script language="_javascript_" type="text/_javascript_" src=""></script> <script type="text/_javascript_"> @@ -93,7 +95,7 @@ width : "100%", theme : "advanced", theme_advanced_buttons1 : "<?php echo $mce_buttons; ?>", - theme_advanced_buttons2 : "", + theme_advanced_buttons2 : "<?php echo $mce_buttons_2; ?>", theme_advanced_buttons3 : "", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", @@ -110,7 +112,9 @@ convert_newlines_to_brs : false, remove_linebreaks : true, save_callback : "wp_save_callback", - valid_elements : "-a[id|href|title|rel],-strong/b,-em/i,-strike,-del,-u,p[class|align|dir],-ol,-ul,-li,br,img[class|src|alt|title|width|height|align],-sub,-sup,-blockquote[dir],-table[border=0|cellspacing|cellpadding|width|height|class|align|dir],thead[class|rowspan|width|height|align|valign|dir],tr[class|rowspan|width|height|align|valign|dir],th[dir|class|colspan|rowspan|width|height|align|valign|scope],td[dir|class|colspan|rowspan|width|height|align|valign],-div[dir|class|align],-span[class|align],-pre[class],-code[class],-address,-h1[class|align|dir],-h2[class|align|dir],-h3[class|align|dir],-h4[class|align|dir],-h5[class|align|dir],-h6[class|align|dir],hr", +<?php if (current_user_can('unfiltered_html') == false) : ?> +valid_elements : "-a[id|href|title|rel],-strong/b,-em/i,-strike,-del,-u,p[class|align|dir],-ol,-ul,-li,br,img[class|src|alt|title|width|height|align],-sub,-sup,-blockquote[dir],-table[border=0|cellspacing|cellpadding|width|height|class|align|dir],thead[class|rowspan|width|height|align|valign|dir],tr[class|rowspan|width|height|align|valign|dir],th[dir|class|colspan|rowspan|width|height|align|valign|scope],td[dir|class|colspan|rowspan|width|height|align|valign],-div[dir|class|align],-span[class|align],-pre[class],-code[class],-address,-h1[class|align|dir],-h2[class|align|dir],-h3[class|align|dir],-h4[class|align|dir],-h5[class|align|dir],-h6[class|align|dir],hr", +<?php endif; ?> plugins : "<?php echo $mce_plugins; ?>" <?php do_action('mce_options'); ?> }); @@ -151,6 +155,7 @@ var newcat; function newCatAddIn() { + if ( !document.getElementById('jaxcat') ) return false; var ajaxcat = document.createElement('p'); ajaxcat.id = 'ajaxcat';
Modified: trunk/wp-admin/edit-form-advanced.php (3282 => 3283)
--- trunk/wp-admin/edit-form-advanced.php 2005-12-09 19:21:39 UTC (rev 3282) +++ trunk/wp-admin/edit-form-advanced.php 2005-12-09 19:24:14 UTC (rev 3283) @@ -7,8 +7,6 @@ <div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div> <?php endif; ?> -<?php $richedit = ( 'true' != get_user_option('rich_editing') ) ? false : true; ?> - <form name="post" action="" method="post" id="post"> <?php if ( (isset($mode) && 'bookmarklet' == $mode) || isset($_GET['popupurl']) ): ?> @@ -139,7 +137,7 @@ <div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo $post->post_title; ?>" id="title" /></div> </fieldset> -<fieldset id="<?php echo $richedit ? 'postdivrich' : 'postdiv'; ?>"> +<fieldset id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>"> <legend><?php _e('Post') ?></legend> <?php @@ -148,20 +146,15 @@ $rows = 12; } ?> -<?php if ( !$richedit ) the_quicktags(); ?> +<?php the_quicktags(); ?> -<div><textarea <?php if ( $richedit ) echo 'title="true"'; ?> rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="2" id="content"><?php echo $richedit ? wp_richedit_pre($post->post_content) : $post->post_content; ?></textarea></div> +<div><textarea title="true" rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="2" id="content"><?php echo user_can_richedit() ? wp_richedit_pre($post->post_content) : $post->post_content; ?></textarea></div> </fieldset> -<?php if ( !$richedit ) : ?> <script type="text/_javascript_"> <!-- edCanvas = document.getElementById('content'); -//--> -</script> -<?php else : ?> -<script type="text/_javascript_"> -<!-- +<?php if ( user_can_richedit() ) : ?> // This code is meant to allow tabbing from Title to Post (TinyMCE). if ( tinyMCE.isMSIE ) document.getElementById('title'). (e) @@ -193,10 +186,9 @@ return false; } } - +<?php endif; ?> //--> </script> -<?php endif; ?> <?php echo $form_pingback ?> <?php echo $form_prevstatus ?>
Modified: trunk/wp-admin/edit-form-comment.php (3282 => 3283)
--- trunk/wp-admin/edit-form-comment.php 2005-12-09 19:21:39 UTC (rev 3282) +++ trunk/wp-admin/edit-form-comment.php 2005-12-09 19:24:14 UTC (rev 3283) @@ -4,7 +4,6 @@ $form_action = 'editedcomment'; $form_extra = "' />\n<input type='hidden' name='comment_ID' value='" . $comment->comment_ID . "' />\n<input type='hidden' name='comment_post_ID' value='".$comment->comment_post_ID; ?> -<?php $richedit = ( 'true' != get_user_option('rich_editing') ) ? false : true; ?> <form name="post" action="" method="post" id="post"> <div class="wrap"> @@ -32,13 +31,13 @@ <fieldset id="uridiv"> <legend><?php _e('URI:') ?></legend> <div> - <input type="text" name="newcomment_author_url" size="35" value="<?php echo $comment->comment_author_url ?>" tabindex="3" id="URL" /> + <input type="text" id="newcomment_author_url" name="newcomment_author_url" size="35" value="<?php echo $comment->comment_author_url ?>" tabindex="3" id="URL" /> </div> </fieldset> <fieldset HordeCleaned="clear: both;"> <legend><?php _e('Comment') ?></legend> -<?php if ( !$richedit ) the_quicktags(); ?> +<?php the_quicktags(); ?> <?php $rows = get_settings('default_post_edit_rows'); @@ -46,16 +45,47 @@ $rows = 10; } ?> -<div><textarea <?php if ( $richedit ) echo 'title="true"'; ?> rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content" HordeCleaned="width: 99%"><?php echo $richedit ? wp_richedit_pre($comment->comment_content) : $comment->comment_content; ?></textarea></div> +<div><textarea title="true" rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content" HordeCleaned="width: 99%"><?php echo user_can_richedit() ? wp_richedit_pre($comment->comment_content) : $comment->comment_content; ?></textarea></div> </fieldset> -<?php if ( !$richedit ) : ?> <script type="text/_javascript_"> <!-- edCanvas = document.getElementById('content'); +<?php if ( user_can_richedit() ) : ?> +// This code is meant to allow tabbing from Author URL to Post (TinyMCE). +if ( tinyMCE.isMSIE ) + document.getElementById('newcomment_author_url'). (e) + { + e = e ? e : window.event; + if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) { + var i = tinyMCE.selectedInstance; + if(typeof i == 'undefined') + return true; + tinyMCE.execCommand("mceStartTyping"); + this.blur(); + i.contentWindow.focus(); + e.returnValue = false; + return false; + } + } +else + document.getElementById('newcomment_author_url'). (e) + { + e = e ? e : window.event; + if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) { + var i = tinyMCE.selectedInstance; + if(typeof i == 'undefined') + return true; + tinyMCE.execCommand("mceStartTyping"); + this.blur(); + i.contentWindow.focus(); + e.returnValue = false; + return false; + } + } +<?php endif; ?> //--> </script> -<?php endif; ?> <p class="submit"><input type="submit" name="editcomment" id="editcomment" value="<?php echo $submitbutton_text ?>" HordeCleaned="font-weight: bold;" tabindex="6" /> <input name="referredby" type="hidden" id="referredby" value="<?php echo $_SERVER['HTTP_REFERER']; ?>" />
Modified: trunk/wp-admin/edit-page-form.php (3282 => 3283)
--- trunk/wp-admin/edit-page-form.php 2005-12-09 19:21:39 UTC (rev 3282) +++ trunk/wp-admin/edit-page-form.php 2005-12-09 19:24:14 UTC (rev 3283) @@ -20,8 +20,6 @@ ?> -<?php $richedit = ( 'true' != get_user_option('rich_editing') ) ? false : true; ?> - <form name="post" action="" method="post" id="post"> <?php @@ -119,7 +117,7 @@ </fieldset> -<fieldset id="<?php echo ( $richedit) ? 'postdivrich' : 'postdiv'; ?>"> +<fieldset id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>"> <legend><?php _e('Page Content') ?></legend> <?php $rows = get_settings('default_post_edit_rows'); @@ -127,18 +125,49 @@ $rows = 10; } ?> -<?php if (! $richedit ) the_quicktags(); ?> +<?php the_quicktags(); ?> -<div><textarea title="true" rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content"><?php echo $richedit ? wp_richedit_pre($post->post_content) : $post->post_content; ?></textarea></div> +<div><textarea title="true" rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content"><?php echo user_can_richedit() ? wp_richedit_pre($post->post_content) : $post->post_content; ?></textarea></div> </fieldset> -<?php if ( !$richedit ) : ?> <script type="text/_javascript_"> <!-- edCanvas = document.getElementById('content'); +<?php if ( user_can_richedit() ) : ?> +// This code is meant to allow tabbing from Title to Post (TinyMCE). +if ( tinyMCE.isMSIE ) + document.getElementById('title'). (e) + { + e = e ? e : window.event; + if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) { + var i = tinyMCE.selectedInstance; + if(typeof i == 'undefined') + return true; + tinyMCE.execCommand("mceStartTyping"); + this.blur(); + i.contentWindow.focus(); + e.returnValue = false; + return false; + } + } +else + document.getElementById('title'). (e) + { + e = e ? e : window.event; + if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) { + var i = tinyMCE.selectedInstance; + if(typeof i == 'undefined') + return true; + tinyMCE.execCommand("mceStartTyping"); + this.blur(); + i.contentWindow.focus(); + e.returnValue = false; + return false; + } + } +<?php endif; ?> //--> </script> -<?php endif; ?> <p class="submit"> <?php if ( $post_ID ) : ?>
Modified: trunk/wp-admin/inline-uploading.php (3282 => 3283)
--- trunk/wp-admin/inline-uploading.php 2005-12-09 19:21:39 UTC (rev 3282) +++ trunk/wp-admin/inline-uploading.php 2005-12-09 19:24:14 UTC (rev 3283) @@ -150,6 +150,7 @@ $uwidth_sum = 0; $html = ''; +$popups = ''; $style = ''; $script = ''; if ( count($attachments) > 0 ) { @@ -162,6 +163,7 @@ $__using_thumbnail = __('Using Thumbnail'); $__using_original = __('Using Original'); $__no_thumbnail = '<del>'.__('No Thumbnail').'</del>'; + $__send_to_editor = __('Send to editor'); $__close = __('Close Options'); $__confirmdelete = __('Delete this file from the server?'); $__nothumb = __('There is no thumbnail associated with this photo.'); @@ -190,7 +192,8 @@ add_post_meta($ID, '_wp_attachment_metadata', $meta); } $attachment = array_merge($attachment, $meta); - $delete_cancel = "<a confirm('$__confirmdelete')\" href="" + $send_delete_cancel =HordeCleanedvoid()\">$__send_to_editor</a> +<a confirm('$__confirmdelete')\" href="" <a "; $uwidth_sum += 128; @@ -219,31 +222,33 @@ imgb[{$ID}] = '<img id=\"image{$ID}\" src="" alt=\"{$image['post_title']}\" $height_width />'; "; $html .= "<div id='target{$ID}' class='attwrap left'> - <div id='HordeCleanedvoid()\">$__not_linked</a> - {$delete_cancel} - </div> <div id='div{$ID}' class='imagewrap' <img id=\"image{$ID}\" src="" alt=\"{$image['post_title']}\" $height_width /> </div> </div> "; + $popups .=HordeCleanedvoid()\">$__not_linked</a> + {$send_delete_cancel} +</div> +"; } else { - $script .= "a{$ID}a = '<a id=\"{$ID}\" rel=\"attachment\" href="" false;\" title=\"{$attachment['post_title']}\">{$attachment['post_title']}</a>'; -a{$ID}b = '<a id=\"{$ID}\" href="" false;\" title=\"{$attachment['post_title']}\">{$attachment['post_title']}</a>'; + $script .= "aa[{$ID}] = '<a id=\"{$ID}\" rel=\"attachment\" href="" false;\" title=\"{$attachment['post_title']}\">{$attachment['post_title']}</a>'; +ab[{$ID}] = '<a id=\"{$ID}\" href="" false;\" title=\"{$attachment['post_title']}\">{$attachment['post_title']}</a>'; "; $html .= "<div id='target{$ID}' class='attwrap left'> - <div id='HordeCleanedvoid()\">$__linked_to_file</a> - {$delete_cancel} - </div> <div id='div{$ID}' class='otherwrap' false;\"> <a id=\"{$ID}\" href="" false;\">{$attachment['post_title']}</a> </div> </div> "; + $popups .=HordeCleanedvoid()\">$__linked_to_file</a> + {$send_delete_cancel} +</div> +"; } } } @@ -278,13 +283,14 @@ target = document.getElementById('target'+i); popup = document.getElementById('popup'+i); popup.style.left = (target.offsetLeft) + 'px'; + popup.style.top = (target.offsetTop) + 'px'; popup.style.display = 'block'; } -function init() { - popup = false; -} +popup = false; function selectLink(n) { o=document.getElementById('div'+n); + if ( typeof document.body.createTextRange == 'undefined' || typeof win.tinyMCE == 'undefined' || win.tinyMCE.configs.length < 1 ) + return; r = document.body.createTextRange(); if ( typeof r != 'undefined' ) { r.moveToElementText(o); @@ -333,6 +339,24 @@ oi.innerHTML = usingthumbnail; } } + +var win = window.opener ? window.opener : window.dialogArguments; +if (!win) win = top; +tinyMCE = win.tinyMCE; +richedit = ( typeof tinyMCE == 'object' && tinyMCE.configs.length > 0 ); +function sendToEditor(n) { + o = document.getElementById('div'+n); + h = o.innerHTML.replace(new RegExp('^\\s*(.*?)\\s*$', ''), '$1'); // Trim + h = h.replace(new RegExp(' (class|title|width|height|id|onclick|onmousedown)=([^\'"][^ ]*)( |/|>)', 'g'), ' $1="$2"$3'); // Enclose attribs in quotes + h = h.replace(new RegExp(' on(click|mousedown)="[^"]*"', 'g'), ''); // Drop menu events + h = h.replace(new RegExp('<(/?)A', 'g'), '<$1a'); // Lowercase tagnames + h = h.replace(new RegExp('<IMG', 'g'), '<img'); // Lowercase again + h = h.replace(new RegExp('(<img .+?")>', 'g'), '$1 />'); // XHTML + if ( richedit ) + win.tinyMCE.execCommand('mceInsertContent', false, h); + else + win.edInsertContent(win.edCanvas, h); +} </script> <style type="text/css"> body { @@ -351,9 +375,10 @@ width: 100%; } #images { + position: absolute; clear: both; margin: 0px; - padding: 3px 15px; + padding: 15px 15px; height: 96px; /* white-space: nowrap;*/ width: <?php echo $images_width; ?>px; @@ -492,7 +517,7 @@ } </style> </head> -<body > +<body> <ul id="upload-menu"> <li<?php echo $current_1; ?>><a href="" echo basename(__FILE__); ?>?action="" echo $post; ?>&all=<?php echo $all; ?>"><?php _e('Upload'); ?></a></li> <?php if ( $attachments = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE post_parent = '$post'") ) { ?> @@ -521,9 +546,10 @@ </ul> <?php if ( $action == 'view' ) : ?> <div id="wrap"> -<div class="tip"><?php _e('You can drag and drop these items into your post. Click on one for more options.'); ?></div> +<!--<div class="tip"><?php _e('You can drag and drop these items into your post. Click on one for more options.'); ?></div>--> <div id="images"> <?php echo $html; ?> +<?php echo $popups; ?> </div> </div> <?php elseif ( $action == 'upload' ) : ?>
Modified: trunk/wp-admin/wp-admin.css (3282 => 3283)
--- trunk/wp-admin/wp-admin.css 2005-12-09 19:21:39 UTC (rev 3282) +++ trunk/wp-admin/wp-admin.css 2005-12-09 19:24:14 UTC (rev 3283) @@ -1,7 +1,9 @@ * html #poststuff { height: 100%; /* kill peekaboo bug in IE */ } - +body { + border: none; +} a { border-bottom: 1px solid #69c; color: #00019b;
Modified: trunk/wp-includes/js/quicktags.js (3282 => 3283)
--- trunk/wp-includes/js/quicktags.js 2005-12-09 19:21:39 UTC (rev 3282) +++ trunk/wp-includes/js/quicktags.js 2005-12-09 19:24:14 UTC (rev 3283) @@ -386,4 +386,4 @@ + '" />'; edInsertContent(myField, myValue); } -} \ No newline at end of file +}
Modified: trunk/wp-includes/js/tinymce/tiny_mce.js (3282 => 3283)
--- trunk/wp-includes/js/tinymce/tiny_mce.js 2005-12-09 19:21:39 UTC (rev 3282) +++ trunk/wp-includes/js/tinymce/tiny_mce.js 2005-12-09 19:24:14 UTC (rev 3283) @@ -5526,7 +5526,7 @@ case "mceInsertContent": var insertHTMLFailed = false; this.getWin().focus(); - +/* WP if (tinyMCE.isGecko || tinyMCE.isOpera) { try { // Is plain text or HTML @@ -5560,7 +5560,7 @@ return; } } - +*/ // Ugly hack in Opera due to non working "inserthtml" if (tinyMCE.isOpera && insertHTMLFailed) { this.getDoc().execCommand("insertimage", false, tinyMCE.uniqueURL);
_______________________________________________ wp-testers mailing list [email protected] http://lists.automattic.com/mailman/listinfo/wp-testers
