1 line
15 KiB
JavaScript
1 line
15 KiB
JavaScript
|
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8012],{52507:(e,t,l)=>{l.d(t,{A:()=>E});var a=l(74848),d=l(96540),i=l(620),r=l(17500),s=l(93813),n=l(5338);function o(e){let{editor:t,rootElement:l}=e;return(0,a.jsx)("div",{className:"embed-popup-form-content-wrapper text-sm mt-2 flex-wrap bg-white p-10 rounded max-w-2xl w-full",children:(0,a.jsxs)("form",{onSubmit:e=>{e.preventDefault();let a=e.target["embed-text-area"].value;if(!(null==a?void 0:a.match(/./)))return alert("Please Enter HTML Text to continue.");t.insertContent(a),document.body.removeChild(l)},className:"w-full flex flex-col items-stretch gap-2",children:[(0,a.jsx)("h3",{className:"m-0 text-center text-lg",children:"Enter HTML code"}),(0,a.jsx)("textarea",{name:"embed-text-area",id:"embed-text-area",cols:30,rows:10,placeholder:"Paste Code here ..."}),(0,a.jsx)("button",{type:"submit",children:"Embed"})]})})}function c(e){let{editor:t}=e;navigator.clipboard.writeText((null==t?void 0:t.getContent())||"").then(()=>{alert("Html Copied to Clipboard!")})}var u=l(76897),m=l(85471),p=l.n(m);function f(e){let{editor:t,rootElement:l}=e,i=t.getContent(),r=d.useRef(),s=d.useRef(),[n,o]=d.useState(null);return d.useEffect(()=>{try{var e;if(!(null===(e=ace)||void 0===e?void 0:e.edit)||!r.current){console.log("Ace Editor not found!");return}let t=ace.edit(r.current);t.setOptions({mode:"ace/mode/html",value:p()(i)}),o(t);try{ace.require("ace/ext/beautify").beautify(t.session)}catch(e){}}catch(e){console.log("JSON Editor ERROR =>",e.message)}},[]),(0,a.jsxs)("div",{onKeyUp:e=>{if(e.ctrlKey&&"Enter"==e.key){var t;null===(t=s.current)||void 0===t||t.click()}},children:[(0,a.jsx)("div",{className:"embed-popup-form-content-wrapper relative flex flex-col items-center justify-center",children:(0,a.jsxs)("div",{className:"max-w-[1200px] rounded-md overflow-hidden bg-white w-[90vw] items-start justify-start relative",children:[(0,a.jsx)("div",{ref:r,className:"w-full h-[80vh] text-[18px]"}),(0,a.jsx)("button",{className:"absolute bottom-4 right-4",onClick:e=>{if(n){let e=n.getValue();t.setContent(e),setTimeout(()=>{document.body.removeChild(l)},200)}},ref:s,children:"Save"})]})}),(0,a.jsx)("button",{className:"absolute top-4 right-8 rounded-full white",onClick:()=>{try{document.body.removeChild(l)}catch(e){}},style:{width:"40px",height:"40px",padding:"0",zIndex:"12039800000"},children:(0,a.jsx)(u.A,{})})]})}function x(e){let{editor:t}=e,l=document.createElement("div");l.style.position="fixed",l.style.width="100vw",l.style.height="100vh",l.style.zIndex="123000000000000000",l.style.backgroundColor="rgba(0,0,0,0.8)",l.style.display="flex",l.style.alignItems="center",l.style.justifyContent="center",l.style.top="0",l.style.left="0",document.body.append(l),l.onclick=e=>{e.target.closest(".embed-popup-form-content-wrapper")||document.body.removeChild(l)},t&&n.createRoot(l).render((0,a.jsx)(f,{editor:t,rootElement:l}))}function h(e){let{editor:t}=e,l=document.createElement("div");l.style.position="fixed",l.style.width="100vw",l.style.height="100vh",l.style.zIndex="123000000000000000",l.style.backgroundColor="rgba(0,0,0,0.8)",l.style.display="flex",l.style.alignItems="center",l.style.justifyContent="center",l.style.top="0",l.style.left="0",document.body.append(l),l.onclick=e=>{if(e.target.closest(".embed-popup-form-content-wrapper")){console.log("Still In Form");return}document.body.removeChild(l)},t&&n.createRoot(l).render((0,a.jsx)(o,{editor:t,rootElement:l}))}function b(e){let{fieldObject:t,dataTypeSchema:l,richTextEditors:n,entry:o,currentRichTextEditorForms:u,entryPage:m,formButtonId:p}=e,[f,b]=d.useState(!1),y=d.useRef(),v=d.useRef();return d.useEffect(()=>{b(!0)},[]),d.useEffect(()=>{f&&(n.current.push({fieldName:t.fieldName||"",ref:v}),u.current.push({fieldName:t.fieldName||"",ref:v}))},[f]),(0,a.jsxs)("div",{className:"flex flex-col items-start gap-0 w-full rich-text-editor-wrapper",children:[(0,a.jsxs)("label",{className:"font-bold text-slate-700 dark:text-slate-300 text-base px-3 py-1 bg-slate-100 dark:bg-slate-700 rounded-t-md border border-solid border-sl
|