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