🏠 Root
/
home
/
artorgp
/
www
/
wp-content
/
plugins
/
login-with-ajax
/
blocks
/
login
/
build
/
Editing: index.js
!function(){"use strict";var e={n:function(l){var t=l&&l.__esModule?function(){return l.default}:function(){return l};return e.d(t,{a:t}),t},d:function(l,t){for(var a in t)e.o(t,a)&&!e.o(l,a)&&Object.defineProperty(l,a,{enumerable:!0,get:t[a]})},o:function(e,l){return Object.prototype.hasOwnProperty.call(e,l)}},l=window.wp.blocks,t=window.wp.element,a=window.wp.blockEditor,n=window.wp.components,o=window.wp.serverSideRender,i=e.n(o),r=window.wp.i18n;(0,l.registerBlockType)("login-with-ajax/login",{edit:function(e){let{attributes:l,setAttributes:o}=e,g=void 0!==wp.textWidgets;const[c,w]=(0,t.useState)(!1);return(0,t.createElement)("div",(0,a.useBlockProps)(),(0,t.createElement)(i(),{block:"login-with-ajax/login",attributes:l}),(0,t.createElement)(a.BlockControls,null,(0,t.createElement)(n.ToolbarGroup,{label:(0,r.__)("Preview Mode","login-with-ajax")},(0,t.createElement)(n.ToolbarItem,{as:"p",style:{"padding-left":"10px"}},(0,r.__)("Preview Mode","login-with-ajax")),(0,t.createElement)(n.ToolbarButton,{label:l.v?(0,r.__)("Viewing whilst logged out.","login-with-ajax"):(0,r.__)("Viewing whilst logged in.","login-with-ajax"),icon:l.v?"unlock":"lock",className:"lwa-view-toggle",onClick:e=>{e.currentTarget.blur(),e.currentTarget.attributes.label=l.v?(0,r.__)("Viewing logged in preview.","login-with-ajax"):(0,r.__)("Viewing logged out preview.","login-with-ajax"),e.currentTarget.firstChild.classList.toggle("dashicons-edit"),e.currentTarget.firstChild.classList.toggle("dashicons-smiley"),o({v:!l.v})}}))),(0,t.createElement)(a.InspectorControls,{key:"inspector"},(0,t.createElement)(n.PanelBody,{title:(0,r.__)("General Options","login-with-ajax")},(0,t.createElement)(n.PanelRow,null,(0,t.createElement)(n.SelectControl,{label:(0,r.__)("Template","login-with-ajax"),value:l.template,options:LoginWithAjax.templates,onChange:e=>o({template:e})})),(0,t.createElement)(n.PanelRow,null,(0,t.createElement)(n.ColorPicker,{label:(0,r.__)("Template Color","login-with-ajax"),color:l.template_color.hex,defaultValue:l.template_color.hex,copyFormat:"hsl",onChangeComplete:e=>{o({template_color:{H:e.hsl.h,S:e.hsl.s,L:e.hsl.l,hex:e.hex}})}})),(0,t.createElement)(n.PanelRow,null,(0,t.createElement)(n.ToggleControl,{label:(0,r.__)("Guest Preview Mode","login-with-ajax"),help:(0,r.__)("View login form as a guest when in editing/preview mode.","login-with-ajax"),checked:l.v,onChange:()=>{w((e=>!e)),o({v:c})}})),g&&(0,t.createElement)(n.PanelRow,null,(0,t.createElement)(n.CheckboxControl,{label:(0,r.__)("Leagacy Widget Title","login-with-ajax"),value:l.widget_title,checked:l.widget_title,onChange:e=>o({widget_title:e}),help:(0,r.__)("New blocks do not display sidebar titles the same way legacy widgets do. If you would like to display the logged in/out titles the same way traditional widgets do for this block, check this box.","login-with-ajax")}))),(0,t.createElement)(n.PanelBody,{title:(0,r.__)("Logged Out","login-with-ajax")},(0,t.createElement)(n.PanelRow,null,(0,t.createElement)(n.TextControl,{label:(0,r.__)("Title","login-with-ajax"),value:l.title,onChange:e=>o({title:e})})),(0,t.createElement)(n.PanelRow,null,(0,t.createElement)(n.SelectControl,{label:(0,r.__)("Show Recover Password?","login-with-ajax"),value:l.remember,onChange:e=>o({remember:e}),options:[{value:0,label:(0,r.__)("No Link","login-with-ajax")},{value:1,label:(0,r.__)("Show link with AJAX form","login-with-ajax")},{value:2,label:(0,r.__)("Show direct link","login-with-ajax")}]})),(0,t.createElement)(n.PanelRow,null,(0,t.createElement)(n.SelectControl,{label:(0,r.__)("AJAX Registration?","login-with-ajax"),value:l.registration,onChange:e=>o({registration:e}),options:[{value:0,label:(0,r.__)("No Link","login-with-ajax")},{value:1,label:(0,r.__)("Show link with AJAX form","login-with-ajax")},{value:2,label:(0,r.__)("Show direct link","login-with-ajax")}]}))),(0,t.createElement)(n.PanelBody,{title:(0,r.__)("Logged In","login-with-ajax")},(0,t.createElement)(n.PanelRow,null,(0,t.createElement)(n.TextControl,{label:(0,r.__)("Title","login-with-ajax"),value:l.title_loggedin,onChange:e=>o({title_loggedin:e})})),(0,t.createElement)(n.PanelRow,null,(0,t.createElement)(n.CheckboxControl,{label:(0,r.__)("Show profile link?","login-with-ajax"),value:l.profile_link,checked:l.profile_link,onChange:e=>o({profile_link:e})})),(0,t.createElement)(n.PanelRow,null,(0,t.createElement)(n.CheckboxControl,{label:(0,r.__)("Show round avatar picture?","login-with-ajax"),value:l.avatar_rounded,checked:l.avatar_rounded,onChange:e=>o({avatar_rounded:e})})),(0,t.createElement)(n.PanelRow,null,(0,t.createElement)(n.RangeControl,{label:(0,r.__)("Avatar size (pixels)","login-with-ajax"),value:l.avatar_size,onChange:e=>o({avatar_size:e}),min:10,max:300})),(0,t.createElement)(n.PanelRow,null,(0,t.createElement)(n.CheckboxControl,{label:(0,r.__)("Display vertically?","login-with-ajax"),value:l.loggedin_vertical,checked:l.loggedin_vertical,onChange:e=>o({loggedin_vertical:e})})))))},save:()=>null,transforms:{from:[{type:"block",blocks:["core/legacy-widget"],isMatch:e=>{let{idBase:l,instance:t}=e;return!(null==t||!t.raw)&&"loginwithajaxwidget"===l},transform:e=>{let{instance:t}=e;return(0,l.createBlock)("login-with-ajax/login",{template:t.raw.template,title:t.raw.title,remember:t.raw.remember,registration:t.raw.registration,title_loggedin:t.raw.title_loggedin,profile_link:t.raw.profile_link,widget_title:!0})}}]}})}();
Save
Cancel