import{r as t,c as e,h as n,H as i,g as o}from"./p-9f21f85f.js";const l=class{constructor(n){t(this,n),this.cellFormCancel=e(this,"cellFormCancel",7),this.cellFormSubmit=e(this,"cellFormSubmit",7),this.isConfirmationDialogShown=!1}async focus(){var t,e;null===(e=null===(t=this.el.querySelector("dvn-input"))||void 0===t?void 0:t.focus)||void 0===e||e.call(t)}render(){const{field:t,value:e}=this;return n(i,null,n("dvn-side-modal",{shown:!0,onDismiss:()=>{var t,e;JSON.stringify(null===(t=this.value)||void 0===t?void 0:t.content)!==JSON.stringify(null===(e=this.internalValue)||void 0===e?void 0:e.content)?this.isConfirmationDialogShown=!0:this.cellFormCancel.emit()}},n("div",{class:"flex-grow-1 d-flex flex-column mt-3"},n("div",{class:"flex-grow-1"},n("dvn-rich-editor",{key:"editor",onChange:t=>{t.stopImmediatePropagation(),this.internalValue={version:"0.0.1",content:t.detail}},editorSettings:t.settings||s,value:(e||{version:"0.0.1",content:[{type:"text",id:"form-content",value:{placeholder:t.placeholder,text:""}}]}).content})),n("div",{class:"form-footer"},n("dvn-button",{leaned:!0,onClick:t=>{t.stopImmediatePropagation(),this.cellFormSubmit.emit({value:this.internalValue}),this.cellFormCancel.emit()}},"Save")))),n("dvn-dialog",{shown:this.isConfirmationDialogShown,title:"You have unsaved changes"},"You're going to loose the changes if you don't save.",n("div",{slot:"actions"},n("dvn-button",{tint:"danger",view:"flat",onClick:t=>{t.stopImmediatePropagation(),this.cellFormCancel.emit()}},"Discard Changes"),n("dvn-button",{view:"flat",onClick:()=>this.isConfirmationDialogShown=!1},"Cancel"))))}get el(){return o(this)}},s={enableDrag:!1,enableBlockCreation:!1,enableBlockDeletion:!1,hideDragControls:!0,blockTypes:[],blockSettings:{text:{textSelectionOptions:["bold","link"]}}};l.style="dvn-field-input-cell-rich-content{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:100%}dvn-field-input-cell-rich-content .form-footer{padding:calc(2 * var(--spacing-unit));background-color:var(--color-background-secondary)}";export{l as dvn_field_input_cell_rich_content}