mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-15 07:05:37 +01:00
2d74427834
This updates the 5.5 branch to support the latest LTS version of NodeJS (currently 14.x) in an effort to allow the same version of NodeJS to be used across all WordPress branches receiving security updates as a courtesy. In addition to backporting the package updates that happened after branching 5.5, dependencies that were removed in future releases have also been updated to their latest versions. Props desrosj, dd32, netweb, jorbin. Merges [48705,49636,49933,49937,49939-49940,49983,49989-49990,50016-50017,50126,50176,50185] to the 5.5 branch. See #52341. Built from https://develop.svn.wordpress.org/branches/5.5@50188 git-svn-id: http://core.svn.wordpress.org/branches/5.5@49866 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2 lines
2.6 KiB
JavaScript
2 lines
2.6 KiB
JavaScript
/*! This file is auto-generated */
|
|
!function(t){"use strict";var i=wp.media.view.MediaFrame.VideoDetails.extend({createStates:function(){this.states.add([new wp.media.controller.VideoDetails({media:this.media}),new wp.media.controller.MediaLibrary({type:"video",id:"add-video-source",title:wp.media.view.l10n.videoAddSourceTitle,toolbar:"add-video-source",media:this.media,menu:!1}),new wp.media.controller.MediaLibrary({type:"text",id:"add-track",title:wp.media.view.l10n.videoAddTrackTitle,toolbar:"add-track",media:this.media,menu:"video-details"})])}}),e=t.MediaWidgetModel.extend({}),d=t.MediaWidgetControl.extend({showDisplaySettings:!1,oembedResponses:{},mapModelToMediaFrameProps:function(e){e=t.MediaWidgetControl.prototype.mapModelToMediaFrameProps.call(this,e);return e.link="embed",e},fetchEmbed:function(){var t=this,d=t.model.get("url");t.oembedResponses[d]||(t.fetchEmbedDfd&&"pending"===t.fetchEmbedDfd.state()&&t.fetchEmbedDfd.abort(),t.fetchEmbedDfd=wp.apiRequest({url:wp.media.view.settings.oEmbedProxyUrl,data:{url:t.model.get("url"),maxwidth:t.model.get("width"),maxheight:t.model.get("height"),discover:!1},type:"GET",dataType:"json",context:t}),t.fetchEmbedDfd.done(function(e){t.oembedResponses[d]=e,t.renderPreview()}),t.fetchEmbedDfd.fail(function(){t.oembedResponses[d]=null}))},isHostedVideo:function(){return!0},renderPreview:function(){var e,t,d,i=this,o="",a=!1,s=i.model.get("attachment_id"),m=i.model.get("url"),n=i.model.get("error");(s||m)&&((t=i.selectedAttachment.get("mime"))&&s?_.contains(_.values(wp.media.view.settings.embedMimes),t)||(n="unsupported_file_type"):s||((d=document.createElement("a")).href=m,(d=d.pathname.toLowerCase().match(/\.(\w+)$/))?_.contains(_.keys(wp.media.view.settings.embedMimes),d[1])||(n="unsupported_file_type"):a=!0),a&&(i.fetchEmbed(),i.oembedResponses[m]&&(e=i.oembedResponses[m].thumbnail_url,o=i.oembedResponses[m].html.replace(/\swidth="\d+"/,' width="100%"').replace(/\sheight="\d+"/,""))),d=i.$el.find(".media-widget-preview"),i=wp.template("wp-media-widget-video-preview"),d.html(i({model:{attachment_id:s,html:o,src:m,poster:e},is_oembed:a,error:n})),wp.mediaelement.initialize())},editMedia:function(){var t=this,e=t.mapModelToMediaFrameProps(t.model.toJSON()),d=new i({frame:"video",state:"video-details",metadata:e});(wp.media.frame=d).$el.addClass("media-widget"),e=function(e){t.selectedAttachment.set(e),t.model.set(_.extend(_.omit(t.model.defaults(),"title"),t.mapMediaToModelProps(e),{error:!1}))},d.state("video-details").on("update",e),d.state("replace-video").on("replace",e),d.on("close",function(){d.detach()}),d.open()}});t.controlConstructors.media_video=d,t.modelConstructors.media_video=e}(wp.mediaWidgets); |