mirror of
https://github.com/strapi/strapi.git
synced 2025-09-26 08:52:26 +00:00
Add emit event in back button in upload plugin
Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
parent
6bd863b563
commit
e73e11971d
@ -10,13 +10,14 @@ import React, { Fragment } from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||||
import { HeaderModalTitle } from 'strapi-helper-plugin';
|
import { HeaderModalTitle, useGlobalContext } from 'strapi-helper-plugin';
|
||||||
import ModalSection from '../ModalSection';
|
import ModalSection from '../ModalSection';
|
||||||
import Text from '../Text';
|
import Text from '../Text';
|
||||||
import BackButton from './BackButton';
|
import BackButton from './BackButton';
|
||||||
import Wrapper from './Wrapper';
|
import Wrapper from './Wrapper';
|
||||||
|
|
||||||
const ModalHeader = ({ goBack, headerBreadcrumbs, withBackButton, HeaderComponent }) => {
|
const ModalHeader = ({ goBack, headerBreadcrumbs, withBackButton, HeaderComponent }) => {
|
||||||
|
const { emitEvent } = useGlobalContext();
|
||||||
const translatedHeaders = headerBreadcrumbs
|
const translatedHeaders = headerBreadcrumbs
|
||||||
? headerBreadcrumbs.map(headerTrad => ({
|
? headerBreadcrumbs.map(headerTrad => ({
|
||||||
key: headerTrad,
|
key: headerTrad,
|
||||||
@ -25,6 +26,9 @@ const ModalHeader = ({ goBack, headerBreadcrumbs, withBackButton, HeaderComponen
|
|||||||
: null;
|
: null;
|
||||||
|
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
|
// Emit event on backButton with hardcoded upload location
|
||||||
|
emitEvent('didGoBack', { location: 'upload' });
|
||||||
|
|
||||||
goBack('backButton');
|
goBack('backButton');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user