File Editor
Directories:
.. (Back)
Files:
dashboard.asset.php
dashboard.js
dashboard.scss-rtl.css
dashboard.scss.asset.php
dashboard.scss.css
dashboard.scss.js
displayFrame.asset.php
displayFrame.js
form-block.asset.php
form-block.js
nf-behavioral.asset.php
nf-behavioral.js
sub-table-block.asset.php
sub-table-block.js
sub-table-render.asset.php
sub-table-render.js
submissions.asset.php
submissions.js
submissions.scss-rtl.css
submissions.scss.asset.php
submissions.scss.css
submissions.scss.js
Create New File
Create
Edit File: form-block.js
(()=>{var e={2694:(e,t,r)=>{"use strict";var n=r(6925);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,r,o,i,a){if(a!==n){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function t(){return e}e.isRequired=e;var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return r.PropTypes=r,r}},5556:(e,t,r)=>{e.exports=r(2694)()},6925:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";const e=window.React,t=window.wp.element,n=window.wp.components,o=window.wp.blockEditor;function i(e){const[r]=(0,t.useState)((()=>Array.isArray(e.forms)?e.forms:Object.values(e.forms)));return{getFormTitle:e=>{if(e=parseInt(e,10),!r.length)return;let t=r.find((t=>t.formID===e));return t?t.formTitle:void 0},asSelectOptions:()=>r.length?r.map((e=>({label:e.formTitle,value:e.formID}))):[]}}var a=r(5556),l=r.n(a);function s(r){let{formID:o,homeUrl:i,previewToken:a,isBlock:l=!0}=r;const s=(0,t.useId)(),m=(0,t.useRef)(),[c,f]=(0,t.useState)(!0),[p,u]=(0,t.useState)(0),[d,h]=(0,t.useState)("auto");return(0,e.createElement)("div",{id:s,className:"nf-iframe-container"},(0,e.createElement)("div",{className:"nf-iframe-overlay",style:l?{}:{display:"flex",width:"100%",height:"100%",flexDirection:"column",overflow:"hidden"}},c&&(0,e.createElement)(n.Spinner,null),(0,e.createElement)("iframe",{src:`${i}?nf_preview_form=${o}&nf_iframe=${a}`,title:`nf-preview-form-${o}`,ref:e=>m.current=e,onLoad:()=>{f(!1);const e=m.current.contentWindow.document.getElementById(`nf-form-${o}-cont`),t=e.querySelectorAll(".ninja-forms-form-wrap");t&&t.length?(h(t[0].scrollWidth),u(t[0].scrollHeight)):(h(e.scrollWidth),u(e.scrollHeight))},scrolling:"no",height:l&&p?p:"",width:l&&d?d:"",style:{pointerEvents:"none",flexGrow:"1",border:"none",margin:"0",padding:"0"}})))}s.propTypes={formID:l().number.isRequired,homeUrl:l().string.isRequired,previewToken:l().string.isRequired};const m=(0,e.createElement)("svg",{"data-name":"Layer 1",xmlns:"http://www.w3.org/2000/svg",width:"30px",height:"30px",viewBox:"0 0 29.93 13.43"},(0,e.createElement)("path",{fill:"#fff",d:"M22,21.7a4.72,4.72,0,0,0-2.44-4,14.44,14.44,0,0,0-13.38-.06,4.61,4.61,0,0,0-2.53,4Z",transform:"translate(-0.03 -8.27)"}),(0,e.createElement)("path",{fill:"#414242",d:"M3.68,21.7a4.6,4.6,0,0,1,2.53-4,14.44,14.44,0,0,1,13.38,0,4.73,4.73,0,0,1,2.44,4h3.65v-.37a12.76,12.76,0,0,0-1.2-5.42A7.59,7.59,0,0,0,24,15a31.79,31.79,0,0,1,4.14-1c1.36-.28,2.14-.46,1.68-.83-1-.81-2.24-1.68-2.24-1.68s5.05-4.18,0-2.91a9.62,9.62,0,0,0-2.53,1,10.69,10.69,0,0,0-3.13,2.76,12.83,12.83,0,0,0-21.9,9,3.15,3.15,0,0,0,0,.37Z",transform:"translate(-0.03 -8.27)"}),(0,e.createElement)("path",{fill:"#414242",d:"M9.3,21.7c0-1-.58-1.81-1.29-1.81s-1.27.81-1.29,1.81Z",transform:"translate(-0.03 -8.27)"}),(0,e.createElement)("path",{fill:"#414242",d:"M19,21.7c0-1-.59-1.81-1.29-1.81s-1.27.81-1.29,1.81Z",transform:"translate(-0.03 -8.27)"})),c=t=>(0,e.createElement)(n.Placeholder,{icon:(0,e.createElement)("div",null,t.icon?t.icon:m),instructions:"Display a form",style:{alignItems:"center"}},(0,e.createElement)("div",{style:{margin:"auto",width:"50%"}},t.children));c.propTypes={children:l().element.isRequired};const f=r=>{let{formID:o,forms:a,onChange:l,labelText:s}=r;const{asSelectOptions:m}=i({forms:a}),c=(0,t.useMemo)((()=>[{label:"---"},...m()]),[a,m]);return(0,e.createElement)(n.SelectControl,{label:s||"Select Form",value:o,onChange:l,options:c})};function p(r){let{formID:n,forms:a,labelText:l,setAttributes:m,homeUrl:p,previewToken:u,icon:d}=r;const{getFormTitle:h}=i({forms:a}),y=e=>{const t=e?h(e):"";m({formID:parseInt(e),formTitle:t})};return n?(0,e.createElement)(t.Fragment,null,(0,e.createElement)(o.InspectorControls,null,(0,e.createElement)(f,{formID:n,forms:a,onChange:y,labelText:l})),(0,e.createElement)(s,{homeUrl:p,previewToken:u,formID:n})):(0,e.createElement)(c,{icon:d},(0,e.createElement)(f,{label:l||"Select Form",formID:n,forms:a,onChange:y,labelText:l}))}f.propTypes={formID:l().PropTypes.number,forms:l().oneOfType([l().array,l().object]).isRequired,onChange:l().func.isRequired,labelText:l().string},p.propTypes={formID:l().number,forms:l().oneOfType([l().array,l().object]).isRequired,labelText:l().string,setAttributes:l().func.isRequired,homeUrl:l().string.isRequired,previewToken:l().string.isRequired};const u=JSON.parse('{"icon":"feedback","category":"common","attributes":{"formID":{"type":"integer"},"formTitle":{"type":"string"}}}'),d=window.wp.i18n,h=window.wp.blocks,y=window.nfFormsBlock||{},{forms:g,homeUrl:w,previewToken:v}=y;(0,h.registerBlockType)("ninja-forms/form",{...u,title:(0,d.__)("Ninja Form","ninja-forms"),edit:e=>{let{attributes:r,setAttributes:n}=e;return(0,t.createElement)(p,{forms:g,formID:r.formID,formTitle:r.formTitle,setAttributes:n,homeUrl:w,previewToken:v})},save:()=>null,deprecated:[{attributes:{formID:{type:"integer",default:0},formName:{type:"string",default:""}},save:function(e){var r=e.attributes.formID;if(!r)return"";var n="[ninja_forms id="+parseInt(r)+"]";return(0,t.createElement)("div",null,n)}}]})})()})();
Save Changes
Rename File
Rename