Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.151/page_editor/app/components/HTMLEditorModal",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/modal","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$react","./CodeMirrorEditor"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var l=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/button")),r=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/modal")),n=_interopRequireDefault(a("liferay!frontend-js-react-web$classnames")),o=_interopRequireWildcard(a("liferay!frontend-js-react-web$react")),i=_interopRequireDefault(a("./CodeMirrorEditor"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}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 a={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=l?Object.getOwnPropertyDescriptor(e,r):null;n&&(n.get||n.set)?Object.defineProperty(a,r,n):a[r]=e[r]}return a.default=e,t&&t.set(e,a),a}const e={columns:1,fullscreen:2,rows:3};var _default=({initialContent:t="",onClose:a,onSave:d})=>{const[u,c]=(0,o.useState)(t),[s,f]=(0,o.useState)(e.columns),[y,p]=(0,o.useState)(!0),{observer:m,onClose:g}=(0,r.useModal)({onClose:()=>{p(!1),a()}});return y&&o.default.createElement(r.default,{containerProps:{className:"cadmin"},observer:m,size:"full-screen"},o.default.createElement(r.default.Header,null,Liferay.Language.get("edit-content")),o.default.createElement(r.default.Body,{className:"pb-0"},o.default.createElement("div",{className:"d-flex justify-content-end pr-2 w-100"},o.default.createElement(l.default.Group,null,o.default.createElement(l.ClayButtonWithIcon,{"aria-label":Liferay.Language.get("display-vertically"),displayType:"secondary",onClick:()=>f(e.columns),size:"sm",symbol:"columns",title:Liferay.Language.get("display-vertically")}),o.default.createElement(l.ClayButtonWithIcon,{"aria-label":Liferay.Language.get("display-horizontally"),displayType:"secondary",onClick:()=>f(e.rows),size:"sm",symbol:"cards",title:Liferay.Language.get("display-horizontally")}),o.default.createElement(l.ClayButtonWithIcon,{"aria-label":Liferay.Language.get("full-screen"),displayType:"secondary",onClick:()=>f(e.fullscreen),size:"sm",symbol:"expand",title:Liferay.Language.get("full-screen")}))),o.default.createElement("div",{className:(0,n.default)("d-flex page-editor__html-editor-modal__editor-container",{"flex-column":s===e.rows})},o.default.createElement("div",{className:(0,n.default)({"h-50 w-100":s===e.rows,"h-100 w-50":s===e.columns,"h-100 w-100":s===e.fullscreen})},o.default.createElement(i.default,{initialContent:t,onChange:e=>c(e)})),s!==e.fullscreen&&o.default.createElement("div",{className:(0,n.default)({"page-editor__html-editor-modal__preview-columns h-100 px-3 w-50":s===e.columns,"page-editor__html-editor-modal__preview-rows h-50 py-2 w-100":s===e.rows})},o.default.createElement("div",{dangerouslySetInnerHTML:{__html:u},onClick:e=>e.preventDefault()})))),o.default.createElement(r.default.Footer,{last:o.default.createElement(l.default.Group,{spaced:!0},o.default.createElement(l.default,{displayType:"secondary",onClick:()=>{g()}},Liferay.Language.get("cancel")),o.default.createElement(l.default,{onClick:()=>{d(u),g()}},Liferay.Language.get("save")))}))};t.default=_default}}));
//# sourceMappingURL=HTMLEditorModal.js.map