← Back
Editing: wp-editor.bundle.min.js
(()=>{var e={755:()=>{const{cssJsPanel:e}=FLBuilderConfig;if(e){const{PluginDocumentSettingPanel:e}=wp.editor||wp.editPost,{useEntityProp:t}=wp.coreData,{TextareaControl:o}=wp.components,{__:n}=wp.i18n,{registerPlugin:s}=wp.plugins;s("fl-builder-css-js-panel",{render:()=>{const s=wp.data.useSelect(e=>e("core/editor").getCurrentPostType(),[]),[i,l]=t("postType",s,"fl_builder_css_js");if(!s)return null;const r=i?i.css:"",c=i?i.js:"";return wp.element.createElement(e,{name:"fl-builder-css-js",title:n("Builder CSS/JS","fl-builder")},wp.element.createElement(o,{label:n("CSS","fl-builder"),value:r,onChange:e=>l({...i||{},css:e}),rows:10}),wp.element.createElement(o,{label:n("JS","fl-builder"),value:c,onChange:e=>l({...i||{},js:e}),rows:10}))}})}},870:()=>{const{registerStore:e}=wp.data,t={launching:!1};e("fl-builder",{reducer:(e=t,o)=>("SET_LAUNCHING"===o.type&&(e.launching=o.launching),e),actions:{setLaunching:e=>({type:"SET_LAUNCHING",launching:e})},selectors:{isLaunching:e=>e.launching}})}},t={};function o(n){var s=t[n];if(void 0!==s)return s.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,o),i.exports}(()=>{"use strict";const e=(t=null,o=!1)=>{const{wp:n={}}=window||{},{data:s={},blocks:i={}}=n,{dispatch:l,select:r}=s,{createBlock:c}=i,{replaceBlock:a}=l("core/block-editor");if(!0!=(null!==t&&"object"==typeof t&&null!==t.clientId&&"string"==typeof t.clientId))return!1;const u=r("core/block-editor").getBlock(t.clientId);if(1!=!u){const{clientId:t="",isValid:s=!0,innerBlocks:i=[]}=u,l=null!==i&&Array.isArray(i)&&i.length>=1;!0!==s&&(a(t,(({name:e="",attributes:t={},innerBlocks:o=[]})=>c(e,t,o))(u)),!0===o&&n.data.dispatch("core/editor").savePost()),l&&i.forEach((t={})=>{e(t,o)})}return!1},{wp:t={}}=window||{},{domReady:n,data:s}=t;jQuery(document).on("fl-builder-fix-blocks",function(){!0==(!0===(!0===jQuery("body").hasClass("post-php")&&jQuery(".block-editor").length>=1&&jQuery("body").hasClass("fl-builder-blocks"))&&!0==(void 0!==n&&void 0!==s))&&((t=!1)=>{const{wp:o={}}=window||{},{domReady:n,data:s={}}=o,{select:i}=s;n(function(){setTimeout(function(){const o=i("core/block-editor").getBlocks();!0===(Array.isArray(o)&&o.length>=1)&&o.forEach((o={})=>{e(o,t)})},1)})})(!1)}),o(870);const i=e=>!(!e||!e.length)&&e.some(e=>!(!e.name||0!==e.name.indexOf("fl-ds/"))||i(e.innerBlocks)),l=e=>!i(e)||(alert("Converting design system blocks to Beaver Builder is currently not supported. Doing so would destroy the layout."),!1),{builder:r,strings:c,urls:a}=FLBuilderConfig,{rawHandler:u,serialize:d}=wp.blocks,{Button:p,Placeholder:h,Spinner:b}=wp.components,{compose:m}=wp.compose,{withDispatch:g,withSelect:w}=wp.data,{Component:k}=wp.element,B=m(g((e,t)=>{const o=e("core/block-editor"),n=e("core/editor"),s=e("fl-builder");return{removeBlocks:o.removeBlocks,replaceBlocks:o.replaceBlocks,savePost:n.savePost,setLaunching:s.setLaunching}}),w(e=>{const t=e("core/block-editor"),o=(e("core/editor"),e("fl-builder"));return{blockCount:t.getBlockCount(),blocks:t.getBlocks(),isLaunching:o.isLaunching()}}))(class extends k{constructor(){super(...arguments)}componentDidMount(){const{blockCount:e}=this.props;1===e&&this.toggleEditor("disable")}componentWillUnmount(){this.toggleEditor("enable")}render(){const{blockCount:e,onReplace:t,isLaunching:o}=this.props;let n,s,i;return 1===e?(n=r.access?c.launch:c.view,s=this.launchBuilder.bind(this)):(n=c.convert,s=this.convertToBuilder.bind(this)),i=r.enabled?c.active:c.description,!1===r.showui?"":React.createElement(h,{key:"placeholder",instructions:i,label:c.title,className:"fl-builder-layout-launch-view"},o&&React.createElement(b,null),!o&&React.createElement(p,{isLarge:!0,isPrimary:!0,type:"submit",onClick:s},n),!o&&React.createElement(p,{isLarge:!0,type:"submit",onClick:this.convertToBlocks.bind(this)},c.editor))}toggleEditor(e="enable"){const{classList:t}=window.top.document.body,o="fl-builder-layout-enabled";"enable"===e?t.contains(o)&&t.remove(o):t.contains(o)||t.add(o)}launchBuilder(){const{savePost:e,setLaunching:t}=this.props;t(!0),wp.data.select("core/editor").getEditedPostAttribute("title")||wp.data.dispatch("core/editor").editPost({title:wp.i18n.__("(no title)")}),e().then(()=>{setTimeout(function(){window.top.location.href=r.access?a.edit:a.view},2e3)})}convertToBuilder(){const{clientId:e,blocks:t,setAttributes:o,removeBlocks:n}=this.props;if(!l(t))return;const s=d(t),i=t.map(e=>e.clientId).filter(t=>t!==e);o({content:s.replace(/<!--(.*?)-->/g,"")}),n(i),this.launchBuilder()}convertToBlocks(){const{attributes:e,clientId:t,replaceBlocks:o,onReplace:n}=this.props;e.content&&!confirm(c.warning)||(e.content?o([t],u({HTML:e.content,mode:"BLOCKS"})):n([]))}}),{builder:f,strings:y}=FLBuilderConfig,{registerBlockType:v}=wp.blocks,{useBlockProps:C}=wp.blockEditor,{RawHTML:P,createElement:L}=wp.element;(f.access&&f.unrestricted||f.enabled)&&v("fl-builder/layout",{apiVersion:3,title:y.title,description:y.description,icon:"welcome-widgets-menus",category:"layout",useOnce:!0,supports:{customClassName:!1,className:!1,html:!1},attributes:{content:{type:"string",source:"html"}},edit:e=>{const t=C();return L("div",t,L(B,e))},save:({attributes:e})=>React.createElement(P,null,e.content)});const{builder:E,strings:T,urls:S}=FLBuilderConfig,{createBlock:I,serialize:j}=wp.blocks,{Button:R}=wp.components,{compose:_}=wp.compose,{withDispatch:x,withSelect:A}=wp.data,{PluginMoreMenuItem:N}=wp.editor||wp.editPost,{Component:D}=wp.element,Q=_(x((e,t)=>{const o=e("core/block-editor"),n=e("core/editor"),s=e("fl-builder");return{insertBlock:o.insertBlock,removeBlocks:o.removeBlocks,savePost:n.savePost,setLaunching:s.setLaunching}}),A(e=>({blocks:e("core/block-editor").getBlocks()})))(class extends D{render(){return this.hasBuilderBlock()&&(jQuery("body").addClass("fl-builder-blocks"),jQuery(document).trigger("fl-builder-fix-blocks")),React.createElement(N,{onClick:this.menuItemClicked.bind(this)},this.hasBuilderBlock()?T.launch:T.convert)}hasBuilderBlock(){const{blocks:e}=this.props;return!!e.filter(e=>"fl-builder/layout"===e.name).length}menuItemClicked(){this.hasBuilderBlock()?this.launchBuilder():this.convertToBuilder()}convertToBuilder(){const{blocks:e,insertBlock:t,removeBlocks:o}=this.props;if(!l(e))return;const n=e.map(e=>e.clientId),s=j(e).replace(/<!--(.*?)-->/g,"");t(I("fl-builder/layout",{content:s}),0),o(n)}launchBuilder(){const{savePost:e,setLaunching:t}=this.props;t(!0),wp.data.select("core/editor").getEditedPostAttribute("title")||wp.data.dispatch("core/editor").editPost({title:wp.i18n.__("(no title)")}),e().then(()=>{setTimeout(function(){window.location.href=E.access?S.edit:S.view},2e3)})}}),{registerPlugin:H}=wp.plugins;H("fl-builder-plugin-sidebar",{icon:"welcome-widgets-menus",render:Q}),o(755)})()})();
Save File
Cancel