mirror of
https://github.com/strapi/strapi.git
synced 2025-08-12 10:48:12 +00:00
Fix #4127
This commit is contained in:
parent
ea0b72fe00
commit
2dc5df9595
@ -16,9 +16,10 @@ function ListItem({
|
||||
moveRelation,
|
||||
nextSearch,
|
||||
onRemove,
|
||||
source,
|
||||
targetModel,
|
||||
}) {
|
||||
const to = `/plugins/${pluginId}/${targetModel}/${data.id}?redirectUrl=${nextSearch}`;
|
||||
const to = `/plugins/${pluginId}/${targetModel}/${data.id}?source=${source}&redirectUrl=${nextSearch}`;
|
||||
|
||||
const originalIndex = findRelation(data.id).index;
|
||||
const [{ isDragging }, drag, preview] = useDrag({
|
||||
@ -72,6 +73,7 @@ ListItem.propTypes = {
|
||||
moveRelation: PropTypes.func,
|
||||
nextSearch: PropTypes.string,
|
||||
onRemove: PropTypes.func,
|
||||
source: PropTypes.string.isRequired,
|
||||
targetModel: PropTypes.string,
|
||||
};
|
||||
|
||||
|
@ -23,6 +23,7 @@ function SelectMany({
|
||||
onRemove,
|
||||
options,
|
||||
placeholder,
|
||||
source,
|
||||
targetModel,
|
||||
value,
|
||||
}) {
|
||||
@ -62,7 +63,8 @@ function SelectMany({
|
||||
id={name}
|
||||
filterOption={(candidate, input) => {
|
||||
if (!isEmpty(value)) {
|
||||
const isSelected = value.findIndex(item => item.id === candidate.value.id) !== -1;
|
||||
const isSelected =
|
||||
value.findIndex(item => item.id === candidate.value.id) !== -1;
|
||||
if (isSelected) {
|
||||
return false;
|
||||
}
|
||||
@ -98,6 +100,7 @@ function SelectMany({
|
||||
moveRelation={moveRelation}
|
||||
nextSearch={nextSearch}
|
||||
onRemove={() => onRemove(`${name}.${index}`)}
|
||||
source={source}
|
||||
targetModel={targetModel}
|
||||
/>
|
||||
))}
|
||||
@ -111,6 +114,7 @@ function SelectMany({
|
||||
|
||||
SelectMany.defaultProps = {
|
||||
move: () => {},
|
||||
source: 'content-manager',
|
||||
value: null,
|
||||
};
|
||||
|
||||
@ -128,6 +132,7 @@ SelectMany.propTypes = {
|
||||
onRemove: PropTypes.func.isRequired,
|
||||
options: PropTypes.array.isRequired,
|
||||
placeholder: PropTypes.node.isRequired,
|
||||
source: PropTypes.string,
|
||||
targetModel: PropTypes.string.isRequired,
|
||||
value: PropTypes.array,
|
||||
};
|
||||
|
@ -32,11 +32,12 @@ function SelectWrapper({
|
||||
pathname,
|
||||
search,
|
||||
} = useEditView();
|
||||
const source = isEmpty(plugin) ? 'content-manager' : plugin;
|
||||
const [state, setState] = useState({
|
||||
_q: '',
|
||||
_limit: 20,
|
||||
_start: 0,
|
||||
source: isEmpty(plugin) ? 'content-manager' : plugin,
|
||||
source,
|
||||
});
|
||||
const [options, setOptions] = useState([]);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
@ -128,7 +129,7 @@ function SelectWrapper({
|
||||
const nextSearch = `${pathname}${search}`;
|
||||
const to = `/plugins/${pluginId}/${targetModel}/${
|
||||
value ? value.id : null
|
||||
}?redirectUrl=${nextSearch}`;
|
||||
}?source=${source}&redirectUrl=${nextSearch}`;
|
||||
const link =
|
||||
value === null ||
|
||||
value === undefined ||
|
||||
@ -185,6 +186,7 @@ function SelectWrapper({
|
||||
placeholder
|
||||
)
|
||||
}
|
||||
source={source}
|
||||
targetModel={targetModel}
|
||||
value={value}
|
||||
/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user