Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.169/page_editor/common/components/Editor",["module","exports","require","frontend-js-web","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../app/config/index"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function Editor({autoFocus:e=!1,configurationName:t,id:r,initialValue:i,label:c,onChange:d,placeholder:l}){const u=a.config.defaultEditorConfigurations[t].editorConfig,[f,s]=(0,o.useState)(null),p=(0,o.useRef)(null);return(0,o.useEffect)((()=>{if(f){const e=f.get("nativeEditor");e.getData()&&i||e.setData(i)}}),[f,i]),(0,o.useEffect)((()=>{const e=new n.EventHandler;if(f&&d){const t=f.get("nativeEditor");e.add(t.on("change",(()=>d(t.getData())))),e.add(t.on("actionPerformed",(()=>d(t.getData()))))}return()=>{e.removeAllListeners(),e.dispose()}}),[f,d]),(0,o.useEffect)((()=>{const t=AlloyEditor.editable(p.current,_objectSpread(_objectSpread({},u),{},{enterMode:1,startupFocus:e,title:c}));let r=!1;const n=t.get("nativeEditor").once("instanceReady",(()=>{r=!0,p.current.removeAttribute("title"),s(t)}));return()=>{try{r?(t.destroy(),s(null)):(n.removeListener(),t.get("nativeEditor").once("instanceReady",(()=>{t.destroy()})))}catch(e){}}}),[e,u,c]),o.default.createElement("div",{className:"alloy-editor-container"},o.default.createElement("div",{className:"alloy-editor form-control form-control-sm page-editor__editor page-editor__editor-placeholder",contentEditable:!1,"data-placeholder":l,"data-required":!1,id:r,name:r,ref:p}))};var n=r("frontend-js-web"),o=(function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r("liferay!frontend-js-react-web$prop-types")),function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var a=n?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(r,o,a):r[o]=e[o]}r.default=e,t&&t.set(e,r);return r}(r("liferay!frontend-js-react-web$react"))),a=r("../../app/config/index");function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}}}));
//# sourceMappingURL=Editor.js.map