From 2fcc122d9c1046811e5130466131cad055181c8b Mon Sep 17 00:00:00 2001 From: Daryl Koopersmith Date: Fri, 9 Nov 2012 10:48:50 +0000 Subject: [PATCH] Media: Output correct link html when inserting attachments. see #21390. git-svn-id: https://develop.svn.wordpress.org/trunk@22499 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/js/mce-view.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/wp-includes/js/mce-view.js b/wp-includes/js/mce-view.js index 345b517a2a..cb1ce2a87c 100644 --- a/wp-includes/js/mce-view.js +++ b/wp-includes/js/mce-view.js @@ -484,6 +484,16 @@ window.wp = window.wp || {}; single: true }; + // Generate the `href` based on the `link` property. + if ( props.link && 'none' !== props.link ) { + props.anchor = props.anchor || {}; + + if ( 'post' === props.link ) + props.anchor.href = attachment.link; + else if ( 'file' === props.link ) + props.anchor.href = attachment.url; + } + // Generate the `a` element options, if they exist. if ( props.anchor ) { options = {