Mentions légales du service

Skip to content
Snippets Groups Projects

Resolve "add chapter after remove doesn't work"

Merged VIAUD Nathan requested to merge 371-add-chapter-after-remove-doesn-t-work into main
2 files
+ 6
6
Compare changes
  • Side-by-side
  • Inline
Files
2
import { Node, useVueFlow } from '@vue-flow/core';
import { Node, useVueFlow } from '@vue-flow/core';
import { Chapter } from '@epoc/epoc-types/src/v1';
import { Chapter } from '@epoc/epoc-types/src/v1';
import { generateContentId, graphService } from '@/src/shared/services';
import { generateContentId, generateId, graphService } from '@/src/shared/services';
const { nodes, findNode, addNodes } = useVueFlow('main');
const { nodes, findNode, addNodes } = useVueFlow('main');
/**
/**
@@ -30,7 +30,7 @@ export function addChapter(chapterId?: string, chapter?: Chapter, offsetY?: numb
@@ -30,7 +30,7 @@ export function addChapter(chapterId?: string, chapter?: Chapter, offsetY?: numb
offsetY = offsetY ? offsetY : 0;
offsetY = offsetY ? offsetY : 0;
const newYPos = chapters.length > 0 ? chapters[chapters.length - 1].position.y + 200 + offsetY : 200 + offsetY;
const newYPos = chapters.length > 0 ? chapters[chapters.length - 1].position.y + 200 + offsetY : 200 + offsetY;
const newChapter: Node = {
const newChapter: Node = {
id: (nodes.value.length + 1).toString(),
id: generateId(),
type: 'chapter',
type: 'chapter',
position: { x: 0, y: newYPos },
position: { x: 0, y: newYPos },
data,
data,
Loading