WordPress/wp-includes/js/media-editor.min.js

2 lines
11 KiB
JavaScript
Raw Normal View History

/*! This file is auto-generated */
!function(a,l){var i={};wp.media.coerce=function(e,t){return l.isUndefined(e[t])&&!l.isUndefined(this.defaults[t])?e[t]=this.defaults[t]:"true"===e[t]?e[t]=!0:"false"===e[t]&&(e[t]=!1),e[t]},wp.media.string={props:function(e,t){var i,n,a,d,r=wp.media.view.settings.defaultProps;return e=e?l.clone(e):{},t&&t.type&&(e.type=t.type),"image"===e.type&&(e=l.defaults(e||{},{align:r.align||getUserSetting("align","none"),size:r.size||getUserSetting("imgsize","medium"),url:"",classes:[]})),t&&(e.title=e.title||t.title,"file"===(i=e.link||r.link||getUserSetting("urlbutton","file"))||"embed"===i?n=t.url:"post"===i?n=t.link:"custom"===i&&(n=e.linkUrl),e.linkUrl=n||"","image"===t.type?(e.classes.push("wp-image-"+t.id),a=(d=t.sizes)&&d[e.size]?d[e.size]:t,l.extend(e,l.pick(t,"align","caption","alt"),{width:a.width,height:a.height,src:a.url,captionId:"attachment_"+t.id})):"video"===t.type||"audio"===t.type?l.extend(e,l.pick(t,"title","type","icon","mime")):(e.title=e.title||t.filename,e.rel=e.rel||"attachment wp-att-"+t.id)),e},link:function(e,t){var i;return i={tag:"a",content:(e=wp.media.string.props(e,t)).title,attrs:{href:e.linkUrl}},e.rel&&(i.attrs.rel=e.rel),wp.html.string(i)},audio:function(e,t){return wp.media.string._audioVideo("audio",e,t)},video:function(e,t){return wp.media.string._audioVideo("video",e,t)},_audioVideo:function(e,t,i){var n,a;return"embed"!==(t=wp.media.string.props(t,i)).link?wp.media.string.link(t):(n={},"video"===e&&(i.image&&-1===i.image.src.indexOf(i.icon)&&(n.poster=i.image.src),i.width&&(n.width=i.width),i.height&&(n.height=i.height)),a=i.filename.split(".").pop(),l.contains(wp.media.view.settings.embedExts,a)?(n[a]=i.url,wp.shortcode.string({tag:e,attrs:n})):wp.media.string.link(t))},image:function(e,t){var i,n,a,d,r={};return e.type="image",n=(e=wp.media.string.props(e,t)).classes||[],r.src=l.isUndefined(t)?e.url:t.url,l.extend(r,l.pick(e,"width","height","alt")),e.align&&!e.caption&&n.push("align"+e.align),e.size&&n.push("size-"+e.size),r.class=l.compact(n).join(" "),i={tag:"img",attrs:r,single:!0},e.linkUrl&&(i={tag:"a",attrs:{href:e.linkUrl},content:i}),d=wp.html.string(i),e.caption&&(a={},r.width&&(a.width=r.width),e.captionId&&(a.id=e.captionId),e.align&&(a.align="align"+e.align),d=wp.shortcode.string({tag:"caption",attrs:a,content:d+" "+e.caption})),d}},wp.media.embed={coerce:wp.media.coerce,defaults:{url:"",width:"",height:""},edit:function(e,t){var i,n={};return t?n.url=e.replace(/<[^>]+>/g,""):(i=wp.shortcode.next("embed",e).shortcode,n=l.defaults(i.attrs.named,this.defaults),i.content&&(n.url=i.content)),wp.media({frame:"post",state:"embed",metadata:n})},shortcode:function(i){var e,n=this;return l.each(this.defaults,function(e,t){i[t]=n.coerce(i,t),e===i[t]&&delete i[t]}),e=i.url,delete i.url,new wp.shortcode({tag:"embed",attrs:i,content:e})}},wp.media.collection=function(e){var o={};return l.extend({coerce:wp.media.coerce,attachments:function(e){var t,i,n,a,d=e.string(),r=o[d],s=this;return delete o[d],r||(t=l.defaults(e.attrs.named,this.defaults),(i=l.pick(t,"orderby","order")).type=this.type,i.perPage=-1,void 0!==t.orderby&&(t._orderByField=t.orderby),"rand"===t.orderby&&(t._orderbyRandom=!0),t.orderby&&!/^menu_order(?: ID)?$/i.test(t.orderby)||(i.orderby="menuOrder"),t.ids?(i.post__in=t.ids.split(","),i.orderby="post__in"):t.include&&(i.post__in=t.include.split(",")),t.exclude&&(i.post__not_in=t.exclude.split(",")),i.post__in||(i.uploadedTo=t.id),a=l.omit(t,"id","ids","include","exclude","orderby","order"),l.each(this.defaults,function(e,t){a[t]=s.coerce(a,t)}),(n=wp.media.query(i))[this.tag]=new Backbone.Model(a),n)},shortcode:function(e){var t,i,n=e.props.toJSON(),a=l.pick(n,"orderby","order");return e.type&&(a.type=e.type,delete e.type),e[this.tag]&&l.extend(a,e[this.tag].toJSON()),a.ids=e.pluck("id"),n.uploadedTo&&(a.id=n.uploadedTo),delete a.orderby,a._orderbyRandom?a.orderby="rand":a._orderByField&&"rand"!==a._orderByField&&(a.orderby=a._orderByField),delete a._orderbyRandom,delete a._orderByField,a.ids&&"post__in"===a.orderby&&delete a.orderby,a=this.setDefaults(a),t=new wp.short