diff --git a/src/editors/AdvancedEditor.test.tsx b/src/editors/AdvancedEditor.test.tsx
index 635069f351..e4381d587d 100644
--- a/src/editors/AdvancedEditor.test.tsx
+++ b/src/editors/AdvancedEditor.test.tsx
@@ -38,8 +38,8 @@ describe('AdvancedEditor', () => {
// Expect open cancel confimation modal
expect(await screen.findByText(/Are you sure you want to exit the editor/)).toBeInTheDocument();
- // Click on "OK"
- const confirmButton = await screen.findByRole('button', { name: 'OK' });
+ // Click on "Discard button"
+ const confirmButton = await screen.findByRole('button', { name: 'Discard Changes and Exit' });
fireEvent.click(confirmButton);
// Should call `onClose`
expect(onCloseMock).toHaveBeenCalled();
diff --git a/src/editors/containers/EditorContainer/components/CancelConfirmModal.tsx b/src/editors/containers/EditorContainer/components/CancelConfirmModal.tsx
index a0860c0fca..7f7859adb2 100644
--- a/src/editors/containers/EditorContainer/components/CancelConfirmModal.tsx
+++ b/src/editors/containers/EditorContainer/components/CancelConfirmModal.tsx
@@ -17,18 +17,27 @@ const CancelConfirmModal = ({
const intl = useIntl();
return (
onCloseEditor?.()}
+ >
+
+
+ )}
confirmAction={(
)}
isOpen={isOpen}
close={closeCancelConfirmModal}
title={intl.formatMessage(messages.cancelConfirmTitle)}
+ hideCancelButton
>
diff --git a/src/editors/containers/EditorContainer/index.test.tsx b/src/editors/containers/EditorContainer/index.test.tsx
index f61730626c..403f27f85a 100644
--- a/src/editors/containers/EditorContainer/index.test.tsx
+++ b/src/editors/containers/EditorContainer/index.test.tsx
@@ -90,14 +90,14 @@ describe('EditorContainer', () => {
expect(defaultPropsHtml.onClose).not.toHaveBeenCalled();
// Should close modal if cancelled
- const cancelBtn = await screen.findByRole('button', { name: 'Cancel' });
+ const cancelBtn = await screen.findByRole('button', { name: 'Keep Editing' });
fireEvent.click(cancelBtn);
expect(defaultPropsHtml.onClose).not.toHaveBeenCalled();
// open modal again
fireEvent.click(closeButton);
// And can confirm the cancelation:
- const confirmButton = await screen.findByRole('button', { name: 'OK' });
+ const confirmButton = await screen.findByRole('button', { name: 'Discard Changes and Exit' });
fireEvent.click(confirmButton);
expect(defaultPropsHtml.onClose).toHaveBeenCalled();
window.dispatchEvent(mockEvent);
diff --git a/src/editors/containers/EditorContainer/messages.ts b/src/editors/containers/EditorContainer/messages.ts
index 55b4259ca9..f9dc2fd156 100644
--- a/src/editors/containers/EditorContainer/messages.ts
+++ b/src/editors/containers/EditorContainer/messages.ts
@@ -17,10 +17,15 @@ const messages = defineMessages({
defaultMessage: 'Exit the editor',
description: 'Alt text for the Exit button',
},
- okButtonLabel: {
- id: 'authoring.editorContainer.okButton.label',
- defaultMessage: 'OK',
- description: 'Label for OK button',
+ keepEditingButtonLabel: {
+ id: 'authoring.editorContainer.keepEditing.label',
+ defaultMessage: 'Keep Editing',
+ description: 'Label for keep editing button on the editor cancel confirmation',
+ },
+ discardChangesButtonlabel: {
+ id: 'authoring.editorContainer.discardChanges.label',
+ defaultMessage: 'Discard Changes and Exit',
+ description: 'Label for discard changes button on the editor cancel confirmation',
},
modalTitle: {
id: 'authoring.editorContainer.accessibleTitle',
diff --git a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/__snapshots__/SwitchToAdvancedEditorCard.test.jsx.snap b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/__snapshots__/SwitchToAdvancedEditorCard.test.jsx.snap
index 4996845242..ee45799a9d 100644
--- a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/__snapshots__/SwitchToAdvancedEditorCard.test.jsx.snap
+++ b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/__snapshots__/SwitchToAdvancedEditorCard.test.jsx.snap
@@ -23,6 +23,7 @@ exports[`SwitchToAdvancedEditorCard snapshot snapshot: SwitchToAdvancedEditorCar
}
footerAction={null}
headerComponent={null}
+ hideCancelButton={false}
isFullscreenScroll={true}
isOpen={false}
size="md"
diff --git a/src/editors/sharedComponents/BaseModal/__snapshots__/index.test.jsx.snap b/src/editors/sharedComponents/BaseModal/__snapshots__/index.test.jsx.snap
index aee7fdf3ed..f76ae5ceaa 100644
--- a/src/editors/sharedComponents/BaseModal/__snapshots__/index.test.jsx.snap
+++ b/src/editors/sharedComponents/BaseModal/__snapshots__/index.test.jsx.snap
@@ -32,8 +32,10 @@ exports[`BaseModal ImageUploadModal template component snapshot 1`] = `
- props.footerAction node
-
+
+ props.footerAction node
+
+
(
- {footerAction}
-
-
-
-
+ {footerAction && (
+ <>
+ {footerAction}
+
+ >
+ )}
+ {!hideCancelButton && (
+
+
+
+ )}
{confirmAction}
@@ -65,6 +72,7 @@ BaseModal.defaultProps = {
isFullscreenScroll: true,
bodyStyle: null,
className: undefined,
+ hideCancelButton: false,
};
BaseModal.propTypes = {
@@ -79,6 +87,7 @@ BaseModal.propTypes = {
isFullscreenScroll: PropTypes.bool,
bodyStyle: PropTypes.shape({}),
className: PropTypes.string,
+ hideCancelButton: PropTypes.bool,
};
export default BaseModal;
diff --git a/src/editors/sharedComponents/ImageUploadModal/ImageSettingsModal/__snapshots__/index.test.jsx.snap b/src/editors/sharedComponents/ImageUploadModal/ImageSettingsModal/__snapshots__/index.test.jsx.snap
index d590d01b40..edc1be5cd7 100644
--- a/src/editors/sharedComponents/ImageUploadModal/ImageSettingsModal/__snapshots__/index.test.jsx.snap
+++ b/src/editors/sharedComponents/ImageUploadModal/ImageSettingsModal/__snapshots__/index.test.jsx.snap
@@ -37,6 +37,7 @@ exports[`ImageSettingsModal render snapshot 1`] = `
}
footerAction={null}
headerComponent={null}
+ hideCancelButton={false}
isFullscreenScroll={true}
isOpen={false}
size="lg"
diff --git a/src/editors/sharedComponents/SourceCodeModal/__snapshots__/index.test.jsx.snap b/src/editors/sharedComponents/SourceCodeModal/__snapshots__/index.test.jsx.snap
index e0b26f6fec..94cfe04497 100644
--- a/src/editors/sharedComponents/SourceCodeModal/__snapshots__/index.test.jsx.snap
+++ b/src/editors/sharedComponents/SourceCodeModal/__snapshots__/index.test.jsx.snap
@@ -30,6 +30,7 @@ exports[`SourceCodeModal renders as expected with default behavior 1`] = `
}
footerAction={null}
headerComponent={null}
+ hideCancelButton={false}
isFullscreenScroll={true}
isOpen={false}
size="xl"