View file File name : d5364615d9e73d44cc26.js Content :"use strict";(self.webpackChunkneve=self.webpackChunkneve||[]).push([[63],{63:(e,t,i)=>{i.r(t),i.d(t,{default:()=>l});var n=i(307),o=i(697),a=i.n(o),s=i(167);const r=({onChange:e,currentValue:t,label:i,id:o,toolbars:a,allowedDynamicFields:r})=>{var l,c;const d=(0,n.useRef)(null),u=Boolean(Array.isArray(r)&&r.length),m="formatselect,bold,italic,bullist,numlist,link,wp_adv",v="strikethrough,hr,forecolor,pastetext,removeformat",{toolbar1:f=m,toolbar2:y=v}=a,w=`${o}-editor`;NeveReactCustomize.fieldSelection={};const g=wp.oldEditor||wp.editor,h=(0,n.useCallback)((()=>e(g.getContent(w))),[w]),p=()=>{window.tinymce.editors[w]&&window.tinymce.editors[w].on("change",h)},b=t=>{e(t),window.tinymce.editors[w].setContent(t)};return(0,n.useEffect)((()=>{d&&d.current&&(d.current.addEventListener("change",(()=>{b(d.current.value)})),d.current.addEventListener("focusout",(function(e){NeveReactCustomize.fieldSelection[o]={start:e.target.selectionStart,end:e.target.selectionEnd}}))),g.initialize(w,{quicktags:!0,mediaButtons:!0,tinymce:{toolbar1:f,toolbar2:y,style_formats_merge:!0,style_formats:[],verify_html:!1}}),setTimeout(p,0),wp.oldEditor&&setTimeout((()=>{window.tinymce.editors[w]&&window.tinymce.editors[w].off("change",h),g.remove(w),g.initialize(w,{quicktags:!0,mediaButtons:!0,tinymce:{toolbar1:f,toolbar2:y,style_formats_merge:!0,style_formats:[],verify_html:!1}}),setTimeout(p,0)}),300)}),[]),(0,n.useEffect)((()=>{document.addEventListener("neve-changed-customizer-value",(e=>!!e.detail&&e.detail.id===o&&void b(e.detail.value)))}),[]),(0,n.createElement)("div",{className:"neve-white-background-control neve-rich-text",style:{position:"relative"}},(0,n.createElement)("span",{className:"customize-control-title"},i),u&&(0,n.createElement)("span",{style:{position:"absolute",top:0,right:"8px"}},(0,n.createElement)(s.Z,{options:(null===(l=NeveReactCustomize)||void 0===l||null===(c=l.dynamicTags)||void 0===c?void 0:c.options)||[],allowedOptionsTypes:r,onSelect:(e,t)=>function(e,t){let i;const n=d.current;if(i="url"===t?`<a href="{${e}}">Link</a>`:`{${e}}`,window.tinymce.editors[w].hidden){if(NeveReactCustomize.fieldSelection[o]){const{start:e,end:t}=NeveReactCustomize.fieldSelection[o],a=n.value.length;n.value=n.value.substring(0,e)+i+n.value.substring(t,a)}else n.value+=i;n.focus()}else window.tinymce.editors[w].editorCommands.execCommand("mceInsertContent",!1,i),window.tinymce.editors[w].focus();n.dispatchEvent(new Event("change"))}(e,t)})),(0,n.createElement)("textarea",{ref:d,id:w,className:"neve-custom-html-control-tinymce-editor mce-tinymce",value:t,style:{width:"100%"},onChange:({target:{value:t}})=>e(t)}))};r.propTypes={id:a().string.isRequired,toolbars:a().object,allowedDynamicFields:a().array,label:a().string.isRequired,onChange:a().func.isRequired,currentValue:a().string.isRequired};const l=r}}]);