mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-16 07:35:39 +01:00
b667105f60
The following package versions were changed: @wordpress/a11y: 2.11.0 -> 2.13.0 @wordpress/annotations: 1.20.4 -> 1.22.0 @wordpress/api-fetch: 3.18.0 -> 3.20.0 @wordpress/autop: 2.9.0 -> 2.10.0 @wordpress/blob: 2.9.0 -> 2.10.0 @wordpress/block-directory: 1.13.7 -> 1.16.0 @wordpress/block-editor: 4.3.7 -> 5.0.0 @wordpress/block-library: 2.22.7 -> 2.25.0 @wordpress/block-serialization-default-parser: 3.7.0 -> 3.8.0 @wordpress/blocks: 6.20.3 -> 6.23.0 @wordpress/components: 10.0.6 -> 11.0.0 @wordpress/compose: 3.19.3 -> 3.21.0 @wordpress/core-data: 2.20.3 -> 2.23.0 @wordpress/data: 4.22.3 -> 4.24.0 @wordpress/data-controls: 1.16.3 -> 1.18.0 @wordpress/date: 3.10.0 -> 3.12.0 @wordpress/deprecated: 2.9.0 -> 2.10.0 @wordpress/dom: 2.13.1 -> 2.15.0 @wordpress/dom-ready: 2.10.0 -> 2.11.0 @wordpress/e2e-test-utils: 4.11.2 -> 4.14.0 @wordpress/edit-post: 3.21.7 -> 3.24.0 @wordpress/editor: 9.20.7 -> 9.23.0 @wordpress/element: 2.16.0 -> 2.18.0 @wordpress/escape-html: 1.9.0 -> 1.10.0 @wordpress/format-library: 1.22.7 -> 1.24.0 @wordpress/hooks: 2.9.0 -> 2.10.0 @wordpress/html-entities: 2.8.0 -> 2.9.0 @wordpress/i18n: 3.14.0 -> 3.16.0 @wordpress/icons: 2.4.0 -> 2.7.0 @wordpress/is-shallow-equal: 2.1.0 -> 2.3.0 @wordpress/keyboard-shortcuts: 1.9.3 -> 1.11.0 @wordpress/keycodes: 2.14.0 -> 2.16.0 @wordpress/library-export-default-webpack-plugin: 1.7.0 -> 1.9.0 @wordpress/list-reusable-blocks: 1.21.6 -> 1.23.0 @wordpress/media-utils: 1.15.0 -> 1.17.0 @wordpress/notices: 2.8.3 -> 2.10.0 @wordpress/nux: 3.20.6 -> 3.22.0 @wordpress/plugins: 2.20.3 -> 2.22.0 @wordpress/primitives: 1.7.0 -> 1.9.0 @wordpress/priority-queue: 1.7.0 -> 1.9.0 @wordpress/redux-routine: 3.10.0 -> 3.12.0 @wordpress/rich-text: 3.20.4 -> 3.22.0 @wordpress/scripts: 12.1.1 -> 12.3.0 @wordpress/server-side-render: 1.16.6 -> 1.18.0 @wordpress/shortcode: 2.9.0 -> 2.11.0 @wordpress/token-list: 1.11.0 -> 1.13.0 @wordpress/url: 2.17.0 -> 2.19.0 @wordpress/viewport: 2.21.3 -> 2.23.0 @wordpress/warning: 1.2.0 -> 1.3.0 @wordpress/wordcount: 2.10.0 -> 2.12.0 Props isabel_brison, youknowriad, mcsf. Fixes #51461. Built from https://develop.svn.wordpress.org/trunk@49135 git-svn-id: http://core.svn.wordpress.org/trunk@48897 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2 lines
16 KiB
JavaScript
2 lines
16 KiB
JavaScript
/*! This file is auto-generated */
|
|
this.wp=this.wp||{},this.wp.mediaUtils=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=475)}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},12:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(38);var i=n(30),o=n(39);function a(e,t){return Object(r.a)(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,i=!1,o=void 0;try{for(var a,c=e[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw o}}return n}}(e,t)||Object(i.a)(e,t)||Object(o.a)()}},15:function(e,t,n){"use strict";function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}n.d(t,"a",(function(){return r}))},17:function(e,t,n){"use strict";function r(e){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}n.d(t,"a",(function(){return r}))},18:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(27);var i=n(37),o=n(30);function a(e){return function(e){if(Array.isArray(e))return Object(r.a)(e)}(e)||Object(i.a)(e)||Object(o.a)(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}},2:function(e,t){!function(){e.exports=this.lodash}()},20:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}n.d(t,"a",(function(){return i}))},21:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}n.d(t,"a",(function(){return r}))},22:function(e,t,n){"use strict";function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}n.d(t,"a",(function(){return i}))},23:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(40),i=n(15);function o(e,t){return!t||"object"!==Object(r.a)(t)&&"function"!=typeof t?Object(i.a)(e):t}},24:function(e,t){!function(){e.exports=this.regeneratorRuntime}()},27:function(e,t,n){"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}n.d(t,"a",(function(){return r}))},30:function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(27);function i(e,t){if(e){if("string"==typeof e)return Object(r.a)(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Object(r.a)(e,t):void 0}}},37:function(e,t,n){"use strict";function r(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}n.d(t,"a",(function(){return r}))},38:function(e,t,n){"use strict";function r(e){if(Array.isArray(e))return e}n.d(t,"a",(function(){return r}))},39:function(e,t,n){"use strict";function r(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}n.d(t,"a",(function(){return r}))},40:function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}n.d(t,"a",(function(){return r}))},43:function(e,t){!function(){e.exports=this.wp.blob}()},45:function(e,t){!function(){e.exports=this.wp.apiFetch}()},47:function(e,t,n){"use strict";function r(e,t,n,r,i,o,a){try{var c=e[o](a),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,i)}function i(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function c(e){r(a,i,o,c,l,"next",e)}function l(e){r(a,i,o,c,l,"throw",e)}c(void 0)}))}}n.d(t,"a",(function(){return i}))},475:function(e,t,n){"use strict";n.r(t),n.d(t,"MediaUpload",(function(){return h})),n.d(t,"uploadMedia",(function(){return M}));var r=n(21),i=n(20),o=n(15),a=n(22),c=n(23),l=n(17),u=n(2),s=n(0),f=n(1);function p(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Object(l.a)(e);if(t){var i=Object(l.a)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Object(c.a)(this,n)}}var d=window.wp,m=[],b=function(e){return Object(u.pick)(e,["sizes","mime","type","subtype","id","url","alt","link","caption"])},y=function(e){return d.media.query({order:"ASC",orderby:"post__in",post__in:e,posts_per_page:-1,query:!0,type:"image"})},h=function(e){Object(a.a)(n,e);var t=p(n);function n(e){var i,a=e.allowedTypes,c=e.gallery,l=void 0!==c&&c,u=e.unstableFeaturedImageFlow,s=void 0!==u&&u,p=e.modalClass,m=e.multiple,b=void 0!==m&&m,y=e.title,h=void 0===y?Object(f.__)("Select or Upload Media"):y;if(Object(r.a)(this,n),(i=t.apply(this,arguments)).openModal=i.openModal.bind(Object(o.a)(i)),i.onOpen=i.onOpen.bind(Object(o.a)(i)),i.onSelect=i.onSelect.bind(Object(o.a)(i)),i.onUpdate=i.onUpdate.bind(Object(o.a)(i)),i.onClose=i.onClose.bind(Object(o.a)(i)),l)i.buildAndSetGalleryFrame();else{var v={title:h,multiple:b};a&&(v.library={type:a}),i.frame=d.media(v)}return p&&i.frame.$el.addClass(p),s&&i.buildAndSetFeatureImageFrame(),i.initializeListeners(),i}return Object(i.a)(n,[{key:"initializeListeners",value:function(){this.frame.on("select",this.onSelect),this.frame.on("update",this.onUpdate),this.frame.on("open",this.onOpen),this.frame.on("close",this.onClose)}},{key:"buildAndSetGalleryFrame",value:function(){var e=this.props,t=e.addToGallery,n=void 0!==t&&t,r=e.allowedTypes,i=e.multiple,o=void 0!==i&&i,a=e.value,c=void 0===a?m:a;if(c!==this.lastGalleryValue){var l;this.lastGalleryValue=c,this.frame&&this.frame.remove(),l=n?"gallery-library":c&&c.length?"gallery-edit":"gallery",this.GalleryDetailsMediaFrame||(this.GalleryDetailsMediaFrame=d.media.view.MediaFrame.Post.extend({galleryToolbar:function(){var e=this.state().get("editing");this.toolbar.set(new d.media.view.Toolbar({controller:this,items:{insert:{style:"primary",text:e?d.media.view.l10n.updateGallery:d.media.view.l10n.insertGallery,priority:80,requires:{library:!0},click:function(){var e=this.controller,t=e.state();e.close(),t.trigger("update",t.get("library")),e.setState(e.options.state),e.reset()}}}}))},editState:function(){var e=this.state("gallery").get("selection"),t=new d.media.view.EditImage({model:e.single(),controller:this}).render();this.content.set(t),t.loadEditor()},createStates:function(){this.on("toolbar:create:main-gallery",this.galleryToolbar,this),this.on("content:render:edit-image",this.editState,this),this.states.add([new d.media.controller.Library({id:"gallery",title:d.media.view.l10n.createGalleryTitle,priority:40,toolbar:"main-gallery",filterable:"uploaded",multiple:"add",editable:!1,library:d.media.query(Object(u.defaults)({type:"image"},this.options.library))}),new d.media.controller.EditImage({model:this.options.editImage}),new d.media.controller.GalleryEdit({library:this.options.selection,editing:this.options.editing,menu:"gallery",displaySettings:!1,multiple:!0}),new d.media.controller.GalleryAdd])}}));var s=y(c),f=new d.media.model.Selection(s.models,{props:s.props.toJSON(),multiple:o});this.frame=new this.GalleryDetailsMediaFrame({mimeType:r,state:l,multiple:o,selection:f,editing:!(!c||!c.length)}),d.media.frame=this.frame,this.initializeListeners()}}},{key:"buildAndSetFeatureImageFrame",value:function(){var e=d.media.view.MediaFrame.Select.extend({featuredImageToolbar:function(e){this.createSelectToolbar(e,{text:d.media.view.l10n.setFeaturedImage,state:this.options.state})},editState:function(){var e=this.state("featured-image").get("selection"),t=new d.media.view.EditImage({model:e.single(),controller:this}).render();this.content.set(t),t.loadEditor()},createStates:function(){this.on("toolbar:create:featured-image",this.featuredImageToolbar,this),this.on("content:render:edit-image",this.editState,this),this.states.add([new d.media.controller.FeaturedImage,new d.media.controller.EditImage({model:this.options.editImage})])}}),t=y(this.props.value),n=new d.media.model.Selection(t.models,{props:t.props.toJSON()});this.frame=new e({mimeType:this.props.allowedTypes,state:"featured-image",multiple:this.props.multiple,selection:n,editing:!!this.props.value}),d.media.frame=this.frame}},{key:"componentWillUnmount",value:function(){this.frame.remove()}},{key:"onUpdate",value:function(e){var t=this.props,n=t.onSelect,r=t.multiple,i=void 0!==r&&r,o=this.frame.state(),a=e||o.get("selection");a&&a.models.length&&n(i?a.models.map((function(e){return b(e.toJSON())})):b(a.models[0].toJSON()))}},{key:"onSelect",value:function(){var e=this.props,t=e.onSelect,n=e.multiple,r=void 0!==n&&n,i=this.frame.state().get("selection").toJSON();t(r?i:i[0])}},{key:"onOpen",value:function(){if(this.updateCollection(),this.props.value){if(!this.props.gallery){var e=this.frame.state().get("selection");Object(u.castArray)(this.props.value).forEach((function(t){e.add(d.media.attachment(t))}))}y(Object(u.castArray)(this.props.value)).more()}}},{key:"onClose",value:function(){var e=this.props.onClose;e&&e()}},{key:"updateCollection",value:function(){var e=this.frame.content.get();if(e&&e.collection){var t=e.collection;t.toArray().forEach((function(e){return e.trigger("destroy",e)})),t.mirroring._hasMore=!0,t.more()}}},{key:"openModal",value:function(){this.props.gallery&&this.buildAndSetGalleryFrame(),this.frame.open()}},{key:"render",value:function(){return this.props.render({open:this.openModal})}}]),n}(s.Component),v=n(24),O=n.n(v),g=n(5),j=n(47),w=n(18),S=n(12),_=n(45),x=n.n(_),E=n(43);function T(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function k(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?T(Object(n),!0).forEach((function(t){Object(g.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function A(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return P(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return P(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,c=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return a=e.done,e},e:function(e){c=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(c)throw o}}}}function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function I(e){return e?Object(u.flatMap)(e,(function(e,t){var n=e.split("/"),r=Object(S.a)(n,1)[0],i=t.split("|");return[e].concat(Object(w.a)(Object(u.map)(i,(function(e){return"".concat(r,"/").concat(e)}))))})):e}function M(e){return F.apply(this,arguments)}function F(){return(F=Object(j.a)(O.a.mark((function e(t){var n,r,i,o,a,c,l,p,d,m,b,y,h,v,g,j,S,_,x,T,P,M,F,G,U,D;return O.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.allowedTypes,r=t.additionalData,i=void 0===r?{}:r,o=t.filesList,a=t.maxUploadFileSize,c=t.onError,l=void 0===c?u.noop:c,p=t.onFileChange,d=t.wpAllowedMimeTypes,m=void 0===d?null:d,b=Object(w.a)(o),y=[],h=function(e,t){Object(E.revokeBlobURL)(Object(u.get)(y,[e,"url"])),y[e]=t,p(Object(u.compact)(y))},v=function(e){return!n||Object(u.some)(n,(function(t){return Object(u.includes)(t,"/")?t===e:Object(u.startsWith)(e,"".concat(t,"/"))}))},g=I(m),j=function(e){return Object(u.includes)(g,e)},S=function(e){e.message=[Object(s.createElement)("strong",{key:"filename"},e.file.name),": ",e.message],l(e)},_=[],x=A(b),e.prev=10,x.s();case 12:if((T=x.n()).done){e.next=31;break}if(P=T.value,!g||!P.type||j(P.type)){e.next=17;break}return S({code:"MIME_TYPE_NOT_ALLOWED_FOR_USER",message:Object(f.__)("Sorry, this file type is not permitted for security reasons."),file:P}),e.abrupt("continue",29);case 17:if(!P.type||v(P.type)){e.next=20;break}return S({code:"MIME_TYPE_NOT_SUPPORTED",message:Object(f.__)("Sorry, this file type is not supported here."),file:P}),e.abrupt("continue",29);case 20:if(!(a&&P.size>a)){e.next=23;break}return S({code:"SIZE_ABOVE_LIMIT",message:Object(f.__)("This file exceeds the maximum upload size for this site."),file:P}),e.abrupt("continue",29);case 23:if(!(P.size<=0)){e.next=26;break}return S({code:"EMPTY_FILE",message:Object(f.__)("This file is empty."),file:P}),e.abrupt("continue",29);case 26:_.push(P),y.push({url:Object(E.createBlobURL)(P)}),p(y);case 29:e.next=12;break;case 31:e.next=36;break;case 33:e.prev=33,e.t0=e.catch(10),x.e(e.t0);case 36:return e.prev=36,x.f(),e.finish(36);case 39:M=0;case 40:if(!(M<_.length)){e.next=59;break}return F=_[M],e.prev=42,e.next=45,C(F,i);case 45:G=e.sent,U=k(k({},Object(u.omit)(G,["alt_text","source_url"])),{},{alt:G.alt_text,caption:Object(u.get)(G,["caption","raw"],""),title:G.title.raw,url:G.source_url}),h(M,U),e.next=56;break;case 50:e.prev=50,e.t1=e.catch(42),h(M,null),D=void 0,D=Object(u.has)(e.t1,["message"])?Object(u.get)(e.t1,["message"]):Object(f.sprintf)(Object(f.__)("Error while uploading file %s to the media library."),F.name),l({code:"GENERAL",message:D,file:F});case 56:++M,e.next=40;break;case 59:case"end":return e.stop()}}),e,null,[[10,33,36,39],[42,50]])})))).apply(this,arguments)}function C(e,t){var n=new window.FormData;return n.append("file",e,e.name||e.type.replace("/",".")),Object(u.forEach)(t,(function(e,t){return n.append(t,e)})),x()({path:"/wp/v2/media",body:n,method:"POST"})}},5:function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.d(t,"a",(function(){return r}))}}); |