Add a class method to `wpLink`, `buildHtml()`. This will allows devs to duck-punch the implementation.

Props martinsachse.
Fixes #32180.


git-svn-id: https://develop.svn.wordpress.org/trunk@32802 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2015-06-16 20:19:54 +00:00
parent 862c761c08
commit a6a0480eb0
1 changed files with 11 additions and 8 deletions

View File

@ -266,6 +266,16 @@ var wpLink;
};
},
buildHtml: function(attrs) {
var html = '<a href="' + attrs.href + '"';
if ( attrs.target ) {
html += ' target="' + attrs.target + '"';
}
return html + '>';
},
update: function() {
if ( wpLink.isMCE() ) {
wpLink.mceUpdate();
@ -290,14 +300,7 @@ var wpLink;
return;
}
// Build HTML
html = '<a href="' + attrs.href + '"';
if ( attrs.target ) {
html += ' target="' + attrs.target + '"';
}
html += '>';
html = wpLink.buildHtml(attrs);
// Insert HTML
if ( document.selection && wpLink.range ) {