Media: Add Embed from URL tab.

Note: There is a bug that currently blocks adding several successive embeds.

see #21390.


git-svn-id: https://develop.svn.wordpress.org/trunk@22547 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Daryl Koopersmith
2012-11-12 05:57:12 +00:00
parent ac3a589c8d
commit f6a737ed34
7 changed files with 539 additions and 48 deletions
+1 -1
View File
@@ -38,7 +38,7 @@
});
frame.toolbar.on( 'activate:select', function() {
frame.toolbar.view().add({
frame.toolbar.view().set({
select: {
style: 'primary',
text: $el.data('update'),
+1 -1
View File
@@ -25,7 +25,7 @@
});
frame.toolbar.on( 'activate:select', function() {
frame.toolbar.view().add({
frame.toolbar.view().set({
select: {
style: 'primary',
text: $el.data('update'),
+46
View File
@@ -144,6 +144,52 @@ var tb_position;
this.insert( shortcode.string() );
}, this );
workflow.get('embed').on( 'select', function() {
var embed = workflow.state().toJSON(),
options;
if ( 'link' === embed.type ) {
this.insert( wp.html.string({
tag: 'a',
content: embed.title || embed.url,
attrs: {
href: embed.url
}
}) );
} else if ( 'image' === embed.type ) {
_.defaults( embed, {
align: 'none',
url: '',
alt: '',
linkUrl: '',
link: 'none'
});
options = {
single: true,
tag: 'img',
attrs: {
'class': 'align' + embed.align,
src: embed.url,
alt: embed.alt
}
};
if ( 'custom' === embed.link || 'file' === embed.link ) {
options = {
tag: 'a',
content: options,
attrs: {
href: 'custom' === embed.link ? embed.linkUrl : embed.url
}
};
}
this.insert( wp.html.string( options ) );
}
}, this );
return workflow;
},