Changeset 10337
- Timestamp:
- 01/09/2009 12:02:59 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 1 deleted
- 8 edited
-
wp-admin/admin-header.php (modified) (1 diff)
-
wp-admin/gears-manifest.php (modified) (1 diff)
-
wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css (modified) (1 diff)
-
wp-includes/js/tinymce/plugins/wordpress/editor_plugin.dev.js (added)
-
wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js (modified) (1 diff)
-
wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.dev.js (added)
-
wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js (modified) (1 diff)
-
wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.dev.js (added)
-
wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.js (modified) (1 diff)
-
wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css (modified) (2 diffs)
-
wp-includes/js/tinymce/wordpress.css (deleted)
-
wp-includes/script-loader.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-header.php
r10258 r10337 55 55 56 56 if ( in_array( $pagenow, array('post.php', 'post-new.php', 'page.php', 'page-new.php') ) ) { 57 add_action( 'admin_ head', 'wp_tiny_mce' );57 add_action( 'admin_footer', 'wp_tiny_mce' ); 58 58 } 59 59 -
trunk/wp-admin/gears-manifest.php
r10132 r10337 191 191 { "url" : "images/yes.png" }, 192 192 193 <?php if ( is_file('../wp-includes/js/tinymce/tiny_mce.js') ) { ?>193 <?php if ( @is_file('../wp-includes/js/tinymce/tiny_mce.js') ) { ?> 194 194 { "url" : "../wp-includes/js/tinymce/tiny_mce.js", "src" : "../wp-includes/js/tinymce/tiny_mce.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true }, 195 195 { "url" : "../wp-includes/js/tinymce/langs/wp-langs-en.js", "src" : "../wp-includes/js/tinymce/langs/wp-langs-en.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true }, 196 { "url" : "../wp-includes/js/tinymce/wordpress.css", "src" : "../wp-includes/js/tinymce/wordpress.css?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },197 196 { "url" : "../wp-includes/js/tinymce/utils/mctabs.js", "src" : "../wp-includes/js/tinymce/utils/mctabs.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true }, 198 197 { "url" : "../wp-includes/js/tinymce/utils/validate.js", "src" : "../wp-includes/js/tinymce/utils/validate.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true }, -
trunk/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css
r7679 r10337 4 4 5 5 /* General */ 6 .clearlooks2 div, .clearlooks2 span, .clearlooks2 a {position:absolute; border:0; padding:0; margin:0; background:transparent; font-family:Arial,Verdana; font-size:11px; color:#000; text-decoration:none; font-weight:normal; width:auto; height:auto; overflow:hidden; display:block;} 7 .clearlooks2 {position:absolute;} 6 .clearlooks2 {position:absolute; direction:ltr} 8 7 .clearlooks2 .mceWrapper {position:static} 9 .mceEventBlocker {position: absolute; left:0; top:0; background:url(img/horizontal.gif) no-repeat 0 -75px; width:100%; height:100%;}10 .clearlooks2 .mcePlaceHolder {border:1px solid #000; background:#888; top:0; left:0; opacity:0.5; filter:alpha(opacity=50);}11 .clearlooks2_modalBlocker {position: absolute; left:0; top:0; width:100%; height:100%; background:#FFF; opacity:0.6; filter:alpha(opacity=60); display:none}8 .mceEventBlocker {position:fixed; left:0; top:0; background:url(img/horizontal.gif) no-repeat 0 -75px; width:100%; height:100%} 9 .clearlooks2 .mcePlaceHolder {border:1px solid #000; background:#888; top:0; left:0; opacity:0.5; -ms-filter:'alpha(opacity=50)'; filter:alpha(opacity=50)} 10 .clearlooks2_modalBlocker {position:fixed; left:0; top:0; width:100%; height:100%; background:#FFF; opacity:0.6; -ms-filter:'alpha(opacity=60)'; filter:alpha(opacity=60); display:none} 12 11 13 12 /* Top */ -
trunk/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js
r9389 r10337 1 /** 2 * WordPress plugin. 3 */ 4 5 (function() { 6 var DOM = tinymce.DOM; 7 8 // Load plugin specific language pack 9 tinymce.PluginManager.requireLangPack('wordpress'); 10 11 tinymce.create('tinymce.plugins.WordPress', { 12 init : function(ed, url) { 13 var t = this, tbId = ed.getParam('wordpress_adv_toolbar', 'toolbar2'); 14 var moreHTML = '<img src="' + url + '/img/trans.gif" class="mceWPmore mceItemNoResize" title="'+ed.getLang('wordpress.wp_more_alt')+'" />'; 15 var nextpageHTML = '<img src="' + url + '/img/trans.gif" class="mceWPnextpage mceItemNoResize" title="'+ed.getLang('wordpress.wp_page_alt')+'" />'; 16 17 if ( getUserSetting('hidetb', '0') == '1' ) 18 ed.settings.wordpress_adv_hidden = 0; 19 20 // Hides the specified toolbar and resizes the iframe 21 ed.onPostRender.add(function() { 22 if ( ed.getParam('wordpress_adv_hidden', 1) ) { 23 DOM.hide(ed.controlManager.get(tbId).id); 24 t._resizeIframe(ed, tbId, 28); 25 } 26 }); 27 28 // Register commands 29 ed.addCommand('WP_More', function() { 30 ed.execCommand('mceInsertContent', 0, moreHTML); 31 }); 32 33 ed.addCommand('WP_Page', function() { 34 ed.execCommand('mceInsertContent', 0, nextpageHTML); 35 }); 36 37 ed.addCommand('WP_Help', function() { 38 ed.windowManager.open({ 39 url : tinymce.baseURL + '/wp-mce-help.php', 40 width : 450, 41 height : 420, 42 inline : 1 43 }); 44 }); 45 46 ed.addCommand('WP_Adv', function() { 47 var id = ed.controlManager.get(tbId).id, cm = ed.controlManager; 48 49 if (DOM.isHidden(id)) { 50 cm.setActive('wp_adv', 1); 51 DOM.show(id); 52 t._resizeIframe(ed, tbId, -28); 53 ed.settings.wordpress_adv_hidden = 0; 54 setUserSetting('hidetb', '1'); 55 } else { 56 cm.setActive('wp_adv', 0); 57 DOM.hide(id); 58 t._resizeIframe(ed, tbId, 28); 59 ed.settings.wordpress_adv_hidden = 1; 60 setUserSetting('hidetb', '0'); 61 } 62 }); 63 64 // Register buttons 65 ed.addButton('wp_more', { 66 title : 'wordpress.wp_more_desc', 67 image : url + '/img/more.gif', 68 cmd : 'WP_More' 69 }); 70 71 ed.addButton('wp_page', { 72 title : 'wordpress.wp_page_desc', 73 image : url + '/img/page.gif', 74 cmd : 'WP_Page' 75 }); 76 77 ed.addButton('wp_help', { 78 title : 'wordpress.wp_help_desc', 79 image : url + '/img/help.gif', 80 cmd : 'WP_Help' 81 }); 82 83 ed.addButton('wp_adv', { 84 title : 'wordpress.wp_adv_desc', 85 image : url + '/img/toolbars.gif', 86 cmd : 'WP_Adv' 87 }); 88 89 // Add Media buttons 90 ed.addButton('add_media', { 91 title : 'wordpress.add_media', 92 image : url + '/img/media.gif', 93 onclick : function() { 94 tb_show('', tinymce.DOM.get('add_media').href); 95 tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' ); 96 } 97 }); 98 99 ed.addButton('add_image', { 100 title : 'wordpress.add_image', 101 image : url + '/img/image.gif', 102 onclick : function() { 103 tb_show('', tinymce.DOM.get('add_image').href); 104 tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' ); 105 } 106 }); 107 108 ed.addButton('add_video', { 109 title : 'wordpress.add_video', 110 image : url + '/img/video.gif', 111 onclick : function() { 112 tb_show('', tinymce.DOM.get('add_video').href); 113 tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' ); 114 } 115 }); 116 117 ed.addButton('add_audio', { 118 title : 'wordpress.add_audio', 119 image : url + '/img/audio.gif', 120 onclick : function() { 121 tb_show('', tinymce.DOM.get('add_audio').href); 122 tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' ); 123 } 124 }); 125 126 // Add Media buttons to fullscreen 127 ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) { 128 if ( 'mceFullScreen' != cmd ) return; 129 if ( 'mce_fullscreen' != ed.id ) 130 ed.settings.theme_advanced_buttons1 += ',|,add_image,add_video,add_audio,add_media'; 131 }); 132 133 // Add class "alignleft", "alignright" and "aligncenter" when selecting align for images. 134 ed.addCommand('JustifyLeft', function() { 135 var n = ed.selection.getNode(); 136 137 if ( n.nodeName != 'IMG' ) 138 ed.editorCommands.mceJustify('JustifyLeft', 'left'); 139 else ed.plugins.wordpress.do_align(n, 'alignleft'); 140 }); 141 142 ed.addCommand('JustifyRight', function() { 143 var n = ed.selection.getNode(); 144 145 if ( n.nodeName != 'IMG' ) 146 ed.editorCommands.mceJustify('JustifyRight', 'right'); 147 else ed.plugins.wordpress.do_align(n, 'alignright'); 148 }); 149 150 ed.addCommand('JustifyCenter', function() { 151 var n = ed.selection.getNode(), P = ed.dom.getParent(n, 'p'), DL = ed.dom.getParent(n, 'dl'); 152 153 if ( n.nodeName == 'IMG' && ( P || DL ) ) 154 ed.plugins.wordpress.do_align(n, 'aligncenter'); 155 else ed.editorCommands.mceJustify('JustifyCenter', 'center'); 156 }); 157 158 // Word count if script is loaded 159 if ( 'undefined' != typeof wpWordCount ) { 160 var last = 0; 161 ed.onKeyUp.add(function(ed, e) { 162 if ( e.keyCode == last ) return; 163 if ( 13 == e.keyCode || 8 == last || 46 == last ) wpWordCount.wc( ed.getContent({format : 'raw'}) ); 164 last = e.keyCode; 165 }); 166 }; 167 168 // Add listeners to handle more break 169 t._handleMoreBreak(ed, url); 170 171 // Add custom shortcuts 172 ed.addShortcut('alt+shift+c', ed.getLang('justifycenter_desc'), 'JustifyCenter'); 173 ed.addShortcut('alt+shift+r', ed.getLang('justifyright_desc'), 'JustifyRight'); 174 ed.addShortcut('alt+shift+l', ed.getLang('justifyleft_desc'), 'JustifyLeft'); 175 ed.addShortcut('alt+shift+j', ed.getLang('justifyfull_desc'), 'JustifyFull'); 176 ed.addShortcut('alt+shift+q', ed.getLang('blockquote_desc'), 'mceBlockQuote'); 177 ed.addShortcut('alt+shift+u', ed.getLang('bullist_desc'), 'InsertUnorderedList'); 178 ed.addShortcut('alt+shift+o', ed.getLang('numlist_desc'), 'InsertOrderedList'); 179 ed.addShortcut('alt+shift+d', ed.getLang('striketrough_desc'), 'Strikethrough'); 180 ed.addShortcut('alt+shift+n', ed.getLang('spellchecker.desc'), 'mceSpellCheck'); 181 ed.addShortcut('alt+shift+a', ed.getLang('link_desc'), 'mceLink'); 182 ed.addShortcut('alt+shift+s', ed.getLang('unlink_desc'), 'unlink'); 183 ed.addShortcut('alt+shift+m', ed.getLang('image_desc'), 'mceImage'); 184 ed.addShortcut('alt+shift+g', ed.getLang('fullscreen.desc'), 'mceFullScreen'); 185 ed.addShortcut('alt+shift+z', ed.getLang('wp_adv_desc'), 'WP_Adv'); 186 ed.addShortcut('alt+shift+h', ed.getLang('help_desc'), 'WP_Help'); 187 ed.addShortcut('alt+shift+t', ed.getLang('wp_more_desc'), 'WP_More'); 188 ed.addShortcut('alt+shift+p', ed.getLang('wp_page_desc'), 'WP_Page'); 189 190 if ( tinymce.isWebKit ) { 191 ed.addShortcut('alt+shift+b', ed.getLang('bold_desc'), 'Bold'); 192 ed.addShortcut('alt+shift+i', ed.getLang('italic_desc'), 'Italic'); 193 } 194 }, 195 196 getInfo : function() { 197 return { 198 longname : 'WordPress Plugin', 199 author : 'WordPress', // add Moxiecode? 200 authorurl : 'http://wordpress.org', 201 infourl : 'http://wordpress.org', 202 version : '3.0' 203 }; 204 }, 205 206 // Internal functions 207 do_align : function(n, a) { 208 var P, DL, DIV, cls, c, ed = tinyMCE.activeEditor; 209 210 if ( /^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className) ) 211 return; 212 213 P = ed.dom.getParent(n, 'p'); 214 DL = ed.dom.getParent(n, 'dl'); 215 DIV = ed.dom.getParent(n, 'div'); 216 217 if ( DL && DIV ) { 218 cls = ed.dom.hasClass(DL, a) ? 'alignnone' : a; 219 DL.className = DL.className.replace(/align[^ '"]+\s?/g, ''); 220 ed.dom.addClass(DL, cls); 221 c = (cls == 'aligncenter') ? ed.dom.addClass(DIV, 'mceIEcenter') : ed.dom.removeClass(DIV, 'mceIEcenter'); 222 } else if ( P ) { 223 cls = ed.dom.hasClass(n, a) ? 'alignnone' : a; 224 n.className = n.className.replace(/align[^ '"]+\s?/g, ''); 225 ed.dom.addClass(n, cls); 226 if ( cls == 'aligncenter' ) 227 ed.dom.setStyle(P, 'textAlign', 'center'); 228 else if (P.style && P.style.textAlign == 'center') 229 ed.dom.setStyle(P, 'textAlign', ''); 230 } 231 232 ed.execCommand('mceRepaint'); 233 }, 234 235 // Resizes the iframe by a relative height value 236 _resizeIframe : function(ed, tb_id, dy) { 237 var ifr = ed.getContentAreaContainer().firstChild; 238 239 DOM.setStyle(ifr, 'height', ifr.clientHeight + dy); // Resize iframe 240 ed.theme.deltaHeight += dy; // For resize cookie 241 }, 242 243 _handleMoreBreak : function(ed, url) { 244 var moreHTML = '<img src="' + url + '/img/trans.gif" alt="$1" class="mceWPmore mceItemNoResize" title="'+ed.getLang('wordpress.wp_more_alt')+'" />'; 245 var nextpageHTML = '<img src="' + url + '/img/trans.gif" class="mceWPnextpage mceItemNoResize" title="'+ed.getLang('wordpress.wp_page_alt')+'" />'; 246 247 // Load plugin specific CSS into editor 248 ed.onInit.add(function() { 249 ed.dom.loadCSS(url + '/css/content.css'); 250 }); 251 252 // Display morebreak instead if img in element path 253 ed.onPostRender.add(function() { 254 if (ed.theme.onResolveName) { 255 ed.theme.onResolveName.add(function(th, o) { 256 if (o.node.nodeName == 'IMG') { 257 if ( ed.dom.hasClass(o.node, 'mceWPmore') ) 258 o.name = 'wpmore'; 259 if ( ed.dom.hasClass(o.node, 'mceWPnextpage') ) 260 o.name = 'wppage'; 261 } 262 263 }); 264 } 265 }); 266 267 // Replace morebreak with images 268 ed.onBeforeSetContent.add(function(ed, o) { 269 o.content = o.content.replace(/<!--more(.*?)-->/g, moreHTML); 270 o.content = o.content.replace(/<!--nextpage-->/g, nextpageHTML); 271 }); 272 273 // Replace images with morebreak 274 ed.onPostProcess.add(function(ed, o) { 275 if (o.get) 276 o.content = o.content.replace(/<img[^>]+>/g, function(im) { 277 if (im.indexOf('class="mceWPmore') !== -1) { 278 var m, moretext = (m = im.match(/alt="(.*?)"/)) ? m[1] : ''; 279 im = '<!--more'+moretext+'-->'; 280 } 281 if (im.indexOf('class="mceWPnextpage') !== -1) 282 im = '<!--nextpage-->'; 283 284 return im; 285 }); 286 }); 287 288 // Set active buttons if user selected pagebreak or more break 289 ed.onNodeChange.add(function(ed, cm, n) { 290 cm.setActive('wp_page', n.nodeName === 'IMG' && ed.dom.hasClass(n, 'mceWPnextpage')); 291 cm.setActive('wp_more', n.nodeName === 'IMG' && ed.dom.hasClass(n, 'mceWPmore')); 292 }); 293 } 294 }); 295 296 // Register plugin 297 tinymce.PluginManager.add('wordpress', tinymce.plugins.WordPress); 298 })(); 1 (function(){var a=tinymce.DOM;tinymce.create("tinymce.plugins.WordPress",{init:function(c,d){var e=this,h=c.getParam("wordpress_adv_toolbar","toolbar2"),g=0,f,b;f='<img src="'+d+'/img/trans.gif" class="mceWPmore mceItemNoResize" title="'+c.getLang("wordpress.wp_more_alt")+'" />';b='<img src="'+d+'/img/trans.gif" class="mceWPnextpage mceItemNoResize" title="'+c.getLang("wordpress.wp_page_alt")+'" />';if(getUserSetting("hidetb","0")=="1"){c.settings.wordpress_adv_hidden=0}c.onPostRender.add(function(){if(c.getParam("wordpress_adv_hidden",1)){a.hide(c.controlManager.get(h).id);e._resizeIframe(c,h,28)}});c.addCommand("WP_More",function(){c.execCommand("mceInsertContent",0,f)});c.addCommand("WP_Page",function(){c.execCommand("mceInsertContent",0,b)});c.addCommand("WP_Help",function(){c.windowManager.open({url:tinymce.baseURL+"/wp-mce-help.php",width:450,height:420,inline:1})});c.addCommand("WP_Adv",function(){var j=c.controlManager.get(h).id,i=c.controlManager;if(a.isHidden(j)){i.setActive("wp_adv",1);a.show(j);e._resizeIframe(c,h,-28);c.settings.wordpress_adv_hidden=0;setUserSetting("hidetb","1")}else{i.setActive("wp_adv",0);a.hide(j);e._resizeIframe(c,h,28);c.settings.wordpress_adv_hidden=1;setUserSetting("hidetb","0")}});c.addButton("wp_more",{title:"wordpress.wp_more_desc",image:d+"/img/more.gif",cmd:"WP_More"});c.addButton("wp_page",{title:"wordpress.wp_page_desc",image:d+"/img/page.gif",cmd:"WP_Page"});c.addButton("wp_help",{title:"wordpress.wp_help_desc",image:d+"/img/help.gif",cmd:"WP_Help"});c.addButton("wp_adv",{title:"wordpress.wp_adv_desc",image:d+"/img/toolbars.gif",cmd:"WP_Adv"});c.addButton("add_media",{title:"wordpress.add_media",image:d+"/img/media.gif",onclick:function(){tb_show("",tinymce.DOM.get("add_media").href);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")}});c.addButton("add_image",{title:"wordpress.add_image",image:d+"/img/image.gif",onclick:function(){tb_show("",tinymce.DOM.get("add_image").href);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")}});c.addButton("add_video",{title:"wordpress.add_video",image:d+"/img/video.gif",onclick:function(){tb_show("",tinymce.DOM.get("add_video").href);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")}});c.addButton("add_audio",{title:"wordpress.add_audio",image:d+"/img/audio.gif",onclick:function(){tb_show("",tinymce.DOM.get("add_audio").href);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")}});c.onBeforeExecCommand.add(function(i,k,j,l){if("mceFullScreen"!=k){return}if("mce_fullscreen"!=i.id){i.settings.theme_advanced_buttons1+=",|,add_image,add_video,add_audio,add_media"}});c.addCommand("JustifyLeft",function(){var i=c.selection.getNode();if(i.nodeName!="IMG"){c.editorCommands.mceJustify("JustifyLeft","left")}else{c.plugins.wordpress.do_align(i,"alignleft")}});c.addCommand("JustifyRight",function(){var i=c.selection.getNode();if(i.nodeName!="IMG"){c.editorCommands.mceJustify("JustifyRight","right")}else{c.plugins.wordpress.do_align(i,"alignright")}});c.addCommand("JustifyCenter",function(){var k=c.selection.getNode(),j=c.dom.getParent(k,"p"),i=c.dom.getParent(k,"dl");if(k.nodeName=="IMG"&&(j||i)){c.plugins.wordpress.do_align(k,"aligncenter")}else{c.editorCommands.mceJustify("JustifyCenter","center")}});if("undefined"!=typeof wpWordCount){c.onKeyUp.add(function(i,j){if(j.keyCode==g){return}if(13==j.keyCode||8==g||46==g){wpWordCount.wc(i.getContent({format:"raw"}))}g=j.keyCode})}e._handleMoreBreak(c,d);c.addShortcut("alt+shift+c",c.getLang("justifycenter_desc"),"JustifyCenter");c.addShortcut("alt+shift+r",c.getLang("justifyright_desc"),"JustifyRight");c.addShortcut("alt+shift+l",c.getLang("justifyleft_desc"),"JustifyLeft");c.addShortcut("alt+shift+j",c.getLang("justifyfull_desc"),"JustifyFull");c.addShortcut("alt+shift+q",c.getLang("blockquote_desc"),"mceBlockQuote");c.addShortcut("alt+shift+u",c.getLang("bullist_desc"),"InsertUnorderedList");c.addShortcut("alt+shift+o",c.getLang("numlist_desc"),"InsertOrderedList");c.addShortcut("alt+shift+d",c.getLang("striketrough_desc"),"Strikethrough");c.addShortcut("alt+shift+n",c.getLang("spellchecker.desc"),"mceSpellCheck");c.addShortcut("alt+shift+a",c.getLang("link_desc"),"mceLink");c.addShortcut("alt+shift+s",c.getLang("unlink_desc"),"unlink");c.addShortcut("alt+shift+m",c.getLang("image_desc"),"mceImage");c.addShortcut("alt+shift+g",c.getLang("fullscreen.desc"),"mceFullScreen");c.addShortcut("alt+shift+z",c.getLang("wp_adv_desc"),"WP_Adv");c.addShortcut("alt+shift+h",c.getLang("help_desc"),"WP_Help");c.addShortcut("alt+shift+t",c.getLang("wp_more_desc"),"WP_More");c.addShortcut("alt+shift+p",c.getLang("wp_page_desc"),"WP_Page");if(tinymce.isWebKit){c.addShortcut("alt+shift+b",c.getLang("bold_desc"),"Bold");c.addShortcut("alt+shift+i",c.getLang("italic_desc"),"Italic")}},getInfo:function(){return{longname:"WordPress Plugin",author:"WordPress",authorurl:"http://wordpress.org",infourl:"http://wordpress.org",version:"3.0"}},do_align:function(j,d){var h,f,g,b,i,e=tinyMCE.activeEditor;if(/^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(j.className)){return}h=e.dom.getParent(j,"p");f=e.dom.getParent(j,"dl");g=e.dom.getParent(j,"div");if(f&&g){b=e.dom.hasClass(f,d)?"alignnone":d;f.className=f.className.replace(/align[^ '"]+\s?/g,"");e.dom.addClass(f,b);i=(b=="aligncenter")?e.dom.addClass(g,"mceIEcenter"):e.dom.removeClass(g,"mceIEcenter")}else{if(h){b=e.dom.hasClass(j,d)?"alignnone":d;j.className=j.className.replace(/align[^ '"]+\s?/g,"");e.dom.addClass(j,b);if(b=="aligncenter"){e.dom.setStyle(h,"textAlign","center")}else{if(h.style&&h.style.textAlign=="center"){e.dom.setStyle(h,"textAlign","")}}}}e.execCommand("mceRepaint")},_resizeIframe:function(c,e,b){var d=c.getContentAreaContainer().firstChild;a.setStyle(d,"height",d.clientHeight+b);c.theme.deltaHeight+=b},_handleMoreBreak:function(c,d){var e,b;e='<img src="'+d+'/img/trans.gif" alt="$1" class="mceWPmore mceItemNoResize" title="'+c.getLang("wordpress.wp_more_alt")+'" />';b='<img src="'+d+'/img/trans.gif" class="mceWPnextpage mceItemNoResize" title="'+c.getLang("wordpress.wp_page_alt")+'" />';c.onInit.add(function(){c.dom.loadCSS(d+"/css/content.css")});c.onPostRender.add(function(){if(c.theme.onResolveName){c.theme.onResolveName.add(function(f,g){if(g.node.nodeName=="IMG"){if(c.dom.hasClass(g.node,"mceWPmore")){g.name="wpmore"}if(c.dom.hasClass(g.node,"mceWPnextpage")){g.name="wppage"}}})}});c.onBeforeSetContent.add(function(f,g){g.content=g.content.replace(/<!--more(.*?)-->/g,e);g.content=g.content.replace(/<!--nextpage-->/g,b)});c.onPostProcess.add(function(f,g){if(g.get){g.content=g.content.replace(/<img[^>]+>/g,function(i){if(i.indexOf('class="mceWPmore')!==-1){var h,j=(h=i.match(/alt="(.*?)"/))?h[1]:"";i="<!--more"+j+"-->"}if(i.indexOf('class="mceWPnextpage')!==-1){i="<!--nextpage-->"}return i})}});c.onNodeChange.add(function(g,f,h){f.setActive("wp_page",h.nodeName==="IMG"&&g.dom.hasClass(h,"mceWPnextpage"));f.setActive("wp_more",h.nodeName==="IMG"&&g.dom.hasClass(h,"mceWPmore"))})}});tinymce.PluginManager.add("wordpress",tinymce.plugins.WordPress)})(); -
trunk/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js
r9847 r10337 1 2 (function() { 3 tinymce.create('tinymce.plugins.wpEditImage', { 4 5 init : function(ed, url) { 6 var t = this; 7 8 t.url = url; 9 t._createButtons(); 10 11 // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('...'); 12 ed.addCommand('WP_EditImage', function() { 13 var el = ed.selection.getNode(), vp = tinymce.DOM.getViewPort(), H = vp.h, W = ( 720 < vp.w ) ? 720 : vp.w; 14 var cls = ed.dom.getAttrib(el, 'class'); 15 16 if ( cls.indexOf('mceItem') != -1 || cls.indexOf('wpGallery') != -1 || el.nodeName != 'IMG' ) 17 return; 18 19 tb_show('', url + '/editimage.html?ver=321&TB_iframe=true'); 20 tinymce.DOM.setStyles('TB_window', { 21 'width':( W - 50 )+'px', 22 'height':( H - 45 )+'px', 23 'margin-left':'-'+parseInt((( W - 50 ) / 2),10) + 'px' 24 }); 25 26 if ( ! tinymce.isIE6 ) { 27 tinymce.DOM.setStyles('TB_window', { 28 'top':'20px', 29 'marginTop':'0' 30 }); 31 } 32 33 tinymce.DOM.setStyles('TB_iframeContent', { 34 'width':( W - 50 )+'px', 35 'height':( H - 75 )+'px' 36 }); 37 tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' ); 38 }); 39 40 ed.onInit.add(function(ed) { 41 tinymce.dom.Event.add(ed.getWin(), 'scroll', function(e) { 42 ed.plugins.wpeditimage.hideButtons(); 43 }); 44 }); 45 46 ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) { 47 ed.plugins.wpeditimage.hideButtons(); 48 }); 49 50 ed.onSaveContent.add(function(ed, o) { 51 ed.plugins.wpeditimage.hideButtons(); 52 }); 53 54 ed.onMouseUp.add(function(ed, e) { 55 if ( tinymce.isOpera ) { 56 if ( e.target.nodeName == 'IMG' ) 57 ed.plugins.wpeditimage.showButtons(e.target); 58 } else if ( ! tinymce.isWebKit ) { 59 var n = ed.selection.getNode(), DL; 60 61 if ( n.nodeName == 'IMG' && (DL = ed.dom.getParent(n, 'DL')) ) { 62 window.setTimeout(function(){ 63 var ed = tinyMCE.activeEditor, n = ed.selection.getNode(), DL = ed.dom.getParent(n, 'DL'); 64 65 if ( n.width != (parseInt(ed.dom.getStyle(DL, 'width')) - 10) ) { 66 ed.dom.setStyle(DL, 'width', parseInt(n.width)+10); 67 ed.execCommand('mceRepaint'); 68 } 69 }, 100); 70 } 71 } 72 }); 73 74 ed.onMouseDown.add(function(ed, e) { 75 if ( tinymce.isOpera || e.target.nodeName != 'IMG' ) { 76 t.hideButtons(); 77 return; 78 } 79 ed.plugins.wpeditimage.showButtons(e.target); 80 }); 81 82 ed.onKeyPress.add(function(ed, e) { 83 var DL, DIV; 84 85 if ( e.keyCode == 13 && (DL = ed.dom.getParent(ed.selection.getNode(), 'DL')) ) { 86 var P = ed.dom.create('p', {}, ' '); 87 if ( (DIV = DL.parentNode) && DIV.nodeName == 'DIV' ) 88 ed.dom.insertAfter( P, DIV ); 89 else ed.dom.insertAfter( P, DL ); 90 91 tinymce.dom.Event.cancel(e); 92 ed.selection.select(P); 93 return false; 94 } 95 }); 96 97 ed.onBeforeSetContent.add(function(ed, o) { 98 o.content = t._do_shcode(o.content); 99 }); 100 101 ed.onPostProcess.add(function(ed, o) { 102 if (o.get) 103 o.content = t._get_shcode(o.content); 104 }); 105 }, 106 107 _do_shcode : function(co) { 108 return co.replace(/\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\][\s\u00a0]*/g, function(a,b,c){ 109 b = b.replace(/\\'|\\'|\\'/g, ''').replace(/\\"|\\"/g, '"'); 110 c = c.replace(/\\'|\\'/g, ''').replace(/\\"/g, '"'); 111 var id = b.match(/id=['"]([^'"]+)/i), cls = b.match(/align=['"]([^'"]+)/i); 112 var w = b.match(/width=['"]([0-9]+)/), cap = b.match(/caption=['"]([^'"]+)/i); 113 114 id = ( id && id[1] ) ? id[1] : ''; 115 cls = ( cls && cls[1] ) ? cls[1] : 'alignnone'; 116 w = ( w && w[1] ) ? w[1] : ''; 117 cap = ( cap && cap[1] ) ? cap[1] : ''; 118 if ( ! w || ! cap ) return c; 119 120 var div_cls = (cls == 'aligncenter') ? 'mceTemp mceIEcenter' : 'mceTemp'; 121 122 return '<div class="'+div_cls+'"><dl id="'+id+'" class="wp-caption '+cls+'" style="width: '+(10+parseInt(w))+ 123 'px"><dt class="wp-caption-dt">'+c+'</dt><dd class="wp-caption-dd">'+cap+'</dd></dl></div>'; 124 }); 125 }, 126 127 _get_shcode : function(co) { 128 return co.replace(/<div class="mceTemp[^"]*">\s*<dl([^>]+)>\s*<dt[^>]+>([\s\S]+?)<\/dt>\s*<dd[^>]+>(.+?)<\/dd>\s*<\/dl>\s*<\/div>\s*/gi, function(a,b,c,cap){ 129 var id = b.match(/id=['"]([^'"]+)/i), cls = b.match(/class=['"]([^'"]+)/i); 130 var w = c.match(/width=['"]([0-9]+)/); 131 132 id = ( id && id[1] ) ? id[1] : ''; 133 cls = ( cls && cls[1] ) ? cls[1] : 'alignnone'; 134 w = ( w && w[1] ) ? w[1] : ''; 135 136 if ( ! w || ! cap ) return c; 137 cls = cls.match(/align[^ '"]+/) || 'alignnone'; 138 cap = cap.replace(/<\S[^<>]*>/gi, '').replace(/'/g, ''').replace(/"/g, '"'); 139 140 return '[caption id="'+id+'" align="'+cls+'" width="'+w+'" caption="'+cap+'"]'+c+'[/caption]'; 141 }); 142 }, 143 144 showButtons : function(n) { 145 var t = this, ed = tinyMCE.activeEditor, p1, p2, vp, DOM = tinymce.DOM, X, Y; 146 var cls = ed.dom.getAttrib(n, 'class'); 147 148 if ( cls.indexOf('mceItem') != -1 || cls.indexOf('wpGallery') != -1 ) 149 return; 150 151 vp = ed.dom.getViewPort(ed.getWin()); 152 p1 = DOM.getPos(ed.getContentAreaContainer()); 153 p2 = ed.dom.getPos(n); 154 155 X = Math.max(p2.x - vp.x, 0) + p1.x; 156 Y = Math.max(p2.y - vp.y, 0) + p1.y; 157 158 DOM.setStyles('wp_editbtns', { 159 'top' : Y+5+'px', 160 'left' : X+5+'px', 161 'display' : 'block' 162 }); 163 164 t.btnsTout = window.setTimeout( function(){ed.plugins.wpeditimage.hideButtons();}, 5000 ); 165 }, 166 167 hideButtons : function() { 168 if ( tinymce.DOM.isHidden('wp_editbtns') ) return; 169 170 tinymce.DOM.hide('wp_editbtns'); 171 window.clearTimeout(this.btnsTout); 172 }, 173 174 _createButtons : function() { 175 var t = this, ed = tinyMCE.activeEditor, DOM = tinymce.DOM; 176 177 DOM.remove('wp_editbtns'); 178 179 var wp_editbtns = DOM.add(document.body, 'div', { 180 id : 'wp_editbtns', 181 style : 'display:none;' 182 }); 183 184 var wp_editimgbtn = DOM.add('wp_editbtns', 'img', { 185 src : t.url+'/img/image.png', 186 id : 'wp_editimgbtn', 187 width : '24', 188 height : '24', 189 title : ed.getLang('wpeditimage.edit_img') 190 }); 191 192 wp_editimgbtn.onmousedown = function(e) { 193 var ed = tinyMCE.activeEditor; 194 ed.windowManager.bookmark = ed.selection.getBookmark('simple'); 195 ed.execCommand("WP_EditImage"); 196 this.parentNode.style.display = 'none'; 197 }; 198 199 var wp_delimgbtn = DOM.add('wp_editbtns', 'img', { 200 src : t.url+'/img/delete.png', 201 id : 'wp_delimgbtn', 202 width : '24', 203 height : '24', 204 title : ed.getLang('wpeditimage.del_img') 205 }); 206 207 wp_delimgbtn.onmousedown = function(e) { 208 var ed = tinyMCE.activeEditor, el = ed.selection.getNode(), p; 209 210 if ( el.nodeName == 'IMG' && ed.dom.getAttrib(el, 'class').indexOf('mceItem') == -1 ) { 211 if ( (p = ed.dom.getParent(el, 'div')) && ed.dom.hasClass(p, 'mceTemp') ) 212 ed.dom.remove(p); 213 else if ( (p = ed.dom.getParent(el, 'A')) && p.childNodes.length == 1 ) 214 ed.dom.remove(p); 215 else ed.dom.remove(el); 216 217 this.parentNode.style.display = 'none'; 218 ed.execCommand('mceRepaint'); 219 return false; 220 } 221 }; 222 }, 223 224 getInfo : function() { 225 return { 226 longname : 'Edit Image', 227 author : 'WordPress', 228 authorurl : 'http://wordpress.org', 229 infourl : '', 230 version : "1.0" 231 }; 232 } 233 }); 234 235 tinymce.PluginManager.add('wpeditimage', tinymce.plugins.wpEditImage); 236 })(); 1 (function(){tinymce.create("tinymce.plugins.wpEditImage",{init:function(a,b){var c=this;c.url=b;c._createButtons();a.addCommand("WP_EditImage",function(){var h=a.selection.getNode(),f=tinymce.DOM.getViewPort(),g=f.h,d=(720<f.w)?720:f.w,e=a.dom.getAttrib(h,"class");if(e.indexOf("mceItem")!=-1||e.indexOf("wpGallery")!=-1||h.nodeName!="IMG"){return}tb_show("",b+"/editimage.html?ver=321&TB_iframe=true");tinymce.DOM.setStyles("TB_window",{width:(d-50)+"px",height:(g-45)+"px","margin-left":"-"+parseInt(((d-50)/2),10)+"px"});if(!tinymce.isIE6){tinymce.DOM.setStyles("TB_window",{top:"20px",marginTop:"0"})}tinymce.DOM.setStyles("TB_iframeContent",{width:(d-50)+"px",height:(g-75)+"px"});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.wpeditimage.hideButtons()})});a.onBeforeExecCommand.add(function(d,f,e,g){d.plugins.wpeditimage.hideButtons()});a.onSaveContent.add(function(d,e){d.plugins.wpeditimage.hideButtons()});a.onMouseUp.add(function(d,g){var h,f;if(tinymce.isOpera){if(g.target.nodeName=="IMG"){d.plugins.wpeditimage.showButtons(g.target)}}else{if(!tinymce.isWebKit){h=d.selection.getNode();if(h.nodeName=="IMG"&&(f=d.dom.getParent(h,"DL"))){window.setTimeout(function(){var e=tinyMCE.activeEditor,j=e.selection.getNode(),i=e.dom.getParent(j,"DL");if(j.width!=(parseInt(e.dom.getStyle(i,"width"))-10)){e.dom.setStyle(i,"width",parseInt(j.width)+10);e.execCommand("mceRepaint")}},100)}}}});a.onMouseDown.add(function(d,f){if(tinymce.isOpera||f.target.nodeName!="IMG"){c.hideButtons();return}d.plugins.wpeditimage.showButtons(f.target)});a.onKeyPress.add(function(d,i){var f,h,g;if(i.keyCode==13&&(f=d.dom.getParent(d.selection.getNode(),"DL"))){g=d.dom.create("p",{}," ");if((h=f.parentNode)&&h.nodeName=="DIV"){d.dom.insertAfter(g,h)}else{d.dom.insertAfter(g,f)}tinymce.dom.Event.cancel(i);d.selection.select(g);return false}});a.onBeforeSetContent.add(function(d,e){e.content=c._do_shcode(e.content)});a.onPostProcess.add(function(d,e){if(e.get){e.content=c._get_shcode(e.content)}})},_do_shcode:function(a){return a.replace(/\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\][\s\u00a0]*/g,function(g,d,k){var j,f,e,h,i;d=d.replace(/\\'|\\'|\\'/g,"'").replace(/\\"|\\"/g,""");k=k.replace(/\\'|\\'/g,"'").replace(/\\"/g,""");j=d.match(/id=['"]([^'"]+)/i);f=d.match(/align=['"]([^'"]+)/i);e=d.match(/width=['"]([0-9]+)/);h=d.match(/caption=['"]([^'"]+)/i);j=(j&&j[1])?j[1]:"";f=(f&&f[1])?f[1]:"alignnone";e=(e&&e[1])?e[1]:"";h=(h&&h[1])?h[1]:"";if(!e||!h){return k}i=(f=="aligncenter")?"mceTemp mceIEcenter":"mceTemp";return'<div class="'+i+'"><dl id="'+j+'" class="wp-caption '+f+'" style="width: '+(10+parseInt(e))+'px"><dt class="wp-caption-dt">'+k+'</dt><dd class="wp-caption-dd">'+h+"</dd></dl></div>"})},_get_shcode:function(a){return a.replace(/<div class="mceTemp[^"]*">\s*<dl([^>]+)>\s*<dt[^>]+>([\s\S]+?)<\/dt>\s*<dd[^>]+>(.+?)<\/dd>\s*<\/dl>\s*<\/div>\s*/gi,function(g,d,j,h){var i,f,e;i=d.match(/id=['"]([^'"]+)/i);f=d.match(/class=['"]([^'"]+)/i);e=j.match(/width=['"]([0-9]+)/);i=(i&&i[1])?i[1]:"";f=(f&&f[1])?f[1]:"alignnone";e=(e&&e[1])?e[1]:"";if(!e||!h){return j}f=f.match(/align[^ '"]+/)||"alignnone";h=h.replace(/<\S[^<>]*>/gi,"").replace(/'/g,"'").replace(/"/g,""");return'[caption id="'+i+'" align="'+f+'" width="'+e+'" caption="'+h+'"]'+j+"[/caption]"})},showButtons:function(d){var j=this,e=tinyMCE.activeEditor,g,f,a,i=tinymce.DOM,c,b,h=e.dom.getAttrib(d,"class");if(h.indexOf("mceItem")!=-1||h.indexOf("wpGallery")!=-1){return}a=e.dom.getViewPort(e.getWin());g=i.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;i.setStyles("wp_editbtns",{top:b+5+"px",left:c+5+"px",display:"block"});j.btnsTout=window.setTimeout(function(){e.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 d=this,b=tinyMCE.activeEditor,e=tinymce.DOM,a,c,f;e.remove("wp_editbtns");a=e.add(document.body,"div",{id:"wp_editbtns",style:"display:none;"});c=e.add("wp_editbtns","img",{src:d.url+"/img/image.png",id:"wp_editimgbtn",width:"24",height:"24",title:b.getLang("wpeditimage.edit_img")});c.onmousedown=function(h){var g=tinyMCE.activeEditor;g.windowManager.bookmark=g.selection.getBookmark("simple");g.execCommand("WP_EditImage");this.parentNode.style.display="none"};f=e.add("wp_editbtns","img",{src:d.url+"/img/delete.png",id:"wp_delimgbtn",width:"24",height:"24",title:b.getLang("wpeditimage.del_img")});f.onmousedown=function(j){var g=tinyMCE.activeEditor,h=g.selection.getNode(),i;if(h.nodeName=="IMG"&&g.dom.getAttrib(h,"class").indexOf("mceItem")==-1){if((i=g.dom.getParent(h,"div"))&&g.dom.hasClass(i,"mceTemp")){g.dom.remove(i)}else{if((i=g.dom.getParent(h,"A"))&&i.childNodes.length==1){g.dom.remove(i)}else{g.dom.remove(h)}}this.parentNode.style.display="none";g.execCommand("mceRepaint");return false}}},getInfo:function(){return{longname:"Edit Image",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wpeditimage",tinymce.plugins.wpEditImage)})(); -
trunk/wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.js
r9917 r10337 1 2 (function() { 3 tinymce.create('tinymce.plugins.wpGallery', { 4 5 init : function(ed, url) { 6 var t = this; 7 8 t.url = url; 9 t._createButtons(); 10 11 // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('...'); 12 ed.addCommand('WP_Gallery', function() { 13 var el = ed.selection.getNode(), vp = tinymce.DOM.getViewPort(), W = ( 720 < vp.w ) ? 720 : vp.w; 14 15 if ( el.nodeName != 'IMG' ) return; 16 if ( ed.dom.getAttrib(el, 'class').indexOf('wpGallery') == -1 ) return; 17 18 var post_id = tinymce.DOM.get('post_ID').value; 19 tb_show('', tinymce.documentBaseURL + '/media-upload.php?post_id='+post_id+'&tab=gallery&TB_iframe=true'); 20 21 tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' ); 22 }); 23 24 ed.onInit.add(function(ed) { 25 tinymce.dom.Event.add(ed.getWin(), 'scroll', function(e) { 26 ed.plugins.wpgallery.hideButtons(); 27 }); 28 }); 29 30 ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) { 31 ed.plugins.wpgallery.hideButtons(); 32 }); 33 34 ed.onSaveContent.add(function(ed, o) { 35 ed.plugins.wpgallery.hideButtons(); 36 }); 37 38 ed.onMouseUp.add(function(ed, e) { 39 if ( tinymce.isOpera ) { 40 if ( e.target.nodeName == 'IMG' ) 41 ed.plugins.wpgallery.showButtons(e.target); 42 } 43 44 }); 45 46 ed.onMouseDown.add(function(ed, e) { 47 if ( tinymce.isOpera || e.target.nodeName != 'IMG' ) { 48 t.hideButtons(); 49 return; 50 } 51 ed.plugins.wpgallery.showButtons(e.target); 52 }); 53 54 ed.onBeforeSetContent.add(function(ed, o) { 55 o.content = t._do_gallery(o.content); 56 }); 57 58 ed.onPostProcess.add(function(ed, o) { 59 if (o.get) 60 o.content = t._get_gallery(o.content); 61 }); 62 }, 63 64 _do_gallery : function(co) { 65 return co.replace(/\[gallery([^\]]*)\]/g, function(a,b){ 66 return '<img src="'+tinymce.baseURL+'/plugins/wpgallery/img/t.gif" class="wpGallery mceItem" title="gallery'+tinymce.DOM.encode(b)+'" />'; 67 }); 68 }, 69 70 _get_gallery : function(co) { 71 72 function getAttr(s, n) { 73 n = new RegExp(n + '=\"([^\"]+)\"', 'g').exec(s); 74 return n ? tinymce.DOM.decode(n[1]) : ''; 75 }; 76 77 return co.replace(/(?:<p[^>]*>)*(<img[^>]+>)(?:<\/p>)*/g, function(a,im) { 78 var cls = getAttr(im, 'class'); 79 80 if ( cls.indexOf('wpGallery') != -1 ) 81 return '<p>['+tinymce.trim(getAttr(im, 'title'))+']</p>'; 82 83 return a; 84 }); 85 }, 86 87 showButtons : function(n) { 88 var t = this, ed = tinyMCE.activeEditor, p1, p2, vp, DOM = tinymce.DOM, X, Y; 89 90 if (ed.dom.getAttrib(n, 'class').indexOf('wpGallery') == -1) 91 return; 92 93 vp = ed.dom.getViewPort(ed.getWin()); 94 p1 = DOM.getPos(ed.getContentAreaContainer()); 95 p2 = ed.dom.getPos(n); 96 97 X = Math.max(p2.x - vp.x, 0) + p1.x; 98 Y = Math.max(p2.y - vp.y, 0) + p1.y; 99 100 DOM.setStyles('wp_gallerybtns', { 101 'top' : Y+5+'px', 102 'left' : X+5+'px', 103 'display' : 'block' 104 }); 105 106 t.btnsTout = window.setTimeout( function(){ed.plugins.wpgallery.hideButtons();}, 5000 ); 107 }, 108 109 hideButtons : function() { 110 if ( tinymce.DOM.isHidden('wp_gallerybtns') ) return; 111 112 tinymce.DOM.hide('wp_gallerybtns'); 113 window.clearTimeout(this.btnsTout); 114 }, 115 116 _createButtons : function() { 117 var t = this, ed = tinyMCE.activeEditor, DOM = tinymce.DOM; 118 119 DOM.remove('wp_gallerybtns'); 120 121 var wp_gallerybtns = DOM.add(document.body, 'div', { 122 id : 'wp_gallerybtns', 123 style : 'display:none;' 124 }); 125 126 var wp_editgallery = DOM.add('wp_gallerybtns', 'img', { 127 src : t.url+'/img/edit.png', 128 id : 'wp_editgallery', 129 width : '24', 130 height : '24', 131 title : ed.getLang('wordpress.editgallery') 132 }); 133 134 wp_editgallery.onmousedown = function(e) { 135 var ed = tinyMCE.activeEditor; 136 ed.windowManager.bookmark = ed.selection.getBookmark('simple'); 137 ed.execCommand("WP_Gallery"); 138 this.parentNode.style.display = 'none'; 139 }; 140 141 var wp_delgallery = DOM.add('wp_gallerybtns', 'img', { 142 src : t.url+'/img/delete.png', 143 id : 'wp_delgallery', 144 width : '24', 145 height : '24', 146 title : ed.getLang('wordpress.delgallery') 147 }); 148 149 wp_delgallery.onmousedown = function(e) { 150 var ed = tinyMCE.activeEditor, el = ed.selection.getNode(); 151 152 if ( el.nodeName == 'IMG' && ed.dom.getAttrib(el, 'class').indexOf('wpGallery') != -1 ) { 153 ed.dom.remove(el); 154 155 this.parentNode.style.display = 'none'; 156 ed.execCommand('mceRepaint'); 157 return false; 158 } 159 }; 160 }, 161 162 getInfo : function() { 163 return { 164 longname : 'Gallery Settings', 165 author : 'WordPress', 166 authorurl : 'http://wordpress.org', 167 infourl : '', 168 version : "1.0" 169 }; 170 } 171 }); 172 173 tinymce.PluginManager.add('wpgallery', tinymce.plugins.wpGallery); 174 })(); 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)})(); -
trunk/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css
r8614 r10337 1 body, td {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;} 1 /* default styles */ 2 2 body {background:#FFF;} 3 3 body.mceForceColors {background:#FFF; color:#000;} … … 18 18 cite {border-bottom:1px dashed blue} 19 19 acronym {border-bottom:1px dotted #CCC; cursor:help} 20 abbr, html\:abbr {border-bottom:1px dashed #CCC; cursor:help} 21 22 /* WordPress styles */ 23 html { 24 background-color: #fff; 25 } 26 27 .aligncenter, 28 dl.aligncenter { 29 display: block; 30 margin-left: auto; 31 margin-right: auto; 32 } 33 34 .alignleft { 35 float: left; 36 } 37 38 .alignright { 39 float: right; 40 } 41 42 .wp-caption { 43 border: 1px solid #ddd; 44 text-align: center; 45 background-color: #f3f3f3; 46 padding-top: 4px; 47 margin: 10px; 48 -moz-border-radius: 3px; 49 -khtml-border-radius: 3px; 50 -webkit-border-radius: 3px; 51 border-radius: 3px; 52 } 53 54 .wp-caption img { 55 margin: 0; 56 padding: 0; 57 border: 0 none; 58 } 59 60 .wp-caption-dd { 61 font-size: 11px; 62 line-height: 17px; 63 padding: 0 4px 5px; 64 margin: 0; 65 } 66 67 img.wpGallery { 68 border: 1px dotted #cc0000; 69 background: #ffffcc url("../../../../plugins/wpgallery/img/gallery.png") no-repeat scroll center center; 70 width: 99%; 71 height: 250px; 72 } 73 74 body.mceContentBody { 75 font: 13px/19px Georgia, "Times New Roman", "Bitstream Charter", Times, serif; 76 padding: 0.6em; 77 margin: 0; 78 } 79 80 pre { 81 font: 12px/18px Consolas, Monaco, "Courier New", Courier, monospace; 82 } 83 84 td { 85 color: #000; 86 font-size: 11px; 87 margin: 8px; 88 } 89 90 .mceIEcenter { 91 text-align: center; 92 } -
trunk/wp-includes/script-loader.php
r10326 r10337 65 65 // Modify this version when tinyMCE plugins are changed. 66 66 function mce_version() { 67 return '200 81129';67 return '20090108'; 68 68 } 69 69 add_filter( 'tiny_mce_version', 'mce_version' );
Note: See TracChangeset
for help on using the changeset viewer.