wp-editor.bundle.min.js 18 KB

1
  1. (()=>{var e={585:()=>{var e=wp.data.registerStore,t={launching:!1};e("fl-builder",{reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,n=arguments.length>1?arguments[1]:void 0;if("SET_LAUNCHING"===n.type)e.launching=n.launching;return e},actions:{setLaunching:function(e){return{type:"SET_LAUNCHING",launching:e}}},selectors:{isLaunching:function(e){return e.launching}}})}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}(()=>{"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}var t=function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=window||{},i=r.wp,c=void 0===i?{}:i,u=c.data,l=void 0===u?{}:u,s=c.blocks,a=void 0===s?{}:s,f=l.dispatch,p=l.select,d=a.createBlock,y=f("core/block-editor"),b=y.replaceBlock,h=function(e){var t=e.name,n=void 0===t?"":t,o=e.attributes,r=void 0===o?{}:o,i=e.innerBlocks;return d(n,r,void 0===i?[]:i)},v=null!==n&&"object"===e(n)&&null!==n.clientId&&"string"==typeof n.clientId;if(!0!==v)return!1;var m=p("core/block-editor").getBlock(n.clientId);if(!0!=!m){var k=m.clientId,w=void 0===k?"":k,g=m.isValid,B=void 0===g||g,P=m.innerBlocks,O=void 0===P?[]:P,j=null!==O&&Array.isArray(O)&&O.length>=1;if(!0!==B){var S=h(m);b(w,S),!0===o&&c.data.dispatch("core/editor").savePost()}j&&O.forEach((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t(e,o)}))}return!1},o=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=window||{},o=n.wp,r=void 0===o?{}:o,i=r.domReady,c=r.data,u=void 0===c?{}:c,l=u.select;i((function(){setTimeout((function(){var n=l("core/block-editor").getBlocks();!0===(Array.isArray(n)&&n.length>=1)&&n.forEach((function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t(n,e)}))}),1)}))};var r=(window||{}).wp,i=void 0===r?{}:r,c=i.domReady,u=i.data;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!==c&&void 0!==u))&&o(!1)}));n(585);function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function f(e,t){return f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},f(e,t)}function p(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=y(e);if(t){var r=y(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return d(this,n)}}function d(e,t){if(t&&("object"===l(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}var b=FLBuilderConfig,h=b.builder,v=b.strings,m=b.urls,k=wp.blocks,w=k.rawHandler,g=k.serialize,B=wp.components,P=B.Button,O=B.Placeholder,j=B.Spinner,S=wp.compose.compose,R=wp.data,C=R.withDispatch,L=R.withSelect,E=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}(i,e);var t,n,o,r=p(i);function i(){return s(this,i),r.apply(this,arguments)}return t=i,n=[{key:"componentDidMount",value:function(){1===this.props.blockCount&&this.toggleEditor("disable")}},{key:"componentWillUnmount",value:function(){this.toggleEditor("enable")}},{key:"render",value:function(){var e,t,n,o=this.props,r=o.blockCount,i=(o.onReplace,o.isLaunching);return 1===r?(e=h.access?v.launch:v.view,t=this.launchBuilder.bind(this)):(e=v.convert,t=this.convertToBuilder.bind(this)),n=h.enabled?v.active:v.description,!1===h.showui?"":React.createElement(O,{key:"placeholder",instructions:n,label:v.title,className:"fl-builder-layout-launch-view"},i&&React.createElement(j,null),!i&&React.createElement(P,{isLarge:!0,isPrimary:!0,type:"submit",onClick:t},e),!i&&React.createElement(P,{isLarge:!0,type:"submit",onClick:this.convertToBlocks.bind(this)},v.editor))}},{key:"toggleEditor",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"enable",t=document.body.classList,n="fl-builder-layout-enabled";"enable"===e?t.contains(n)&&t.remove(n):t.contains(n)||t.add(n)}},{key:"launchBuilder",value:function(){var e=this.props,t=e.savePost;(0,e.setLaunching)(!0),wp.data.select("core/editor").getEditedPostAttribute("title")||wp.data.dispatch("core/editor").editPost({title:wp.i18n.__("(no title)")}),t().then((function(){setTimeout((function(){window.top.location.href=h.access?m.edit:m.view}),2e3)}))}},{key:"convertToBuilder",value:function(){var e=this.props,t=e.clientId,n=e.blocks,o=e.setAttributes,r=e.removeBlocks,i=g(n),c=n.map((function(e){return e.clientId})).filter((function(e){return e!==t}));o({content:i.replace(/<!--(.*?)-->/g,"")}),r(c),this.launchBuilder()}},{key:"convertToBlocks",value:function(){var e=this.props,t=e.attributes,n=e.clientId,o=e.replaceBlocks,r=e.onReplace;t.content&&!confirm(v.warning)||(t.content?o([n],w({HTML:t.content,mode:"BLOCKS"})):r([]))}}],n&&a(t.prototype,n),o&&a(t,o),Object.defineProperty(t,"prototype",{writable:!1}),i}(wp.element.Component),_=S(C((function(e,t){var n=e("core/block-editor"),o=e("core/editor"),r=e("fl-builder");return{removeBlocks:n.removeBlocks,replaceBlocks:n.replaceBlocks,savePost:o.savePost,setLaunching:r.setLaunching}})),L((function(e){var t=e("core/block-editor"),n=(e("core/editor"),e("fl-builder"));return{blockCount:t.getBlockCount(),blocks:t.getBlocks(),isLaunching:n.isLaunching()}})))(E);function T(e){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},T(e)}function I(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function x(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function D(e,t){return D=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},D(e,t)}function A(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=N(e);if(t){var r=N(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return F(this,n)}}function F(e,t){if(t&&("object"===T(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return M(e)}function M(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function N(e){return N=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},N(e)}var H=FLBuilderConfig,Q=H.builder,U=H.strings,G=H.urls,z=wp.blocks,K=z.rawHandler,W=z.serialize,V=wp.components,q=V.Button,J=V.Placeholder,X=V.Spinner,Y=wp.compose.compose,Z=wp.data,$=Z.subscribe,ee=Z.withDispatch,te=Z.withSelect,ne=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&D(e,t)}(i,e);var t,n,o,r=A(i);function i(){var e;return I(this,i),(e=r.apply(this,arguments)).unsubscribe=$(e.storeDidUpdate.bind(M(e))),e}return t=i,n=[{key:"storeDidUpdate",value:function(){var e=this.props,t=e.isLaunching,n=e.isSavingPost;t&&!n&&(this.unsubscribe(),this.redirectToBuilder())}},{key:"componentDidMount",value:function(){1===this.props.blockCount&&this.toggleEditor("disable")}},{key:"componentWillUnmount",value:function(){this.unsubscribe(),this.toggleEditor("enable")}},{key:"render",value:function(){var e,t,n,o=this.props,r=o.blockCount,i=(o.onReplace,o.isLaunching);return 1===r?(e=Q.access?U.launch:U.view,t=this.launchBuilder.bind(this)):(e=U.convert,t=this.convertToBuilder.bind(this)),n=Q.enabled?U.active:U.description,!1===Q.showui?"":React.createElement(J,{key:"placeholder",instructions:n,icon:"welcome-widgets-menus",label:U.title,className:"fl-builder-layout-launch-view"},i&&React.createElement(X,null),!i&&React.createElement(q,{isLarge:!0,isPrimary:!0,type:"submit",onClick:t},e),!i&&React.createElement(q,{isLarge:!0,type:"submit",onClick:this.convertToBlocks.bind(this)},U.editor))}},{key:"toggleEditor",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"enable",t=document.body.classList,n="fl-builder-layout-enabled";"enable"===e?t.contains(n)&&t.remove(n):t.contains(n)||t.add(n)}},{key:"redirectToBuilder",value:function(){window.location.href=Q.access?G.edit:G.view}},{key:"launchBuilder",value:function(){var e=this.props,t=e.savePost;(0,e.setLaunching)(!0),t()}},{key:"convertToBuilder",value:function(){var e=this.props,t=e.clientId,n=e.blocks,o=e.setAttributes,r=e.removeBlocks,i=W(n),c=n.map((function(e){return e.clientId})).filter((function(e){return e!==t}));o({content:i.replace(/<!--(.*?)-->/g,"")}),r(c),this.launchBuilder()}},{key:"convertToBlocks",value:function(){var e=this.props,t=e.attributes,n=e.clientId,o=e.replaceBlocks,r=e.onReplace;t.content&&!confirm(U.warning)||(t.content?o([n],K({HTML:t.content,mode:"BLOCKS"})):r([]))}}],n&&x(t.prototype,n),o&&x(t,o),Object.defineProperty(t,"prototype",{writable:!1}),i}(wp.element.Component),oe=Y(ee((function(e,t){var n=e("core/editor"),o=e("fl-builder");return{savePost:n.savePost,removeBlocks:n.removeBlocks,replaceBlocks:n.replaceBlocks,setLaunching:o.setLaunching}})),te((function(e){var t=e("core/editor"),n=e("fl-builder");return{blockCount:t.getBlockCount(),blocks:t.getBlocks(),isSavingPost:t.isSavingPost(),isLaunching:n.isLaunching()}})))(ne),re=FLBuilderConfig,ie=re.builder,ce=re.strings,ue=FLBuilderConfig.wp.version,le=wp.blocks.registerBlockType,se=wp.element.RawHTML;function ae(e){return ae="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ae(e)}function fe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pe(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function de(e,t){return de=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},de(e,t)}function ye(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=he(e);if(t){var r=he(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return be(this,n)}}function be(e,t){if(t&&("object"===ae(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function he(e){return he=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},he(e)}(ie.access&&ie.unrestricted||ie.enabled)&&le("fl-builder/layout",{title:ce.title,description:ce.description,icon:"welcome-widgets-menus",category:"layout",useOnce:!0,supports:{customClassName:!1,className:!1,html:!1},attributes:{content:{type:"string",source:"html"}},edit:parseFloat(ue)<5.3?oe:_,save:function(e){var t=e.attributes;return React.createElement(se,null,t.content)}});var ve=FLBuilderConfig,me=ve.builder,ke=ve.strings,we=ve.urls,ge=wp.blocks,Be=ge.createBlock,Pe=ge.serialize,Oe=(wp.components.Button,wp.compose.compose),je=wp.data,Se=je.withDispatch,Re=je.withSelect,Ce=wp.editPost.PluginMoreMenuItem,Le=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&de(e,t)}(i,e);var t,n,o,r=ye(i);function i(){return fe(this,i),r.apply(this,arguments)}return t=i,(n=[{key:"render",value:function(){return this.hasBuilderBlock()&&(jQuery("body").addClass("fl-builder-blocks"),jQuery(document).trigger("fl-builder-fix-blocks")),React.createElement(Ce,{onClick:this.menuItemClicked.bind(this)},this.hasBuilderBlock()?ke.launch:ke.convert)}},{key:"hasBuilderBlock",value:function(){return!!this.props.blocks.filter((function(e){return"fl-builder/layout"===e.name})).length}},{key:"menuItemClicked",value:function(){this.hasBuilderBlock()?this.launchBuilder():this.convertToBuilder()}},{key:"convertToBuilder",value:function(){var e=this.props,t=e.blocks,n=e.insertBlock,o=e.removeBlocks,r=t.map((function(e){return e.clientId})),i=Pe(t).replace(/<!--(.*?)-->/g,"");n(Be("fl-builder/layout",{content:i}),0),o(r)}},{key:"launchBuilder",value:function(){var e=this.props,t=e.savePost;(0,e.setLaunching)(!0),wp.data.select("core/editor").getEditedPostAttribute("title")||wp.data.dispatch("core/editor").editPost({title:wp.i18n.__("(no title)")}),t().then((function(){setTimeout((function(){window.location.href=me.access?we.edit:we.view}),2e3)}))}}])&&pe(t.prototype,n),o&&pe(t,o),Object.defineProperty(t,"prototype",{writable:!1}),i}(wp.element.Component),Ee=Oe(Se((function(e,t){var n=e("core/block-editor"),o=e("core/editor"),r=e("fl-builder");return{insertBlock:n.insertBlock,removeBlocks:n.removeBlocks,savePost:o.savePost,setLaunching:r.setLaunching}})),Re((function(e){return{blocks:e("core/block-editor").getBlocks()}})))(Le);function _e(e){return _e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_e(e)}function Te(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ie(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function xe(e,t){return xe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},xe(e,t)}function De(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=Fe(e);if(t){var r=Fe(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return Ae(this,n)}}function Ae(e,t){if(t&&("object"===_e(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Fe(e){return Fe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Fe(e)}var Me=FLBuilderConfig.strings,Ne=wp.blocks,He=Ne.createBlock,Qe=Ne.serialize,Ue=(wp.components.Button,wp.compose.compose),Ge=wp.data,ze=Ge.withDispatch,Ke=Ge.withSelect,We=wp.editPost.PluginSidebarMoreMenuItem,Ve=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&xe(e,t)}(i,e);var t,n,o,r=De(i);function i(){return Te(this,i),r.apply(this,arguments)}return t=i,(n=[{key:"render",value:function(){return React.createElement(We,null,React.createElement("div",{className:"fl-builder-plugin-sidebar-button",onClick:this.menuItemClicked.bind(this)}),this.hasBuilderBlock()?Me.launch:Me.convert)}},{key:"hasBuilderBlock",value:function(){return!!this.props.blocks.filter((function(e){return"fl-builder/layout"===e.name})).length}},{key:"menuItemClicked",value:function(){var e=this.props.closeGeneralSidebar;this.hasBuilderBlock()?this.launchBuilder():this.convertToBuilder(),setTimeout(e,100)}},{key:"convertToBuilder",value:function(){var e=this.props,t=e.blocks,n=e.insertBlock,o=e.removeBlocks,r=t.map((function(e){return e.clientId})),i=Qe(t).replace(/<!--(.*?)-->/g,"");n(He("fl-builder/layout",{content:i}),0),o(r)}},{key:"launchBuilder",value:function(){var e=this.props,t=e.savePost;(0,e.setLaunching)(!0),t()}}])&&Ie(t.prototype,n),o&&Ie(t,o),Object.defineProperty(t,"prototype",{writable:!1}),i}(wp.element.Component),qe=Ue(ze((function(e,t){var n=e("core/editor"),o=e("core/edit-post"),r=e("fl-builder");return{savePost:n.savePost,insertBlock:n.insertBlock,removeBlocks:n.removeBlocks,closeGeneralSidebar:o.closeGeneralSidebar,setLaunching:r.setLaunching}})),Ke((function(e){return{blocks:e("core/editor").getBlocks()}})))(Ve),Je=FLBuilderConfig.wp.version;(0,wp.plugins.registerPlugin)("fl-builder-plugin-sidebar",{icon:"welcome-widgets-menus",render:parseFloat(Je)<5.3?qe:Ee})})()})();