mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
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:
@@ -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'),
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -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;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user