{studioViewFinished ? (
@@ -59,9 +61,11 @@ export const VideoEditor = ({
VideoEditor.defaultProps = {
onClose: null,
+ returnFunction: null,
};
VideoEditor.propTypes = {
onClose: PropTypes.func,
+ returnFunction: PropTypes.func,
// injected
intl: intlShape.isRequired,
// redux
diff --git a/src/editors/hooks.js b/src/editors/hooks.js
index b9c99e617..c9dc77665 100644
--- a/src/editors/hooks.js
+++ b/src/editors/hooks.js
@@ -17,6 +17,7 @@ export const navigateTo = (destination) => {
};
export const navigateCallback = ({
+ returnFunction,
destination,
analyticsEvent,
analytics,
@@ -24,6 +25,10 @@ export const navigateCallback = ({
if (process.env.NODE_ENV !== 'development' && analyticsEvent && analytics) {
sendTrackEvent(analyticsEvent, analytics);
}
+ if (returnFunction) {
+ returnFunction();
+ return;
+ }
module.navigateTo(destination);
};
@@ -34,6 +39,7 @@ export const saveBlock = ({
content,
destination,
dispatch,
+ returnFunction,
validateEntry,
}) => {
if (!content) {
@@ -53,6 +59,7 @@ export const saveBlock = ({
destination,
analyticsEvent: analyticsEvt.editorSaveClick,
analytics,
+ returnFunction,
}),
content,
}));
diff --git a/src/editors/hooks.test.jsx b/src/editors/hooks.test.jsx
index 18e19f096..5fc21b04a 100644
--- a/src/editors/hooks.test.jsx
+++ b/src/editors/hooks.test.jsx
@@ -74,6 +74,7 @@ describe('hooks', () => {
let output;
const SAVED_ENV = process.env;
const destination = 'hOmE';
+ const returnFunction = jest.fn();
beforeEach(() => {
jest.resetModules();
process.env = { ...SAVED_ENV };
@@ -100,6 +101,15 @@ describe('hooks', () => {
output();
expect(spy).toHaveBeenCalledWith(destination);
});
+ it('should call returnFunction and return null', () => {
+ output = hooks.navigateCallback({
+ destination,
+ returnFunction,
+ });
+ const returnedOutput = output();
+ expect(returnFunction).toHaveBeenCalled();
+ expect(returnedOutput).toEqual(undefined);
+ });
});
describe('nullMethod', () => {