diff --git src/wp-includes/js/media/controllers/embed.js src/wp-includes/js/media/controllers/embed.js
index d347db0..27bfe37 100644
|
|
|
13 | 13 | * @param {string} [attributes.content=embed] Initial mode for the content region. |
14 | 14 | * @param {string} [attributes.menu=default] Initial mode for the menu region. |
15 | 15 | * @param {string} [attributes.toolbar=main-embed] Initial mode for the toolbar region. |
16 | | * @param {string} [attributes.menu=false] Initial mode for the menu region. |
17 | 16 | * @param {int} [attributes.priority=120] The priority for the state link in the media menu. |
18 | 17 | * @param {string} [attributes.type=link] The type of embed. Currently only link is supported. |
19 | 18 | * @param {string} [attributes.url] The embed URL. |
… |
… |
var l10n = wp.media.view.l10n, |
26 | 25 | Embed = wp.media.controller.State.extend({ |
27 | 26 | defaults: { |
28 | 27 | id: 'embed', |
29 | | title: l10n.insertFromUrlTitle, |
| 28 | title: l10n.fromUrlTitle, |
30 | 29 | content: 'embed', |
31 | 30 | menu: 'default', |
| 31 | router: 'browse', |
32 | 32 | toolbar: 'main-embed', |
33 | 33 | priority: 120, |
34 | 34 | type: 'link', |
… |
… |
Embed = wp.media.controller.State.extend({ |
46 | 46 | this.props.on( 'change:url', this.debouncedScan, this ); |
47 | 47 | this.props.on( 'change:url', this.refresh, this ); |
48 | 48 | this.on( 'scan', this.scanImage, this ); |
| 49 | this.off( 'ready', this._ready, this ); |
49 | 50 | }, |
50 | 51 | |
51 | 52 | /** |
… |
… |
Embed = wp.media.controller.State.extend({ |
100 | 101 | image.onload = function() { |
101 | 102 | deferred.resolve(); |
102 | 103 | |
103 | | if ( state !== frame.state() || url !== state.props.get('url') ) { |
| 104 | if ( url !== state.props.get('url') ) { |
104 | 105 | return; |
105 | 106 | } |
106 | 107 | |
diff --git src/wp-includes/js/media/views/frame/post.js src/wp-includes/js/media/views/frame/post.js
index f4d078f..b0a916a 100644
|
|
Post = Select.extend({ |
174 | 174 | bindHandlers: function() { |
175 | 175 | var handlers, checkCounts; |
176 | 176 | |
| 177 | this.on( 'content:create:browse', this._fixState, this ); |
| 178 | this.on( 'content:render:upload', this._fixState, this ); |
| 179 | this.on( 'content:render:embed', this._fixState, this ); |
| 180 | |
177 | 181 | Select.prototype.bindHandlers.apply( this, arguments ); |
178 | 182 | |
179 | 183 | this.on( 'activate', this.activate, this ); |
… |
… |
Post = Select.extend({ |
196 | 200 | this.on( 'toolbar:create:main-video-playlist', this.createToolbar, this ); |
197 | 201 | this.on( 'toolbar:create:featured-image', this.featuredImageToolbar, this ); |
198 | 202 | this.on( 'toolbar:create:main-embed', this.mainEmbedToolbar, this ); |
| 203 | this.on( 'router:render:browse', this.embedRouterItem, this ); |
199 | 204 | |
200 | 205 | handlers = { |
201 | 206 | menu: { |
… |
… |
Post = Select.extend({ |
348 | 353 | }); |
349 | 354 | }, |
350 | 355 | |
| 356 | embedRouterItem: function( routerView ) { |
| 357 | var state = this.state(), |
| 358 | routerItem = routerView.get( 'embed' ); |
| 359 | |
| 360 | if ( 'embed' === state.id || 'insert' === state.id ) { |
| 361 | if ( ! routerItem ) { |
| 362 | routerView.set( 'embed', { |
| 363 | text: l10n.fromUrlTitle, |
| 364 | priority: 60 |
| 365 | }); |
| 366 | } else { |
| 367 | routerView.show( 'embed' ); |
| 368 | } |
| 369 | } else { |
| 370 | routerView.hide( 'embed' ); |
| 371 | } |
| 372 | }, |
| 373 | |
351 | 374 | // Content |
| 375 | _fixState: function() { |
| 376 | var mode = this.content.mode(), |
| 377 | state = this.state().id; |
| 378 | |
| 379 | if ( 'embed' === mode ) { |
| 380 | this.setState( 'embed' ); |
| 381 | } else if ( 'embed' === state ) { |
| 382 | this.setState( 'insert' ); |
| 383 | this.content.mode( mode ); |
| 384 | } |
| 385 | }, |
| 386 | |
352 | 387 | embedContent: function() { |
353 | 388 | var view = new wp.media.view.Embed({ |
354 | 389 | controller: this, |
diff --git src/wp-includes/media.php src/wp-includes/media.php
index 7a58329..da03ce7 100644
|
|
function wp_enqueue_media( $args = array() ) { |
3091 | 3091 | 'attachmentDetails' => __( 'Attachment Details' ), |
3092 | 3092 | |
3093 | 3093 | // From URL |
3094 | | 'insertFromUrlTitle' => __( 'Insert from URL' ), |
| 3094 | 'fromUrlTitle' => __( 'From URL' ), |
3095 | 3095 | |
3096 | 3096 | // Featured Images |
3097 | 3097 | 'setFeaturedImageTitle' => $post_type_object->labels->featured_image, |