From 2cc03f7d06564e5f867fd2d6d0d7008b3be6d777 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 10 Jun 2008 04:40:21 +0000 Subject: [PATCH] Unify TinyMCE image popup and insert image popup. Props azaozz. see #6811 git-svn-id: http://svn.automattic.com/wordpress/trunk@8066 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/css/colors-classic.css | 2 +- wp-admin/css/colors-fresh.css | 2 +- wp-admin/gears-manifest.php | 7 +- wp-admin/wp-admin.css | 23 + .../plugins/wpeditimage/css/editimage.css | 167 +++++++ .../plugins/wpeditimage/editimage.html | 262 ++++++++++ .../plugins/wpeditimage/editor_plugin.js | 138 +++++ .../plugins/wpeditimage/img/delete.png | Bin 0 -> 1638 bytes .../tinymce/plugins/wpeditimage/img/image.png | Bin 0 -> 3701 bytes .../plugins/wpeditimage/js/editimage.js | 471 ++++++++++++++++++ wp-includes/js/tinymce/tiny_mce_config.php | 6 +- wp-includes/script-loader.php | 2 +- 12 files changed, 1073 insertions(+), 7 deletions(-) create mode 100644 wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css create mode 100644 wp-includes/js/tinymce/plugins/wpeditimage/editimage.html create mode 100644 wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js create mode 100644 wp-includes/js/tinymce/plugins/wpeditimage/img/delete.png create mode 100644 wp-includes/js/tinymce/plugins/wpeditimage/img/image.png create mode 100644 wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js diff --git a/wp-admin/css/colors-classic.css b/wp-admin/css/colors-classic.css index 10b2ac1b30..83a1141c17 100644 --- a/wp-admin/css/colors-classic.css +++ b/wp-admin/css/colors-classic.css @@ -561,7 +561,7 @@ div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover } /* Containers */ -.wp_themeSkin table { +.wp_themeSkin table, #wp_editbtns { background: #83B4D5; } diff --git a/wp-admin/css/colors-fresh.css b/wp-admin/css/colors-fresh.css index d901e4f751..1d59940632 100644 --- a/wp-admin/css/colors-fresh.css +++ b/wp-admin/css/colors-fresh.css @@ -533,7 +533,7 @@ div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover } /* Containers */ -.wp_themeSkin table { +.wp_themeSkin table, #wp_editbtns { background: #cee1ef; } diff --git a/wp-admin/gears-manifest.php b/wp-admin/gears-manifest.php index a48004d86c..6fc01da8d2 100644 --- a/wp-admin/gears-manifest.php +++ b/wp-admin/gears-manifest.php @@ -87,7 +87,7 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' ); ?> { "betaManifestVersion" : 1, -"version" : "_20080602", +"version" : "_20080606", "entries" : [ @@ -149,6 +149,7 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' ); { "url" : "../wp-includes/js/tinymce/themes/advanced/js/link.js?ver=3091" }, { "url" : "../wp-includes/js/tinymce/themes/advanced/js/source_editor.js?ver=3091" }, { "url" : "../wp-includes/js/tinymce/themes/advanced/js/anchor.js?ver=3091" }, +{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js?ver=3091" }, { "url" : "../wp-includes/js/tinymce/themes/advanced/source_editor.htm?ver=3091" }, { "url" : "../wp-includes/js/tinymce/themes/advanced/anchor.htm?ver=3091" }, @@ -162,6 +163,7 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' ); { "url" : "../wp-includes/js/tinymce/plugins/paste/pastetext.htm?ver=3091" }, { "url" : "../wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm?ver=3091" }, { "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/template.htm?ver=3091" }, +{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/editimage.html?ver=3091" }, { "url" : "../wp-includes/js/tinymce/wp-mce-help.php?ver=3091" }, { "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css?ver=3091" }, @@ -174,6 +176,7 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' ); { "url" : "../wp-includes/js/tinymce/plugins/media/css/media.css?ver=3091" }, { "url" : "../wp-includes/js/tinymce/plugins/paste/css/pasteword.css?ver=3091" }, { "url" : "../wp-includes/js/tinymce/plugins/paste/css/blank.css?ver=3091" }, +{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css?ver=3091" }, { "url" : "../wp-includes/js/tinymce/wordpress.css?ver=3091" }, { "url" : "../wp-includes/js/tinymce/themes/advanced/img/icons.gif" }, @@ -208,5 +211,7 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' ); { "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/page.gif" }, { "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/page_bug.gif" }, { "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/toolbars.gif" }, +{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/img/image.png" }, +{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/img/delete.png" }, { "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/help.gif" } ]} diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css index 585937e178..f61932bd1b 100644 --- a/wp-admin/wp-admin.css +++ b/wp-admin/wp-admin.css @@ -1587,3 +1587,26 @@ fieldset { margin: 0; padding: 0 7px; } + +#wp_editbtns { + padding: 2px; + position: absolute; + display: none; + z-index: 999998; +} + +#wp_editimgbtn, #wp_delimgbtn { + margin: 2px; + padding: 2px; + border: 1px solid #999; + background-color: #eee; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +#wp_editimgbtn:hover, #wp_delimgbtn:hover { + border-color: #555; + background-color: #ccc; +} diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css b/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css new file mode 100644 index 0000000000..48a5a9f567 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css @@ -0,0 +1,167 @@ + +html, body { + background-color: #fff; + margin: 0; + padding: 0; +} + +.submit input, +.button { + font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif; + padding: 3px 5px; + font-size: 12px; + line-height: 1.5em; + border-width: 1px; + border-style: solid; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + cursor: pointer; + text-decoration: none; +} + +textarea, +input, +select { + font: 13px Verdana, Arial, Helvetica, sans-serif; + margin: 1px; + padding: 3px; +} + +body, td { + font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif; +} + +abbr.required { + color: #FF0000; + text-align: left; +} + +.alignright { + float: right; +} + +.alignleft { + float: left; +} + +.aligncenter { + display: block; + margin-left: auto; + margin-right: auto; +} + +label { + cursor: pointer; +} + +th.label { + width: 128px; +} + +.show-align { + padding: 8px; + height: 200px; + background-color: #f1f1f1; + cursor: default; + -moz-user-select: none; + user-select: none; + overflow: hidden; +} + +#media-upload #img-edit { + border: 1px solid #c0c0c0; + width: 623px; + margin: 20px auto auto; +} + +#media-upload .media-upload-form table.describe { + border-top-style: none; + border-top-width: 0; +} + +#img_demo_txt { + font-size: 6px; + line-height: 10px; + font-family: "Courier New",Courier,monotype; + color: #ccc; + background-color: #ccc; +} + +#img_demo { + padding: 0 5px 4px; +} + +#saveeditimg { + padding: 10px 0 0 5px; + border-top: 1px solid #ccc; +} + +#sidemenu, +#sidemenu li { + list-style: none; + +} + +#sidemenu li { + + display: inline; +} + +#sidemenu a { + border-bottom-style: solid; + border-bottom-width: 1px; + border-top-style: solid; + border-top-width: 1px; + display: block; + float: left; + line-height: 28px; + text-decoration: none; + text-align: center; + white-space: nowrap; + margin: 0; + padding: 0pt 7px; +} + +#sidemenu a.current { + -moz-border-radius-topleft:4px; + -moz-border-radius-topright:4px; + border-style:solid; + border-width:1px; + font-weight:normal; +} + +#adv_settings .field label { + padding: 0 5px 5px; +} + +#media-upload h3 { + clear:both; + padding:0pt 0pt 3px; + border-bottom-style:solid; + border-bottom-width:1px; + font-family:Georgia,"Times New Roman",Times,serif; + font-size:20px; + font-weight:normal; + line-height:normal; + margin:20px 0 15px -4px; + padding:0 0 3px 0; + border-bottom-color:#DADADA; + color:#5A5A5A; +} + +#img_dim #width, +#img_dim #height { + width:40px; +} + +#img_dim abbr { + padding: 0 4px; +} + +#basic .align .field label { + margin: 0 10px 0 0; + padding: 0 0 0 25px; +} + diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html b/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html new file mode 100644 index 0000000000..33ccc5f528 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html @@ -0,0 +1,262 @@ + + + + + + + + + + + + + + + +
+ +
+ +
+
+
+ +
+ + + Lorem ipsum dolor sit amet consectetuer velit pretium euismod ipsum enim. Mi cursus at a mollis senectus id arcu gravida quis urna. Sed et felis id tempus Morbi mauris tincidunt enim In mauris. Pede eu risus velit libero natoque enim lorem adipiscing ipsum consequat. In malesuada et sociis tincidunt tempus pellentesque cursus convallis ipsum Suspendisse. Risus In ac quis ut Nunc convallis laoreet ante Suspendisse Nam. Amet amet urna condimentum Vestibulum sem at Curabitur lorem et cursus. Sodales tortor fermentum leo dui habitant Nunc Sed Vestibulum. + Ut lorem In penatibus libero id ipsum sagittis nec elit Sed. Condimentum eget Vivamus vel consectetuer lorem molestie turpis amet tellus id. Condimentum vel ridiculus Fusce sed pede Nam nunc sodales eros tempor. Sit lacus magna dictumst Curabitur fringilla auctor id vitae wisi facilisi. Fermentum eget turpis felis velit leo Nunc Proin orci molestie Praesent. Curabitur tellus scelerisque suscipit ut sem amet cursus mi Morbi eu. Donec libero Vestibulum augue et mollis accumsan ornare condimentum In enim. Leo eget ac consectetuer quis condimentum malesuada. + Condimentum commodo et Lorem fringilla malesuada libero volutpat sem tellus enim. Tincidunt sed at Aenean nec nonummy porttitor Nam Sed Nulla ut. Auctor leo In aliquet Curabitur eros et velit Quisque justo morbi. Et vel mauris sit nulla semper vitae et quis at dui. Id at elit laoreet justo eu mauris Quisque et interdum pharetra. Nullam accumsan interdum Maecenas condimentum quis quis Fusce a sollicitudin Sed. Non Quisque Vivamus congue porttitor non semper ipsum porttitor quis vel. Donec eros lacus volutpat et tincidunt sem convallis id venenatis sit. Consectetuer odio. + Semper faucibus Morbi nulla convallis orci Aliquam Sed porttitor et Pellentesque. Venenatis laoreet lorem id a a Morbi augue turpis id semper. Arcu volutpat ac mauris Vestibulum fringilla Aenean condimentum nibh sed id. Sagittis eu lacus orci urna tellus tellus pretium Curabitur dui nunc. Et nibh eu eu nibh adipiscing at lorem Vestibulum adipiscing augue. Magna convallis Phasellus dolor malesuada Curabitur ornare adipiscing tellus Aliquam tempus. Id Aliquam Integer augue Nulla consectetuer ac Donec Curabitur tincidunt et. Id vel Nunc amet lacus dui magna ridiculus penatibus laoreet Duis. Enim sagittis nibh quis Nulla nec laoreet vel Maecenas mattis vel. Nullam velit est Curabitur gravida Vestibulum justo. + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +

Alternate text, e.g. "The Mona Lisa"

+
+ + +
+ + + +

Enter a link URL or click above for presets.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + +
+ + + +
+ + + + + + + +
+
+
+ + + diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js b/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js new file mode 100644 index 0000000000..4ad1ba3f29 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js @@ -0,0 +1,138 @@ + +(function() { + tinymce.create('tinymce.plugins.wpEditImage', { + + init : function(ed, url) { + var t = this; + + t.url = url; + t._createButtons(); + + // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('...'); + ed.addCommand('WP_EditImage', function() { + var el = ed.selection.getNode(); + + if ( ed.dom.getAttrib(el, 'class').indexOf('mceItem') != -1 || el.nodeName != 'IMG' ) + return; + + tb_show('', url + '/editimage.html?TB_iframe=true'); + 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.wpeditimage.hideButtons(); + }); + }); + + ed.onExecCommand.add(function(ed, cmd, ui, val) { + if ( 'mceFullScreen' == cmd ) + ed.plugins.wpeditimage.hideButtons(); + }); + + ed.onSaveContent.add(function(ed, o) { + ed.plugins.wpeditimage.hideButtons(); + }); + + ed.onMouseUp.add(function(ed, e) { + if ( tinymce.isOpera ) + ed.plugins.wpeditimage.showButtons(e); + }); + + ed.onMouseDown.add(function(ed, e) { + if ( tinymce.isOpera ) return; + ed.plugins.wpeditimage.showButtons(e); + }); + }, + + showButtons : function(e) { + var t = this, ed = tinyMCE.activeEditor, p1, p2, vp, DOM = tinymce.DOM, X, Y, el = e.target; + + t.hideButtons(); + if (el.nodeName == 'IMG') { + if (ed.dom.getAttrib(el, 'class').indexOf('mceItem') != -1) + return; + + vp = ed.dom.getViewPort(ed.getWin()); + p1 = DOM.getPos(ed.getContentAreaContainer()); + p2 = ed.dom.getPos(el); + + 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() { + tinymce.DOM.hide('wp_editbtns'); + window.clearTimeout(this.btnsTout); + }, + + _createButtons : function() { + var t = this, ed = tinyMCE.activeEditor, DOM = tinymce.DOM; + + DOM.remove('wp_editbtns'); + + var wp_editbtns = DOM.add(document.body, 'div', { + id : 'wp_editbtns', + style : 'display:none;' + }); + + var wp_editimgbtn = DOM.add('wp_editbtns', 'img', { + src : t.url+'/img/image.png', + id : 'wp_editimgbtn', + width : '24', + height : '24', + title : 'Edit' + }); + + wp_editimgbtn.onmousedown = function(e) { + var ed = tinyMCE.activeEditor; + ed.windowManager.bookmark = ed.selection.getBookmark('simple'); + ed.execCommand("WP_EditImage"); + this.parentNode.style.display = 'none'; + } + + var wp_delimgbtn = DOM.add('wp_editbtns', 'img', { + src : t.url+'/img/delete.png', + id : 'wp_delimgbtn', + width : '24', + height : '24', + title : 'Delete' + }); + + wp_delimgbtn.onmousedown = function(e) { + var ed = tinyMCE.activeEditor, el = ed.selection.getNode(), p; + + if ( el.nodeName != 'IMG' || ed.dom.getAttrib(el, 'class').indexOf('mceItem') != -1 ) return; + + if ( (p = ed.dom.getParent(el, 'A')) && p.childNodes.length == 1) + ed.dom.remove(p); + else ed.dom.remove(el); + + this.parentNode.style.display = 'none'; + ed.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); +})(); diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/img/delete.png b/wp-includes/js/tinymce/plugins/wpeditimage/img/delete.png new file mode 100644 index 0000000000000000000000000000000000000000..d64d8a66ebc7f512f5a44dd30f9ba88b9eb4d81c GIT binary patch literal 1638 zcmV-s2ATPZP)S54zJI5e!u&= za$o=4;(*pHSK`m7um^`QUV9mNTw&os;M_GiAJW0sx8B(K;`R63gVE6emV;Iys1OhcX@F@! z5D;EG&)FAWqJQAj9$(5IUfsd91P^_-Z`Tv+@4ORjnCQBTa_f}xdFIPylvX674(W6T z)3%YRG=_lj!++q=8-IGH90d0*3%JIJKDT4%wkKM9dT_@l&?s_~)BNT1X-T8 z&Y(ryc2<9?yk-K|0$3gHnzULdGi)>=P!b3 zGCn%Y!FNv9CMwkj&co|-aQQyKsaKN?Ln8x)c(T2e%i$FY$V8k?Z5#RM$mmlSE({+A z1_4ZKFo)sT0DHHrZ((9&oPrPpg?XMkF>vEdln=tXs3MP_N+Urcl`o=Q0uG^c3m*Jgun|Z4L3e&(ysY`uOo#Q=j@N!1{zK z86FyD&NK+3G0rZOzQYpyi?#ua`}o*wbL!#w!Zc#iMK@-6BbVd&xr_g}L8_a!Dvi$P z$q0=v_@wOT71Lkb~$B)?@i zCFethAxVagvl+rWEZC<4p9Kvu(xU(vLbC zECa+{TBDZIG!SgvmWaOlt+a!v)EQEmpfQaXaj3g>ECq&PVcHh)r~`pZI6XzP?_ot9 zUMP9|s#4$W!}9=+*8h{HCl8iuUz3P~yH_;OB_w&}W7sCiRV_s97*Yy?P*E)x@$z+I zi5Lqy$_sO4o~^o%umlH4UX`ZH^}Dx9)t#eWaO5lLWNLf!N*Y%;V`eiDi-QzcwHo$Z zgre*7?n0GU3q=mQ{=G3Fp1T@$^@tb&)@T?5CoScJ+b#3^T@9(&=4>PBL>z>mSgtTM zH^)Bj47> znx!l(C`BE(mcRs%OJ5gx6e1dAA4C9Sa1g7#Jv8BjarEd3+20R0l6gk7nG;@wq_MECjbBd07*qoM6N<$f>OgCM*si- literal 0 HcmV?d00001 diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/img/image.png b/wp-includes/js/tinymce/plugins/wpeditimage/img/image.png new file mode 100644 index 0000000000000000000000000000000000000000..f3d4b4490223c9429434d9f3cf9842862229bc26 GIT binary patch literal 3701 zcmV-*4vO)KP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=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6{{l^aT z)_m?ifM`e%F$f@m2L@_JzU1#j6YcG-%;m}%`Qj7ayKtPU`c__f`yCRsaQW;we|+~D z(S@tX^dvjWJPX;wkfyUYdQ6HQH%zV|2M55%pn;bmy4gKf-~aAwo~JrkAz!>iW%DikG*N&m-zt;CbPfyQ8I^ES+U0nq&z+&kkCJ;CvA' ); + break; + } + } + }, + + I : function(e) { + return document.getElementById(e); + }, + + current : '', + link : '', + link_rel : '', + + setTabs : function(tab) { + var t = this; + + if ( 'current' == tab.className ) return false; + t.I('div_advanced').style.display = ( 'tab_advanced' == tab.id ) ? 'block' : 'none'; + t.I('div_basic').style.display = ( 'tab_basic' == tab.id ) ? 'block' : 'none'; + t.I('tab_basic').className = t.I('tab_advanced').className = ''; + tab.className = 'current'; + return false; + }, + + img_seturl : function(u) { + var t = this, rel = t.I('link_rel').value; + + if ( 'current' == u ) { + t.I('link_href').value = t.current; + t.I('link_rel').value = t.link_rel; + } else { + t.I('link_href').value = t.link; + if ( rel ) { + rel = rel.replace( /attachment|wp-att-[0-9]+/gi, '' ); + t.I('link_rel').value = tinymce.trim(rel); + } + } + }, + + imgAlignCls : function(v) { + var t = this, cls = t.I('img_classes').value; + + t.I('img_demo').className = v; + + cls = cls.replace( /align[^ "']+/gi, '' ); + cls += (' ' + v); + cls = cls.replace( /\s+/g, ' ' ).replace( /^\s/, '' ); + + t.I('img_classes').value = cls; + }, + + imgSizeCls : function(v) { + var t = this, cls = t.I('img_classes').value; + + if (v) { + if ( cls.indexOf('size-') != -1 ) + cls = cls.replace( /size-[^ "']+/i, 'size-' + v ); + else cls += (' size-' + v); + } else { + cls = cls.replace( /size-[^ "']+/gi, '' ); + t.demoSetSize(); + t.I('thumbnail').checked = ''; + t.I('medium').checked = ''; + t.I('full').checked = ''; + } + cls = cls.replace( /\s+/g, ' ' ).replace( /^\s|\s$/, '' ); + + t.I('img_classes').value = cls; + }, + + imgEditSize : function(size) { + var t = this, f = document.forms[0], sz, m = null; + + var W = parseInt(t.preloadImg.width), H = parseInt(t.preloadImg.height); + + if ( ! t.preloadImg || W == "" || H == "" ) + return; + + switch(size) { + case 'thumbnail': + m = 150; + t.imgSizeCls('thumbnail'); + break; + case 'medium': + m = 300; + t.imgSizeCls('medium'); + break; + case 'full': + m = 500; + t.imgSizeCls('full'); + break; + } + + if (m) { + if ( W > H ) { + m = Math.min(W, m); + f.width.value = m; + f.height.value = Math.floor((m / W) * H); + } else { + m = Math.min(H, m); + f.height.value = m; + f.width.value = Math.floor((m / H) * W); + } + + t.width = f.width.value; + t.height = f.height.value; + } + t.demoSetSize(); + }, + + demoSetSize : function(img) { + var demo = this.I('img_demo'), f = document.forms[0]; + + demo.style.width = f.width.value ? Math.floor(f.width.value * 0.6) + 'px' : ''; + demo.style.height = f.height.value ? Math.floor(f.height.value * 0.6) + 'px' : '60%'; + }, + + origSize : function() { + var t = this, f = document.forms[0]; + + f.width.value = t.preloadImg.width; + f.height.value = t.preloadImg.height; + t.demoSetSize(); + t.imgSizeCls(); + }, + + init : function() { + var ed = tinyMCEPopup.editor, h; + + h = document.body.innerHTML; + + // Replace a=x with a="x" in IE + if (tinymce.isIE) + h = h.replace(/ (value|title|alt)=([^"][^\s>]+)/gi, ' $1="$2"') + + document.dir = ed.getParam('directionality',''); + document.body.innerHTML = ed.translate(h); + window.setTimeout( function(){wpImage.setup();}, 100 ); + }, + + setup : function() { + var t = this, h, c, el, id, link, fname, f = document.forms[0], ed = tinyMCEPopup.editor, d = t.I('img_demo'), tr = ed.translate; + + tinyMCEPopup.restoreSelection(); + el = ed.selection.getNode(); + if (el.nodeName != 'IMG') return; + + f.img_src.value = d.src = link = ed.dom.getAttrib(el, 'src'); + + f.img_title.value = ed.dom.getAttrib(el, 'title'); + f.img_alt.value = ed.dom.getAttrib(el, 'alt'); + f.border.value = ed.dom.getAttrib(el, 'border'); + f.vspace.value = ed.dom.getAttrib(el, 'vspace'); + f.hspace.value = ed.dom.getAttrib(el, 'hspace'); + f.align.value = ed.dom.getAttrib(el, 'align'); + f.width.value = t.width = ed.dom.getAttrib(el, 'width'); + f.height.value = t.height = ed.dom.getAttrib(el, 'height'); + f.img_classes.value = c = ed.dom.getAttrib(el, 'class'); + f.img_style.value = ed.dom.getAttrib(el, 'style'); + this.updateStyle(); + + if (pa = ed.dom.getParent(el, 'A')) { + f.link_href.value = t.current = ed.dom.getAttrib(pa, 'href'); + f.link_title.value = ed.dom.getAttrib(pa, 'title'); + f.link_rel.value = t.link_rel = ed.dom.getAttrib(pa, 'rel'); + f.link_rev.value = ed.dom.getAttrib(pa, 'rev'); + f.link_style.value = ed.dom.getAttrib(pa, 'style'); + f.link_target.value = ed.dom.getAttrib(pa, 'target'); + f.link_classes.value = ed.dom.getAttrib(pa, 'class'); + } + + fname = link.substring( link.lastIndexOf('/') ); + fname = fname.replace(/-[0-9]{2,4}x[0-9]{2,4}/, '' ); + t.link = link.substring( 0, link.lastIndexOf('/') ) + fname; + + if ( c.indexOf('size-thumbnail') != -1 ) + t.I('thumbnail').checked = "checked"; + else if ( c.indexOf('size-medium') != -1 ) + t.I('medium').checked = "checked"; + else if ( c.indexOf('size-full') != -1 ) + t.I('full').checked = "checked"; + + if ( c.indexOf('alignleft') != -1 ) { + t.I('alignleft').checked = "checked"; + d.className = "alignleft"; + } else if ( c.indexOf('aligncenter') != -1 ) { + t.I('aligncenter').checked = "checked"; + d.className = "aligncenter"; + } else if ( c.indexOf('alignright') != -1 ) { + t.I('alignright').checked = "checked"; + d.className = "alignright"; + } else if ( c.indexOf('alignnone') != -1 ) { + t.I('alignnone').checked = "checked"; + d.className = "alignnone"; + } + + document.body.style.display = ''; + t.getImageData(); + + if ( (id = c.match( /wp-image-([0-9]{1,6})/ )) && id[1] ) { + t.I('tab_attachment').href = tinymce.documentBaseURL + 'media.php?action=edit&attachment_id=' + id[1]; + t.I('tab_attachment').style.display = 'inline'; + } + }, + + remove : function() { + var ed = tinyMCEPopup.editor, p, el; + + tinyMCEPopup.restoreSelection(); + el = ed.selection.getNode(); + if (el.nodeName != 'IMG') return; + + if ( (p = ed.dom.getParent(el, 'A')) && p.childNodes.length == 1) + ed.dom.remove(p); + else + ed.dom.remove(el); + + ed.execCommand('mceRepaint'); + tinyMCEPopup.close(); + return; + }, + + update : function() { + var t = this, f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, p, el, b; + + tinyMCEPopup.restoreSelection(); + el = ed.selection.getNode(); + + if (el.nodeName != 'IMG') return; + if (f.img_src.value === '') t.remove(); + + ed.dom.setAttribs(el, { + src : f.img_src.value, + title : f.img_title.value, + alt : f.img_alt.value, + width : f.width.value, + height : f.height.value, + style : f.img_style.value, + 'class' : f.img_classes.value + }); + + pa = ed.dom.getParent(el, 'A'); + + if ( ! f.link_href.value ) { + if ( pa ) { + tinyMCEPopup.execCommand("mceBeginUndoLevel"); + b = ed.selection.getBookmark(); + ed.dom.remove(pa, 1); + ed.selection.moveToBookmark(b); + tinyMCEPopup.execCommand("mceEndUndoLevel"); + tinyMCEPopup.close(); + return; + } + } + + tinyMCEPopup.execCommand("mceBeginUndoLevel"); + + // Create new anchor elements + if (pa == null) { + tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1}); + + tinymce.each(ed.dom.select("a"), function(n) { + if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') { + + ed.dom.setAttribs(n, { + href : f.link_href.value, + title : f.link_title.value, + rel : f.link_rel.value, + rev : f.link_rev.value, + target : f.link_target.value, + 'class' : f.link_classes.value, + style : f.link_style.value + }); + } + }); + } else { + ed.dom.setAttribs(pa, { + href : f.link_href.value, + title : f.link_title.value, + rel : f.link_rel.value, + rev : f.link_rev.value, + target : f.link_target.value, + 'class' : f.link_classes.value, + style : f.link_style.value + }); + } + + tinyMCEPopup.execCommand("mceEndUndoLevel"); + tinyMCEPopup.close(); + }, + + updateStyle : function() { + var dom = tinyMCEPopup.dom, st, v, f = document.forms[0]; + + if (tinyMCEPopup.editor.settings.inline_styles) { + st = tinyMCEPopup.dom.parseStyle(f.img_style.value); + + // Handle align + v = f.align.value; + if (v) { + if (v == 'left' || v == 'right') { + st['float'] = v; + delete st['vertical-align']; + } else { + st['vertical-align'] = v; + delete st['float']; + } + } else { + delete st['float']; + delete st['vertical-align']; + } + + // Handle border + v = f.border.value; + if (v || v == '0') { + if (v == '0') + st['border'] = '0'; + else + st['border'] = v + 'px solid black'; + } else + delete st['border']; + + // Handle hspace + v = f.hspace.value; + if (v) { + delete st['margin']; + st['margin-left'] = v + 'px'; + st['margin-right'] = v + 'px'; + } else { + delete st['margin-left']; + delete st['margin-right']; + } + + // Handle vspace + v = f.vspace.value; + if (v) { + delete st['margin']; + st['margin-top'] = v + 'px'; + st['margin-bottom'] = v + 'px'; + } else { + delete st['margin-top']; + delete st['margin-bottom']; + } + + // Merge + st = tinyMCEPopup.dom.parseStyle(dom.serializeStyle(st)); + f.img_style.value = dom.serializeStyle(st); + } + }, + + checkVal : function(f) { + + if ( f.value == '' ) { + // if ( f.id == 'width' ) f.value = this.width || this.preloadImg.width; + // if ( f.id == 'height' ) f.value = this.height || this.preloadImg.height; + if ( f.id == 'img_src' ) f.value = this.I('img_demo').src || this.preloadImg.src; + } + }, + + resetImageData : function() { + var f = document.forms[0]; + + f.width.value = f.height.value = ""; + }, + + updateImageData : function() { + var f = document.forms[0], t = wpImage; + + if ( f.width.value == '' || f.height.value == '' ) { + f.width.value = t.preloadImg.width; + f.height.value = t.preloadImg.height; + } + t.demoSetSize(); + }, + + getImageData : function() { + var t = wpImage, f = document.forms[0]; + + t.preloadImg = new Image(); + t.preloadImg.onload = t.updateImageData; + t.preloadImg.onerror = t.resetImageData; + t.preloadImg.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.img_src.value); + } +}; + +window.onload = function(){wpImage.init();} +wpImage.preInit(); diff --git a/wp-includes/js/tinymce/tiny_mce_config.php b/wp-includes/js/tinymce/tiny_mce_config.php index f528336a1c..6f7b0cc0bb 100644 --- a/wp-includes/js/tinymce/tiny_mce_config.php +++ b/wp-includes/js/tinymce/tiny_mce_config.php @@ -70,7 +70,7 @@ http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker */ $mce_spellchecker_languages = apply_filters('mce_spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv'); -$plugins = array( 'safari', 'inlinepopups', 'autosave', 'spellchecker', 'paste', 'wordpress', 'media', 'fullscreen' ); +$plugins = array( 'safari', 'inlinepopups', 'autosave', 'spellchecker', 'paste', 'wordpress', 'media', 'fullscreen', 'wpeditimage' ); /* The following filter takes an associative array of external plugins for TinyMCE in the form 'plugin_name' => 'url'. @@ -122,7 +122,7 @@ if ( ! empty($mce_external_plugins) ) { } $plugins = implode($plugins, ','); -$mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', '|', 'bullist', 'numlist', 'blockquote', '|', 'justifyleft', 'justifycenter', 'justifyright', '|', 'link', 'unlink', 'image', 'wp_more', '|', 'spellchecker', 'fullscreen', 'wp_adv' )); +$mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', '|', 'bullist', 'numlist', 'blockquote', '|', 'justifyleft', 'justifycenter', 'justifyright', '|', 'link', 'unlink', 'wp_more', '|', 'spellchecker', 'fullscreen', 'wp_adv' )); $mce_buttons = implode($mce_buttons, ','); $mce_buttons_2 = apply_filters('mce_buttons_2', array('formatselect', 'underline', 'justifyfull', 'forecolor', '|', 'pastetext', 'pasteword', 'removeformat', '|', 'media', 'charmap', '|', 'outdent', 'indent', '|', 'undo', 'redo', 'wp_help' )); @@ -226,7 +226,7 @@ if ( $compress && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) { // Setup cache info if ( $disk_cache ) { - $cacheKey = apply_filters('tiny_mce_version', '20080602'); + $cacheKey = apply_filters('tiny_mce_version', '20080606'); foreach ( $initArray as $v ) $cacheKey .= $v; diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 9258a2dadf..3615d41e1c 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -35,7 +35,7 @@ function wp_default_scripts( &$scripts ) { $scripts->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080325' ); // Modify this version when tinyMCE plugins are changed. - $mce_version = apply_filters('tiny_mce_version', '20080602'); + $mce_version = apply_filters('tiny_mce_version', '20080606'); $scripts->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('editor_functions'), $mce_version ); $scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6');