fix(editor): Restore valid drag state when NDV is closed via ESC while dragging (#16758)

This commit is contained in:
Charlie Kolb
2025-07-07 14:59:08 +02:00
committed by GitHub
parent 7d06a89d4d
commit 7cc5a05bd3

View File

@@ -1,7 +1,7 @@
<script setup lang="ts">
import type { DraggableMode, XYPosition } from '@/Interface';
import { isPresent } from '@/utils/typesUtils';
import { type StyleValue, computed, ref } from 'vue';
import { type StyleValue, computed, onBeforeUnmount, ref } from 'vue';
type Props = {
type: DraggableMode;
@@ -113,8 +113,14 @@ const onDragEnd = () => {
if (draggingElement.value) emit('dragend', draggingElement.value);
isDragging.value = false;
draggingElement.value = undefined;
}, 0);
});
};
onBeforeUnmount(() => {
if (draggingElement.value) {
emit('dragend', draggingElement.value);
}
});
</script>
<template>