diff --git a/wp-includes/class-wp-editor.php b/wp-includes/class-wp-editor.php index bcbc631835..a8299451c2 100644 --- a/wp-includes/class-wp-editor.php +++ b/wp-includes/class-wp-editor.php @@ -207,7 +207,7 @@ final class _WP_Editors { $ext_plugins = ''; if ( $set['teeny'] ) { - self::$plugins = $plugins = apply_filters( 'teeny_mce_plugins', array( 'fullscreen', 'link', 'image', 'wordpress', 'wplink' ), $editor_id ); + self::$plugins = $plugins = apply_filters( 'teeny_mce_plugins', array( 'fullscreen', 'link', 'image', 'wordpress', 'wpeditimage', 'wplink' ), $editor_id ); } else { /** * TinyMCE external plugins filter @@ -335,8 +335,12 @@ final class _WP_Editors { self::$first_init['external_plugins'] = json_encode( $mce_external_plugins ); } - // WordPress default stylesheet - $mce_css = array( self::$baseurl . '/skins/wordpress/wp-content.css' ); + $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; + $version = 'ver=' . $GLOBALS['wp_version']; + $dashicons = includes_url( "css/dashicons$suffix.css?$version" ); + + // WordPress default stylesheet and dashicons + $mce_css = array( $dashicons, self::$baseurl . '/skins/wordpress/wp-content.css' ); // load editor_style.css if the current theme supports it if ( ! empty( $GLOBALS['editor_styles'] ) && is_array( $GLOBALS['editor_styles'] ) ) { diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js b/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js index 6681eda11c..f62509779b 100644 --- a/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js +++ b/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js @@ -42,7 +42,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) { width = parseInt( w, 10 ) + 10; - return '
)?\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\](?:<\/p>)?/g,function(a,b,c){var d,e,f,g,h,i,j=tinymce.trim;return d=b.match(/id=['"]([^'"]*)['"] ?/),d&&(b=b.replace(d[0],"")),e=b.match(/align=['"]([^'"]*)['"] ?/),e&&(b=b.replace(e[0],"")),f=b.match(/width=['"]([0-9]*)['"] ?/),f&&(b=b.replace(f[0],"")),c=j(c),h=c.match(/((?:]+>)?]+>(?:<\/a>)?)([\s\S]*)/i),h&&h[2]?(g=j(h[2]),h=j(h[1])):(g=j(b).replace(/caption=['"]/,"").replace(/['"]$/,""),h=c),d=d&&d[1]?d[1]:"",e=e&&e[1]?e[1]:"alignnone",f=f&&f[1]?f[1]:"",f&&g?(i=parseInt(f,10)+10,' "+c[1]+" [\s\S]*<\/p>)?[\s\S]*/gi," $1 /,"").replace(/<\/p>$/,""))),"A"===b.parentNode.nodeName&&(d.linkUrl=a.dom.getAttrib(b.parentNode,"href")),d}function e(b,c){var d,e,g,h,i,j,k;c.caption?(h=f(c,"html"),e=c.width+10,d="align"+c.align,h=' /,"").replace(/<\/p>$/,"")))}),b.bind(a.getDoc(),"dragstart",function(c){var d=a.selection.getNode();"IMG"===d.nodeName&&b.getParent(d,".wp-caption")&&c.preventDefault()})}),a.on("ObjectResized",function(b){var c,d,e=b.target;"IMG"===e.nodeName&&(c=a.dom.getParent(e,".wp-caption"))&&(d=b.width||a.dom.getAttrib(e,"width"),d&&(d=parseInt(d,10)+10,a.dom.setStyle(c,"width",d+"px")))}),a.on("BeforeExecCommand",function(b){var c,d,e,f,g=b.command,h=a.dom;if("mceInsertContent"===g){if((c=h.getParent(a.selection.getNode(),"div.mceTemp"))&&(d=h.create("p"),h.insertAfter(d,c),a.selection.setCursorLocation(d,0),a.nodeChanged(),tinymce.Env.ie>8))return setTimeout(function(){a.selection.setCursorLocation(d,0),a.selection.setContent(b.value)},500),!1}else if("JustifyLeft"===g||"JustifyRight"===g||"JustifyCenter"===g){if(c=a.selection.getNode(),f=g.substr(7).toLowerCase(),f="align"+f,e=h.is(c,"dl.wp-caption")?c:h.getParent(c,"dl.wp-caption"))return h.hasClass(e,f)?(h.removeClass(e,f),h.addClass(e,"alignnone")):(e.className=e.className.replace(/align[^ ]+/g,""),h.addClass(e,f)),!1;"IMG"===c.nodeName&&(h.hasClass(c,f)?h.addClass(c,"alignnone"):h.removeClass(c,"alignnone"))}}),a.on("keydown",function(b){var c,d,e,f,g=a.selection,h=a.dom;if(b.keyCode===tinymce.util.VK.ENTER)d=h.getParent(a.selection.getNode(),"div.mceTemp"),d&&(h.events.cancel(b),tinymce.each(h.select("dt, dd",d),function(a){h.isEmpty(a)&&h.remove(a)}),f=tinymce.Env.ie?"":' )?\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\](?:<\/p>)?/g,function(a,b,c){var d,e,f,g,h,i,j=tinymce.trim;return d=b.match(/id=['"]([^'"]*)['"] ?/),d&&(b=b.replace(d[0],"")),e=b.match(/align=['"]([^'"]*)['"] ?/),e&&(b=b.replace(e[0],"")),f=b.match(/width=['"]([0-9]*)['"] ?/),f&&(b=b.replace(f[0],"")),c=j(c),h=c.match(/((?:]+>)?]+>(?:<\/a>)?)([\s\S]*)/i),h&&h[2]?(g=j(h[2]),h=j(h[1])):(g=j(b).replace(/caption=['"]/,"").replace(/['"]$/,""),h=c),d=d&&d[1]?d[1]:"",e=e&&e[1]?e[1]:"alignnone",f=f&&f[1]?f[1]:"",f&&g?(i=parseInt(f,10)+10,']+)>\s*
"),'[caption id="'+e+'" align="'+f+'" width="'+g+'"]'+c+" "+d+"[/caption]"):c}),0!==c.indexOf("[caption")&&(c=b.replace(/[\s\S]*?((?:]+>)?]+>(?:<\/a>)?)(
]*>/g,"$&\n").replace(/^
]*>)\s*\n\s*/g,"$1").replace(/\s*\n\s*/g,"
")),j?(h=j.id||null,b.setAttribs(j,i),d=b.getParent(j,"dl.wp-caption"),k?d?(e=b.select("dd.wp-caption-dd",d)[0])&&(e.innerHTML=k):(j.className&&(l=j.className.match(/wp-image-([0-9]+)/),m=j.className.match(/align(left|right|center|none)/)),m?(m=m[0],j.className=j.className.replace(/align(left|right|center|none)/g,"")):m="alignnone",m=' class="wp-caption '+m+'"',l&&(l=' id="attachment_'+l[1]+'"'),n=i.width||j.clientWidth,n&&(n=parseInt(n,10)+10,n=' style="width: '+n+'px"'),j.parentNode&&"A"===j.parentNode.nodeName?(g=b.getOuterHTML(j.parentNode),f=j.parentNode):(g=b.getOuterHTML(j),f=j),g="",(e=b.getParent(j,"p"))?(d=b.create("div",{"class":"mceTemp",draggable:"true"},g),b.insertAfter(d,e),a.selection.select(d),a.nodeChanged(),b.remove(f),b.isEmpty(e)&&b.remove(e)):a.selection.setContent('
]*>/g,"$&\n").replace(/^
',e=h.create("p",null,f),h.insertAfter(e,d),g.setCursorLocation(e,0),a.nodeChanged());else if((b.keyCode===tinymce.util.VK.DELETE||b.keyCode===tinymce.util.VK.BACKSPACE)&&(c=g.getNode(),"DIV"===c.nodeName&&h.hasClass(c,"mceTemp")?d=c:("IMG"===c.nodeName||"DT"===c.nodeName||"A"===c.nodeName)&&(d=h.getParent(c,"div.mceTemp")),d))return h.events.cancel(b),g.select(d.nextSibling?d.nextSibling:d.previousSibling?d.previousSibling:d.parentNode),g.collapse(!0),a.nodeChanged(),h.remove(d),d=null,!1}),a.on("mousedown",function(b){var c,f,g;if("IMG"===b.target.nodeName&&a.selection.getNode()===b.target&&2!==b.button){if(a.dom.hasClass(b.target,"mceItem")||"1"===a.dom.getAttrib(b.target,"data-mce-placeholder"))return;c=b.target,f=wp.media({frame:"image",state:"image-details",metadata:d(c)}),g=function(b){e(c,b),a.focus()},f.state("image-details").on("update",g),f.state("replace-image").on("replace",g),f.open()}}),a.wpSetImgCaption=function(a){return b(a)},a.wpGetImgCaption=function(a){return c(a)},a.on("BeforeSetContent",function(b){b.content=a.wpSetImgCaption(b.content)}),a.on("PostProcess",function(b){b.get&&(b.content=a.wpGetImgCaption(b.content))}),{_do_shcode:b,_get_shcode:c}});
\ No newline at end of file
+tinymce.PluginManager.add("wpeditimage",function(a){function b(a){return a.replace(/(?: