mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-14 22:56:19 +01:00
1fbf5fa51d
Updates the editor npm packages to latest versions. See https://github.com/WordPress/wordpress-develop/pull/6612. Props ellatrix, mukesh27, youknowriad, mamaduka. Built from https://develop.svn.wordpress.org/trunk@58187 git-svn-id: http://core.svn.wordpress.org/trunk@57650 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2 lines
47 KiB
JavaScript
2 lines
47 KiB
JavaScript
/*! This file is auto-generated */
|
||
(()=>{"use strict";var e={n:t=>{var o=t&&t.__esModule?()=>t.default:()=>t;return e.d(o,{a:o}),o},d:(t,o)=>{for(var s in o)e.o(o,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:o[s]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r: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,{PluginBlockSettingsMenuItem:()=>co,PluginDocumentSettingPanel:()=>uo,PluginMoreMenuItem:()=>po,PluginPostPublishPanel:()=>go,PluginPostStatusInfo:()=>ho,PluginPrePublishPanel:()=>mo,PluginSidebar:()=>Eo,PluginSidebarMoreMenuItem:()=>bo,__experimentalFullscreenModeClose:()=>rt,__experimentalMainDashboardButton:()=>kt,__experimentalPluginPostExcerpt:()=>wo,initializeEditor:()=>yo,reinitializeEditor:()=>vo,store:()=>Qe});var o={};e.r(o),e.d(o,{__experimentalSetPreviewDeviceType:()=>le,__unstableCreateTemplate:()=>pe,closeGeneralSidebar:()=>z,closeModal:()=>q,closePublishSidebar:()=>Q,hideBlockTypes:()=>se,initializeMetaBoxes:()=>ge,metaBoxUpdatesFailure:()=>ae,metaBoxUpdatesSuccess:()=>ne,openGeneralSidebar:()=>H,openModal:()=>W,openPublishSidebar:()=>$,removeEditorPanel:()=>Y,requestMetaBoxUpdates:()=>re,setAvailableMetaBoxesPerLocation:()=>ie,setIsEditingTemplate:()=>ue,setIsInserterOpened:()=>ce,setIsListViewOpened:()=>de,showBlockTypes:()=>oe,switchEditorMode:()=>J,toggleDistractionFree:()=>he,toggleEditorPanelEnabled:()=>j,toggleEditorPanelOpened:()=>Z,toggleFeature:()=>K,togglePinnedPluginItem:()=>ee,togglePublishSidebar:()=>X,updatePreferredStyleVariations:()=>te});var s={};e.r(s),e.d(s,{__experimentalGetInsertionPoint:()=>He,__experimentalGetPreviewDeviceType:()=>Ge,areMetaBoxesInitialized:()=>qe,getActiveGeneralSidebarName:()=>fe,getActiveMetaBoxLocations:()=>Re,getAllMetaBoxes:()=>Le,getEditedPostTemplate:()=>$e,getEditorMode:()=>ye,getHiddenBlockTypes:()=>ke,getMetaBoxesPerLocation:()=>Fe,getPreference:()=>Pe,getPreferences:()=>Se,hasMetaBoxes:()=>Ne,isEditingTemplate:()=>We,isEditorPanelEnabled:()=>Te,isEditorPanelOpened:()=>xe,isEditorPanelRemoved:()=>Be,isEditorSidebarOpened:()=>ve,isFeatureActive:()=>Ae,isInserterOpened:()=>Ue,isListViewOpened:()=>ze,isMetaBoxLocationActive:()=>De,isMetaBoxLocationVisible:()=>Oe,isModalActive:()=>Ie,isPluginItemPinned:()=>Ce,isPluginSidebarOpened:()=>_e,isPublishSidebarOpened:()=>Me,isSavingMetaBoxes:()=>Ve});const i=window.React,r=window.wp.blocks,n=window.wp.blockLibrary,a=window.wp.deprecated;var l=e.n(a);const c=window.wp.element,d=window.wp.data,u=window.wp.preferences,p=window.wp.widgets,m=window.wp.editor,g=window.wp.hooks,h=window.wp.mediaUtils;(0,g.addFilter)("editor.MediaUpload","core/edit-post/replace-media-upload",(()=>h.MediaUpload));const E=window.wp.components,b=window.wp.blockEditor,w=window.wp.i18n,y=window.wp.compose;function v(e,t){if(Array.isArray(e)&&e.length)for(const o of e){if(o.name===t)return o;const e=v(o.innerBlocks,t);if(e)return e}}const _=(0,y.compose)((0,d.withSelect)(((e,t)=>{if((0,r.hasBlockSupport)(t.name,"multiple",!0))return{};const o=v(e(b.store).getBlocks(),t.name);return{originalBlockClientId:o&&o.clientId!==t.clientId&&o.clientId}})),(0,d.withDispatch)(((e,{originalBlockClientId:t})=>({selectFirst:()=>e(b.store).selectBlock(t)})))),f=(0,y.createHigherOrderComponent)((e=>_((({originalBlockClientId:t,selectFirst:o,...s})=>{if(!t)return(0,i.createElement)(e,{...s});const n=(0,r.getBlockType)(s.name),a=function(e){const t=(0,r.findTransform)((0,r.getBlockTransforms)("to",e),(({type:e,blocks:t})=>"block"===e&&1===t.length));if(!t)return null;return(0,r.getBlockType)(t.blocks[0])}(s.name);return[(0,i.createElement)("div",{key:"invalid-preview",style:{minHeight:"60px"}},(0,i.createElement)(e,{key:"block-edit",...s})),(0,i.createElement)(b.Warning,{key:"multiple-use-warning",actions:[(0,i.createElement)(E.Button,{key:"find-original",variant:"secondary",onClick:o},(0,w.__)("Find original")),(0,i.createElement)(E.Button,{key:"remove",variant:"secondary",onClick:()=>s.onReplace([])},(0,w.__)("Remove")),a&&(0,i.createElement)(E.Button,{key:"transform",variant:"secondary",onClick:()=>s.onReplace((0,r.createBlock)(a.name,s.attributes))},(0,w.__)("Transform into:")," ",a.title)]},(0,i.createElement)("strong",null,n?.title,": "),(0,w.__)("This block can only be used once."))]}))),"withMultipleValidation");(0,g.addFilter)("editor.BlockEdit","core/edit-post/validate-multiple-use/with-multiple-validation",f);const S=window.wp.coreData,P=window.wp.commands;function k(e){var t,o,s="";if("string"==typeof e||"number"==typeof e)s+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(o=k(e[t]))&&(s&&(s+=" "),s+=o)}else for(o in e)e[o]&&(s&&(s+=" "),s+=o);return s}const M=function(){for(var e,t,o=0,s="",i=arguments.length;o<i;o++)(e=arguments[o])&&(t=k(e))&&(s&&(s+=" "),s+=t);return s},B=window.wp.plugins,T=window.wp.keyboardShortcuts,x=window.wp.notices,I=window.wp.coreCommands,A=window.wp.url,C=window.wp.keycodes;function R(e=[],t){const o=[...e];for(const e of t){const t=o.findIndex((t=>t.id===e.id));-1!==t?o[t]=e:o.push(e)}return o}const O=(0,d.combineReducers)({isSaving:function(e=!1,t){switch(t.type){case"REQUEST_META_BOX_UPDATES":return!0;case"META_BOX_UPDATES_SUCCESS":case"META_BOX_UPDATES_FAILURE":return!1;default:return e}},locations:function(e={},t){if("SET_META_BOXES_PER_LOCATIONS"===t.type){const o={...e};for(const[e,s]of Object.entries(t.metaBoxesPerLocation))o[e]=R(o[e],s);return o}return e},initialized:function(e=!1,t){return"META_BOXES_INITIALIZED"===t.type||e}}),D=(0,d.combineReducers)({metaBoxes:O}),F=window.wp.apiFetch;var L=e.n(F);const N=window.wp.privateApis,{lock:V,unlock:G}=(0,N.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.","@wordpress/edit-post"),{interfaceStore:U}=G(m.privateApis),H=e=>({registry:t})=>{t.dispatch(U).enableComplementaryArea("core",e)},z=()=>({registry:e})=>e.dispatch(U).disableComplementaryArea("core"),W=e=>({registry:t})=>(l()("select( 'core/edit-post' ).openModal( name )",{since:"6.3",alternative:"select( 'core/interface').openModal( name )"}),t.dispatch(U).openModal(e)),q=()=>({registry:e})=>(l()("select( 'core/edit-post' ).closeModal()",{since:"6.3",alternative:"select( 'core/interface').closeModal()"}),e.dispatch(U).closeModal()),$=()=>({registry:e})=>{l()("dispatch( 'core/edit-post' ).openPublishSidebar",{since:"6.6",alternative:"dispatch( 'core/editor').openPublishSidebar"}),e.dispatch(m.store).openPublishSidebar()},Q=()=>({registry:e})=>{l()("dispatch( 'core/edit-post' ).closePublishSidebar",{since:"6.6",alternative:"dispatch( 'core/editor').closePublishSidebar"}),e.dispatch(m.store).closePublishSidebar()},X=()=>({registry:e})=>{l()("dispatch( 'core/edit-post' ).togglePublishSidebar",{since:"6.6",alternative:"dispatch( 'core/editor').togglePublishSidebar"}),e.dispatch(m.store).togglePublishSidebar()},j=e=>({registry:t})=>{l()("dispatch( 'core/edit-post' ).toggleEditorPanelEnabled",{since:"6.5",alternative:"dispatch( 'core/editor').toggleEditorPanelEnabled"}),t.dispatch(m.store).toggleEditorPanelEnabled(e)},Z=e=>({registry:t})=>{l()("dispatch( 'core/edit-post' ).toggleEditorPanelOpened",{since:"6.5",alternative:"dispatch( 'core/editor').toggleEditorPanelOpened"}),t.dispatch(m.store).toggleEditorPanelOpened(e)},Y=e=>({registry:t})=>{l()("dispatch( 'core/edit-post' ).removeEditorPanel",{since:"6.5",alternative:"dispatch( 'core/editor').removeEditorPanel"}),t.dispatch(m.store).removeEditorPanel(e)},K=e=>({registry:t})=>t.dispatch(u.store).toggle("core/edit-post",e),J=e=>({registry:t})=>{l()("dispatch( 'core/edit-post' ).switchEditorMode",{since:"6.6",alternative:"dispatch( 'core/editor').switchEditorMode"}),t.dispatch(m.store).switchEditorMode(e)},ee=e=>({registry:t})=>{const o=t.select(U).isItemPinned("core",e);t.dispatch(U)[o?"unpinItem":"pinItem"]("core",e)};function te(){return l()("dispatch( 'core/edit-post' ).updatePreferredStyleVariations",{since:"6.6",hint:"Preferred Style Variations are not supported anymore."}),{type:"NOTHING"}}const oe=e=>({registry:t})=>{G(t.dispatch(m.store)).showBlockTypes(e)},se=e=>({registry:t})=>{G(t.dispatch(m.store)).hideBlockTypes(e)};function ie(e){return{type:"SET_META_BOXES_PER_LOCATIONS",metaBoxesPerLocation:e}}const re=()=>async({registry:e,select:t,dispatch:o})=>{o({type:"REQUEST_META_BOX_UPDATES"}),window.tinyMCE&&window.tinyMCE.triggerSave();const s=e.select(m.store).getCurrentPost(),i=[!!s.comment_status&&["comment_status",s.comment_status],!!s.ping_status&&["ping_status",s.ping_status],!!s.sticky&&["sticky",s.sticky],!!s.author&&["post_author",s.author]].filter(Boolean),r=[new window.FormData(document.querySelector(".metabox-base-form")),...t.getActiveMetaBoxLocations().map((e=>new window.FormData((e=>{const t=document.querySelector(`.edit-post-meta-boxes-area.is-${e} .metabox-location-${e}`);return t||document.querySelector("#metaboxes .metabox-location-"+e)})(e))))].reduce(((e,t)=>{for(const[o,s]of t)e.append(o,s);return e}),new window.FormData);i.forEach((([e,t])=>r.append(e,t)));try{await L()({url:window._wpMetaBoxUrl,method:"POST",body:r,parse:!1}),o.metaBoxUpdatesSuccess()}catch{o.metaBoxUpdatesFailure()}};function ne(){return{type:"META_BOX_UPDATES_SUCCESS"}}function ae(){return{type:"META_BOX_UPDATES_FAILURE"}}const le=e=>({registry:t})=>{l()("dispatch( 'core/edit-post' ).__experimentalSetPreviewDeviceType",{since:"6.5",version:"6.7",hint:"registry.dispatch( editorStore ).setDeviceType"}),t.dispatch(m.store).setDeviceType(e)},ce=e=>({registry:t})=>{l()("dispatch( 'core/edit-post' ).setIsInserterOpened",{since:"6.5",alternative:"dispatch( 'core/editor').setIsInserterOpened"}),t.dispatch(m.store).setIsInserterOpened(e)},de=e=>({registry:t})=>{l()("dispatch( 'core/edit-post' ).setIsListViewOpened",{since:"6.5",alternative:"dispatch( 'core/editor').setIsListViewOpened"}),t.dispatch(m.store).setIsListViewOpened(e)};function ue(){return l()("dispatch( 'core/edit-post' ).setIsEditingTemplate",{since:"6.5",alternative:"dispatch( 'core/editor').setRenderingMode"}),{type:"NOTHING"}}function pe(){return l()("dispatch( 'core/edit-post' ).__unstableCreateTemplate",{since:"6.5"}),{type:"NOTHING"}}let me=!1;const ge=()=>({registry:e,select:t,dispatch:o})=>{if(!e.select(m.store).__unstableIsEditorReady())return;if(me)return;const s=e.select(m.store).getCurrentPostType();window.postboxes.page!==s&&window.postboxes.add_postbox_toggles(s),me=!0,(0,g.addFilter)("editor.__unstableSavePost","core/edit-post/save-metaboxes",((e,s)=>e.then((()=>{if(!s.isAutosave&&t.hasMetaBoxes())return o.requestMetaBoxUpdates()})))),o({type:"META_BOXES_INITIALIZED"})},he=()=>({registry:e})=>{l()("dispatch( 'core/edit-post' ).toggleDistractionFree",{since:"6.6",alternative:"dispatch( 'core/editor').toggleDistractionFree"}),e.dispatch(m.store).toggleDistractionFree()},{interfaceStore:Ee}=G(m.privateApis),be=[],we={},ye=(0,d.createRegistrySelector)((e=>()=>{var t;return null!==(t=e(u.store).get("core","editorMode"))&&void 0!==t?t:"visual"})),ve=(0,d.createRegistrySelector)((e=>()=>{const t=e(Ee).getActiveComplementaryArea("core");return["edit-post/document","edit-post/block"].includes(t)})),_e=(0,d.createRegistrySelector)((e=>()=>{const t=e(Ee).getActiveComplementaryArea("core");return!!t&&!["edit-post/document","edit-post/block"].includes(t)})),fe=(0,d.createRegistrySelector)((e=>()=>e(Ee).getActiveComplementaryArea("core")));const Se=(0,d.createRegistrySelector)((e=>()=>{l()("select( 'core/edit-post' ).getPreferences",{since:"6.0",alternative:"select( 'core/preferences' ).get"});const t=["editorMode","hiddenBlockTypes"].reduce(((t,o)=>({...t,[o]:e(u.store).get("core",o)})),{}),o=function(e,t){var o;const s=e?.reduce(((e,t)=>({...e,[t]:{enabled:!1}})),{}),i=t?.reduce(((e,t)=>{const o=e?.[t];return{...e,[t]:{...o,opened:!0}}}),null!=s?s:{});return null!==(o=null!=i?i:s)&&void 0!==o?o:we}(e(u.store).get("core","inactivePanels"),e(u.store).get("core","openPanels"));return{...t,panels:o}}));function Pe(e,t,o){l()("select( 'core/edit-post' ).getPreference",{since:"6.0",alternative:"select( 'core/preferences' ).get"});const s=Se(e)[t];return void 0===s?o:s}const ke=(0,d.createRegistrySelector)((e=>()=>{var t;return null!==(t=e(u.store).get("core","hiddenBlockTypes"))&&void 0!==t?t:be})),Me=(0,d.createRegistrySelector)((e=>()=>(l()("select( 'core/edit-post' ).isPublishSidebarOpened",{since:"6.6",alternative:"select( 'core/editor' ).isPublishSidebarOpened"}),e(m.store).isPublishSidebarOpened()))),Be=(0,d.createRegistrySelector)((e=>(t,o)=>(l()("select( 'core/edit-post' ).isEditorPanelRemoved",{since:"6.5",alternative:"select( 'core/editor' ).isEditorPanelRemoved"}),e(m.store).isEditorPanelRemoved(o)))),Te=(0,d.createRegistrySelector)((e=>(t,o)=>(l()("select( 'core/edit-post' ).isEditorPanelEnabled",{since:"6.5",alternative:"select( 'core/editor' ).isEditorPanelEnabled"}),e(m.store).isEditorPanelEnabled(o)))),xe=(0,d.createRegistrySelector)((e=>(t,o)=>(l()("select( 'core/edit-post' ).isEditorPanelOpened",{since:"6.5",alternative:"select( 'core/editor' ).isEditorPanelOpened"}),e(m.store).isEditorPanelOpened(o)))),Ie=(0,d.createRegistrySelector)((e=>(t,o)=>(l()("select( 'core/edit-post' ).isModalActive",{since:"6.3",alternative:"select( 'core/interface' ).isModalActive"}),!!e(Ee).isModalActive(o)))),Ae=(0,d.createRegistrySelector)((e=>(t,o)=>!!e(u.store).get("core/edit-post",o))),Ce=(0,d.createRegistrySelector)((e=>(t,o)=>e(Ee).isItemPinned("core",o))),Re=(0,d.createSelector)((e=>Object.keys(e.metaBoxes.locations).filter((t=>De(e,t)))),(e=>[e.metaBoxes.locations])),Oe=(0,d.createRegistrySelector)((e=>(t,o)=>De(t,o)&&Fe(t,o)?.some((({id:o})=>e(m.store).isEditorPanelEnabled(t,`meta-box-${o}`)))));function De(e,t){const o=Fe(e,t);return!!o&&0!==o.length}function Fe(e,t){return e.metaBoxes.locations[t]}const Le=(0,d.createSelector)((e=>Object.values(e.metaBoxes.locations).flat()),(e=>[e.metaBoxes.locations]));function Ne(e){return Re(e).length>0}function Ve(e){return e.metaBoxes.isSaving}const Ge=(0,d.createRegistrySelector)((e=>()=>(l()("select( 'core/edit-site' ).__experimentalGetPreviewDeviceType",{since:"6.5",version:"6.7",alternative:"select( 'core/editor' ).getDeviceType"}),e(m.store).getDeviceType()))),Ue=(0,d.createRegistrySelector)((e=>()=>(l()("select( 'core/edit-post' ).isInserterOpened",{since:"6.5",alternative:"select( 'core/editor' ).isInserterOpened"}),e(m.store).isInserterOpened()))),He=(0,d.createRegistrySelector)((e=>()=>(l()("select( 'core/edit-post' ).__experimentalGetInsertionPoint",{since:"6.5",version:"6.7"}),G(e(m.store)).getInsertionPoint()))),ze=(0,d.createRegistrySelector)((e=>()=>(l()("select( 'core/edit-post' ).isListViewOpened",{since:"6.5",alternative:"select( 'core/editor' ).isListViewOpened"}),e(m.store).isListViewOpened()))),We=(0,d.createRegistrySelector)((e=>()=>(l()("select( 'core/edit-post' ).isEditingTemplate",{since:"6.5",alternative:"select( 'core/editor' ).getRenderingMode"}),"wp_template"===e(m.store).getCurrentPostType())));function qe(e){return e.metaBoxes.initialized}const $e=(0,d.createRegistrySelector)((e=>()=>{const{id:t,type:o,slug:s}=e(m.store).getCurrentPost(),{getSite:i,getEditedEntityRecord:r,getEntityRecords:n}=e(S.store),a=i();if(+t===a?.page_for_posts){return r("postType","wp_template",e(S.store).getDefaultTemplateId({slug:"home"}))}const l=e(m.store).getEditedPostAttribute("template");if(l){const e=n("postType","wp_template",{per_page:-1})?.find((e=>e.slug===l));return e?r("postType","wp_template",e.id):e}let c;c=s?"page"===o?`${o}-${s}`:`single-${o}-${s}`:"page"===o?"page":`single-${o}`;const d=e(S.store).getDefaultTemplateId({slug:c});return e(S.store).getEditedEntityRecord("postType","wp_template",d)})),Qe=(0,d.createReduxStore)("core/edit-post",{reducer:D,actions:o,selectors:s});function Xe(){const e=(0,d.useSelect)((e=>e(m.store).getEditorSettings().richEditingEnabled),[]),{switchEditorMode:t}=(0,d.useDispatch)(m.store),{isWelcomeGuideVisible:o}=(0,d.useSelect)((e=>{const{isFeatureActive:t}=e(Qe);return{isWelcomeGuideVisible:t("welcomeGuide")}}),[]),s=(0,c.useRef)();return(0,c.useEffect)((()=>{o||s?.current?.focus()}),[o]),(0,i.createElement)("div",{className:"edit-post-text-editor"},e&&(0,i.createElement)("div",{className:"edit-post-text-editor__toolbar"},(0,i.createElement)("h2",null,(0,w.__)("Editing code")),(0,i.createElement)(E.Button,{variant:"tertiary",onClick:()=>t("visual"),shortcut:C.displayShortcut.secondary("m")},(0,w.__)("Exit code editor"))),(0,i.createElement)("div",{className:"edit-post-text-editor__body"},(0,i.createElement)(m.PostTitleRaw,{ref:s}),(0,i.createElement)(m.PostTextEditor,null)))}(0,d.register)(Qe);const{EditorCanvas:je}=G(m.privateApis),Ze=!1;function Ye({styles:e}){const{isWelcomeGuideVisible:t,renderingMode:o,isBlockBasedTheme:s,hasV3BlocksOnly:n,isEditingTemplate:a,isZoomedOutView:l}=(0,d.useSelect)((e=>{const{isFeatureActive:t}=e(Qe),{getEditorSettings:o,getRenderingMode:s}=e(m.store),{getBlockTypes:i}=e(r.store),{__unstableGetEditorMode:n}=e(b.store),a=o();return{isWelcomeGuideVisible:t("welcomeGuide"),renderingMode:s(),isBlockBasedTheme:a.__unstableIsBlockBasedTheme,hasV3BlocksOnly:i().every((e=>e.apiVersion>=3)),isEditingTemplate:"wp_template"===e(m.store).getCurrentPostType(),isZoomedOutView:"zoom-out"===n()}}),[]),u=(0,d.useSelect)((e=>e(Qe).hasMetaBoxes()),[]),p=function(){const e=(0,d.useRegistry)();return(0,y.useRefEffect)((t=>{function o(o){if(o.target!==t)return;const{ownerDocument:s}=t,{defaultView:i}=s;if(!i.parseInt(i.getComputedStyle(t).paddingBottom,10))return;const n=t.lastElementChild;if(!n)return;const a=n.getBoundingClientRect();if(o.clientY<a.bottom)return;o.preventDefault();const l=e.select(b.store).getBlockOrder(""),c=l[l.length-1];if(!c)return;const d=e.select(b.store).getBlock(c),{selectBlock:u,insertDefaultBlock:p}=e.dispatch(b.store);(0,r.isUnmodifiedDefaultBlock)(d)?u(c):p()}return t.addEventListener("mousedown",o),()=>{t.removeEventListener("mousedown",o)}}),[e])}();let g;l||u||"post-only"!==o||(g="40vh"),e=(0,c.useMemo)((()=>[...e,{css:g?`body{padding-bottom:${g}}`:""}]),[e,g]);const h=(n||Ze&&s)&&!u||a;return(0,i.createElement)("div",{className:M("edit-post-visual-editor",{"has-inline-canvas":!h})},(0,i.createElement)(je,{disableIframe:!h,styles:e,autoFocus:!t,contentRef:p}))}const Ke=function(){const{toggleFeature:e}=(0,d.useDispatch)(Qe),{registerShortcut:t}=(0,d.useDispatch)(T.store);return(0,c.useEffect)((()=>{t({name:"core/edit-post/toggle-fullscreen",category:"global",description:(0,w.__)("Toggle fullscreen mode."),keyCombination:{modifier:"secondary",character:"f"}})}),[]),(0,T.useShortcut)("core/edit-post/toggle-fullscreen",(()=>{e("fullscreenMode")})),null},{ReusableBlocksRenameHint:Je}=G(b.privateApis);function et(){const{editPost:e}=(0,d.useDispatch)(m.store),[t,o]=(0,c.useState)(!1),[s,r]=(0,c.useState)(void 0),[n,a]=(0,c.useState)(""),{postType:l,isNewPost:u}=(0,d.useSelect)((e=>{const{getEditedPostAttribute:t,isCleanNewPost:o}=e(m.store);return{postType:t("type"),isNewPost:o()}}),[]);return(0,c.useEffect)((()=>{u&&"wp_block"===l&&o(!0)}),[]),"wp_block"===l&&u?(0,i.createElement)(i.Fragment,null,t&&(0,i.createElement)(E.Modal,{title:(0,w.__)("Create pattern"),onRequestClose:()=>{o(!1)},overlayClassName:"reusable-blocks-menu-items__convert-modal"},(0,i.createElement)("form",{onSubmit:t=>{t.preventDefault(),o(!1),e({title:n,meta:{wp_pattern_sync_status:s}})}},(0,i.createElement)(E.__experimentalVStack,{spacing:"5"},(0,i.createElement)(E.TextControl,{label:(0,w.__)("Name"),value:n,onChange:a,placeholder:(0,w.__)("My pattern"),className:"patterns-create-modal__name-input",__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),(0,i.createElement)(Je,null),(0,i.createElement)(E.ToggleControl,{label:(0,w._x)("Synced","Option that makes an individual pattern synchronized"),help:(0,w.__)("Sync this pattern across multiple locations."),checked:!s,onChange:()=>{r(s?void 0:"unsynced")}}),(0,i.createElement)(E.__experimentalHStack,{justify:"right"},(0,i.createElement)(E.Button,{variant:"primary",type:"submit",disabled:!n,__experimentalIsFocusable:!0},(0,w.__)("Create"))))))):null}class tt extends c.Component{constructor(){super(...arguments),this.state={historyId:null}}componentDidUpdate(e){const{postId:t,postStatus:o,postType:s,isSavingPost:i,hasHistory:r}=this.props,{historyId:n}=this.state;"trash"!==o||i?t===e.postId&&t===n||"auto-draft"===o||!t||r||this.setBrowserURL(t):this.setTrashURL(t,s)}setTrashURL(e,t){window.location.href=function(e,t){return(0,A.addQueryArgs)("edit.php",{trashed:1,post_type:t,ids:e})}(e,t)}setBrowserURL(e){window.history.replaceState({id:e},"Post "+e,function(e){return(0,A.addQueryArgs)("post.php",{post:e,action:"edit"})}(e)),this.setState((()=>({historyId:e})))}render(){return null}}const ot=(0,d.withSelect)((e=>{const{getCurrentPost:t,isSavingPost:o}=e(m.store),s=t();let{id:i,status:r,type:n}=s;return["wp_template","wp_template_part"].includes(n)&&(i=s.wp_id),{postId:i,postStatus:r,postType:n,isSavingPost:o()}}))(tt),st=window.wp.primitives,it=(0,i.createElement)(st.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,i.createElement)(st.Path,{d:"M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z"}));const rt=function({showTooltip:e,icon:t,href:o,initialPost:s}){var r;const{isActive:n,isRequestingSiteIcon:a,postType:l,siteIconUrl:c}=(0,d.useSelect)((e=>{const{getCurrentPostType:t}=e(m.store),{isFeatureActive:o}=e(Qe),{getEntityRecord:i,getPostType:r,isResolving:n}=e(S.store),a=i("root","__unstableBase",void 0)||{},l=s?.type||t();return{isActive:o("fullscreenMode"),isRequestingSiteIcon:n("getEntityRecord",["root","__unstableBase",void 0]),postType:r(l),siteIconUrl:a.site_icon_url}}),[]),u=(0,y.useReducedMotion)();if(!n||!l)return null;let p=(0,i.createElement)(E.Icon,{size:"36px",icon:it});const g={expand:{scale:1.25,transition:{type:"tween",duration:"0.3"}}};c&&(p=(0,i.createElement)(E.__unstableMotion.img,{variants:!u&&g,alt:(0,w.__)("Site Icon"),className:"edit-post-fullscreen-mode-close_site-icon",src:c})),a&&(p=null),t&&(p=(0,i.createElement)(E.Icon,{size:"36px",icon:t}));const h=M({"edit-post-fullscreen-mode-close":!0,"has-icon":c}),b=null!=o?o:(0,A.addQueryArgs)("edit.php",{post_type:l.slug}),v=null!==(r=l?.labels?.view_items)&&void 0!==r?r:(0,w.__)("Back");return(0,i.createElement)(E.__unstableMotion.div,{whileHover:"expand"},(0,i.createElement)(E.Button,{className:h,href:b,label:v,showTooltip:e},p))};const nt=function(){const e=(0,d.useSelect)((e=>{const{canUser:t}=e(S.store),o=(0,A.addQueryArgs)("edit.php",{post_type:"wp_block"}),s=(0,A.addQueryArgs)("site-editor.php",{path:"/patterns"});return t("create","templates")?s:o}),[]);return(0,i.createElement)(E.MenuItem,{role:"menuitem",href:e},(0,w.__)("Manage patterns"))};function at(){const e=(0,d.useSelect)((e=>"wp_template"===e(m.store).getCurrentPostType()),[]);return(0,i.createElement)(u.PreferenceToggleMenuItem,{scope:"core/edit-post",name:e?"welcomeGuideTemplate":"welcomeGuide",label:(0,w.__)("Welcome Guide")})}const{PreferenceBaseOption:lt}=G(u.privateApis);function ct({willEnable:e}){const[t,o]=(0,c.useState)(!1);return(0,i.createElement)(i.Fragment,null,(0,i.createElement)("p",{className:"edit-post-preferences-modal__custom-fields-confirmation-message"},(0,w.__)("A page reload is required for this change. Make sure your content is saved before reloading.")),(0,i.createElement)(E.Button,{className:"edit-post-preferences-modal__custom-fields-confirmation-button",variant:"secondary",isBusy:t,disabled:t,onClick:()=>{o(!0),function(){const e=document.getElementById("toggle-custom-fields-form");e.querySelector('[name="_wp_http_referer"]').setAttribute("value",(0,A.getPathAndQueryString)(window.location.href)),e.submit()}()}},e?(0,w.__)("Show & Reload Page"):(0,w.__)("Hide & Reload Page")))}const dt=(0,d.withSelect)((e=>({areCustomFieldsEnabled:!!e(m.store).getEditorSettings().enableCustomFields})))((function({label:e,areCustomFieldsEnabled:t}){const[o,s]=(0,c.useState)(t);return(0,i.createElement)(lt,{label:e,isChecked:o,onChange:s},o!==t&&(0,i.createElement)(ct,{willEnable:o}))})),{PreferenceBaseOption:ut}=G(u.privateApis),pt=(0,y.compose)((0,d.withSelect)(((e,{panelName:t})=>{const{isEditorPanelEnabled:o,isEditorPanelRemoved:s}=e(m.store);return{isRemoved:s(t),isChecked:o(t)}})),(0,y.ifCondition)((({isRemoved:e})=>!e)),(0,d.withDispatch)(((e,{panelName:t})=>({onChange:()=>e(m.store).toggleEditorPanelEnabled(t)}))))(ut),{PreferencesModalSection:mt}=G(u.privateApis);const gt=(0,d.withSelect)((e=>{const{getEditorSettings:t}=e(m.store),{getAllMetaBoxes:o}=e(Qe);return{areCustomFieldsRegistered:void 0!==t().enableCustomFields,metaBoxes:o()}}))((function({areCustomFieldsRegistered:e,metaBoxes:t,...o}){const s=t.filter((({id:e})=>"postcustom"!==e));return e||0!==s.length?(0,i.createElement)(mt,{...o},e&&(0,i.createElement)(dt,{label:(0,w.__)("Custom fields")}),s.map((({id:e,title:t})=>(0,i.createElement)(pt,{key:e,label:t,panelName:`meta-box-${e}`})))):null})),{PreferenceToggleControl:ht}=G(u.privateApis),{PreferencesModal:Et}=G(m.privateApis);function bt(){const e={general:(0,i.createElement)(gt,{title:(0,w.__)("Advanced")}),appearance:(0,i.createElement)(ht,{scope:"core/edit-post",featureName:"themeStyles",help:(0,w.__)("Make the editor look like your theme."),label:(0,w.__)("Use theme styles")})};return(0,i.createElement)(Et,{extraSections:e})}const{ToolsMoreMenuGroup:wt,ViewMoreMenuGroup:yt}=G(m.privateApis),vt=()=>{const e=(0,y.useViewportMatch)("large");return(0,i.createElement)(i.Fragment,null,e&&(0,i.createElement)(yt,null,(0,i.createElement)(u.PreferenceToggleMenuItem,{scope:"core/edit-post",name:"fullscreenMode",label:(0,w.__)("Fullscreen mode"),info:(0,w.__)("Show and hide the admin user interface"),messageActivated:(0,w.__)("Fullscreen mode activated"),messageDeactivated:(0,w.__)("Fullscreen mode deactivated"),shortcut:C.displayShortcut.secondary("f")})),(0,i.createElement)(wt,null,(0,i.createElement)(nt,null),(0,i.createElement)(at,null)),(0,i.createElement)(bt,null))},_t="__experimentalMainDashboardButton",{Fill:ft,Slot:St}=(0,E.createSlotFill)(_t),Pt=ft;Pt.Slot=({children:e})=>{const t=(0,E.__experimentalUseSlotFills)(_t);return Boolean(t&&t.length)?(0,i.createElement)(St,{bubblesVirtually:!0}):e};const kt=Pt,{Header:Mt}=G(m.privateApis),Bt={hidden:{x:"-100%"},distractionFreeInactive:{x:0},hover:{x:0,transition:{type:"tween",delay:.2}}};const Tt=function({setEntitiesSavedStatesCallback:e,initialPost:t}){const{hasActiveMetaboxes:o}=(0,d.useSelect)((e=>({hasActiveMetaboxes:e(Qe).hasMetaBoxes()})),[]);return(0,i.createElement)(Mt,{forceIsDirty:o,setEntitiesSavedStatesCallback:e},(0,i.createElement)(kt.Slot,null,(0,i.createElement)(E.__unstableMotion.div,{variants:Bt,transition:{type:"tween",delay:.8}},(0,i.createElement)(rt,{showTooltip:!0,initialPost:t}))),(0,i.createElement)(vt,null))};const xt=function({location:e}){const t=(0,c.useRef)(null),o=(0,c.useRef)(null);(0,c.useEffect)((()=>(o.current=document.querySelector(".metabox-location-"+e),o.current&&t.current.appendChild(o.current),()=>{o.current&&document.querySelector("#metaboxes").appendChild(o.current)})),[e]);const s=(0,d.useSelect)((e=>e(Qe).isSavingMetaBoxes()),[]),r=M("edit-post-meta-boxes-area",`is-${e}`,{"is-loading":s});return(0,i.createElement)("div",{className:r},s&&(0,i.createElement)(E.Spinner,null),(0,i.createElement)("div",{className:"edit-post-meta-boxes-area__container",ref:t}),(0,i.createElement)("div",{className:"edit-post-meta-boxes-area__clear"}))};class It extends c.Component{componentDidMount(){this.updateDOM()}componentDidUpdate(e){this.props.isVisible!==e.isVisible&&this.updateDOM()}updateDOM(){const{id:e,isVisible:t}=this.props,o=document.getElementById(e);o&&(t?o.classList.remove("is-hidden"):o.classList.add("is-hidden"))}render(){return null}}const At=(0,d.withSelect)(((e,{id:t})=>({isVisible:e(m.store).isEditorPanelEnabled(`meta-box-${t}`)})))(It);function Ct({location:e}){const t=(0,d.useRegistry)(),{metaBoxes:o,areMetaBoxesInitialized:s,isEditorReady:r}=(0,d.useSelect)((t=>{const{__unstableIsEditorReady:o}=t(m.store),{getMetaBoxesPerLocation:s,areMetaBoxesInitialized:i}=t(Qe);return{metaBoxes:s(e),areMetaBoxesInitialized:i(),isEditorReady:o()}}),[e]),n=!!o?.length;return(0,c.useEffect)((()=>{r&&n&&!s&&t.dispatch(Qe).initializeMetaBoxes()}),[r,n,s]),s?(0,i.createElement)(i.Fragment,null,(null!=o?o:[]).map((({id:e})=>(0,i.createElement)(At,{key:e,id:e}))),(0,i.createElement)(xt,{location:e})):null}function Rt({nonAnimatedSrc:e,animatedSrc:t}){return(0,i.createElement)("picture",{className:"edit-post-welcome-guide__image"},(0,i.createElement)("source",{srcSet:e,media:"(prefers-reduced-motion: reduce)"}),(0,i.createElement)("img",{src:t,width:"312",height:"240",alt:""}))}function Ot(){const{toggleFeature:e}=(0,d.useDispatch)(Qe);return(0,i.createElement)(E.Guide,{className:"edit-post-welcome-guide",contentLabel:(0,w.__)("Welcome to the block editor"),finishButtonText:(0,w.__)("Get started"),onFinish:()=>e("welcomeGuide"),pages:[{image:(0,i.createElement)(Rt,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-canvas.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-canvas.gif"}),content:(0,i.createElement)(i.Fragment,null,(0,i.createElement)("h1",{className:"edit-post-welcome-guide__heading"},(0,w.__)("Welcome to the block editor")),(0,i.createElement)("p",{className:"edit-post-welcome-guide__text"},(0,w.__)("In the WordPress editor, each paragraph, image, or video is presented as a distinct “block” of content.")))},{image:(0,i.createElement)(Rt,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-editor.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-editor.gif"}),content:(0,i.createElement)(i.Fragment,null,(0,i.createElement)("h1",{className:"edit-post-welcome-guide__heading"},(0,w.__)("Make each block your own")),(0,i.createElement)("p",{className:"edit-post-welcome-guide__text"},(0,w.__)("Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected.")))},{image:(0,i.createElement)(Rt,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-library.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-library.gif"}),content:(0,i.createElement)(i.Fragment,null,(0,i.createElement)("h1",{className:"edit-post-welcome-guide__heading"},(0,w.__)("Get to know the block library")),(0,i.createElement)("p",{className:"edit-post-welcome-guide__text"},(0,c.createInterpolateElement)((0,w.__)("All of the blocks available to you live in the block library. You’ll find it wherever you see the <InserterIconImage /> icon."),{InserterIconImage:(0,i.createElement)("img",{alt:(0,w.__)("inserter"),src:"data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A"})})))},{image:(0,i.createElement)(Rt,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.gif"}),content:(0,i.createElement)(i.Fragment,null,(0,i.createElement)("h1",{className:"edit-post-welcome-guide__heading"},(0,w.__)("Learn how to use the block editor")),(0,i.createElement)("p",{className:"edit-post-welcome-guide__text"},(0,w.__)("New to the block editor? Want to learn more about using it? "),(0,i.createElement)(E.ExternalLink,{href:(0,w.__)("https://wordpress.org/documentation/article/wordpress-block-editor/")},(0,w.__)("Here's a detailed guide."))))}]})}function Dt(){const{toggleFeature:e}=(0,d.useDispatch)(Qe);return(0,i.createElement)(E.Guide,{className:"edit-template-welcome-guide",contentLabel:(0,w.__)("Welcome to the template editor"),finishButtonText:(0,w.__)("Get started"),onFinish:()=>e("welcomeGuideTemplate"),pages:[{image:(0,i.createElement)(Rt,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-template-editor.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-template-editor.gif"}),content:(0,i.createElement)(i.Fragment,null,(0,i.createElement)("h1",{className:"edit-post-welcome-guide__heading"},(0,w.__)("Welcome to the template editor")),(0,i.createElement)("p",{className:"edit-post-welcome-guide__text"},(0,w.__)("Templates help define the layout of the site. You can customize all aspects of your posts and pages using blocks and patterns in this editor.")))}]})}function Ft(){const{isActive:e,isEditingTemplate:t}=(0,d.useSelect)((e=>{const{isFeatureActive:t}=e(Qe),{getCurrentPostType:o}=e(m.store),s="wp_template"===o();return{isActive:t(s?"welcomeGuideTemplate":"welcomeGuide"),isEditingTemplate:s}}),[]);return e?t?(0,i.createElement)(Dt,null):(0,i.createElement)(Ot,null):null}const Lt=(0,i.createElement)(st.SVG,{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,i.createElement)(st.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM8.5 18.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h2.5v13zm10-.5c0 .3-.2.5-.5.5h-8v-13h8c.3 0 .5.2.5.5v12z"})),Nt=(0,i.createElement)(st.SVG,{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,i.createElement)(st.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4 14.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h8v13zm4.5-.5c0 .3-.2.5-.5.5h-2.5v-13H18c.3 0 .5.2.5.5v12z"})),Vt=(0,i.createElement)(st.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,i.createElement)(st.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"})),Gt=(0,i.createElement)(st.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,i.createElement)(st.Path,{d:"M6 4a2 2 0 0 0-2 2v3h1.5V6a.5.5 0 0 1 .5-.5h3V4H6Zm3 14.5H6a.5.5 0 0 1-.5-.5v-3H4v3a2 2 0 0 0 2 2h3v-1.5Zm6 1.5v-1.5h3a.5.5 0 0 0 .5-.5v-3H20v3a2 2 0 0 1-2 2h-3Zm3-16a2 2 0 0 1 2 2v3h-1.5V6a.5.5 0 0 0-.5-.5h-3V4h3Z"})),Ut=(0,i.createElement)(st.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,i.createElement)(st.Path,{d:"M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})),{interfaceStore:Ht}=G(m.privateApis);const{getLayoutStyles:zt}=G(b.privateApis),{useCommands:Wt}=G(I.privateApis),{useCommandContext:qt}=G(P.privateApis),{InserterSidebar:$t,ListViewSidebar:Qt,ComplementaryArea:Xt,FullscreenMode:jt,SavePublishPanels:Zt,InterfaceSkeleton:Yt,interfaceStore:Kt,Sidebar:Jt}=G(m.privateApis),{BlockKeyboardShortcuts:eo}=G(n.privateApis),to={header:(0,w.__)("Editor top bar"),body:(0,w.__)("Editor content"),sidebar:(0,w.__)("Editor settings"),actions:(0,w.__)("Editor publish"),footer:(0,w.__)("Editor footer")};const oo=function({initialPost:e}){Wt(),function(){const{openGeneralSidebar:e,closeGeneralSidebar:t}=(0,d.useDispatch)(Qe),{activeSidebar:o,isFullscreen:s,isPublishSidebarEnabled:i}=(0,d.useSelect)((e=>{const{get:t}=e(u.store);return{activeSidebar:e(Ht).getActiveComplementaryArea("core"),isPublishSidebarEnabled:e(m.store).isPublishSidebarEnabled(),isFullscreen:t("core/edit-post","fullscreenMode")}}),[]),{toggle:r}=(0,d.useDispatch)(u.store),{createInfoNotice:n}=(0,d.useDispatch)(x.store);(0,P.useCommand)({name:"core/open-settings-sidebar",label:(0,w.__)("Toggle settings sidebar"),icon:(0,w.isRTL)()?Lt:Nt,callback:({close:s})=>{s(),"edit-post/document"===o?t():e("edit-post/document")}}),(0,P.useCommand)({name:"core/open-block-inspector",label:(0,w.__)("Toggle block inspector"),icon:Vt,callback:({close:s})=>{s(),"edit-post/block"===o?t():e("edit-post/block")}}),(0,P.useCommand)({name:"core/toggle-fullscreen-mode",label:s?(0,w.__)("Exit fullscreen"):(0,w.__)("Enter fullscreen"),icon:Gt,callback:({close:e})=>{r("core/edit-post","fullscreenMode"),e(),n(s?(0,w.__)("Fullscreen off."):(0,w.__)("Fullscreen on."),{id:"core/edit-post/toggle-fullscreen-mode/notice",type:"snackbar",actions:[{label:(0,w.__)("Undo"),onClick:()=>{r("core/edit-post","fullscreenMode")}}]})}}),(0,P.useCommand)({name:"core/toggle-publish-sidebar",label:i?(0,w.__)("Disable pre-publish checks"):(0,w.__)("Enable pre-publish checks"),icon:Ut,callback:({close:e})=>{e(),r("core","isPublishSidebarEnabled"),n(i?(0,w.__)("Pre-publish checks disabled."):(0,w.__)("Pre-publish checks enabled."),{id:"core/editor/publish-sidebar/notice",type:"snackbar"})}})}();const t=(0,y.useViewportMatch)("medium","<"),o=(0,y.useViewportMatch)("large"),s=(0,y.useViewportMatch)("medium"),{closeGeneralSidebar:r}=(0,d.useDispatch)(Qe),{createErrorNotice:n}=(0,d.useDispatch)(x.store),{mode:a,isFullscreenActive:l,isRichEditingEnabled:p,sidebarIsOpened:g,hasActiveMetaboxes:h,previousShortcut:v,nextShortcut:_,hasBlockSelected:f,isInserterOpened:S,isListViewOpened:k,showIconLabels:I,isDistractionFree:C,showBlockBreadcrumbs:R,showMetaBoxes:O,documentLabel:D,hasHistory:F,hasBlockBreadcrumbs:L,blockEditorMode:N,isEditingTemplate:V}=(0,d.useSelect)((e=>{const{get:t}=e(u.store),{getEditorSettings:o,getPostTypeLabel:s}=e(m.store),i=o(),r=s();return{showMetaBoxes:"post-only"===e(m.store).getRenderingMode(),sidebarIsOpened:!(!e(Kt).getActiveComplementaryArea("core")&&!e(m.store).isPublishSidebarOpened()),isFullscreenActive:e(Qe).isFeatureActive("fullscreenMode"),isInserterOpened:e(m.store).isInserterOpened(),isListViewOpened:e(m.store).isListViewOpened(),mode:e(m.store).getEditorMode(),isRichEditingEnabled:i.richEditingEnabled,hasActiveMetaboxes:e(Qe).hasMetaBoxes(),previousShortcut:e(T.store).getAllShortcutKeyCombinations("core/editor/previous-region"),nextShortcut:e(T.store).getAllShortcutKeyCombinations("core/editor/next-region"),showIconLabels:t("core","showIconLabels"),isDistractionFree:t("core","distractionFree"),showBlockBreadcrumbs:t("core","showBlockBreadcrumbs"),documentLabel:r||(0,w._x)("Document","noun"),hasBlockSelected:!!e(b.store).getBlockSelectionStart(),hasHistory:!!o().onNavigateToPreviousEntityRecord,hasBlockBreadcrumbs:t("core","showBlockBreadcrumbs"),blockEditorMode:e(b.store).__unstableGetEditorMode(),isEditingTemplate:"wp_template"===e(m.store).getCurrentPostType()}}),[]);qt(f?"block-selection-edit":"post-editor-edit");const G=function(){const{hasThemeStyleSupport:e,editorSettings:t}=(0,d.useSelect)((e=>({hasThemeStyleSupport:e(Qe).isFeatureActive("themeStyles"),editorSettings:e(m.store).getEditorSettings()})),[]);return(0,c.useMemo)((()=>{var o,s;const i=null!==(o=t.styles?.filter((e=>e.__unstableType&&"theme"!==e.__unstableType)))&&void 0!==o?o:[],r=[...t.defaultEditorStyles,...i],n=e&&i.length!==(null!==(s=t.styles?.length)&&void 0!==s?s:0);return t.disableLayoutStyles||n||r.push({css:zt({style:{},selector:"body",hasBlockGapSupport:!1,hasFallbackGapSupport:!0,fallbackGapValue:"0.5em"})}),n?t.styles:r}),[t.defaultEditorStyles,t.disableLayoutStyles,t.styles,e])}(),[U,H]=(0,c.useState)(!1),z=(0,c.useCallback)((e=>{"function"==typeof U&&U(e),H(!1)}),[U]);I?document.body.classList.add("show-icon-labels"):document.body.classList.remove("show-icon-labels");const W=M("edit-post-layout","is-mode-"+a,{"is-sidebar-opened":g,"has-metaboxes":h,"is-distraction-free":C&&o,"is-entity-save-view-open":!!U,"has-block-breadcrumbs":L&&!C&&o}),q=k?(0,w.__)("Document Overview"):(0,w.__)("Block Library"),{createSuccessNotice:$}=(0,d.useDispatch)(x.store),Q=(0,c.useCallback)(((e,t)=>{switch(e){case"move-to-trash":document.location.href=(0,A.addQueryArgs)("edit.php",{trashed:1,post_type:t[0].type,ids:t[0].id});break;case"duplicate-post":{const e=t[0],o="string"==typeof e.title?e.title:e.title?.rendered;$((0,w.sprintf)((0,w.__)('"%s" successfully created.'),o),{type:"snackbar",id:"duplicate-post-action",actions:[{label:(0,w.__)("Edit"),onClick:()=>{const t=e.id;document.location.href=(0,A.addQueryArgs)("post.php",{post:t,action:"edit"})}}]})}}}),[$]);return(0,i.createElement)(i.Fragment,null,(0,i.createElement)(jt,{isActive:l}),(0,i.createElement)(ot,{hasHistory:F}),(0,i.createElement)(m.UnsavedChangesWarning,null),(0,i.createElement)(m.AutosaveMonitor,null),(0,i.createElement)(m.LocalAutosaveMonitor,null),(0,i.createElement)(Ke,null),(0,i.createElement)(m.EditorKeyboardShortcutsRegister,null),(0,i.createElement)(m.EditorKeyboardShortcuts,null),(0,i.createElement)(eo,null),(0,i.createElement)(Yt,{isDistractionFree:C&&o,className:W,labels:{...to,secondarySidebar:q},header:(0,i.createElement)(Tt,{setEntitiesSavedStatesCallback:H,initialPost:e}),editorNotices:(0,i.createElement)(m.EditorNotices,null),secondarySidebar:"visual"===a&&S?(0,i.createElement)($t,{closeGeneralSidebar:r,isRightSidebarOpen:g}):"visual"===a&&k?(0,i.createElement)(Qt,null):null,sidebar:!C&&(0,i.createElement)(Xt.Slot,{scope:"core"}),notices:(0,i.createElement)(m.EditorSnackbars,null),content:(0,i.createElement)(i.Fragment,null,!C&&(0,i.createElement)(m.EditorNotices,null),("text"===a||!p)&&(0,i.createElement)(Xe,null),!s&&(0,i.createElement)(b.BlockToolbar,{hideDragHandle:!0}),p&&"visual"===a&&(0,i.createElement)(Ye,{styles:G}),!C&&O&&(0,i.createElement)("div",{className:"edit-post-layout__metaboxes"},(0,i.createElement)(Ct,{location:"normal"}),(0,i.createElement)(Ct,{location:"advanced"})),t&&g&&(0,i.createElement)(E.ScrollLock,null)),footer:!C&&!t&&R&&p&&"zoom-out"!==N&&"visual"===a&&(0,i.createElement)("div",{className:"edit-post-layout__footer"},(0,i.createElement)(b.BlockBreadcrumb,{rootLabelText:D})),actions:(0,i.createElement)(Zt,{closeEntitiesSavedStates:z,isEntitiesSavedStatesOpen:U,setEntitiesSavedStatesCallback:H,forceIsDirtyPublishPanel:h}),shortcuts:{previous:v,next:_}}),(0,i.createElement)(Ft,null),(0,i.createElement)(et,null),(0,i.createElement)(B.PluginArea,{onError:function(e){n((0,w.sprintf)((0,w.__)('The "%s" plugin has encountered an error and cannot be rendered.'),e))}}),!C&&(0,i.createElement)(Jt,{onActionPerformed:Q,extraPanels:!V&&(0,i.createElement)(Ct,{location:"side"})}))},so=()=>{const{newPermalink:e}=(0,d.useSelect)((e=>({newPermalink:e(m.store).getCurrentPost().link})),[]),t=(0,c.useRef)();(0,c.useEffect)((()=>{t.current=document.querySelector("#wp-admin-bar-preview a")||document.querySelector("#wp-admin-bar-view a")}),[]),(0,c.useEffect)((()=>{e&&t.current&&t.current.setAttribute("href",e)}),[e])};function io(){return so(),null}const{ExperimentalEditorProvider:ro}=G(m.privateApis);const no=function({postId:e,postType:t,settings:o,initialEdits:s,...r}){const{currentPost:n,onNavigateToEntityRecord:a,onNavigateToPreviousEntityRecord:l}=function(e,t,o){const[s,i]=(0,c.useReducer)(((e,{type:t,post:o,previousRenderingMode:s})=>"push"===t?[...e,{post:o,previousRenderingMode:s}]:"pop"===t&&e.length>1?e.slice(0,-1):e),[{post:{postId:e,postType:t}}]),{post:r,previousRenderingMode:n}=s[s.length-1],{getRenderingMode:a}=(0,d.useSelect)(m.store),{setRenderingMode:l}=(0,d.useDispatch)(m.store),u=(0,c.useCallback)((e=>{i({type:"push",post:{postId:e.postId,postType:e.postType},previousRenderingMode:a()}),l(o)}),[a,l,o]),p=(0,c.useCallback)((()=>{i({type:"pop"}),n&&l(n)}),[l,n]);return{currentPost:r,onNavigateToEntityRecord:u,onNavigateToPreviousEntityRecord:s.length>1?p:void 0}}(e,t,"post-only"),{post:u,template:p}=(0,d.useSelect)((e=>{var t;const{getEditedPostTemplate:o}=e(Qe),{getEntityRecord:s,getPostType:i,canUser:r}=e(S.store),{getEditorSettings:a}=e(m.store),l=s("postType",n.postType,n.postId),c=a().supportsTemplateMode,d=null!==(t=i(n.postType)?.viewable)&&void 0!==t&&t,u=r("read","templates");return{template:c&&d&&u&&"wp_template"!==n.postType?o():null,post:l}}),[n.postType,n.postId]),g=(0,c.useMemo)((()=>({...o,onNavigateToEntityRecord:a,onNavigateToPreviousEntityRecord:l,defaultRenderingMode:"post-only"})),[o,a,l]),h=(0,c.useMemo)((()=>({type:t,id:e})),[t,e]);return u?(0,i.createElement)(E.SlotFillProvider,null,(0,i.createElement)(ro,{settings:g,post:u,initialEdits:s,useSubRegistry:!1,__unstableTemplate:p,...r},(0,i.createElement)(m.ErrorBoundary,null,(0,i.createElement)(P.CommandMenu,null),(0,i.createElement)(io,null),(0,i.createElement)(oo,{initialPost:h})),(0,i.createElement)(m.PostLockedModal,null))):null},{PluginPostExcerpt:ao}=G(m.privateApis),lo=e=>{l()(`wp.editPost.${e}`,{since:"6.6",alternative:`wp.editor.${e}`})};function co(e){return lo("PluginBlockSettingsMenuItem"),(0,i.createElement)(m.PluginBlockSettingsMenuItem,{...e})}function uo(e){return lo("PluginDocumentSettingPanel"),(0,i.createElement)(m.PluginDocumentSettingPanel,{...e})}function po(e){return lo("PluginMoreMenuItem"),(0,i.createElement)(m.PluginMoreMenuItem,{...e})}function mo(e){return lo("PluginPrePublishPanel"),(0,i.createElement)(m.PluginPrePublishPanel,{...e})}function go(e){return lo("PluginPostPublishPanel"),(0,i.createElement)(m.PluginPostPublishPanel,{...e})}function ho(e){return lo("PluginPostStatusInfo"),(0,i.createElement)(m.PluginPostStatusInfo,{...e})}function Eo(e){return lo("PluginSidebar"),(0,i.createElement)(m.PluginSidebar,{...e})}function bo(e){return lo("PluginSidebarMoreMenuItem"),(0,i.createElement)(m.PluginSidebarMoreMenuItem,{...e})}function wo(){return l()("wp.editPost.__experimentalPluginPostExcerpt",{since:"6.6",hint:"Core and custom panels can be access programmatically using their panel name.",link:"https://developer.wordpress.org/block-editor/reference-guides/slotfills/plugin-document-setting-panel/#accessing-a-panel-programmatically"}),ao}function yo(e,t,o,s,a){const l=window.matchMedia("(min-width: 782px)").matches,g=document.getElementById(e),h=(0,c.createRoot)(g);(0,d.dispatch)(u.store).setDefaults("core/edit-post",{fullscreenMode:!0,themeStyles:!0,welcomeGuide:!0,welcomeGuideTemplate:!0}),(0,d.dispatch)(u.store).setDefaults("core",{allowRightClickOverrides:!0,editorMode:"visual",fixedToolbar:!1,hiddenBlockTypes:[],inactivePanels:[],openPanels:["post-status"],showBlockBreadcrumbs:!0,showIconLabels:!1,showListViewByDefault:!1,isPublishSidebarEnabled:!0}),(0,d.dispatch)(r.store).reapplyBlockTypeFilters(),l&&(0,d.select)(u.store).get("core","showListViewByDefault")&&!(0,d.select)(u.store).get("core","distractionFree")&&(0,d.dispatch)(m.store).setIsListViewOpened(!0),(0,n.registerCoreBlocks)(),(0,p.registerLegacyWidgetBlock)({inserter:!1}),(0,p.registerWidgetGroupBlock)({inserter:!1});"Standards"!==("CSS1Compat"===document.compatMode?"Standards":"Quirks")&&console.warn("Your browser is using Quirks Mode. \nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins.");return-1!==window.navigator.userAgent.indexOf("iPhone")&&window.addEventListener("scroll",(e=>{const t=document.getElementsByClassName("interface-interface-skeleton__body")[0];e.target===document&&(window.scrollY>100&&(t.scrollTop=t.scrollTop+window.scrollY),document.getElementsByClassName("is-mode-visual")[0]&&window.scrollTo(0,0))})),window.addEventListener("dragover",(e=>e.preventDefault()),!1),window.addEventListener("drop",(e=>e.preventDefault()),!1),h.render((0,i.createElement)(no,{settings:s,postId:o,postType:t,initialEdits:a})),h}function vo(){l()("wp.editPost.reinitializeEditor",{since:"6.2",version:"6.3"})}(window.wp=window.wp||{}).editPost=t})(); |