Fix left menu link active and dnd bug when draging with the img tag

This commit is contained in:
soupette 2019-08-26 16:36:58 +02:00
parent 56b93581d8
commit 69488c5d98
4 changed files with 19 additions and 1 deletions

View File

@ -17,7 +17,10 @@ import styles from './styles.scss';
function LeftMenuLink(props) {
const isLinkActive = startsWith(
props.location.pathname.replace('/admin', '').concat('/'),
props.destination.replace(props.pluginSuffixUrl, '').concat('/')
props.destination
.replace(props.suffixUrlToReplaceForLeftMenuHighlight, '')
.concat('/')
);
const plugin =
@ -87,11 +90,13 @@ LeftMenuLink.propTypes = {
}).isRequired,
pluginSuffixUrl: PropTypes.string,
source: PropTypes.string,
suffixUrlToReplaceForLeftMenuHighlight: PropTypes.string,
};
LeftMenuLink.defaultProps = {
pluginSuffixUrl: '',
source: '',
suffixUrlToReplaceForLeftMenuHighlight: '',
};
export default LeftMenuLink;

View File

@ -81,6 +81,9 @@ function LeftMenuLinkContainer({ plugins, ...rest }) {
label={get(plugin, 'name')}
destination={destination}
pluginSuffixUrl={pluginSuffixUrl}
suffixUrlToReplaceForLeftMenuHighlight={
plugin.suffixUrlToReplaceForLeftMenuHighlight || ''
}
/>
);
}

View File

@ -66,6 +66,15 @@ const NameWrapper = styled.div`
white-space: nowrap;
}
img {
user-drag: none;
user-select: none;
-moz-user-select: none;
-webkit-user-drag: none;
-webkit-user-select: none;
-ms-user-select: none;
}
${({ isHidden }) => {
if (!isHidden) {
return css`

View File

@ -29,6 +29,7 @@ const plugin = {
name: pluginPkg.strapi.name,
preventComponentRendering: false,
suffixUrl: () => '/ctm-configurations/models',
suffixUrlToReplaceForLeftMenuHighlight: '/models',
trads,
};