dsql-admin/dsql-app/.local_dist/static/chunks/2163-2888548322298e53.js

1 line
15 KiB
JavaScript
Raw Permalink Normal View History

2024-12-09 09:39:09 +00:00
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2163],{8214:(e,t,l)=>{l.d(t,{A:()=>T});var a=l(4848),d=l(6540),i=l(620),r=l(3813),n=l(5338);function s(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 o(e){let{editor:t}=e;navigator.clipboard.writeText((null==t?void 0:t.getContent())||"").then(()=>{alert("Html Copied to Clipboard!")})}var c=l(6897),u=l(5471),m=l.n(u);function p(e){let{editor:t,rootElement:l}=e,i=t.getContent(),r=d.useRef(),n=d.useRef(),[s,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:m()(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=n.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(s){let e=s.getValue();t.setContent(e),setTimeout(()=>{document.body.removeChild(l)},200)}},ref:n,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)(c.A,{})})]})}function f(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)(p,{editor:t,rootElement:l}))}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=>{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)(s,{editor:t,rootElement:l}))}var h=l(6446);function b(e){let{fieldObject:t,dataTypeSchema:l,richTextEditors:n,entry:s,currentRichTextEditorForms:c,entryPage:u,formButtonId:m}=e,[p,b]=d.useState(!1),v=d.useRef(),y=d.useRef();return d.useEffect(()=>{b(!0)},[]),d.useEffect(()=>{p&&(n.current.push({fieldName:t.fieldName||"",ref:y}),c.current.push({fieldName:t.fieldName||"",ref:y}))},[p]),(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-slate