From 16dbf2fb1e161efc6963b5ae6474bb26db640596 Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 23 Jun 2008 15:26:03 +0000 Subject: [PATCH] Edit image updates from azaozz. see #6811 git-svn-id: http://svn.automattic.com/wordpress/trunk@8167 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/gears-manifest.php | 2 +- wp-includes/js/tinymce/langs/wp-langs.php | 12 +- .../plugins/wordpress/editor_plugin.js | 64 +++--- .../plugins/wpeditimage/css/editimage-rtl.css | 19 +- .../plugins/wpeditimage/css/editimage.css | 70 ++++++- .../plugins/wpeditimage/editimage.html | 39 ++-- .../plugins/wpeditimage/editor_plugin.js | 34 +++- .../plugins/wpeditimage/js/editimage.js | 190 ++++++++++-------- .../advanced/skins/wp_theme/content.css | 19 +- wp-includes/js/tinymce/tiny_mce_config.php | 2 +- wp-includes/script-loader.php | 2 +- 11 files changed, 279 insertions(+), 174 deletions(-) diff --git a/wp-admin/gears-manifest.php b/wp-admin/gears-manifest.php index ce84f0d3dd..889bc58acb 100644 --- a/wp-admin/gears-manifest.php +++ b/wp-admin/gears-manifest.php @@ -63,7 +63,7 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' ); ?> { "betaManifestVersion" : 1, -"version" : "_20080618", +"version" : "_20080622", "entries" : [ diff --git a/wp-includes/js/tinymce/langs/wp-langs.php b/wp-includes/js/tinymce/langs/wp-langs.php index d62fd8646f..86b3e08b86 100644 --- a/wp-includes/js/tinymce/langs/wp-langs.php +++ b/wp-includes/js/tinymce/langs/wp-langs.php @@ -3,7 +3,7 @@ // escape text only if it needs translating function mce_escape($text) { global $language; - + if ( 'en' == $language ) return $text; else return js_escape($text); } @@ -421,7 +421,15 @@ link_rel:"' . mce_escape( __('Link Rel') ) . '", height:"' . mce_escape( __('Height') ) . '", orig_size:"' . mce_escape( __('Original Size') ) . '", css:"' . mce_escape( __('CSS Class') ) . '", +s60:"' . mce_escape( __('60%') ) . '", +s70:"' . mce_escape( __('70%') ) . '", +s80:"' . mce_escape( __('80%') ) . '", +s90:"' . mce_escape( __('90%') ) . '", +s100:"' . mce_escape( __('100%') ) . '", +s110:"' . mce_escape( __('110%') ) . '", +s120:"' . mce_escape( __('120%') ) . '", +s130:"' . mce_escape( __('130%') ) . '", caption:"' . mce_escape( __('Caption') ) . '" }); -'; +'; ?> \ No newline at end of file diff --git a/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js b/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js index cd4c71e22b..418f3a4914 100644 --- a/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js @@ -24,16 +24,16 @@ t._resizeIframe(ed, tbId, 28); } }); - + // Register commands ed.addCommand('WP_More', function() { ed.execCommand('mceInsertContent', 0, moreHTML); }); - + ed.addCommand('WP_Page', function() { ed.execCommand('mceInsertContent', 0, nextpageHTML); }); - + ed.addCommand('WP_Help', function() { ed.windowManager.open({ url : tinymce.baseURL + '/wp-mce-help.php', @@ -80,7 +80,7 @@ ed.addButton('wp_help', { title : 'wordpress.wp_help_desc', image : url + '/img/help.gif', - cmd : 'WP_Help' + cmd : 'WP_Help' }); ed.addButton('wp_adv', { @@ -90,44 +90,46 @@ }); // Add class "alignleft", "alignright" and "aligncenter" when selecting align for images. - ed.onExecCommand.add(function( editor, cmd ) { - var node, bl, dom = editor.dom; + ed.onExecCommand.add(function( ed, cmd ) { + var n, bl, dom = ed.dom; if ( 'JustifyCenter' == cmd ) { - if ( ( node = editor.selection.getNode() ) && node.nodeName == 'IMG' ) { - if ( ! dom.hasClass( node, "aligncenter" ) && ( bl = editor.forceBlocks.getParentBlock(node) ) && bl.childNodes.length == 1 ) - dom.setStyle(bl, 'text-align', ''); - } - editor.execCommand('mceRepaint'); + tinymce.each(dom.select('img'), function(n) { + var v = n.className; + + if (v.indexOf('aligncenter') == -1) { + dom.getParent(n, function(P) { + if (P && P.style && P.style.textAlign == 'center') + dom.setStyle(P, 'textAlign', ''); + }); + } + }); + + ed.execCommand('mceRepaint'); } }); - ed.onBeforeExecCommand.add(function( editor, cmd ) { - var node, dir, xdir, bl, dom = editor.dom; + ed.onBeforeExecCommand.add(function( ed, cmd ) { + var n, dir, xdir, bl, dom = ed.dom; - if ( ( cmd.indexOf('Justify') != -1 ) && ( node = editor.selection.getNode() ) ) { - if ( 'JustifyFull' == cmd || node.nodeName !== 'IMG' ) return; + if ( ( cmd.indexOf('Justify') != -1 ) && ( n = ed.selection.getNode() ) ) { + if ( 'JustifyFull' == cmd || n.nodeName !== 'IMG' ) return; dir = cmd.substring(7).toLowerCase(); - if ( editor.queryCommandState( cmd ) ) { - dom.removeClass( node, "alignleft" ); - dom.removeClass( node, "alignright" ); - dom.removeClass( node, "aligncenter" ); + if ( ed.queryCommandState( cmd ) ) { + n.className = n.className.replace(/align[^ '"]+\s?/g, ''); + dom.addClass( n, "alignnone" ); } else if ( 'JustifyCenter' == cmd ) { - dom.removeClass( node, "alignleft" ); - dom.removeClass( node, "alignright" ); - - if ( dom.hasClass( node, "aligncenter" ) ) { - dom.removeClass( node, "aligncenter" ); - if ( ( bl = editor.forceBlocks.getParentBlock(node) ) && bl.childNodes.length == 1 && tinymce.isGecko ) - editor.selection.select(bl.firstChild); - } else dom.addClass( node, "aligncenter" ); + n.className = n.className.replace(/alignleft\s?|alignright\s?|alignnone\s?/g, ''); + if ( dom.hasClass( n, "aligncenter" ) ) { + dom.removeClass( n, "aligncenter" ); + dom.addClass( n, "alignnone" ); + } else + dom.addClass( n, "aligncenter" ); } else { - xdir = ( dir == 'left' ) ? 'right' : 'left'; - dom.removeClass( node, "aligncenter" ); - dom.removeClass( node, "align"+xdir ); - dom.addClass( node, "align"+dir ); + n.className = n.className.replace(/align[^ '"]+\s?/g, ''); + dom.addClass( n, "align"+dir ); } } }); diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css b/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css index d993f5b573..e78820ffef 100644 --- a/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css +++ b/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css @@ -4,10 +4,10 @@ body#media-upload ul#sidemenu { right: 0; } -.align .field label { +#basic .align .field label { display: block; float: right; - padding: 0 25px 0 0; + padding: 0 24px 0 0; margin: 5px 3px 5px 5px; } @@ -36,12 +36,9 @@ tr.image-size input { text-align: right; } -.alignleft { - float: right; -} - .show-align, -.alignright { +.alignright, +#img_size { float: left; } @@ -50,7 +47,9 @@ tr.image-size input, #img_dim label, #img_dim input, #img_prop label, -#img_prop input { +#img_prop input, +#img_size_div, +.alignleft { float: right; } @@ -63,3 +62,7 @@ tr.image-size input, #img_prop input { margin: 0 5px 0 10px; } + +#img_size_title { + text-align: left; +} diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css b/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css index 2519bbb6d2..2c9a623dd4 100644 --- a/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css +++ b/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css @@ -18,7 +18,7 @@ html, body { -webkit-border-radius: 3px; border-radius: 3px; cursor: pointer; - text-decoration: none; + text-decoration: none; } textarea, @@ -59,7 +59,7 @@ label { } th.label { - width: 128px; + width: 107px; } .show-align { @@ -104,11 +104,9 @@ th.label { #sidemenu, #sidemenu li { list-style: none; - } #sidemenu li { - display: inline; } @@ -128,8 +126,14 @@ th.label { } #sidemenu a.current { - -moz-border-radius-topleft:4px; - -moz-border-radius-topright:4px; + -moz-border-radius-topleft: 4px; + -khtml-border-top-left-radius: 4px; + -webkit-border-top-left-radius: 4px; + border-top-left-radius: 4px; + -moz-border-radius-topright: 4px; + -khtml-border-top-right-radius: 4px; + -webkit-border-top-right-radius: 4px; + border-top-right-radius: 4px; border-style:solid; border-width:1px; font-weight:normal; @@ -175,3 +179,57 @@ th.label { margin-right: 10px; } +#basic .align .field label { + padding: 0 0 0 24px; +} + +#basic { + padding-top: 2px; +} + +td { + padding: 2px 0; +} + +#img_size { + float: right; + text-align: center; + cursor: pointer; + background-color: #f1f1f1; + padding: 5px 0; + width: 45px; +} + +#img_size div { + font-size: 10px; + padding: 2px; + border: 1px solid #f1f1f1; + line-height: 15px; + height: 15px; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + color: #07273E; +} + +#img_size div#s100 { + border-color: #A3A3A3; + background-color: #E5E5E5; +} + +#img_size_div { + width: 100px; + float: left; + cursor: default; +} + +#img_size_title { + margin: 0 7px 5px; + text-align: right; + font-weight: bold; +} + +#img_align_td { + padding: 2px 0 8px; +} diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html b/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html index 881a41e28a..58e28d642c 100644 --- a/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html +++ b/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html @@ -8,7 +8,7 @@ - +