export class EditorFormModal extends EditorContainerUiElement {
protected definition: EditorFormModalDefinition;
+ protected key: string;
- constructor(definition: EditorFormModalDefinition) {
+ constructor(definition: EditorFormModalDefinition, key: string) {
super([new EditorForm(definition.form)]);
this.definition = definition;
+ this.key = key;
}
show(defaultValues: Record<string, string>) {
const form = this.getForm();
form.setValues(defaultValues);
form.setOnCancel(this.hide.bind(this));
+ form.setOnSuccessfulSubmit(this.hide.bind(this));
+
+ this.getContext().manager.setModalActive(this.key, this);
}
hide() {
this.getDOMElement().remove();
+ this.getContext().manager.setModalInactive(this.key);
}
- protected getForm(): EditorForm {
+ getForm(): EditorForm {
return this.children[0] as EditorForm;
}