You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3 lines
18 KiB
JavaScript
3 lines
18 KiB
JavaScript
7 months ago
|
"use strict";(globalThis.webpackChunkweb_stories_wp=globalThis.webpackChunkweb_stories_wp||[]).push([[6736],{42607:(e,t,n)=>{n.r(t),n.d(t,{default:()=>Ae});var a=n(67294),r=(n(41792),n(69845)),i=n(72443),o=n(21530),l=n(12788),s=n(84967),c=n(36823),d=n(84705),u=n(55571),p=n(3961),m=n(46315),g=n(12161),h=n(59470),f=n(28395),y=n(80852),b=n(28154),w=n(4063),E=n(60641),_=n(36382),C=n(71028),x=n(6992),k=n(72165),v=n(25733),I=n(74515),T=n(69812),M=n(30540);const D=function DeleteDialog(e){let{mediaId:t,type:n,onClose:i}=e;const{actions:{deleteMedia:o}}=(0,v.useAPI)(),{showSnackbar:l}=(0,C.useSnackbar)(),{deleteMediaElement:s}=(0,I.useLocalMedia)((e=>{let{actions:{deleteMediaElement:t}}=e;return{deleteMediaElement:t}})),{deleteElementsByResourceId:d}=(0,T.useStory)((e=>({deleteElementsByResourceId:e.actions.deleteElementsByResourceId}))),u=(0,r.useCallback)((async()=>{i();try{await o(t),s({id:t}),d({id:t})}catch(e){(0,_.trackError)("local_media_deletion",e.message),l({message:(0,c.__)("Failed to delete media item.","web-stories"),dismissible:!0})}}),[o,s,d,t,i,l]),p=(0,c.__)("Delete Image?","web-stories"),m=(0,c.__)("Delete Video?","web-stories"),g=(0,c.__)("You are about to permanently delete this image from your site. The image will appear broken in any content that uses it.","web-stories"),h=(0,c.__)("You are about to permanently delete this video from your site. The video will appear broken in any content that uses it.","web-stories");return a.createElement(M.default,{isOpen:!0,onClose:i,title:"image"===n?p:m,secondaryText:(0,c.__)("Cancel","web-stories"),onPrimary:u,primaryText:(0,c.__)("Delete","web-stories"),maxWidth:512},a.createElement(x.Text.Paragraph,{size:k.TextSize.Small},"image"===n?g:h),a.createElement(x.Text.Paragraph,{size:k.TextSize.Small,isBold:!0},(0,c.__)("This action can not be undone.","web-stories")))};var S=n(36313),R=n(83057),P=n(10693),j=n(13070);const N=(0,l.css)(["display:flex;width:","px;margin-right:28px;"],152),O=l.default.img.withConfig({displayName:"mediaEditDialog__Image",componentId:"sc-ctku7j-0"})(["",""],N),B=l.default.video.withConfig({displayName:"mediaEditDialog__Video",componentId:"sc-ctku7j-1"})(["",""],N),z=l.default.div.withConfig({displayName:"mediaEditDialog__DialogBody",componentId:"sc-ctku7j-2"})(["display:flex;justify-content:left;align-items:flex-start;"]),L=l.default.div.withConfig({displayName:"mediaEditDialog__MetadataTextContainer",componentId:"sc-ctku7j-3"})(["display:flex;flex-direction:column;margin:0 4px;"]),$=(0,l.default)(x.Text.Span).withConfig({displayName:"mediaEditDialog__DateText",componentId:"sc-ctku7j-4"})(["margin-bottom:8px;"]),A=(0,l.default)(j.default).withConfig({displayName:"mediaEditDialog__AssistiveTextArea",componentId:"sc-ctku7j-5"})(["margin:20px 0 4px;"]),V=(0,c.__)("Edit Image","web-stories"),q=(0,c.__)("Edit Video","web-stories"),U=(0,c.__)("Assistive text","web-stories"),F=(0,c.__)("Video description","web-stories"),W=(0,c.__)("Describe the appearance and function of the image. Leave empty if the image is purely decorative.","web-stories"),G=(0,c.__)("For indexability and accessibility. Include any burned-in text inside the video.","web-stories");const X=function MediaEditDialog(e){let{resource:t,onClose:n}=e;const{id:i,src:o,creationDate:l,width:s,height:d,type:u,alt:p,poster:m,mimeType:g}=t,{actions:{updateMedia:h}}=(0,v.useAPI)(),{updateMediaElement:f}=(0,I.useLocalMedia)((e=>{let{actions:{updateMediaElement:t}}=e;return{updateMediaElement:t}})),{showSnackbar:y}=(0,C.useSnackbar)(),[b,w]=(0,r.useState)(p),E=(0,S.toDate)(l),T=(0,r.useCallback)((e=>{w(e.target.value)}),[]),D=(0,r.useCallback)((async()=>{try{await h(i,{altText:b}),f({id:i,data:{alt:b}}),n()}catch(e){(0,_.trackError)("local_media_edit",e.message),y({message:(0,c.__)("Failed to update, please try again.","web-stories"),dismissible:!0})}}),[b,i,n,y,h,f]),j="image"===u;return a.createElement(M.default,{isOpen:!0,onClose:n,title:j?V:q,secondaryText:(0,c.__)("Cancel","web-stories"),onPrimary:D,primaryText:(0,c.__)("Save","web-stories")},a.createElement(z,null,"image"===u?a.createElemen
|
||
|
(0,c.__)("Uploaded: %s","web-stories"),(0,S.formatDate)(l))),a.createElement(x.Text.Span,{size:k.TextSize.Small},(0,R.default)(/* translators: 1: image width. 2: image height. */
|
||
|
(0,c.__)("%1$d x %2$d pixels","web-stories"),s,d)),a.createElement(A,{value:b,"aria-label":j?U:F,type:"text",placeholder:j?U:F,onChange:T}),a.createElement(x.Text.Paragraph,{size:k.TextSize.Small},j?W:G))))},H=(0,l.default)(w.ActionButton).withConfig({displayName:"dropDownMenu__MoreButton",componentId:"sc-1eq0xdj-0"})(["top:4px;right:4px;"]),Y=l.default.div.withConfig({displayName:"dropDownMenu__DropDownContainer",componentId:"sc-1eq0xdj-1"})(["margin-top:10px;"]),K=l.default.div.withConfig({displayName:"dropDownMenu__MenuContainer",componentId:"sc-1eq0xdj-2"})(["z-index:1;"]),J=(0,l.css)(["min-width:160px;margin-top:0;li{display:block;}"]),Q="edit",Z="delete";const ee=function DropDownMenu(e){let{resource:t,display:n,isMenuOpen:i,onMenuOpen:o,onMenuCancelled:l,onMenuSelected:s,setParentActive:d=m.noop}=e;const u=[{options:[{label:(0,c.__)("Edit meta data","web-stories"),value:Q},{label:(0,c.__)("Delete from library","web-stories"),value:Z}]}],[w,_]=(0,r.useState)(!1),[C,x]=(0,r.useState)(!1),k=(0,r.useRef)(),v=(0,r.useCallback)((()=>{l(),k.current?.focus(),d()}),[l,d]),{canTranscodeResource:I}=(0,b.useLocalMedia)((e=>{let{state:{canTranscodeResource:t}}=e;return{canTranscodeResource:t}})),T=(0,r.useCallback)((()=>{_(!1),v()}),[_,v]),M=(0,r.useCallback)((()=>{x(!1),v()}),[x,v]),S=(0,r.useMemo)((()=>`list-${(0,p.default)()}`),[]),R=(0,r.useMemo)((()=>`button-${(0,p.default)()}`),[]);return I(t)&&a.createElement(K,null,k.current&&a.createElement(E.default,{target:k.current}),a.createElement(H,{ref:k,onClick:o,"aria-label":(0,c.__)("More","web-stories"),"aria-pressed":i,"aria-haspopup":!0,"aria-expanded":i,"aria-owns":i?S:null,id:R,$display:n,tabIndex:n||i?0:-1},a.createElement(g.default,null)),(n||i)&&a.createElement(h.default,{anchor:k,placement:f.Placement.BottomStart,isOpen:i},a.createElement(Y,null,a.createElement(y.default,{parentId:R,listId:S,handleMenuItemSelect:(e,t)=>{switch(s(),t){case Q:x(!0);break;case Z:_(!0)}},groups:u,onDismissMenu:v,hasMenuRole:!0,menuStylesOverride:J}))),w&&a.createElement(D,{mediaId:t.id,type:t.type,onClose:T}),C&&a.createElement(X,{resource:t,onClose:M}))};var te=n(37257),ne=n(91960);const ae=(0,l.default)(x.Text.Span).withConfig({displayName:"attribution__StyledText",componentId:"sc-dg18hp-0"})(["color:",";"],(e=>{let{theme:t,active:n}=e;return(0,s.rgba)(t.colors.standard.white,n?1:.6)})),re=l.default.a.withConfig({displayName:"attribution__Link",componentId:"sc-dg18hp-1"})(["display:block;position:absolute;left:0;bottom:0;width:100%;padding:8px;background-color:",";text-overflow:ellipsis;overflow:hidden;white-space:nowrap;text-decoration:none;"],(e=>{let{theme:t,active:n}=e;return(0,s.rgba)(t.colors.bg.primary,n?.8:.6)})),ie=e=>{let{author:t,url:n}=e;const[i,o]=(0,r.useState)(!1),l=()=>o(!0),s=()=>o(!1);return a.createElement(re,{title:t,active:i,onPointerEnter:l,onFocus:l,onPointerLeave:s,onBlur:s,href:n,target:"_blank",rel:"noreferrer"},a.createElement(ae,{size:k.TextSize.XSmall},t))};var oe=n(5101),le=n(65742),se=n(39604),ce=n(37945),de=n(17989);function ue(){return ue=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},ue.apply(this,arguments)}const pe=(0,l.css)(["width:100%;cursor:pointer;transition:0.2s transform,0.15s opacity;border-radius:4px;opacity:0;object-fit:cover;"]),me=l.default.img.withConfig({displayName:"innerElement__Image",componentId:"sc-qkk7ov-0"})(["",""],pe),ge=l.default.video.withConfig({displayName:"innerElement__Video",componentId:"sc-qkk7ov-1"})([""," ",""],pe,(e=>{let{showWithoutDelay:t}=e;return t?"opacity: 1;":""})),he=l.default.div.withConfig({displayName:"innerElement__DurationWrapper",componentId:"sc-qkk7ov-2"})(["position:absolute;bottom:8px;left:8px;background:",";border-radius:100px;height:18px;padding:0 6px;"],(e=>{let{theme:t}=e;return t.colors.opacity.black64})),fe=l.default.div.withConfig({displayName:"innerElement__MuteWrapper",componentId:"sc-qkk7ov-3"})(["position:absolute;bottom:8px;right:8px;height:24px;width:24
|