"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/utils");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(l){if("default"!==l){var n=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(t,l,n.get?n:{enumerable:!0,get:function(){return e[l]}})}})),t.default=e,Object.freeze(t)}var r=l(e);function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var l=0;l

"===n&&(n=null),e.props.onTextChange&&e.props.onTextChange({htmlValue:n,textValue:r,delta:t,source:l})})),e.quill.on("selection-change",(function(t,l,n){e.props.onSelectionChange&&e.props.onSelectionChange({range:t,oldRange:l,source:n})})))})).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 e=this,l=t.classNames("p-component p-editor-container",this.props.className),n=null;return!1===this.props.showHeader?(n="",this.toolbarElement=void 0):n=this.props.headerTemplate?r.default.createElement("div",{ref:function(t){return e.toolbarElement=t},className:"p-editor-toolbar"},this.props.headerTemplate):r.default.createElement("div",{ref:function(t){return e.toolbarElement=t},className:"p-editor-toolbar"},r.default.createElement("span",{className:"ql-formats"},r.default.createElement("select",{className:"ql-header",defaultValue:"0"},r.default.createElement("option",{value:"1"},"Heading"),r.default.createElement("option",{value:"2"},"Subheading"),r.default.createElement("option",{value:"0"},"Normal")),r.default.createElement("select",{className:"ql-font"},r.default.createElement("option",null),r.default.createElement("option",{value:"serif"}),r.default.createElement("option",{value:"monospace"}))),r.default.createElement("span",{className:"ql-formats"},r.default.createElement("button",{type:"button",className:"ql-bold","aria-label":"Bold"}),r.default.createElement("button",{type:"button",className:"ql-italic","aria-label":"Italic"}),r.default.createElement("button",{type:"button",className:"ql-underline","aria-label":"Underline"})),r.default.createElement("span",{className:"ql-formats"},r.default.createElement("select",{className:"ql-color"}),r.default.createElement("select",{className:"ql-background"})),r.default.createElement("span",{className:"ql-formats"},r.default.createElement("button",{type:"button",className:"ql-list",value:"ordered","aria-label":"Ordered List"}),r.default.createElement("button",{type:"button",className:"ql-list",value:"bullet","aria-label":"Unordered List"}),r.default.createElement("select",{className:"ql-align"},r.default.createElement("option",{defaultValue:!0}),r.default.createElement("option",{value:"center"}),r.default.createElement("option",{value:"right"}),r.default.createElement("option",{value:"justify"}))),r.default.createElement("span",{className:"ql-formats"},r.default.createElement("button",{type:"button",className:"ql-link","aria-label":"Insert Link"}),r.default.createElement("button",{type:"button",className:"ql-image","aria-label":"Insert Image"}),r.default.createElement("button",{type:"button",className:"ql-code-block","aria-label":"Insert Code Block"})),r.default.createElement("span",{className:"ql-formats"},r.default.createElement("button",{type:"button",className:"ql-clean","aria-label":"Remove Styles"}))),r.default.createElement("div",{id:this.props.id,className:l},n,r.default.createElement("div",{ref:function(t){return e.editorElement=t},className:"p-editor-content",style:this.props.style}))}}])&&a(s.prototype,d),m&&a(s,m),Object.defineProperty(s,"prototype",{writable:!1}),v}();d(h,"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}),exports.Editor=h;