"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[7579],{57579:(e,t,a)=>{a.r(t),a.d(t,{default:()=>c});var n=a(51609),l=a(86087),r=a(96540),u=a(62819),o=a.n(u),i=a(27723),s=a(4219);const c=(0,l.memo)((({id:e,value:t,onChange:a})=>{const[u,c]=(0,l.useState)(t),[d,m]=(0,l.useState)("wysiwyg"),[g,b]=(0,l.useState)(t),{getFieldValue:h,updateField:w,setChangedField:f}=(0,s.default)();return(0,l.useEffect)((()=>{if(g===t)return;const e=setTimeout((()=>{c(g)}),500);return()=>{clearTimeout(e)}}),[g]),(0,l.useEffect)((()=>{if(u===t)return;const n=setTimeout((()=>{w(e,u),b(u),f(e,u),a(u)}),500);return()=>{clearTimeout(n)}}),[u]),(0,l.useEffect)((()=>{c(t)}),[h(e)]),(0,n.createElement)(n.Fragment,null,(0,n.createElement)("button",{className:"button button-default",onClick:e=>{m("wysiwyg"===d?"html":"wysiwyg")}},"wysiwyg"===d&&"HTML","html"===d&&(0,i.__)("Editor","complianz-gdpr")),"html"===d&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)("textarea",{rows:"8",onChange:e=>{return t=e.target.value,b(t),void c(t);var t},value:g})),"wysiwyg"===d&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)(r.CKEditor,{editor:o(),config:{toolbar:["undo","redo","heading","|","bold","italic","link","bulletedList","numberedList","blockQuote","insertTable"]},data:u,onChange:(e,t)=>{const a=t.getData();c(a)}})))}))}}]);