File Editor
Directories:
.. (Back)
Files:
wp-media.asset.php
wp-media.js
wp-media.js.LICENSE.txt
wp-media.min.js
wp-media.strings.js
Create New File
Create
Edit File: wp-media.min.js
!function(){"use strict";var e={d:function(t,n){for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{useWpMediaAttachment:function(){return l},useWpMediaFrame:function(){return d}});var n=window.elementorV2.query,r=window.elementorV2.utils,o=window.React,i=(0,r.createError)({code:"wp_media_not_available",message:"`wp.media` is not available, make sure the `media-models` handle is set in the dependencies array"}),a=window,u=()=>{if(!a.wp?.media)throw new i;return a.wp.media};function c(e){const{filesizeInBytes:t,filesizeHumanReadable:n,author:r,authorName:o,...i}=e;return{...i,filesize:{inBytes:t,humanReadable:n},author:{id:parseInt(r),name:o}}}function l(e){return(0,n.useQuery)({queryKey:["wp-attachment",e],queryFn:s,enabled:!!e})}async function s({queryKey:[,e]}){if(!e)return null;const t=u().attachment(e),n=t.toJSON();if("url"in n)return c(n);try{return c(await t.fetch())}catch{return null}}function d(e){const t=(0,o.useRef)();return(0,o.useEffect)((()=>()=>{f(t.current)}),[]),{open:(n={})=>{f(t.current),t.current=function({onSelect:e,multiple:t,types:n,selected:r,title:o,mode:i="browse"}){const a=u()({title:o,multiple:t,library:{type:n}}).on("open",(()=>{!function(e,t="browse"){e.content.mode(t)}(a,i),function(e,t){const n=("number"==typeof t?[t]:t)?.filter((e=>!!e)).map((e=>u().attachment(e)));e.state().get("selection").set(n||[])}(a,r)})).on("close",(()=>f(a))).on("insert select",(()=>function(e,t,n){const r=e.state().get("selection").toJSON().map(c);n(t?r:r[0])}(a,t,e)));return a}({...e,...n}),t.current?.open()}}}function f(e){e?.detach(),e?.remove()}(window.elementorV2=window.elementorV2||{}).wpMedia=t}();
Save Changes
Rename File
Rename