← Back
Editing: block-editor.js
(()=>{"use strict";var e={503(e,o,t){const r=window.wp.blockLibrary,s=window.wp.element,l=(window.wp.formatLibrary,window.wp.blockEditor),n=window.wp.blocks,i=window.wp.components,c=window.wp.compose,a=window.wp.i18n,d=window.wp.primitives,w=window.ReactJSXRuntime;var b=(0,w.jsx)(d.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:{fill:"none"},stroke:"currentColor",strokeWidth:"1.5",children:(0,w.jsx)(d.Path,{d:"M8.25 15L4.75 11L8.25 7M4.75 11H15.25C18.25 11 18.5 13.8 18.5 17"})}),m=(0,w.jsx)(d.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:{fill:"none"},stroke:"currentColor",strokeWidth:"1.5",children:(0,w.jsx)(d.Path,{d:"M15 15L18.5 11L15 7M18.5 11H8C5 11 4.75 13.8 4.75 17"})}),p=(0,w.jsx)(d.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:{fill:"none"},stroke:"currentColor",strokeWidth:"1.5",children:(0,w.jsx)(d.Path,{d:"M4.75 10V4.75H10M4.75 4.75L10 10M14 19.25H19.25V14M19.25 19.25L14 14"})}),u=(0,w.jsx)(d.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:{fill:"none"},stroke:"currentColor",strokeWidth:"1.5",children:(0,w.jsx)(d.Path,{d:"M14.25 19.25L18 19.25C18.6904 19.25 19.25 18.6904 19.25 18L19.25 6C19.25 5.30964 18.6904 4.75 18 4.75L14.25 4.75M14.25 19.25L6 19.25C5.30964 19.25 4.75 18.6904 4.75 18L4.75 6C4.75 5.30964 5.30965 4.75 6 4.75L14.25 4.75M14.25 19.25L14.25 4.75"})});const h=window.wp.coreData,x=window.wp.data,k=window.wp.mediaUtils;function v({textarea:e}){const{value:o,setValue:t,hasUndo:r,hasRedo:d,undo:v,redo:g}=(0,c.useStateWithHistory)({blocks:(j=e.value,j.includes("\x3c!--")?(0,n.parse)(j):(0,n.rawHandler)({HTML:j}))});var j;const[_,f]=(0,s.useReducer)(e=>!e,!1),[y,B]=(0,s.useReducer)(e=>!e,!1),L=o=>{t({blocks:o}),e.value=(0,n.serialize)(o)},C=JSON.parse(e.dataset.settings),M=(({allowed_blocks:e,toolbar_position:o})=>(0,x.useSelect)(t=>{const r=rwmbBlockEditor.editor_settings;r.hasFixedToolbar="top"===o,Array.isArray(e)&&e.length>0&&(r.allowedBlockTypes=e);let s=t(h.store).canUser("create","media");return s=s||!1!==s,s?(r.mediaUpload=({onError:e,...o})=>{(0,k.uploadMedia)({wpAllowedMimeTypes:r.allowedMimeTypes,onError:({message:o})=>e(o),...o})},r):r}))(C),E=C.toolbar_position||"top";(0,s.useEffect)(()=>(document.body.style.overflow=y?"hidden":"",()=>{document.body.style.overflow=""}),[y]);const O=(0,w.jsxs)(l.BlockEditorProvider,{value:o.blocks,onChange:L,onInput:L,settings:M,children:[(0,w.jsxs)("div",{className:"rwmb-block-editor__toolbar",children:[(0,w.jsxs)("div",{className:"rwmb-block-editor__toolbar-left",children:[(0,w.jsx)(l.Inserter,{toggleProps:{size:"compact",variant:"primary"}}),(0,w.jsx)(i.Button,{onClick:v,disabled:!r,accessibleWhenDisabled:!0,icon:b,label:(0,a.__)("Undo","meta-box"),size:"compact"}),(0,w.jsx)(i.Button,{onClick:g,disabled:!d,accessibleWhenDisabled:!0,icon:m,label:(0,a.__)("Redo","meta-box"),size:"compact"}),(0,w.jsx)(l.BlockNavigationDropdown,{}),"top"===E&&(0,w.jsx)(l.BlockToolbar,{hideDragHandle:!0})]}),(0,w.jsxs)("div",{className:"rwmb-block-editor__toolbar-right",children:[(0,w.jsx)(i.Button,{icon:p,"aria-pressed":y,label:(0,a.__)("Toggle Fullscreen","meta-box"),size:"compact",onClick:B}),(0,w.jsx)(i.Button,{icon:u,"aria-pressed":_,label:(0,a.__)("Toggle Sidebar","meta-box"),size:"compact",onClick:f})]})]}),(0,w.jsxs)(i.Flex,{gap:0,align:"stretch",className:"rwmb-block-editor__main",children:[(0,w.jsx)("div",{className:"rwmb-block-editor__content",style:{minHeight:C.height},children:(0,w.jsx)(l.BlockTools,{children:(0,w.jsx)(l.WritingFlow,{children:(0,w.jsx)(l.BlockList,{})})})}),_&&(0,w.jsx)("div",{className:"rwmb-block-editor__sidebar",children:(0,w.jsx)(l.BlockInspector,{})})]}),(0,w.jsx)(l.BlockBreadcrumb,{})]});return y?(0,s.createPortal)((0,w.jsx)("div",{className:"rwmb-block-editor__canvas rwmb-block-editor__canvas--fullscreen",children:O}),(()=>{let e=document.getElementById("rwmb-block-editor-portal");return e||(e=document.createElement("div"),e.id="rwmb-block-editor-portal",document.body.appendChild(e)),e})()):(0,w.jsx)("div",{className:"rwmb-block-editor__canvas",children:O})}t.dn(v),(0,r.registerCoreBlocks)();const g=e=>{const o=e.nextElementSibling;o&&o.classList.contains("rwmb-block-editor")&&o.remove(),function(e){const o=document.createElement("div");o.classList.add("rwmb-block-editor");const t=(0,s.createRoot)(o),r=()=>{o.querySelectorAll("button:not([type])").forEach(e=>{e.type="button"})};r(),new MutationObserver(r).observe(o,{childList:!0,subtree:!0}),e.parentNode.insertBefore(o,e.nextSibling),e.style.display="none",t.render((0,w.jsx)(v,{textarea:e}))}(e)};rwmb.$document.on("mb_ready",()=>{document.querySelectorAll(".rwmb-block_editor-wrapper textarea").forEach(g)}).on("clone",".rwmb-block_editor",function(){setTimeout(()=>g(this),200)})}};const o={};function t(r){const s=o[r];if(void 0!==s)return s.exports;const l=o[r]={exports:{}};return e[r](l,l.exports,t),l.exports}t.m=e,(()=>{const e=[];t.O=(o,r,s)=>{if(!r){for(var l=0;l<e.length;l++){let[r,s]=e[l],i=!0;for(var n=0;n<r.length;n++)t.O.j(r[n])?r.splice(n--,1):i=!1;if(i){e.splice(l--,1);const t=s();void 0!==t&&(o=t)}}return o}e.push([r,s])}})(),t.o=(e,o)=>Object.hasOwn(e,o),t.dn=e=>{var o=Object.getOwnPropertyDescriptor(e,"name");(!o||!o.writable&&o.configurable)&&Object.defineProperty(e,"name",{value:"default",configurable:!0})},(()=>{const e={640:0,281:0};t.O.j=o=>0===e[o];const o=(o,r)=>{let[s,l,n]=r;var i,c,a=0;if(s.some(o=>0!==e[o])){for(i in l)t.o(l,i)&&(t.m[i]=l[i]);if(n)var d=n(t)}for(o&&o(r);a<s.length;a++)c=s[a],t.o(e,c)&&e[c]&&e[c][0](),e[c]=0;return t.O(d)},r=globalThis.webpackChunk||=[];r.forEach(o.bind(null,0)),r.push=o.bind(null,r.push.bind(r))})();let r=t.O(void 0,[281],()=>t(503));r=t.O(r)})();
Save File
Cancel