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