mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-07 19:31:54 +01:00
6aead54d17
Included cherry-picked commits from the Gutenberg plugin that fix bugs discovered after WordPress 6.0 Beta 1. Props zieladam, ndiego. See #55567. Built from https://develop.svn.wordpress.org/trunk@53219 git-svn-id: http://core.svn.wordpress.org/trunk@52808 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2 lines
20 KiB
JavaScript
2 lines
20 KiB
JavaScript
/*! This file is auto-generated */
|
||
!function(){"use strict";var e={n:function(t){var l=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(l,{a:l}),l},d:function(t,l){for(var n in l)e.o(l,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:l[n]})},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,{store:function(){return $}});var l={};e.r(l),e.d(l,{getDownloadableBlocks:function(){return _},getErrorNoticeForBlock:function(){return h},getErrorNotices:function(){return y},getInstalledBlockTypes:function(){return g},getNewBlockTypes:function(){return w},getUnusedBlockTypes:function(){return E},isInstalling:function(){return f},isRequestingDownloadableBlocks:function(){return b}});var n={};e.r(n),e.d(n,{addInstalledBlockType:function(){return R},clearErrorNotice:function(){return F},fetchDownloadableBlocks:function(){return C},installBlockType:function(){return D},receiveDownloadableBlocks:function(){return O},removeInstalledBlockType:function(){return A},setErrorNotice:function(){return x},setIsInstalling:function(){return M},uninstallBlockType:function(){return P}});var o={};e.r(o),e.d(o,{getDownloadableBlocks:function(){return V}});var r=window.wp.element,a=window.wp.plugins,i=window.wp.hooks,s=window.wp.blocks,c=window.wp.data,d=window.wp.editor,u=window.lodash;var m=(0,c.combineReducers)({downloadableBlocks:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"FETCH_DOWNLOADABLE_BLOCKS":return{...e,[t.filterValue]:{isRequesting:!0}};case"RECEIVE_DOWNLOADABLE_BLOCKS":return{...e,[t.filterValue]:{results:t.downloadableBlocks,isRequesting:!1}}}return e},blockManagement:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{installedBlockTypes:[],isInstalling:{}},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"ADD_INSTALLED_BLOCK_TYPE":return{...e,installedBlockTypes:[...e.installedBlockTypes,t.item]};case"REMOVE_INSTALLED_BLOCK_TYPE":return{...e,installedBlockTypes:e.installedBlockTypes.filter((e=>e.name!==t.item.name))};case"SET_INSTALLING_BLOCK":return{...e,isInstalling:{...e.isInstalling,[t.blockId]:t.isInstalling}}}return e},errorNotices:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_ERROR_NOTICE":return{...e,[t.blockId]:{message:t.message,isFatal:t.isFatal}};case"CLEAR_ERROR_NOTICE":return(0,u.omit)(e,t.blockId)}return e}}),p=window.wp.blockEditor;function k(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!t.length)return!1;if(t.some((t=>{let{name:l}=t;return l===e.name})))return!0;for(let l=0;l<t.length;l++)if(k(e,t[l].innerBlocks))return!0;return!1}function b(e,t){var l,n;return null!==(l=null===(n=e.downloadableBlocks[t])||void 0===n?void 0:n.isRequesting)&&void 0!==l&&l}function _(e,t){var l,n;return null!==(l=null===(n=e.downloadableBlocks[t])||void 0===n?void 0:n.results)&&void 0!==l?l:[]}function g(e){return e.blockManagement.installedBlockTypes}const w=(0,c.createRegistrySelector)((e=>t=>{const l=e(p.store).getBlocks();return g(t).filter((e=>k(e,l)))})),E=(0,c.createRegistrySelector)((e=>t=>{const l=e(p.store).getBlocks();return g(t).filter((e=>!k(e,l)))}));function f(e,t){return e.blockManagement.isInstalling[t]||!1}function y(e){return e.errorNotices}function h(e,t){return e.errorNotices[t]}var v=window.wp.i18n,B=window.wp.apiFetch,N=e.n(B),I=window.wp.notices,T=window.wp.url;const L=e=>new Promise(((t,l)=>{const n=document.createElement(e.nodeName);["id","rel","src","href","type"].forEach((t=>{e[t]&&(n[t]=e[t])})),e.innerHTML&&n.appendChild(document.createTextNode(e.innerHTML)),n.onload=()=>t(!0),n.onerror=()=>l(new Error("Error loading asset.")),document.body.appendChild(n),("link"===n.nodeName.toLowerCase()||"script"===n.nodeName.toLowerCase()&&!n.src)&&t()}));function S(e){if(!e)return!1;const t=e.links["wp:plugin"]||e.links.self;return!(!t||!t.length)&&t[0].href}function C(e){return{type:"FETCH_DOWNLOADABLE_BLOCKS",filterValue:e}}function O(e,t){return{type:"RECEIVE_DOWNLOADABLE_BLOCKS",downloadableBlocks:e,filterValue:t}}const D=e=>async t=>{let{registry:l,dispatch:n}=t;const{id:o,name:r}=e;let a=!1;n.clearErrorNotice(o);try{n.setIsInstalling(o,!0);const t=S(e);let i={};if(t)await N()({method:"PUT",url:t,data:{status:"active"}});else{i=(await N()({method:"POST",path:"wp/v2/plugins",data:{slug:o,status:"active"}}))._links}n.addInstalledBlockType({...e,links:{...e.links,...i}});const c=["api_version","title","category","parent","icon","description","keywords","attributes","provides_context","uses_context","supports","styles","example","variations"];await N()({path:(0,T.addQueryArgs)(`/wp/v2/block-types/${r}`,{_fields:c})}).catch((()=>{})).then((e=>{e&&(0,s.unstable__bootstrapServerSideBlockDefinitions)({[r]:(0,u.pick)(e,c)})})),await async function(){const e=await N()({url:document.location.href,parse:!1}),t=await e.text(),l=(new window.DOMParser).parseFromString(t,"text/html"),n=Array.from(l.querySelectorAll('link[rel="stylesheet"],script')).filter((e=>e.id&&!document.getElementById(e.id)));for(const e of n)await L(e)}();if(!l.select(s.store).getBlockTypes().some((e=>e.name===r)))throw new Error((0,v.__)("Error registering block. Try reloading the page."));l.dispatch(I.store).createInfoNotice((0,v.sprintf)((0,v.__)("Block %s installed and added."),e.title),{speak:!0,type:"snackbar"}),a=!0}catch(e){let t=e.message||(0,v.__)("An error occurred."),r=e instanceof Error;const a={folder_exists:(0,v.__)("This block is already installed. Try reloading the page."),unable_to_connect_to_filesystem:(0,v.__)("Error installing block. You can reload the page and try again.")};a[e.code]&&(r=!0,t=a[e.code]),n.setErrorNotice(o,t,r),l.dispatch(I.store).createErrorNotice(t,{speak:!0,isDismissible:!0})}return n.setIsInstalling(o,!1),a},P=e=>async t=>{let{registry:l,dispatch:n}=t;try{const t=S(e);await N()({method:"PUT",url:t,data:{status:"inactive"}}),await N()({method:"DELETE",url:t}),n.removeInstalledBlockType(e)}catch(e){l.dispatch(I.store).createErrorNotice(e.message||(0,v.__)("An error occurred."))}};function R(e){return{type:"ADD_INSTALLED_BLOCK_TYPE",item:e}}function A(e){return{type:"REMOVE_INSTALLED_BLOCK_TYPE",item:e}}function M(e,t){return{type:"SET_INSTALLING_BLOCK",blockId:e,isInstalling:t}}function x(e,t){let l=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return{type:"SET_ERROR_NOTICE",blockId:e,message:t,isFatal:l}}function F(e){return{type:"CLEAR_ERROR_NOTICE",blockId:e}}const V=e=>async t=>{let{dispatch:l}=t;if(e)try{l(C(e));const t=await N()({path:`wp/v2/block-directory/search?term=${e}`});l(O(t.map((e=>(0,u.mapKeys)(e,((e,t)=>(0,u.camelCase)(t))))),e))}catch{}},H={reducer:m,selectors:l,actions:n,resolvers:o},$=(0,c.createReduxStore)("core/block-directory",H);function K(){const{uninstallBlockType:e}=(0,c.useDispatch)($),t=(0,c.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:l}=e(d.store);return l()&&!t()}),[]),l=(0,c.useSelect)((e=>e($).getUnusedBlockTypes()),[]);return(0,r.useEffect)((()=>{t&&l.length&&l.forEach((t=>{e(t),(0,s.unregisterBlockType)(t.name)}))}),[t]),null}(0,c.register)($);var z=window.wp.components,Y=window.wp.compose,j=window.wp.coreData;function q(){return q=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e},q.apply(this,arguments)}var U=window.wp.htmlEntities;var G=function(e){let{icon:t,size:l=24,...n}=e;return(0,r.cloneElement)(t,{width:l,height:l,...n})},W=window.wp.primitives;var Q=(0,r.createElement)(W.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(W.Path,{d:"M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"}));var J=(0,r.createElement)(W.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(W.Path,{d:"M9.518 8.783a.25.25 0 00.188-.137l2.069-4.192a.25.25 0 01.448 0l2.07 4.192a.25.25 0 00.187.137l4.626.672a.25.25 0 01.139.427l-3.347 3.262a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.363.264l-4.137-2.176a.25.25 0 00-.233 0l-4.138 2.175a.25.25 0 01-.362-.263l.79-4.607a.25.25 0 00-.072-.222L4.753 9.882a.25.25 0 01.14-.427l4.625-.672zM12 14.533c.28 0 .559.067.814.2l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39v7.143z"}));var X=(0,r.createElement)(W.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(W.Path,{fillRule:"evenodd",d:"M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",clipRule:"evenodd"}));var Z=function(e){let{rating:t}=e;const l=.5*Math.round(t/.5),n=Math.floor(t),o=Math.ceil(t-n),a=5-(n+o);return(0,r.createElement)("span",{"aria-label":(0,v.sprintf)((0,v.__)("%s out of 5 stars"),l)},(0,u.times)(n,(e=>(0,r.createElement)(G,{key:`full_stars_${e}`,className:"block-directory-block-ratings__star-full",icon:Q,size:16}))),(0,u.times)(o,(e=>(0,r.createElement)(G,{key:`half_stars_${e}`,className:"block-directory-block-ratings__star-half-full",icon:J,size:16}))),(0,u.times)(a,(e=>(0,r.createElement)(G,{key:`empty_stars_${e}`,className:"block-directory-block-ratings__star-empty",icon:X,size:16}))))};var ee=e=>{let{rating:t}=e;return(0,r.createElement)("span",{className:"block-directory-block-ratings"},(0,r.createElement)(Z,{rating:t}))};var te=function(e){let{icon:t}=e;const l="block-directory-downloadable-block-icon";return null!==t.match(/\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/)?(0,r.createElement)("img",{className:l,src:t,alt:""}):(0,r.createElement)(p.BlockIcon,{className:l,icon:t,showColors:!0})};var le=e=>{let{block:t}=e;const l=(0,c.useSelect)((e=>e($).getErrorNoticeForBlock(t.id)),[t]);return l?(0,r.createElement)("div",{className:"block-directory-downloadable-block-notice"},(0,r.createElement)("div",{className:"block-directory-downloadable-block-notice__content"},l.message,l.isFatal?" "+(0,v.__)("Try reloading the page."):null)):null};function ne(e,t){let{title:l,rating:n,ratingCount:o}=e,{hasNotice:r,isInstalled:a,isInstalling:i}=t;const s=.5*Math.round(n/.5);return!a&&r?(0,v.sprintf)("Retry installing %s.",(0,U.decodeEntities)(l)):a?(0,v.sprintf)("Add %s.",(0,U.decodeEntities)(l)):i?(0,v.sprintf)("Installing %s.",(0,U.decodeEntities)(l)):o<1?(0,v.sprintf)("Install %s.",(0,U.decodeEntities)(l)):(0,v.sprintf)((0,v._n)("Install %1$s. %2$s stars with %3$s review.","Install %1$s. %2$s stars with %3$s reviews.",o),(0,U.decodeEntities)(l),s,o)}var oe=function(e){let{composite:t,item:l,onClick:n}=e;const{author:o,description:a,icon:i,rating:d,title:u}=l,m=!!(0,s.getBlockType)(l.name),{hasNotice:p,isInstalling:k,isInstallable:b}=(0,c.useSelect)((e=>{const{getErrorNoticeForBlock:t,isInstalling:n}=e($),o=t(l.id),r=o&&o.isFatal;return{hasNotice:!!o,isInstalling:n(l.id),isInstallable:!r}}),[l]);let _="";return m?_=(0,v.__)("Installed!"):k&&(_=(0,v.__)("Installing…")),(0,r.createElement)(z.__unstableCompositeItem,q({__experimentalIsFocusable:!0,role:"option",as:z.Button},t,{className:"block-directory-downloadable-block-list-item",onClick:e=>{e.preventDefault(),n()},isBusy:k,disabled:k||!b,label:ne(l,{hasNotice:p,isInstalled:m,isInstalling:k}),showTooltip:!0,tooltipPosition:"top center"}),(0,r.createElement)("div",{className:"block-directory-downloadable-block-list-item__icon"},(0,r.createElement)(te,{icon:i,title:u}),k?(0,r.createElement)("span",{className:"block-directory-downloadable-block-list-item__spinner"},(0,r.createElement)(z.Spinner,null)):(0,r.createElement)(ee,{rating:d})),(0,r.createElement)("span",{className:"block-directory-downloadable-block-list-item__details"},(0,r.createElement)("span",{className:"block-directory-downloadable-block-list-item__title"},(0,r.createInterpolateElement)((0,v.sprintf)((0,v.__)("%1$s <span>by %2$s</span>"),(0,U.decodeEntities)(u),o),{span:(0,r.createElement)("span",{className:"block-directory-downloadable-block-list-item__author"})})),p?(0,r.createElement)(le,{block:l}):(0,r.createElement)(r.Fragment,null,(0,r.createElement)("span",{className:"block-directory-downloadable-block-list-item__desc"},_||(0,U.decodeEntities)(a)),b&&!(m||k)&&(0,r.createElement)(z.VisuallyHidden,null,(0,v.__)("Install block")))))};var re=function(e){let{items:t,onHover:l=u.noop,onSelect:n}=e;const o=(0,z.__unstableUseCompositeState)(),{installBlockType:a}=(0,c.useDispatch)($);return t.length?(0,r.createElement)(z.__unstableComposite,q({},o,{role:"listbox",className:"block-directory-downloadable-blocks-list","aria-label":(0,v.__)("Blocks available for install")}),t.map((e=>(0,r.createElement)(oe,{key:e.id,composite:o,onClick:()=>{(0,s.getBlockType)(e.name)?n(e):a(e).then((t=>{t&&n(e)})),l(null)},onHover:l,item:e})))):null},ae=window.wp.a11y;var ie=function(e){let{children:t,downloadableItems:l,hasLocalBlocks:n}=e;const o=l.length;return(0,r.useEffect)((()=>{(0,ae.speak)((0,v.sprintf)((0,v._n)("%d additional block is available to install.","%d additional blocks are available to install.",o),o))}),[o]),(0,r.createElement)(r.Fragment,null,!n&&(0,r.createElement)("p",{className:"block-directory-downloadable-blocks-panel__no-local"},(0,v.__)("No results available from your installed blocks.")),(0,r.createElement)("div",{className:"block-editor-inserter__quick-inserter-separator"}),(0,r.createElement)("div",{className:"block-directory-downloadable-blocks-panel"},(0,r.createElement)("div",{className:"block-directory-downloadable-blocks-panel__header"},(0,r.createElement)("h2",{className:"block-directory-downloadable-blocks-panel__title"},(0,v.__)("Available to install")),(0,r.createElement)("p",{className:"block-directory-downloadable-blocks-panel__description"},(0,v.__)("Select a block to install and add it to your post."))),t))};var se=(0,r.createElement)(W.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(W.Path,{d:"M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z"}));var ce=function(){return(0,r.createElement)("div",{className:"block-editor-inserter__no-results"},(0,r.createElement)(G,{className:"block-editor-inserter__no-results-icon",icon:se}),(0,r.createElement)("p",null,(0,v.__)("No results found.")))};var de=(0,Y.compose)([(0,c.withSelect)(((e,t)=>{let{filterValue:l,rootClientId:n=null}=t;const{getDownloadableBlocks:o,isRequestingDownloadableBlocks:r}=e($),{canInsertBlockType:a}=e(p.store),i=e(j.store).canUser("read","block-directory/search");return{downloadableItems:i?o(l).filter((e=>a(e,n,!0))):[],hasPermission:i,isLoading:r(l)}}))])((function(e){let{downloadableItems:t,onSelect:l,onHover:n,hasLocalBlocks:o,hasPermission:a,isLoading:i,isTyping:s}=e;return void 0===a||i||s?(0,r.createElement)(r.Fragment,null,a&&!o&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("p",{className:"block-directory-downloadable-blocks-panel__no-local"},(0,v.__)("No results available from your installed blocks.")),(0,r.createElement)("div",{className:"block-editor-inserter__quick-inserter-separator"})),(0,r.createElement)("div",{className:"block-directory-downloadable-blocks-panel has-blocks-loading"},(0,r.createElement)(z.Spinner,null))):!1===a?o?null:(0,r.createElement)(ce,null):t.length?(0,r.createElement)(ie,{downloadableItems:t,hasLocalBlocks:o},(0,r.createElement)(re,{items:t,onSelect:l,onHover:n})):!o&&(0,r.createElement)(ce,null)}));var ue=function(){const[e,t]=(0,r.useState)(""),l=(0,u.debounce)(t,400);return(0,r.createElement)(p.__unstableInserterMenuExtension,null,(t=>{let{onSelect:n,onHover:o,filterValue:a,hasItems:i,rootClientId:s}=t;return e!==a&&l(a),e?(0,r.createElement)(de,{onSelect:n,onHover:o,rootClientId:s,filterValue:e,hasLocalBlocks:i,isTyping:a!==e}):null}))},me=window.wp.editPost;function pe(e){let{items:t}=e;return t.length?(0,r.createElement)("ul",{className:"block-directory-compact-list"},t.map((e=>{let{icon:t,id:l,title:n,author:o}=e;return(0,r.createElement)("li",{key:l,className:"block-directory-compact-list__item"},(0,r.createElement)(te,{icon:t,title:n}),(0,r.createElement)("div",{className:"block-directory-compact-list__item-details"},(0,r.createElement)("div",{className:"block-directory-compact-list__item-title"},n),(0,r.createElement)("div",{className:"block-directory-compact-list__item-author"},(0,v.sprintf)((0,v.__)("By %s"),o))))}))):null}function ke(){const e=(0,c.useSelect)((e=>e($).getNewBlockTypes()),[]);return e.length?(0,r.createElement)(me.PluginPrePublishPanel,{icon:se,title:(0,v.sprintf)((0,v._n)("Added: %d block","Added: %d blocks",e.length),e.length),initialOpen:!0},(0,r.createElement)("p",{className:"installed-blocks-pre-publish-panel__copy"},(0,v._n)("The following block has been added to your site.","The following blocks have been added to your site.",e.length)),(0,r.createElement)(pe,{items:e})):null}function be(e){let{attributes:t,block:l,clientId:n}=e;const o=(0,c.useSelect)((e=>e($).isInstalling(l.id)),[l.id]),{installBlockType:a}=(0,c.useDispatch)($),{replaceBlock:i}=(0,c.useDispatch)(p.store);return(0,r.createElement)(z.Button,{onClick:()=>a(l).then((e=>{if(e){const e=(0,s.getBlockType)(l.name),[o]=(0,s.parse)(t.originalContent);o&&e&&i(n,(0,s.createBlock)(e.name,o.attributes,o.innerBlocks))}})),disabled:o,isBusy:o,variant:"primary"},(0,v.sprintf)((0,v.__)("Install %s"),l.title))}const _e=e=>{let{originalBlock:t,...l}=e;const{originalName:n,originalUndelimitedContent:o}=l.attributes,{replaceBlock:a}=(0,c.useDispatch)(p.store),i=()=>{a(l.clientId,(0,s.createBlock)("core/html",{content:o}))},d=!!o,u=(0,s.getBlockType)("core/html");let m=(0,v.sprintf)((0,v.__)("Your site doesn’t include support for the %s block. You can try installing the block or remove it entirely."),t.title||n);const k=[(0,r.createElement)(be,{key:"install",block:t,attributes:l.attributes,clientId:l.clientId})];return d&&u&&(m=(0,v.sprintf)((0,v.__)("Your site doesn’t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely."),t.title||n),k.push((0,r.createElement)(z.Button,{key:"convert",onClick:i,variant:"link"},(0,v.__)("Keep as HTML")))),(0,r.createElement)("div",(0,p.useBlockProps)(),(0,r.createElement)(p.Warning,{actions:k},m),(0,r.createElement)(r.RawHTML,null,o))};var ge=e=>t=>{const{originalName:l}=t.attributes,{block:n,hasPermission:o}=(0,c.useSelect)((e=>{const{getDownloadableBlocks:t}=e($),n=t("block:"+l).filter((e=>{let{name:t}=e;return l===t}));return{hasPermission:e(j.store).canUser("read","block-directory/search"),block:n.length&&n[0]}}),[l]);return o&&n?(0,r.createElement)(_e,q({},t,{originalBlock:n})):(0,r.createElement)(e,t)};(0,a.registerPlugin)("block-directory",{render:()=>(0,r.createElement)(r.Fragment,null,(0,r.createElement)(K,null),(0,r.createElement)(ue,null),(0,r.createElement)(ke,null))}),(0,i.addFilter)("blocks.registerBlockType","block-directory/fallback",((e,t)=>("core/missing"!==t||(e.edit=ge(e.edit)),e))),(window.wp=window.wp||{}).blockDirectory=t}(); |