import e,{Component as t}from"react";import{DomHandler as n,classNames as r}from"primereact/utils";function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n

"===r&&(r=null),e.props.onTextChange&&e.props.onTextChange({htmlValue:r,textValue:l,delta:t,source:n})})),e.quill.on("selection-change",(function(t,n,r){e.props.onSelectionChange&&e.props.onSelectionChange({range:t,oldRange:n,source:r})})))})).then((function(){e.quill&&e.quill.getModule("toolbar")&&e.props.onLoad&&e.props.onLoad(e.quill)}))}},{key:"componentDidUpdate",value:function(e){this.props.value!==e.value&&this.quill&&!this.quill.hasFocus()&&(this.props.value?this.quill.setContents(this.quill.clipboard.convert(this.props.value)):this.quill.setText(""))}},{key:"render",value:function(){var t=this,n=r("p-component p-editor-container",this.props.className),l=null;return!1===this.props.showHeader?(l="",this.toolbarElement=void 0):l=this.props.headerTemplate?e.createElement("div",{ref:function(e){return t.toolbarElement=e},className:"p-editor-toolbar"},this.props.headerTemplate):e.createElement("div",{ref:function(e){return t.toolbarElement=e},className:"p-editor-toolbar"},e.createElement("span",{className:"ql-formats"},e.createElement("select",{className:"ql-header",defaultValue:"0"},e.createElement("option",{value:"1"},"Heading"),e.createElement("option",{value:"2"},"Subheading"),e.createElement("option",{value:"0"},"Normal")),e.createElement("select",{className:"ql-font"},e.createElement("option",null),e.createElement("option",{value:"serif"}),e.createElement("option",{value:"monospace"}))),e.createElement("span",{className:"ql-formats"},e.createElement("button",{type:"button",className:"ql-bold","aria-label":"Bold"}),e.createElement("button",{type:"button",className:"ql-italic","aria-label":"Italic"}),e.createElement("button",{type:"button",className:"ql-underline","aria-label":"Underline"})),e.createElement("span",{className:"ql-formats"},e.createElement("select",{className:"ql-color"}),e.createElement("select",{className:"ql-background"})),e.createElement("span",{className:"ql-formats"},e.createElement("button",{type:"button",className:"ql-list",value:"ordered","aria-label":"Ordered List"}),e.createElement("button",{type:"button",className:"ql-list",value:"bullet","aria-label":"Unordered List"}),e.createElement("select",{className:"ql-align"},e.createElement("option",{defaultValue:!0}),e.createElement("option",{value:"center"}),e.createElement("option",{value:"right"}),e.createElement("option",{value:"justify"}))),e.createElement("span",{className:"ql-formats"},e.createElement("button",{type:"button",className:"ql-link","aria-label":"Insert Link"}),e.createElement("button",{type:"button",className:"ql-image","aria-label":"Insert Image"}),e.createElement("button",{type:"button",className:"ql-code-block","aria-label":"Insert Code Block"})),e.createElement("span",{className:"ql-formats"},e.createElement("button",{type:"button",className:"ql-clean","aria-label":"Remove Styles"}))),e.createElement("div",{id:this.props.id,className:n},l,e.createElement("div",{ref:function(e){return t.editorElement=e},className:"p-editor-content",style:this.props.style}))}}])&&o(m.prototype,f),y&&o(m,y),Object.defineProperty(m,"prototype",{writable:!1}),v}();m(y,"defaultProps",{id:null,value:null,style:null,className:null,placeholder:null,readOnly:!1,modules:null,formats:null,theme:"snow",showHeader:!0,headerTemplate:null,onTextChange:null,onSelectionChange:null,onLoad:null});export{y as Editor};