WordPress/wp-admin/js/widgets/media-image-widget.min.js
Sergey Biryukov 49007e52bc Build/Test Tools: Add banner to RTL CSS and minified JS files.
Patches occasionally come in on generated files. We should be kind to new contributors and give them a hint that these files are auto-generated.

This is a follow-up to [41271], which added the banner to minified CSS files.

Fixes #48424. See #30666.
Built from https://develop.svn.wordpress.org/trunk@46589


git-svn-id: http://core.svn.wordpress.org/trunk@46386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-26 00:17:07 +00:00

2 lines
2.0 KiB
JavaScript

/*! This file is auto-generated */
!function(a,d){"use strict";var e,t;e=a.MediaWidgetModel.extend({}),t=a.MediaWidgetControl.extend({events:_.extend({},a.MediaWidgetControl.prototype.events,{"click .media-widget-preview.populated":"editMedia"}),renderPreview:function(){var e,t,i,a,o=this;(o.model.get("attachment_id")||o.model.get("url"))&&(e=o.$el.find(".media-widget-preview"),t=wp.template("wp-media-widget-image-preview"),e.html(t(o.previewTemplateProps.toJSON())),e.addClass("populated"),o.$el.find(".link").is(document.activeElement)||(i=o.$el.find(".media-widget-fields"),a=wp.template("wp-media-widget-image-fields"),i.html(a(o.previewTemplateProps.toJSON()))))},editMedia:function(){var i,e,t,a,o=this;"none"===(a=o.mapModelToMediaFrameProps(o.model.toJSON())).link&&(a.linkUrl=""),(i=wp.media({frame:"image",state:"image-details",metadata:a})).$el.addClass("media-widget"),e=function(){var e,t;t=(e=i.state().attributes.image.toJSON()).link,e.link=e.linkUrl,o.selectedAttachment.set(e),o.displaySettings.set("link",t),o.model.set(_.extend(o.mapMediaToModelProps(e),{error:!1}))},i.state("image-details").on("update",e),i.state("replace-image").on("replace",e),t=wp.media.model.Attachment.prototype.sync,wp.media.model.Attachment.prototype.sync=function(){return d.Deferred().rejectWith(this).promise()},i.on("close",function(){i.detach(),wp.media.model.Attachment.prototype.sync=t}),i.open()},getEmbedResetProps:function(){return _.extend(a.MediaWidgetControl.prototype.getEmbedResetProps.call(this),{size:"full",width:0,height:0})},getModelPropsFromMediaFrame:function(e){return _.omit(a.MediaWidgetControl.prototype.getModelPropsFromMediaFrame.call(this,e),"image_title")},mapModelToPreviewTemplateProps:function(){var e,t,i=this;return t=i.model.get("url"),(e=a.MediaWidgetControl.prototype.mapModelToPreviewTemplateProps.call(i)).currentFilename=t?t.replace(/\?.*$/,"").replace(/^.+\//,""):"",e.link_url=i.model.get("link_url"),e}}),a.controlConstructors.media_image=t,a.modelConstructors.media_image=e}(wp.mediaWidgets,jQuery);