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