Skip to content

Commit 188a2ae

Browse files
Fix pasting within images when using valueList
Previously, copying annotations from one image and pasting on another did not work: the annotation was always pasted on the first image. Now it pastes on the currently selected image. Co-authored-by: alessandro-oe <[email protected]>
1 parent 4f4e86e commit 188a2ae

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

web/libs/editor/src/hooks/useRegionsCopyPaste.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@ export const useRegionsCopyPaste = (entity: any) => {
4040
return { ...res, readonly: false };
4141
});
4242

43+
if (isFF(FF_LSDV_4583)) {
44+
// if user selected another image, we should paste in the current
45+
// image, not the one they copied from
46+
for (const result of results) {
47+
const target = entity.names.get(result.to_name);
48+
if (target.isMultiItem) {
49+
result.item_index = target.currentItemIndex;
50+
}
51+
}
52+
}
53+
4354
entity.appendResults(results);
4455
ev.preventDefault();
4556
} catch (e) {

0 commit comments

Comments
 (0)