diff --git src/wp-includes/js/media-views.js src/wp-includes/js/media-views.js
index c932f21..80a435f 100644
|
|
|
module.exports = EditImage; |
| 503 | 503 | * @param {string} [attributes.content=embed] Initial mode for the content region. |
| 504 | 504 | * @param {string} [attributes.menu=default] Initial mode for the menu region. |
| 505 | 505 | * @param {string} [attributes.toolbar=main-embed] Initial mode for the toolbar region. |
| 506 | | * @param {string} [attributes.menu=false] Initial mode for the menu region. |
| 507 | 506 | * @param {int} [attributes.priority=120] The priority for the state link in the media menu. |
| 508 | 507 | * @param {string} [attributes.type=link] The type of embed. Currently only link is supported. |
| 509 | 508 | * @param {string} [attributes.url] The embed URL. |
| … |
… |
var l10n = wp.media.view.l10n, |
| 516 | 515 | Embed = wp.media.controller.State.extend({ |
| 517 | 516 | defaults: { |
| 518 | 517 | id: 'embed', |
| 519 | | title: l10n.insertFromUrlTitle, |
| | 518 | title: l10n.fromUrlTitle, |
| 520 | 519 | content: 'embed', |
| 521 | 520 | menu: 'default', |
| | 521 | router: 'browse', |
| 522 | 522 | toolbar: 'main-embed', |
| 523 | 523 | priority: 120, |
| 524 | 524 | type: 'link', |
| … |
… |
Embed = wp.media.controller.State.extend({ |
| 536 | 536 | this.props.on( 'change:url', this.debouncedScan, this ); |
| 537 | 537 | this.props.on( 'change:url', this.refresh, this ); |
| 538 | 538 | this.on( 'scan', this.scanImage, this ); |
| | 539 | this.off( 'ready', this._ready, this ); |
| 539 | 540 | }, |
| 540 | 541 | |
| 541 | 542 | /** |
| … |
… |
Embed = wp.media.controller.State.extend({ |
| 590 | 591 | image.onload = function() { |
| 591 | 592 | deferred.resolve(); |
| 592 | 593 | |
| 593 | | if ( state !== frame.state() || url !== state.props.get('url') ) { |
| | 594 | if ( url !== state.props.get('url') ) { |
| 594 | 595 | return; |
| 595 | 596 | } |
| 596 | 597 | |
| … |
… |
Post = Select.extend({ |
| 5252 | 5253 | bindHandlers: function() { |
| 5253 | 5254 | var handlers, checkCounts; |
| 5254 | 5255 | |
| | 5256 | this.on( 'content:create:browse', this._fixState, this ); |
| | 5257 | this.on( 'content:render:upload', this._fixState, this ); |
| | 5258 | this.on( 'content:render:embed', this._fixState, this ); |
| | 5259 | |
| 5255 | 5260 | Select.prototype.bindHandlers.apply( this, arguments ); |
| 5256 | 5261 | |
| 5257 | 5262 | this.on( 'activate', this.activate, this ); |
| … |
… |
Post = Select.extend({ |
| 5274 | 5279 | this.on( 'toolbar:create:main-video-playlist', this.createToolbar, this ); |
| 5275 | 5280 | this.on( 'toolbar:create:featured-image', this.featuredImageToolbar, this ); |
| 5276 | 5281 | this.on( 'toolbar:create:main-embed', this.mainEmbedToolbar, this ); |
| | 5282 | this.on( 'router:render:browse', this.embedRouterItem, this ); |
| 5277 | 5283 | |
| 5278 | 5284 | handlers = { |
| 5279 | 5285 | menu: { |
| … |
… |
Post = Select.extend({ |
| 5426 | 5432 | }); |
| 5427 | 5433 | }, |
| 5428 | 5434 | |
| | 5435 | embedRouterItem: function( routerView ) { |
| | 5436 | var state = this.state(), |
| | 5437 | routerItem = routerView.get( 'embed' ); |
| | 5438 | |
| | 5439 | if ( 'embed' === state.id || 'insert' === state.id ) { |
| | 5440 | if ( ! routerItem ) { |
| | 5441 | routerView.set( 'embed', { |
| | 5442 | text: l10n.fromUrlTitle, |
| | 5443 | priority: 60 |
| | 5444 | }); |
| | 5445 | } else { |
| | 5446 | routerView.show( 'embed' ); |
| | 5447 | } |
| | 5448 | } else { |
| | 5449 | routerView.hide( 'embed' ); |
| | 5450 | } |
| | 5451 | }, |
| | 5452 | |
| 5429 | 5453 | // Content |
| | 5454 | _fixState: function() { |
| | 5455 | var mode = this.content.mode(), |
| | 5456 | state = this.state().id; |
| | 5457 | |
| | 5458 | if ( 'embed' === mode ) { |
| | 5459 | this.setState( 'embed' ); |
| | 5460 | } else if ( 'embed' === state ) { |
| | 5461 | this.setState( 'insert' ); |
| | 5462 | this.content.mode( mode ); |
| | 5463 | } |
| | 5464 | }, |
| | 5465 | |
| 5430 | 5466 | embedContent: function() { |
| 5431 | 5467 | var view = new wp.media.view.Embed({ |
| 5432 | 5468 | controller: this, |