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

2 lines
11 KiB
JavaScript
Raw Permalink Normal View History

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