Client: fixed onMouseUp indexing change logic

This commit is contained in:
Dmitry Sychugov 2024-06-10 16:35:12 +05:00
parent 86f4555c1b
commit d083d108c8

View File

@ -315,7 +315,8 @@ const SectionBodyContent = (props) => {
const replaceableItemType = value && value.split("_").slice(0, 1).join("_");
const isSectionTarget = elem && elem.className === sectionClass;
const replaceableItem = isSectionTarget
let replaceable;
const item = isSectionTarget
? filesList[filesList.length - 1]
: filesList.find((i) =>
replaceableItemType === "file"
@ -323,9 +324,14 @@ const SectionBodyContent = (props) => {
: i.id === replaceableItemId,
);
if (!replaceableItem) return;
replaceable = item;
if (item === filesList[filesList.length - 1] && !isSectionTarget) {
replaceable = filesList[filesList.length - 2];
}
changeIndex(VDRIndexingAction.MoveIndex, replaceableItem);
if (!replaceable) return;
changeIndex(VDRIndexingAction.MoveIndex, replaceable);
return;
};