Dear Community,
I would like to create a Confluence ContentAction with UI Kit 2. The following skeleton gets rendered correctly as a Content Action inside a ModalDialog, and due to the presence of a Form, we already get a Submit button rendered normally, right aligned, next to the default Cancel button.
However, clicking the Submit button (thereby setting isOpen to false), results in only the form (incl. the Submit button) disappearing, the ModalDialog itself, however, stays open.
-
How is it possible to close it with the Submit button, or for that matter, any custom button or action other than the automatically added Cancel button? (The default Cancel button closes the ModalDialog correctly)
-
Is it possible to rename the default Cancel button to anything else? (like No, Abort, Exit, Close, etc.)
const ContentActionDialog = () => {
const [isOpen, setOpen] = useState(true);
if (!isOpen) {
return null;
} else {
return (
<>
<Form
onSubmit={data => {
console.log("Submit clicked");
setOpen(false);
}}>
<Text>Some text</Text>
</Form>
</>
);
}
}
ForgeReconciler.render(
<React.StrictMode>
<ContentActionDialog/>
</React.StrictMode>
);
By the way, returning a ModalDialog from the ContentActionDialog function above results in two modal dialogs opening on the top of each other, so I suppose it is correct that I am only returning the contents of the ModalDialog here. I have also tried view.close() (as the view object from @forge/bridge is available in UI Kit 2), but to no avail