preserve bindings if present and fix testcases

This commit is contained in:
Aakansha Doshi
2023-05-23 16:47:52 +05:30
parent 75cfe54b15
commit f113a393e6
4 changed files with 23 additions and 10 deletions

View File

@@ -733,10 +733,18 @@ export const convertToExcalidrawElements = (
} as ExcalidrawTextElement;
res.push(excalidrawElement);
} else if (element.type === "arrow" || element.type === "line") {
//@ts-ignore
const { start, end, type, endArrowHead, ...rest } = element;
const {
//@ts-ignore
start,
//@ts-ignore
end,
type,
//@ts-ignore
endArrowhead = element.type === "arrow" ? "arrow" : null,
...rest
} = element;
excalidrawElement = {
excalidrawElement = newLinearElement({
type,
width: 200,
height: 24,
@@ -744,10 +752,16 @@ export const convertToExcalidrawElements = (
[0, 0],
[200, 0],
],
endArrowhead: endArrowHead || type === "arrow" ? "arrow" : null,
endArrowhead,
...rest,
} as ExcalidrawLinearElement;
});
mutateElement(excalidrawElement, {
//@ts-ignore
startBinding: element?.startBinding || null,
//@ts-ignore
endBinding: element.endBinding || null,
});
let startBoundElement;
let endBoundElement;
if (start) {