From a404e581fa4d9f2ed15caf29c792677b70a87f2a Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Sat, 27 Sep 2008 06:21:12 +0000 Subject: [PATCH] Media fixes for Press This. Props noel. see #7732 git-svn-id: https://develop.svn.wordpress.org/trunk@8996 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/press-this.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/wp-admin/press-this.php b/wp-admin/press-this.php index 96b20d6935..e8223e2782 100644 --- a/wp-admin/press-this.php +++ b/wp-admin/press-this.php @@ -117,7 +117,7 @@ switch ($_REQUEST['ajax']) { case 'video': ?>

- +

@@ -177,12 +177,12 @@ switch ($_REQUEST['ajax']) { ]*)src=(\"|\')([^<>]+?\.(png|jpeg|jpg|jpe|gif))[^<>\'\"]*(\2)([^>\/]*)\/*>/is'; @@ -192,6 +192,7 @@ switch ($_REQUEST['ajax']) { $sources = array(); foreach ($matches[3] as $src) { + error_log($src); // if no http in url if(strpos($src, 'http') === false) // if it doesn't have a relative uri @@ -257,9 +258,9 @@ switch ($_REQUEST['ajax']) { if(length == 0) length = 1; jQuery('.photolist').append(''); jQuery('.photolist').append(''); - append_editor("\n\n" + '

' + desc + '

'); + insert_editor("\n\n" + '

' + desc + '

'); } - tinyMCE.activeEditor.resizeToContent(); + /*tinyMCE.activeEditor.resizeToContent();*/ return false; } @@ -342,7 +343,7 @@ die; remove_linebreaks : true, accessibility_focus : false, tab_focus : ":next", - plugins : "safari,inlinepopups, media", + plugins : "safari, inlinepopups, media", entities : "38,amp,60,lt,62,gt", force_p_newlines : true, save_callback : 'switchEditors.saveCallback' @@ -372,10 +373,11 @@ die; if ( '' == text || '

' == text ) text = '


'; if ( tinyMCE.activeEditor ) tinyMCE.execCommand('mceSetContent', false, text); } - + function insert_editor(text) { + if ( '' != text && tinyMCE.activeEditor ) tinyMCE.execCommand('mceInsertContent', false, '

' + tinymce.DOM.decode(text) + '

'); + } function append_editor(text) { - if ( '' != text && tinyMCE.activeEditor ) tinyMCE.execCommand('mceSetContent', false, tinyMCE.activeEditor.getContent({format : 'raw'}) - + '

' + tinymce.DOM.decode(text) + '

'); + if ( '' != text && tinyMCE.activeEditor ) tinyMCE.execCommand('mceSetContent', false, tinyMCE.activeEditor.getContent({format : 'raw'}) + '

' + text + '

'); tinyMCE.execCommand('mceCleanup'); } @@ -532,7 +534,7 @@ die;

- +