When inserting the embed shortcode in TinyMCE replace it with a placeholder image, update the 'wordpress', 'wpeditimage' and 'wpgallery' TinyMCE plugins, fix the audio and video "From URL" tabs in the uploader popup to accept only URLs for embedding, see #10337

git-svn-id: http://svn.automattic.com/wordpress/trunk@12098 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2009-10-24 11:43:42 +00:00
parent 4ff21e0cd3
commit f5c253376e
20 changed files with 243 additions and 210 deletions

View File

@ -1 +1 @@
div#media-upload-header{margin:0;padding:0 5px;font-weight:bold;position:relative;border-bottom-width:1px;border-bottom-style:solid;height:2.5em;}body#media-upload ul#sidemenu{font-weight:normal;margin:0 5px;position:absolute;left:0;bottom:-1px;}div#media-upload-error{margin:1em;font-weight:bold;}form{margin:1em;}#search-filter{text-align:right;}th{position:relative;}.media-upload-form label.form-help,td.help{font-family:"Lucida Grande","Bitstream Vera Sans",Verdana,Arial,sans-serif;font-style:italic;font-weight:normal;}.media-upload-form p.help{margin:0;padding:0;}.media-upload-form fieldset{width:100%;border:none;text-align:justify;margin:0 0 1em 0;padding:0;}.image-align-none-label{background:url(../images/align-none.png) no-repeat center left;}.image-align-left-label{background:url(../images/align-left.png) no-repeat center left;}.image-align-center-label{background:url(../images/align-center.png) no-repeat center left;}.image-align-right-label{background:url(../images/align-right.png) no-repeat center left;}tr.image-size td{width:460px;}tr.image-size div.image-size-item{float:left;width:25%;margin:0;}#library-form .progress,#gallery-form .progress,#flash-upload-ui,.insert-gallery,.describe.startopen,.describe.startclosed{display:none;}.media-item .thumbnail{max-width:128px;max-height:128px;}thead.media-item-info tr{background-color:transparent;}thead.media-item-info th,thead.media-item-info td{border:none;margin:0;}.form-table thead.media-item-info{border:8px solid #fff;}abbr.required{text-decoration:none;border:none;}.describe label{display:inline;}.describe td{vertical-align:middle;padding:0 5px 8px 0;}.describe td.A1{width:132px;}.describe input[type="text"],.describe textarea{width:460px;border-width:1px;border-style:solid;}.describe-toggle-on,.describe-toggle-off{display:block;line-height:36px;float:right;margin-right:20px;}.describe-toggle-off{display:none;}.hidden{height:0;width:0;overflow:hidden;border:none;}#media-upload p.ml-submit{padding:1em 0;}#media-upload p.help,#media-upload label.help{font-family:"Lucida Grande","Bitstream Vera Sans",Verdana,Arial,sans-serif;font-style:italic;font-weight:normal;}#media-upload tr.image-size td.field{text-align:center;}#media-upload #media-items{border-width:1px;border-style:solid;border-bottom:none;width:623px;}#media-upload .media-item{border-bottom-width:1px;border-bottom-style:solid;min-height:36px;width:100%;}#media-upload .ui-sortable .media-item{cursor:move;}.filename{line-height:36px;padding:0 10px;overflow:hidden;}#media-upload .describe{padding:5px;width:100%;clear:both;cursor:default;}#media-upload .slidetoggle{border-top-width:1px;border-top-style:solid;}#media-upload .describe th.label{padding-top:.2em;text-align:left;min-width:120px;}#media-upload tr.align td.field{text-align:center;}#media-upload tr.image-size{margin-bottom:1em;height:3em;}#media-upload #filter{width:623px;}#media-upload #filter .subsubsub{margin:8px 0;}#filter .tablenav select{border-style:solid;border-width:1px;padding:2px;vertical-align:top;width:auto;}#media-upload .del-attachment{display:none;margin:5px 0;}.menu_order{float:right;font-size:11px;margin:10px 10px 0;}.menu_order_input{border:1px solid #ddd;font-size:10px;padding:1px;width:23px;}.ui-sortable-helper{background-color:#fff;border:1px solid #aaa;opacity:.6;filter:alpha(opacity=60);}#media-upload th.order-head{width:20%;text-align:center;}#media-upload th.actions-head{width:25%;text-align:center;}#media-upload a.wp-post-thumbnail{margin:0 20px;}#media-items a.delete{display:block;float:right;}#media-upload .widefat{width:626px;border-style:solid solid none;}.sorthelper{height:37px;width:623px;display:block;}#gallery-settings th.label{width:160px;}#gallery-settings #basic th.label{padding:5px 5px 5px 0;}#gallery-settings .title{clear:both;padding:0 0 3px;border-bottom-style:solid;border-bottom-width:1px;font-family:Georgia,"Times New Roman",Times,serif;font-size:1.6em;border-bottom-color:#DADADA;color:#5A5A5A;}h3.media-title{color:#5A5A5A;font-family:Georgia,"Times New Roman",Times,serif;font-size:1.6em;font-weight:normal;}#gallery-settings .describe td{vertical-align:middle;height:3.5em;}#gallery-settings .describe th.label{padding-top:.5em;text-align:left;}#gallery-settings .describe{padding:5px;width:615px;clear:both;cursor:default;}#gallery-settings .describe select{width:15em;border:1px solid #dfdfdf;}#gallery-settings label,#gallery-settings legend{font-size:13px;color:#464646;margin-right:15px;}#gallery-settings .align .field label{margin:0 1.5em 0 0;}#gallery-settings p.ml-submit{border-top:1px solid #dfdfdf;}#gallery-settings select#columns{width:6em;}#sort-buttons{font-size:.8em;margin:3px 25px -8px 0;text-align:right;max-width:625px;}#sort-buttons a{text-decoration:none;}#sort-buttons #asc,#sort-buttons #showall{padding-left:5px;}#sort-buttons span{margin-right:25px;}
div#media-upload-header{margin:0;padding:0 5px;font-weight:bold;position:relative;border-bottom-width:1px;border-bottom-style:solid;height:2.5em;}body#media-upload ul#sidemenu{font-weight:normal;margin:0 5px;position:absolute;left:0;bottom:-1px;}div#media-upload-error{margin:1em;font-weight:bold;}form{margin:1em;}#search-filter{text-align:right;}th{position:relative;}.media-upload-form label.form-help,td.help{font-family:"Lucida Grande","Bitstream Vera Sans",Verdana,Arial,sans-serif;font-style:italic;font-weight:normal;}.media-upload-form p.help{margin:0;padding:0;}.media-upload-form fieldset{width:100%;border:none;text-align:justify;margin:0 0 1em 0;padding:0;}.image-align-none-label{background:url(../images/align-none.png) no-repeat center left;}.image-align-left-label{background:url(../images/align-left.png) no-repeat center left;}.image-align-center-label{background:url(../images/align-center.png) no-repeat center left;}.image-align-right-label{background:url(../images/align-right.png) no-repeat center left;}tr.image-size td{width:460px;}tr.image-size div.image-size-item{float:left;width:25%;margin:0;}#library-form .progress,#gallery-form .progress,#flash-upload-ui,.insert-gallery,.describe.startopen,.describe.startclosed{display:none;}.media-item .thumbnail{max-width:128px;max-height:128px;}thead.media-item-info tr{background-color:transparent;}thead.media-item-info th,thead.media-item-info td{border:none;margin:0;}.form-table thead.media-item-info{border:8px solid #fff;}abbr.required{text-decoration:none;border:none;}.describe label{display:inline;}.describe td{vertical-align:middle;padding:0 5px 8px 0;}.describe td.A1{width:132px;}.describe input[type="text"],.describe textarea{width:460px;border-width:1px;border-style:solid;}.describe-toggle-on,.describe-toggle-off{display:block;line-height:36px;float:right;margin-right:20px;}.describe-toggle-off{display:none;}.hidden{height:0;width:0;overflow:hidden;border:none;}#media-upload p.ml-submit{padding:1em 0;}#media-upload p.help,#media-upload label.help{font-family:"Lucida Grande","Bitstream Vera Sans",Verdana,Arial,sans-serif;font-style:italic;font-weight:normal;}#media-upload tr.image-size td.field{text-align:center;}#media-upload #media-items{border-width:1px;border-style:solid;border-bottom:none;width:623px;}#media-upload .media-item{border-bottom-width:1px;border-bottom-style:solid;min-height:36px;width:100%;}#media-upload .ui-sortable .media-item{cursor:move;}.filename{line-height:36px;padding:0 10px;overflow:hidden;}#media-upload .describe{padding:5px;width:100%;clear:both;cursor:default;}#media-upload .slidetoggle{border-top-width:1px;border-top-style:solid;}#media-upload .describe th.label{padding-top:.2em;text-align:left;min-width:120px;}#media-upload tr.align td.field{text-align:center;}#media-upload tr.image-size{margin-bottom:1em;height:3em;}#media-upload #filter{width:623px;}#media-upload #filter .subsubsub{margin:8px 0;}#filter .tablenav select{border-style:solid;border-width:1px;padding:2px;vertical-align:top;width:auto;}#media-upload .del-attachment{display:none;margin:5px 0;}.menu_order{float:right;font-size:11px;margin:10px 10px 0;}.menu_order_input{border:1px solid #ddd;font-size:10px;padding:1px;width:23px;}.ui-sortable-helper{background-color:#fff;border:1px solid #aaa;opacity:.6;filter:alpha(opacity=60);}#media-upload th.order-head{width:20%;text-align:center;}#media-upload th.actions-head{width:25%;text-align:center;}#media-upload a.wp-post-thumbnail{margin:0 20px;}#media-items a.delete{display:block;float:right;}#media-upload .widefat{width:626px;border-style:solid solid none;}.sorthelper{height:37px;width:623px;display:block;}#gallery-settings th.label{width:160px;}#gallery-settings #basic th.label{padding:5px 5px 5px 0;}#gallery-settings .title{clear:both;padding:0 0 3px;font-size:1.6em;border-bottom:1px solid #DADADA;}h3.media-title{font-size:1.6em;}h4.media-sub-title{border-bottom:1px solid #DADADA;font-size:1.3em;margin:12px;padding:0 0 3px;}#gallery-settings .title,h3.media-title,h4.media-sub-title{font-family:Georgia,"Times New Roman",Times,serif;font-weight:normal;color:#5A5A5A;}#gallery-settings .describe td{vertical-align:middle;height:3em;}#gallery-settings .describe th.label{padding-top:.5em;text-align:left;}#gallery-settings .describe{padding:5px;width:615px;clear:both;cursor:default;}#gallery-settings .describe select{width:15em;}#gallery-settings .describe select option,#gallery-settings .describe td{padding:0;}#gallery-settings label,#gallery-settings legend{font-size:13px;color:#464646;margin-right:15px;}#gallery-settings .align .field label{margin:0 1.5em 0 0;}#gallery-settings p.ml-submit{border-top:1px solid #dfdfdf;}#gallery-settings select#columns{width:6em;}#sort-buttons{font-size:.8em;margin:3px 25px -8px 0;text-align:right;max-width:625px;}#sort-buttons a{text-decoration:none;}#sort-buttons #asc,#sort-buttons #showall{padding-left:5px;}#sort-buttons span{margin-right:25px;}

View File

@ -303,24 +303,32 @@ abbr.required {
#gallery-settings .title {
clear: both;
padding: 0 0 3px;
border-bottom-style: solid;
border-bottom-width: 1px;
font-family: Georgia,"Times New Roman",Times,serif;
font-size: 1.6em;
border-bottom-color: #DADADA;
color: #5A5A5A;
border-bottom: 1px solid #DADADA;
}
h3.media-title {
color: #5A5A5A;
font-family: Georgia,"Times New Roman",Times,serif;
font-size: 1.6em;
}
h4.media-sub-title {
border-bottom: 1px solid #DADADA;
font-size: 1.3em;
margin: 12px;
padding: 0 0 3px;
}
#gallery-settings .title,
h3.media-title,
h4.media-sub-title {
font-family: Georgia,"Times New Roman",Times,serif;
font-weight: normal;
color: #5A5A5A;
}
#gallery-settings .describe td {
vertical-align: middle;
height: 3.5em;
height: 3em;
}
#gallery-settings .describe th.label {
@ -337,7 +345,11 @@ h3.media-title {
#gallery-settings .describe select {
width: 15em;
border: 1px solid #dfdfdf;
}
#gallery-settings .describe select option,
#gallery-settings .describe td {
padding: 0;
}
#gallery-settings label,

View File

@ -166,7 +166,7 @@ var win = window.dialogArguments || opener || parent || top;
win.send_to_editor('<?php echo addslashes($html); ?>');
/* ]]> */
</script>
<?php
<?php
exit;
}
@ -481,16 +481,25 @@ function media_upload_image() {
}
if ( !empty($_POST['insertonlybutton']) ) {
$src = $_POST['insertonly']['src'];
if ( !empty($src) && !strpos($src, '://') )
$src = "http://$src";
$alt = esc_attr($_POST['insertonly']['alt']);
if ( isset($_POST['insertonly']['align']) ) {
$align = esc_attr($_POST['insertonly']['align']);
$class = " class='align$align'";
$alt = $align = '';
if ( !empty($_POST['insertonly']['embed-src']) ) {
$src = $_POST['insertonly']['embed-src'];
if ( !strpos($src, '://') )
$src = "http://$src";
$html = '[embed]' . $src . '[/embed]';
} else {
$src = $_POST['insertonly']['src'];
if ( !empty($src) && !strpos($src, '://') )
$src = "http://$src";
$alt = esc_attr($_POST['insertonly']['alt']);
if ( isset($_POST['insertonly']['align']) ) {
$align = esc_attr($_POST['insertonly']['align']);
$class = " class='align$align'";
}
if ( !empty($src) )
$html = "<img src='$src' alt='$alt'$class />";
}
if ( !empty($src) )
$html = "<img src='$src' alt='$alt'$class />";
$html = apply_filters('image_send_to_editor_url', $html, $src, $alt, $align);
return media_send_to_editor($html);
}
@ -586,12 +595,9 @@ function media_upload_audio() {
$href = $_POST['insertonly']['href'];
if ( !empty($href) && !strpos($href, '://') )
$href = "http://$href";
$title = esc_attr($_POST['insertonly']['title']);
if ( empty($title) )
$title = basename($href);
if ( !empty($title) && !empty($href) )
$html = "<a href='$href' >$title</a>";
$html = apply_filters('audio_send_to_editor_url', $html, $href, $title);
$html = '[embed]' . $href . '[/embed]';
$html = apply_filters('audio_send_to_editor_url', $html, $href);
return media_send_to_editor($html);
}
@ -640,12 +646,9 @@ function media_upload_video() {
$href = $_POST['insertonly']['href'];
if ( !empty($href) && !strpos($href, '://') )
$href = "http://$href";
$title = esc_attr($_POST['insertonly']['title']);
if ( empty($title) )
$title = basename($href);
if ( !empty($title) && !empty($href) )
$html = "<a href='$href' >$title</a>";
$html = apply_filters('video_send_to_editor_url', $html, $href, $title);
$html = '[embed]' . $href . '[/embed]';
$html = apply_filters('video_send_to_editor_url', $html, $href);
return media_send_to_editor($html);
}
@ -694,6 +697,7 @@ function media_upload_file() {
$href = $_POST['insertonly']['href'];
if ( !empty($href) && !strpos($href, '://') )
$href = "http://$href";
$title = esc_attr($_POST['insertonly']['title']);
if ( empty($title) )
$title = basename($href);
@ -1513,7 +1517,11 @@ var addExtImage = {
insert : function() {
var t = this, html, f = document.forms[0], cls, title = '', alt = '', caption = '';
if ( '' == f.src.value || '' == t.width ) return false;
if ( '' != document.getElementById('embed-src').value )
return true;
if ( '' == f.src.value || '' == t.width )
return false;
if ( f.title.value ) {
title = f.title.value.replace(/'/g, '&#039;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
@ -1540,6 +1548,7 @@ var addExtImage = {
var win = window.dialogArguments || opener || parent || top;
win.send_to_editor(html);
return false;
},
resetImageData : function() {
@ -1548,8 +1557,8 @@ var addExtImage = {
t.width = t.height = '';
document.getElementById('go_button').style.color = '#bbb';
if ( ! document.forms[0].src.value )
document.getElementById('status_img').src = 'images/required.gif';
else document.getElementById('status_img').src = 'images/no.png';
document.getElementById('status_img').innerHTML = '*';
else document.getElementById('status_img').innerHTML = '<img src="images/no.png" alt="" />';
},
updateImageData : function() {
@ -1558,7 +1567,7 @@ var addExtImage = {
t.width = t.preloadImg.width;
t.height = t.preloadImg.height;
document.getElementById('go_button').style.color = '#333';
document.getElementById('status_img').src = 'images/yes.png';
document.getElementById('status_img').innerHTML = '<img src="images/yes.png" alt="" />';
},
getImageData : function() {
@ -1568,7 +1577,7 @@ var addExtImage = {
t.resetImageData();
return false;
}
document.getElementById('status_img').src = 'images/wpspin_light.gif';
document.getElementById('status_img').innerHTML = '<img src="images/wpspin_light.gif" alt="" />';
t.preloadImg = new Image();
t.preloadImg.onload = t.updateImageData;
t.preloadImg.onerror = t.resetImageData;
@ -1920,11 +1929,30 @@ function type_url_form_image() {
$default_align = 'none';
return '
<h4 class="media-sub-title">' . __('Embed a picture from a web site that supports oEmbed') . '</h4>
<table class="describe"><tbody>
<tr>
<th valign="top" scope="row" class="label" style="width:120px;">
<th valign="top" scope="row" class="label" style="width:130px;">
<span class="alignleft"><label for="embed-src">' . __('Embed image') . '</label></span>
<span class="alignright"><abbr title="required" class="required">*</abbr></span>
</th>
<td class="field"><input id="embed-src" name="insertonly[embed-src]" value="" type="text" /></td>
</tr>
<tr>
<td></td>
<td>
<input type="submit" class="button" name="insertonlybutton" value="' . esc_attr__('Embed') . '" />
</td>
</tr>
</tbody></table>
<h4 class="media-sub-title">' . __('Insert an image from another web site') . '</h4>
<table class="describe"><tbody>
<tr>
<th valign="top" scope="row" class="label" style="width:130px;">
<span class="alignleft"><label for="src">' . __('Image URL') . '</label></span>
<span class="alignright"><img id="status_img" src="images/required.gif" title="required" alt="required" /></span>
<span class="alignright"><abbr id="status_img" title="required" class="required">*</abbr></span>
</th>
<td class="field"><input id="src" name="src" value="" type="text" aria-required="true" onblur="addExtImage.getImageData()" /></td>
</tr>
@ -1998,14 +2026,7 @@ function type_url_form_audio() {
</th>
<td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td>
</tr>
<tr>
<th valign="top" scope="row" class="label">
<span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span>
<span class="alignright"><abbr title="required" class="required">*</abbr></span>
</th>
<td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
</tr>
<tr><td></td><td class="help">' . __('Link text, e.g. &#8220;Still Alive by Jonathan Coulton&#8221;') . '</td></tr>
<tr>
<td></td>
<td>
@ -2033,14 +2054,7 @@ function type_url_form_video() {
</th>
<td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td>
</tr>
<tr>
<th valign="top" scope="row" class="label">
<span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span>
<span class="alignright"><abbr title="required" class="required">*</abbr></span>
</th>
<td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
</tr>
<tr><td></td><td class="help">' . __('Link text, e.g. &#8220;Lucy on YouTube&#8221;') . '</td></tr>
<tr>
<td></td>
<td>

View File

@ -22,7 +22,7 @@ var switchEditors = {
return document.getElementById(e);
},
pre_wpautop : function(content) {
_wp_Nop : function(content) {
var blocklist1, blocklist2;
// Protect pre|script tags
@ -79,7 +79,6 @@ var switchEditors = {
content = content.replace(/<wp_temp>/g, '\n');
content = content.replace(/<wp_empty_p>\s*/g, '<p>&nbsp;</p>\n\n');
// Hope.
return content;
},
@ -104,14 +103,17 @@ var switchEditors = {
edCloseAllTags(); // :-(
qt.style.display = 'none';
ta.style.color = '#FFF';
ta.value = this.wpautop(ta.value);
if ( ed ) {
ed.show();
} else {
try{tinyMCE.execCommand("mceAddControl", false, id);}
catch(e){}
}
try {
if ( ed )
ed.show();
else
tinyMCE.execCommand("mceAddControl", false, id);
} catch(e) {}
ta.style.color = '#000';
} else {
setUserSetting( 'editor', 'html' );
ta.style.color = '#000';
@ -129,7 +131,7 @@ var switchEditors = {
return false;
},
wpautop : function(pee) {
_wp_Autop : function(pee) {
var blocklist = 'table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]';
if ( pee.indexOf('<object') != -1 ) {
@ -168,5 +170,23 @@ var switchEditors = {
});
return pee;
},
pre_wpautop : function(content) {
var t = this, o = { o: t, data: content, unfiltered: content };
jQuery('body').trigger('beforePreWpautop', [o]);
o.data = t._wp_Nop(o.data);
jQuery('body').trigger('afterPreWpautop', [o]);
return o.data;
},
wpautop : function(pee) {
var t = this, o = { o: t, data: pee, unfiltered: pee };
jQuery('body').trigger('beforeWpautop', [o]);
o.data = t._wp_Autop(o.data);
jQuery('body').trigger('afterWpautop', [o]);
return o.data;
}
};

View File

@ -1 +1 @@
jQuery(document).ready(function(b){var a=wpCookies.getHash("TinyMCE_content_size");if(getUserSetting("editor")=="html"){if(a){b("#content").css("height",a.ch-15+"px")}}else{if(typeof tinyMCE!="object"){b("#content").css("color","#000")}else{b("#quicktags").hide()}}});var switchEditors={mode:"",I:function(a){return document.getElementById(a)},pre_wpautop:function(b){var c,a;b=b.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g,function(d){d=d.replace(/<br ?\/?>[\r\n]*/g,"<wp_temp>");return d.replace(/<\/?p( [^>]*)?>[\r\n]*/g,"<wp_temp>")});b=b.replace(/<p>[\s\u00a0]*<\/p>/g,"<wp_empty_p>");c="blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|div|h[1-6]|p";b=b.replace(new RegExp("\\s*</("+c+")>\\s*","g"),"</$1>\n");b=b.replace(new RegExp("\\s*<(("+c+")[^>]*)>","g"),"\n<$1>");b=b.replace(/(<p [^>]+>.*?)<\/p>/g,"$1</p#>");b=b.replace(/<div([^>]*)>\s*<p>/gi,"<div$1>\n\n");b=b.replace(/\s*<p>/gi,"");b=b.replace(/\s*<\/p>\s*/gi,"\n\n");b=b.replace(/\n[\s\u00a0]+\n/g,"\n\n");b=b.replace(/\s*<br ?\/?>\s*/gi,"\n");b=b.replace(/\s*<div/g,"\n<div");b=b.replace(/<\/div>\s*/g,"</div>\n");b=b.replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi,"\n\n[caption$1[/caption]\n\n");b=b.replace(/caption\]\n\n+\[caption/g,"caption]\n\n[caption");a="blockquote|ul|ol|li|table|thead|tfoot|tr|th|td|h[1-6]|pre";b=b.replace(new RegExp("\\s*<(("+a+") ?[^>]*)\\s*>","g"),"\n<$1>");b=b.replace(new RegExp("\\s*</("+a+")>\\s*","g"),"</$1>\n");b=b.replace(/<li([^>]*)>/g,"\t<li$1>");if(b.indexOf("<object")!=-1){b=b.replace(/<object[\s\S]+?<\/object>/g,function(d){return d.replace(/[\r\n]+/g,"")})}b=b.replace(/<\/p#>/g,"</p>\n");b=b.replace(/\s*(<p [^>]+>[\s\S]*?<\/p>)/g,"\n$1");b=b.replace(/^\s+/,"");b=b.replace(/[\s\u00a0]+$/,"");b=b.replace(/<wp_temp>/g,"\n");b=b.replace(/<wp_empty_p>\s*/g,"<p>&nbsp;</p>\n\n");return b},go:function(i,g){i=i||"content";g=g||this.mode||"";var b,h=this.I("quicktags"),c=this.I("edButtonHTML"),d=this.I("edButtonPreview"),a=this.I(i);try{b=tinyMCE.get(i)}catch(f){b=false}if("tinymce"==g){if(b&&!b.isHidden()){return false}setUserSetting("editor","tinymce");this.mode="html";d.className="active";c.className="";edCloseAllTags();h.style.display="none";a.value=this.wpautop(a.value);if(b){b.show()}else{try{tinyMCE.execCommand("mceAddControl",false,i)}catch(f){}}}else{setUserSetting("editor","html");a.style.color="#000";this.mode="tinymce";c.className="active";d.className="";if(b&&!b.isHidden()){a.style.height=b.getContentAreaContainer().offsetHeight+24+"px";b.hide()}h.style.display="block"}return false},wpautop:function(a){var b="table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]";if(a.indexOf("<object")!=-1){a=a.replace(/<object[\s\S]+?<\/object>/g,function(c){return c.replace(/[\r\n]+/g,"")})}a=a.replace(/<[^<>]+>/g,function(c){return c.replace(/[\r\n]+/g," ")});a=a+"\n\n";a=a.replace(/<br \/>\s*<br \/>/gi,"\n\n");a=a.replace(new RegExp("(<(?:"+b+")[^>]*>)","gi"),"\n$1");a=a.replace(new RegExp("(</(?:"+b+")>)","gi"),"$1\n\n");a=a.replace(/\r\n|\r/g,"\n");a=a.replace(/\n\s*\n+/g,"\n\n");a=a.replace(/([\s\S]+?)\n\n/g,"<p>$1</p>\n");a=a.replace(/<p>\s*?<\/p>/gi,"");a=a.replace(new RegExp("<p>\\s*(</?(?:"+b+")[^>]*>)\\s*</p>","gi"),"$1");a=a.replace(/<p>(<li.+?)<\/p>/gi,"$1");a=a.replace(/<p>\s*<blockquote([^>]*)>/gi,"<blockquote$1><p>");a=a.replace(/<\/blockquote>\s*<\/p>/gi,"</p></blockquote>");a=a.replace(new RegExp("<p>\\s*(</?(?:"+b+")[^>]*>)","gi"),"$1");a=a.replace(new RegExp("(</?(?:"+b+")[^>]*>)\\s*</p>","gi"),"$1");a=a.replace(/\s*\n/gi,"<br />\n");a=a.replace(new RegExp("(</?(?:"+b+")[^>]*>)\\s*<br />","gi"),"$1");a=a.replace(/<br \/>(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)/gi,"$1");a=a.replace(/(?:<p>|<br ?\/?>)*\s*\[caption([^\[]+)\[\/caption\]\s*(?:<\/p>|<br ?\/?>)*/gi,"[caption$1[/caption]");a=a.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g,function(c){c=c.replace(/<br ?\/?>[\r\n]*/g,"\n");return c.replace(/<\/?p( [^>]*)?>[\r\n]*/g,"\n")});return a}};
jQuery(document).ready(function(b){var a=wpCookies.getHash("TinyMCE_content_size");if(getUserSetting("editor")=="html"){if(a){b("#content").css("height",a.ch-15+"px")}}else{if(typeof tinyMCE!="object"){b("#content").css("color","#000")}else{b("#quicktags").hide()}}});var switchEditors={mode:"",I:function(a){return document.getElementById(a)},_wp_Nop:function(b){var c,a;b=b.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g,function(d){d=d.replace(/<br ?\/?>[\r\n]*/g,"<wp_temp>");return d.replace(/<\/?p( [^>]*)?>[\r\n]*/g,"<wp_temp>")});b=b.replace(/<p>[\s\u00a0]*<\/p>/g,"<wp_empty_p>");c="blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|div|h[1-6]|p";b=b.replace(new RegExp("\\s*</("+c+")>\\s*","g"),"</$1>\n");b=b.replace(new RegExp("\\s*<(("+c+")[^>]*)>","g"),"\n<$1>");b=b.replace(/(<p [^>]+>.*?)<\/p>/g,"$1</p#>");b=b.replace(/<div([^>]*)>\s*<p>/gi,"<div$1>\n\n");b=b.replace(/\s*<p>/gi,"");b=b.replace(/\s*<\/p>\s*/gi,"\n\n");b=b.replace(/\n[\s\u00a0]+\n/g,"\n\n");b=b.replace(/\s*<br ?\/?>\s*/gi,"\n");b=b.replace(/\s*<div/g,"\n<div");b=b.replace(/<\/div>\s*/g,"</div>\n");b=b.replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi,"\n\n[caption$1[/caption]\n\n");b=b.replace(/caption\]\n\n+\[caption/g,"caption]\n\n[caption");a="blockquote|ul|ol|li|table|thead|tfoot|tr|th|td|h[1-6]|pre";b=b.replace(new RegExp("\\s*<(("+a+") ?[^>]*)\\s*>","g"),"\n<$1>");b=b.replace(new RegExp("\\s*</("+a+")>\\s*","g"),"</$1>\n");b=b.replace(/<li([^>]*)>/g,"\t<li$1>");if(b.indexOf("<object")!=-1){b=b.replace(/<object[\s\S]+?<\/object>/g,function(d){return d.replace(/[\r\n]+/g,"")})}b=b.replace(/<\/p#>/g,"</p>\n");b=b.replace(/\s*(<p [^>]+>[\s\S]*?<\/p>)/g,"\n$1");b=b.replace(/^\s+/,"");b=b.replace(/[\s\u00a0]+$/,"");b=b.replace(/<wp_temp>/g,"\n");b=b.replace(/<wp_empty_p>\s*/g,"<p>&nbsp;</p>\n\n");return b},go:function(i,g){i=i||"content";g=g||this.mode||"";var b,h=this.I("quicktags"),c=this.I("edButtonHTML"),d=this.I("edButtonPreview"),a=this.I(i);try{b=tinyMCE.get(i)}catch(f){b=false}if("tinymce"==g){if(b&&!b.isHidden()){return false}setUserSetting("editor","tinymce");this.mode="html";d.className="active";c.className="";edCloseAllTags();h.style.display="none";a.style.color="#FFF";a.value=this.wpautop(a.value);try{if(b){b.show()}else{tinyMCE.execCommand("mceAddControl",false,i)}}catch(f){}a.style.color="#000"}else{setUserSetting("editor","html");a.style.color="#000";this.mode="tinymce";c.className="active";d.className="";if(b&&!b.isHidden()){a.style.height=b.getContentAreaContainer().offsetHeight+24+"px";b.hide()}h.style.display="block"}return false},_wp_Autop:function(a){var b="table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]";if(a.indexOf("<object")!=-1){a=a.replace(/<object[\s\S]+?<\/object>/g,function(c){return c.replace(/[\r\n]+/g,"")})}a=a.replace(/<[^<>]+>/g,function(c){return c.replace(/[\r\n]+/g," ")});a=a+"\n\n";a=a.replace(/<br \/>\s*<br \/>/gi,"\n\n");a=a.replace(new RegExp("(<(?:"+b+")[^>]*>)","gi"),"\n$1");a=a.replace(new RegExp("(</(?:"+b+")>)","gi"),"$1\n\n");a=a.replace(/\r\n|\r/g,"\n");a=a.replace(/\n\s*\n+/g,"\n\n");a=a.replace(/([\s\S]+?)\n\n/g,"<p>$1</p>\n");a=a.replace(/<p>\s*?<\/p>/gi,"");a=a.replace(new RegExp("<p>\\s*(</?(?:"+b+")[^>]*>)\\s*</p>","gi"),"$1");a=a.replace(/<p>(<li.+?)<\/p>/gi,"$1");a=a.replace(/<p>\s*<blockquote([^>]*)>/gi,"<blockquote$1><p>");a=a.replace(/<\/blockquote>\s*<\/p>/gi,"</p></blockquote>");a=a.replace(new RegExp("<p>\\s*(</?(?:"+b+")[^>]*>)","gi"),"$1");a=a.replace(new RegExp("(</?(?:"+b+")[^>]*>)\\s*</p>","gi"),"$1");a=a.replace(/\s*\n/gi,"<br />\n");a=a.replace(new RegExp("(</?(?:"+b+")[^>]*>)\\s*<br />","gi"),"$1");a=a.replace(/<br \/>(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)/gi,"$1");a=a.replace(/(?:<p>|<br ?\/?>)*\s*\[caption([^\[]+)\[\/caption\]\s*(?:<\/p>|<br ?\/?>)*/gi,"[caption$1[/caption]");a=a.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g,function(c){c=c.replace(/<br ?\/?>[\r\n]*/g,"\n");return c.replace(/<\/?p( [^>]*)?>[\r\n]*/g,"\n")});return a},pre_wpautop:function(b){var a=this,c={o:a,data:b,unfiltered:b};jQuery("body").trigger("beforePreWpautop",[c]);c.data=a._wp_Nop(c.data);jQuery("body").trigger("afterPreWpautop",[c]);return c.data},wpautop:function(b){var a=this,c={o:a,data:b,unfiltered:b};jQuery("body").trigger("beforeWpautop",[c]);c.data=a._wp_Autop(c.data);jQuery("body").trigger("afterWpautop",[c]);return c.data}};

View File

@ -4,7 +4,7 @@ function send_to_editor(h) {
if ( typeof tinyMCE != 'undefined' && ( ed = tinyMCE.activeEditor ) && !ed.isHidden() ) {
ed.focus();
if (tinymce.isIE)
if ( tinymce.isIE )
ed.selection.moveToBookmark(tinymce.EditorManager.activeEditor.windowManager.bookmark);
if ( h.indexOf('[caption') === 0 ) {
@ -13,6 +13,9 @@ function send_to_editor(h) {
} else if ( h.indexOf('[gallery') === 0 ) {
if ( ed.plugins.wpgallery )
h = ed.plugins.wpgallery._do_gallery(h);
} else if ( h.indexOf('[embed') === 0 ) {
if ( ed.plugins.wordpress )
h = ed.plugins.wordpress._setEmbed(h);
}
ed.execCommand('mceInsertContent', false, h);

View File

@ -1 +1 @@
function send_to_editor(b){var a;if(typeof tinyMCE!="undefined"&&(a=tinyMCE.activeEditor)&&!a.isHidden()){a.focus();if(tinymce.isIE){a.selection.moveToBookmark(tinymce.EditorManager.activeEditor.windowManager.bookmark)}if(b.indexOf("[caption")===0){if(a.plugins.wpeditimage){b=a.plugins.wpeditimage._do_shcode(b)}}else{if(b.indexOf("[gallery")===0){if(a.plugins.wpgallery){b=a.plugins.wpgallery._do_gallery(b)}}}a.execCommand("mceInsertContent",false,b)}else{if(typeof edInsertContent=="function"){edInsertContent(edCanvas,b)}else{jQuery(edCanvas).val(jQuery(edCanvas).val()+b)}}tb_remove()}var tb_position;(function(a){tb_position=function(){var e=a("#TB_window"),d=a(window).width(),c=a(window).height(),b=(720<d)?720:d;if(e.size()){e.width(b-50).height(c-45);a("#TB_iframeContent").width(b-50).height(c-75);e.css({"margin-left":"-"+parseInt(((b-50)/2),10)+"px"});if(typeof document.body.style.maxWidth!="undefined"){e.css({top:"20px","margin-top":"0"})}}return a("a.thickbox").each(function(){var f=a(this).attr("href");if(!f){return}f=f.replace(/&width=[0-9]+/g,"");f=f.replace(/&height=[0-9]+/g,"");a(this).attr("href",f+"&width="+(b-80)+"&height="+(c-85))})};a(window).resize(function(){tb_position()})})(jQuery);jQuery(document).ready(function(a){a("a.thickbox").click(function(){if(typeof tinyMCE!="undefined"&&tinyMCE.activeEditor){tinyMCE.get("content").focus();tinyMCE.activeEditor.windowManager.bookmark=tinyMCE.activeEditor.selection.getBookmark("simple")}})});
function send_to_editor(b){var a;if(typeof tinyMCE!="undefined"&&(a=tinyMCE.activeEditor)&&!a.isHidden()){a.focus();if(tinymce.isIE){a.selection.moveToBookmark(tinymce.EditorManager.activeEditor.windowManager.bookmark)}if(b.indexOf("[caption")===0){if(a.plugins.wpeditimage){b=a.plugins.wpeditimage._do_shcode(b)}}else{if(b.indexOf("[gallery")===0){if(a.plugins.wpgallery){b=a.plugins.wpgallery._do_gallery(b)}}else{if(b.indexOf("[embed")===0){if(a.plugins.wordpress){b=a.plugins.wordpress._setEmbed(b)}}}}a.execCommand("mceInsertContent",false,b)}else{if(typeof edInsertContent=="function"){edInsertContent(edCanvas,b)}else{jQuery(edCanvas).val(jQuery(edCanvas).val()+b)}}tb_remove()}var tb_position;(function(a){tb_position=function(){var e=a("#TB_window"),d=a(window).width(),c=a(window).height(),b=(720<d)?720:d;if(e.size()){e.width(b-50).height(c-45);a("#TB_iframeContent").width(b-50).height(c-75);e.css({"margin-left":"-"+parseInt(((b-50)/2),10)+"px"});if(typeof document.body.style.maxWidth!="undefined"){e.css({top:"20px","margin-top":"0"})}}return a("a.thickbox").each(function(){var f=a(this).attr("href");if(!f){return}f=f.replace(/&width=[0-9]+/g,"");f=f.replace(/&height=[0-9]+/g,"");a(this).attr("href",f+"&width="+(b-80)+"&height="+(c-85))})};a(window).resize(function(){tb_position()})})(jQuery);jQuery(document).ready(function(a){a("a.thickbox").click(function(){if(typeof tinyMCE!="undefined"&&tinyMCE.activeEditor){tinyMCE.get("content").focus();tinyMCE.activeEditor.windowManager.bookmark=tinyMCE.activeEditor.selection.getBookmark("simple")}})});

View File

@ -447,7 +447,7 @@ var photostorage = false;
jQuery('#title').unbind();
jQuery('#publish, #save').click(function() { jQuery('#saving').css('display', 'inline'); });
$('#tagsdiv-post_tag, #categorydiv').children('h3').click(function(){
$('#tagsdiv-post_tag, #categorydiv').children('h3, .handlediv').click(function(){
$(this).siblings('.inside').toggle();
});
});

View File

@ -12,4 +12,18 @@
}
.mceWPnextpage {
background: #ffffff url(../img/page_bug.gif) no-repeat right top;
}
}
img.wpGallery {
border: 1px dashed #888;
background: #f2f8ff url("../../wpgallery/img/gallery.png") no-repeat scroll center center;
width: 99%;
height: 250px;
}
img.wp-oembed {
border: 1px dashed #888;
background: #f7f5f2 url("../img/embedded.png") no-repeat scroll center center;
width: 300px;
height: 250px;
}

View File

@ -175,6 +175,15 @@
}
});
ed.onBeforeSetContent.add(function(ed, o) {
o.content = t._setEmbed(o.content);
});
ed.onPostProcess.add(function(ed, o) {
if ( o.get )
o.content = t._getEmbed(o.content);
});
// Add listeners to handle more break
t._handleMoreBreak(ed, url);
@ -202,6 +211,23 @@
ed.addShortcut('alt+shift+b', ed.getLang('bold_desc'), 'Bold');
ed.addShortcut('alt+shift+i', ed.getLang('italic_desc'), 'Italic');
}
ed.onInit.add(function(ed) {
tinymce.dom.Event.add(ed.getWin(), 'scroll', function(e) {
ed.plugins.wordpress._hideButtons();
});
tinymce.dom.Event.add(ed.getBody(), 'dragstart', function(e) {
ed.plugins.wordpress._hideButtons();
});
});
ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {
ed.plugins.wordpress._hideButtons();
});
ed.onSaveContent.add(function(ed, o) {
ed.plugins.wordpress._hideButtons();
});
},
getInfo : function() {
@ -215,6 +241,49 @@
},
// Internal functions
_setEmbed : function(c) {
return c.replace(/\[embed\]([\s\S]+?)\[\/embed\][\s\u00a0]*/g, function(a,b){
return '<img width="300" height="200" src="' + tinymce.baseURL + '/plugins/wordpress/img/trans.gif" class="wp-oembed mceItemNoResize" alt="'+b+'" title="'+b+'" />';
});
},
_getEmbed : function(c) {
return c.replace(/<img[^>]+>/g, function(a) {
if ( a.indexOf('class="wp-oembed') != -1 ) {
var u = a.match(/alt="([^\"]+)"/);
if ( u[1] )
a = '[embed]' + u[1] + '[/embed]';
}
return a;
});
},
_showButtons : function(n, id) {
var t = this, ed = tinyMCE.activeEditor, p1, p2, vp, DOM = tinymce.DOM, X, Y;
vp = ed.dom.getViewPort(ed.getWin());
p1 = DOM.getPos(ed.getContentAreaContainer());
p2 = ed.dom.getPos(n);
X = Math.max(p2.x - vp.x, 0) + p1.x;
Y = Math.max(p2.y - vp.y, 0) + p1.y;
DOM.setStyles(id, {
'top' : Y+5+'px',
'left' : X+5+'px',
'display' : 'block'
});
t.tout = window.setTimeout( function(){ed.plugins.wordpress._hideButtons();}, 5000 );
},
_hideButtons : function() {
tinymce.DOM.hide(['wp_editbtns', 'wp_gallerybtns']);
if ( this.tout )
window.clearTimeout(this.tout);
},
do_align : function(n, a) {
var P, DL, DIV, cls, c, ed = tinyMCE.activeEditor;
@ -253,7 +322,7 @@
_handleMoreBreak : function(ed, url) {
var moreHTML, nextpageHTML;
moreHTML = '<img src="' + url + '/img/trans.gif" alt="$1" class="mceWPmore mceItemNoResize" title="'+ed.getLang('wordpress.wp_more_alt')+'" />';
nextpageHTML = '<img src="' + url + '/img/trans.gif" class="mceWPnextpage mceItemNoResize" title="'+ed.getLang('wordpress.wp_page_alt')+'" />';

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -37,26 +37,12 @@
});
ed.onInit.add(function(ed) {
tinymce.dom.Event.add(ed.getWin(), 'scroll', function(e) {
ed.plugins.wpeditimage.hideButtons();
});
tinymce.dom.Event.add(ed.getBody(), 'dragstart', function(e) {
ed.plugins.wpeditimage.hideButtons();
if ( !tinymce.isGecko && e.target.nodeName == 'IMG' && ed.dom.getParent(e.target, 'dl.wp-caption') )
return tinymce.dom.Event.cancel(e);
});
});
ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {
ed.plugins.wpeditimage.hideButtons();
});
ed.onSaveContent.add(function(ed, o) {
ed.plugins.wpeditimage.hideButtons();
});
ed.onMouseUp.add(function(ed, e) {
if ( tinymce.isWebKit || tinymce.isOpera )
return;
@ -77,26 +63,30 @@
var p;
if ( e.target.nodeName != 'IMG' ) {
t.hideButtons();
return;
ed.plugins.wordpress._hideButtons();
} else if ( ed.dom.getAttrib(e.target, 'class').indexOf('mceItem') == -1 ) {
ed.plugins.wordpress._showButtons(e.target, 'wp_editbtns');
if ( tinymce.isGecko && (p = ed.dom.getParent(e.target, 'dl.wp-caption')) && ed.dom.hasClass(p.parentNode, 'mceTemp') )
ed.selection.select(p.parentNode);
}
ed.plugins.wpeditimage.showButtons(e.target);
if ( tinymce.isGecko && (p = ed.dom.getParent(e.target, 'dl.wp-caption')) && ed.dom.hasClass(p.parentNode, 'mceTemp') )
ed.selection.select(p.parentNode);
});
ed.onKeyPress.add(function(ed, e) {
var DL, DIV, P;
if ( e.keyCode == 13 && (DL = ed.dom.getParent(ed.selection.getNode(), 'DL')) ) {
if ( e.keyCode == 13 && (DL = ed.dom.getParent(ed.selection.getNode(), 'DL')) && ed.dom.hasClass(DL, 'wp-caption') ) {
P = ed.dom.create('p', {}, '&nbsp;');
if ( (DIV = DL.parentNode) && DIV.nodeName == 'DIV' )
ed.dom.insertAfter( P, DIV );
else ed.dom.insertAfter( P, DL );
else
ed.dom.insertAfter( P, DL );
if ( P.firstChild )
ed.selection.select(P.firstChild);
else
ed.selection.select(P);
tinymce.dom.Event.cancel(e);
ed.selection.select(P);
return false;
}
});
@ -155,46 +145,17 @@
});
},
showButtons : function(n) {
var t = this, ed = tinyMCE.activeEditor, p1, p2, vp, DOM = tinymce.DOM, X, Y, cls = ed.dom.getAttrib(n, 'class');
if ( cls.indexOf('mceItem') != -1 || cls.indexOf('wpGallery') != -1 )
return;
vp = ed.dom.getViewPort(ed.getWin());
p1 = DOM.getPos(ed.getContentAreaContainer());
p2 = ed.dom.getPos(n);
X = Math.max(p2.x - vp.x, 0) + p1.x;
Y = Math.max(p2.y - vp.y, 0) + p1.y;
DOM.setStyles('wp_editbtns', {
'top' : Y+5+'px',
'left' : X+5+'px',
'display' : 'block'
});
t.btnsTout = window.setTimeout( function(){ed.plugins.wpeditimage.hideButtons();}, 5000 );
},
hideButtons : function() {
if ( tinymce.DOM.isHidden('wp_editbtns') ) return;
tinymce.DOM.hide('wp_editbtns');
window.clearTimeout(this.btnsTout);
},
_createButtons : function() {
var t = this, ed = tinyMCE.activeEditor, DOM = tinymce.DOM, wp_editbtns, wp_editimgbtn, wp_delimgbtn;
var t = this, ed = tinyMCE.activeEditor, DOM = tinymce.DOM, editButton, dellButton;
DOM.remove('wp_editbtns');
wp_editbtns = DOM.add(document.body, 'div', {
DOM.add(document.body, 'div', {
id : 'wp_editbtns',
style : 'display:none;'
});
wp_editimgbtn = DOM.add('wp_editbtns', 'img', {
editButton = DOM.add('wp_editbtns', 'img', {
src : t.url+'/img/image.png',
id : 'wp_editimgbtn',
width : '24',
@ -202,12 +163,12 @@
title : ed.getLang('wpeditimage.edit_img')
});
tinymce.dom.Event.add(wp_editimgbtn, 'mousedown', function(e) {
tinymce.dom.Event.add(editButton, 'mousedown', function(e) {
ed.windowManager.bookmark = ed.selection.getBookmark('simple');
ed.execCommand("WP_EditImage");
});
wp_delimgbtn = DOM.add('wp_editbtns', 'img', {
dellButton = DOM.add('wp_editbtns', 'img', {
src : t.url+'/img/delete.png',
id : 'wp_delimgbtn',
width : '24',
@ -215,7 +176,7 @@
title : ed.getLang('wpeditimage.del_img')
});
tinymce.dom.Event.add(wp_delimgbtn, 'mousedown', function(e) {
tinymce.dom.Event.add(dellButton, 'mousedown', function(e) {
var ed = tinyMCE.activeEditor, el = ed.selection.getNode(), p;
if ( el.nodeName == 'IMG' && ed.dom.getAttrib(el, 'class').indexOf('mceItem') == -1 ) {

File diff suppressed because one or more lines are too long

View File

@ -10,7 +10,8 @@
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('...');
ed.addCommand('WP_Gallery', function() {
var el = ed.selection.getNode(), post_id, vp = tinymce.DOM.getViewPort(), H = vp.h - 80, W = ( 640 < vp.w ) ? 640 : vp.w;
var el = ed.selection.getNode(), post_id, vp = tinymce.DOM.getViewPort(),
H = vp.h - 80, W = ( 640 < vp.w ) ? 640 : vp.w;
if ( el.nodeName != 'IMG' ) return;
if ( ed.dom.getAttrib(el, 'class').indexOf('wpGallery') == -1 ) return;
@ -21,34 +22,12 @@
tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
});
ed.onInit.add(function(ed) {
tinymce.dom.Event.add(ed.getWin(), 'scroll', function(e) {
ed.plugins.wpgallery.hideButtons();
});
});
ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {
ed.plugins.wpgallery.hideButtons();
});
ed.onSaveContent.add(function(ed, o) {
ed.plugins.wpgallery.hideButtons();
});
ed.onMouseUp.add(function(ed, e) {
if ( tinymce.isOpera ) {
if ( e.target.nodeName == 'IMG' )
ed.plugins.wpgallery.showButtons(e.target);
}
});
ed.onMouseDown.add(function(ed, e) {
if ( tinymce.isOpera || e.target.nodeName != 'IMG' ) {
t.hideButtons();
return;
if ( e.target.nodeName != 'IMG' ) {
ed.plugins.wordpress._hideButtons();
} else if ( ed.dom.hasClass(e.target, 'wpGallery') ) {
ed.plugins.wordpress._showButtons(e.target, 'wp_gallerybtns');
}
ed.plugins.wpgallery.showButtons(e.target);
});
ed.onBeforeSetContent.add(function(ed, o) {
@ -84,46 +63,17 @@
});
},
showButtons : function(n) {
var t = this, ed = tinyMCE.activeEditor, p1, p2, vp, DOM = tinymce.DOM, X, Y;
if (ed.dom.getAttrib(n, 'class').indexOf('wpGallery') == -1)
return;
vp = ed.dom.getViewPort(ed.getWin());
p1 = DOM.getPos(ed.getContentAreaContainer());
p2 = ed.dom.getPos(n);
X = Math.max(p2.x - vp.x, 0) + p1.x;
Y = Math.max(p2.y - vp.y, 0) + p1.y;
DOM.setStyles('wp_gallerybtns', {
'top' : Y+5+'px',
'left' : X+5+'px',
'display' : 'block'
});
t.btnsTout = window.setTimeout( function(){ed.plugins.wpgallery.hideButtons();}, 5000 );
},
hideButtons : function() {
if ( tinymce.DOM.isHidden('wp_gallerybtns') ) return;
tinymce.DOM.hide('wp_gallerybtns');
window.clearTimeout(this.btnsTout);
},
_createButtons : function() {
var t = this, ed = tinyMCE.activeEditor, DOM = tinymce.DOM, wp_gallerybtns, wp_editgallery, wp_delgallery;
var t = this, ed = tinyMCE.activeEditor, DOM = tinymce.DOM, editButton, dellButton;
DOM.remove('wp_gallerybtns');
wp_gallerybtns = DOM.add(document.body, 'div', {
DOM.add(document.body, 'div', {
id : 'wp_gallerybtns',
style : 'display:none;'
});
wp_editgallery = DOM.add('wp_gallerybtns', 'img', {
editButton = DOM.add('wp_gallerybtns', 'img', {
src : t.url+'/img/edit.png',
id : 'wp_editgallery',
width : '24',
@ -131,14 +81,12 @@
title : ed.getLang('wordpress.editgallery')
});
wp_editgallery.onmousedown = function(e) {
var ed = tinyMCE.activeEditor;
tinymce.dom.Event.add(editButton, 'mousedown', function(e) {
ed.windowManager.bookmark = ed.selection.getBookmark('simple');
ed.execCommand("WP_Gallery");
this.parentNode.style.display = 'none';
};
});
wp_delgallery = DOM.add('wp_gallerybtns', 'img', {
dellButton = DOM.add('wp_gallerybtns', 'img', {
src : t.url+'/img/delete.png',
id : 'wp_delgallery',
width : '24',
@ -146,17 +94,16 @@
title : ed.getLang('wordpress.delgallery')
});
wp_delgallery.onmousedown = function(e) {
tinymce.dom.Event.add(dellButton, 'mousedown', function(e) {
var ed = tinyMCE.activeEditor, el = ed.selection.getNode();
if ( el.nodeName == 'IMG' && ed.dom.getAttrib(el, 'class').indexOf('wpGallery') != -1 ) {
if ( el.nodeName == 'IMG' && ed.dom.hasClass(el, 'wpGallery') ) {
ed.dom.remove(el);
this.parentNode.style.display = 'none';
ed.execCommand('mceRepaint');
return false;
}
};
});
},
getInfo : function() {

View File

@ -1 +1 @@
(function(){tinymce.create("tinymce.plugins.wpGallery",{init:function(a,b){var c=this;c.url=b;c._createButtons();a.addCommand("WP_Gallery",function(){var h=a.selection.getNode(),f,e=tinymce.DOM.getViewPort(),g=e.h-80,d=(640<e.w)?640:e.w;if(h.nodeName!="IMG"){return}if(a.dom.getAttrib(h,"class").indexOf("wpGallery")==-1){return}f=tinymce.DOM.get("post_ID").value;tb_show("",tinymce.documentBaseURL+"/media-upload.php?post_id="+f+"&tab=gallery&TB_iframe=true&width="+d+"&height="+g);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")});a.onInit.add(function(d){tinymce.dom.Event.add(d.getWin(),"scroll",function(f){d.plugins.wpgallery.hideButtons()})});a.onBeforeExecCommand.add(function(d,f,e,g){d.plugins.wpgallery.hideButtons()});a.onSaveContent.add(function(d,e){d.plugins.wpgallery.hideButtons()});a.onMouseUp.add(function(d,f){if(tinymce.isOpera){if(f.target.nodeName=="IMG"){d.plugins.wpgallery.showButtons(f.target)}}});a.onMouseDown.add(function(d,f){if(tinymce.isOpera||f.target.nodeName!="IMG"){c.hideButtons();return}d.plugins.wpgallery.showButtons(f.target)});a.onBeforeSetContent.add(function(d,e){e.content=c._do_gallery(e.content)});a.onPostProcess.add(function(d,e){if(e.get){e.content=c._get_gallery(e.content)}})},_do_gallery:function(a){return a.replace(/\[gallery([^\]]*)\]/g,function(d,c){return'<img src="'+tinymce.baseURL+'/plugins/wpgallery/img/t.gif" class="wpGallery mceItem" title="gallery'+tinymce.DOM.encode(c)+'" />'})},_get_gallery:function(b){function a(c,d){d=new RegExp(d+'="([^"]+)"',"g").exec(c);return d?tinymce.DOM.decode(d[1]):""}return b.replace(/(?:<p[^>]*>)*(<img[^>]+>)(?:<\/p>)*/g,function(e,d){var c=a(d,"class");if(c.indexOf("wpGallery")!=-1){return"<p>["+tinymce.trim(a(d,"title"))+"]</p>"}return e})},showButtons:function(d){var i=this,e=tinyMCE.activeEditor,g,f,a,h=tinymce.DOM,c,b;if(e.dom.getAttrib(d,"class").indexOf("wpGallery")==-1){return}a=e.dom.getViewPort(e.getWin());g=h.getPos(e.getContentAreaContainer());f=e.dom.getPos(d);c=Math.max(f.x-a.x,0)+g.x;b=Math.max(f.y-a.y,0)+g.y;h.setStyles("wp_gallerybtns",{top:b+5+"px",left:c+5+"px",display:"block"});i.btnsTout=window.setTimeout(function(){e.plugins.wpgallery.hideButtons()},5000)},hideButtons:function(){if(tinymce.DOM.isHidden("wp_gallerybtns")){return}tinymce.DOM.hide("wp_gallerybtns");window.clearTimeout(this.btnsTout)},_createButtons:function(){var d=this,b=tinyMCE.activeEditor,e=tinymce.DOM,c,f,a;e.remove("wp_gallerybtns");c=e.add(document.body,"div",{id:"wp_gallerybtns",style:"display:none;"});f=e.add("wp_gallerybtns","img",{src:d.url+"/img/edit.png",id:"wp_editgallery",width:"24",height:"24",title:b.getLang("wordpress.editgallery")});f.onmousedown=function(h){var g=tinyMCE.activeEditor;g.windowManager.bookmark=g.selection.getBookmark("simple");g.execCommand("WP_Gallery");this.parentNode.style.display="none"};a=e.add("wp_gallerybtns","img",{src:d.url+"/img/delete.png",id:"wp_delgallery",width:"24",height:"24",title:b.getLang("wordpress.delgallery")});a.onmousedown=function(i){var g=tinyMCE.activeEditor,h=g.selection.getNode();if(h.nodeName=="IMG"&&g.dom.getAttrib(h,"class").indexOf("wpGallery")!=-1){g.dom.remove(h);this.parentNode.style.display="none";g.execCommand("mceRepaint");return false}}},getInfo:function(){return{longname:"Gallery Settings",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wpgallery",tinymce.plugins.wpGallery)})();
(function(){tinymce.create("tinymce.plugins.wpGallery",{init:function(a,b){var c=this;c.url=b;c._createButtons();a.addCommand("WP_Gallery",function(){var h=a.selection.getNode(),f,e=tinymce.DOM.getViewPort(),g=e.h-80,d=(640<e.w)?640:e.w;if(h.nodeName!="IMG"){return}if(a.dom.getAttrib(h,"class").indexOf("wpGallery")==-1){return}f=tinymce.DOM.get("post_ID").value;tb_show("",tinymce.documentBaseURL+"/media-upload.php?post_id="+f+"&tab=gallery&TB_iframe=true&width="+d+"&height="+g);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")});a.onMouseDown.add(function(d,f){if(f.target.nodeName!="IMG"){d.plugins.wordpress._hideButtons()}else{if(d.dom.hasClass(f.target,"wpGallery")){d.plugins.wordpress._showButtons(f.target,"wp_gallerybtns")}}});a.onBeforeSetContent.add(function(d,e){e.content=c._do_gallery(e.content)});a.onPostProcess.add(function(d,e){if(e.get){e.content=c._get_gallery(e.content)}})},_do_gallery:function(a){return a.replace(/\[gallery([^\]]*)\]/g,function(d,c){return'<img src="'+tinymce.baseURL+'/plugins/wpgallery/img/t.gif" class="wpGallery mceItem" title="gallery'+tinymce.DOM.encode(c)+'" />'})},_get_gallery:function(b){function a(c,d){d=new RegExp(d+'="([^"]+)"',"g").exec(c);return d?tinymce.DOM.decode(d[1]):""}return b.replace(/(?:<p[^>]*>)*(<img[^>]+>)(?:<\/p>)*/g,function(e,d){var c=a(d,"class");if(c.indexOf("wpGallery")!=-1){return"<p>["+tinymce.trim(a(d,"title"))+"]</p>"}return e})},_createButtons:function(){var b=this,a=tinyMCE.activeEditor,d=tinymce.DOM,e,c;d.remove("wp_gallerybtns");d.add(document.body,"div",{id:"wp_gallerybtns",style:"display:none;"});e=d.add("wp_gallerybtns","img",{src:b.url+"/img/edit.png",id:"wp_editgallery",width:"24",height:"24",title:a.getLang("wordpress.editgallery")});tinymce.dom.Event.add(e,"mousedown",function(f){a.windowManager.bookmark=a.selection.getBookmark("simple");a.execCommand("WP_Gallery")});c=d.add("wp_gallerybtns","img",{src:b.url+"/img/delete.png",id:"wp_delgallery",width:"24",height:"24",title:a.getLang("wordpress.delgallery")});tinymce.dom.Event.add(c,"mousedown",function(h){var f=tinyMCE.activeEditor,g=f.selection.getNode();if(g.nodeName=="IMG"&&f.dom.hasClass(g,"wpGallery")){f.dom.remove(g);f.execCommand("mceRepaint");return false}})},getInfo:function(){return{longname:"Gallery Settings",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wpgallery",tinymce.plugins.wpGallery)})();

View File

@ -64,13 +64,6 @@ dl.aligncenter {
margin: 0;
}
img.wpGallery {
border: 1px dotted #cc0000;
background: #ffffcc url("../../../../plugins/wpgallery/img/gallery.png") no-repeat scroll center center;
width: 99%;
height: 250px;
}
body.mceContentBody {
font: 13px/19px Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
padding: 0.6em;

File diff suppressed because one or more lines are too long

View File

@ -22,7 +22,7 @@ $wp_db_version = 12060;
*
* @global string $tinymce_version
*/
$tinymce_version = '327-1235';
$tinymce_version = '327-1235b';
/**
* Holds the cache manifest version