mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 18:41:14 +00:00
refactor(editor): Decouple Draggable from NDV store (#14531)
This commit is contained in:
committed by
GitHub
parent
e54f450a9d
commit
be627f08a4
@@ -86,6 +86,7 @@ const schemaPreviewStore = useSchemaPreviewStore();
|
||||
const environmentsStore = useEnvironmentsStore();
|
||||
const settingsStore = useSettingsStore();
|
||||
const posthogStore = usePostHog();
|
||||
|
||||
const { getSchemaForExecutionData, getSchemaForJsonSchema, getSchema, filterSchema } =
|
||||
useDataSchema();
|
||||
const { closedNodes, flattenSchema, flattenMultipleSchemas, toggleLeaf, toggleNode } =
|
||||
@@ -98,6 +99,9 @@ const emit = defineEmits<{
|
||||
|
||||
const scroller = ref<RecycleScrollerInstance>();
|
||||
|
||||
const canDraggableDrop = computed(() => ndvStore.canDraggableDrop);
|
||||
const draggableStickyPosition = computed(() => ndvStore.draggableStickyPos);
|
||||
|
||||
const toggleNodeAndScrollTop = (id: string) => {
|
||||
toggleNode(id);
|
||||
scroller.value?.scrollToItem(0);
|
||||
@@ -333,11 +337,17 @@ watch(
|
||||
{ once: true, immediate: true },
|
||||
);
|
||||
|
||||
const onDragStart = () => {
|
||||
const onDragStart = (el: HTMLElement, data?: string) => {
|
||||
ndvStore.draggableStartDragging({
|
||||
type: 'mapping',
|
||||
data: data ?? '',
|
||||
dimensions: el?.getBoundingClientRect() ?? null,
|
||||
});
|
||||
ndvStore.resetMappingTelemetry();
|
||||
};
|
||||
|
||||
const onDragEnd = (el: HTMLElement) => {
|
||||
ndvStore.draggableStopDragging();
|
||||
setTimeout(() => {
|
||||
const mappingTelemetry = ndvStore.mappingTelemetry;
|
||||
const parentNode = nodesSchemas.value.find(({ node }) => node.name === el.dataset.nodeName);
|
||||
@@ -387,6 +397,8 @@ const onDragEnd = (el: HTMLElement) => {
|
||||
type="mapping"
|
||||
target-data-key="mappable"
|
||||
:disabled="!mappingEnabled"
|
||||
:can-drop="canDraggableDrop"
|
||||
:sticky-position="draggableStickyPosition"
|
||||
@dragstart="onDragStart"
|
||||
@dragend="onDragEnd"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user