Skip to content
This repository was archived by the owner on Jan 31, 2018. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions public/src/editor/media-gallery-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@ define( [ "util/lang", "util/uri", "util/keys", "util/mediatypes", "editor/edito
thumbnailBtn.addEventListener( "click", addEvent, false );

_galleryList.insertBefore( el, _galleryList.firstChild );
_this.scrollbar.update();

if ( _this.scrollbar ) {
_this.scrollbar.update();
}
resetInput();
}

Expand All @@ -194,7 +197,7 @@ define( [ "util/lang", "util/uri", "util/keys", "util/mediatypes", "editor/edito
source = data.source;

if ( !_media.clipData[ source ] ) {
_media.clipData[ source ] = source;
_media.clipData[ source ] = data;
_butter.dispatch( "mediaclipadded" );

el.classList.add( "new" );
Expand Down Expand Up @@ -293,11 +296,21 @@ define( [ "util/lang", "util/uri", "util/keys", "util/mediatypes", "editor/edito

// We keep track of clips that are in the media gallery for a project once it is saved
// and every time after it is saved.
var clips = _media.clipData;
var clips = _media.clipData,
clip;

for ( var key in clips ) {
if ( clips.hasOwnProperty( key ) ) {
MediaUtils.getMetaData( clips[ key ], addElements );
clip = clips[ key ];
if ( typeof clip === "object" ) {
addElements( clip );
} else if ( typeof clip === "string" ) {
// Load projects saved with just the url the old way.
// Remove it too, so future saves don't come through here.
delete clips[ key ];
// Fire an onSuccess so a new, updated clip is added to clipData.
MediaUtils.getMetaData( clip, onSuccess );
}
}
}

Expand Down