WordPress/wp-admin/js/widgets/media-audio-widget.min.js

2 lines
1.4 KiB
JavaScript

/*! This file is auto-generated */
(d=>{var a=wp.media.view.MediaFrame.AudioDetails.extend({createStates:function(){this.states.add([new wp.media.controller.AudioDetails({media:this.media}),new wp.media.controller.MediaLibrary({type:"audio",id:"add-audio-source",title:wp.media.view.l10n.audioAddSourceTitle,toolbar:"add-audio-source",media:this.media,menu:!1})])}}),e=d.MediaWidgetModel.extend({}),t=d.MediaWidgetControl.extend({showDisplaySettings:!1,mapModelToMediaFrameProps:function(e){e=d.MediaWidgetControl.prototype.mapModelToMediaFrameProps.call(this,e);return e.link="embed",e},renderPreview:function(){var e,d=this,t=d.model.get("attachment_id"),a=d.model.get("url");(t||a)&&(t=d.$el.find(".media-widget-preview"),e=wp.template("wp-media-widget-audio-preview"),t.html(e({model:{attachment_id:d.model.get("attachment_id"),src:a},error:d.model.get("error")})),wp.mediaelement.initialize())},editMedia:function(){var d=this,e=d.mapModelToMediaFrameProps(d.model.toJSON()),t=new a({frame:"audio",state:"audio-details",metadata:e});(wp.media.frame=t).$el.addClass("media-widget"),e=function(e){d.selectedAttachment.set(e),d.model.set(_.extend(d.model.defaults(),d.mapMediaToModelProps(e),{error:!1}))},t.state("audio-details").on("update",e),t.state("replace-audio").on("replace",e),t.on("close",function(){t.detach()}),t.open()}});d.controlConstructors.media_audio=t,d.modelConstructors.media_audio=e})(wp.mediaWidgets);