udpdate api

This commit is contained in:
Aakansha Doshi 2023-08-03 12:14:33 +05:30
parent 8aed24312f
commit eb415c1851

View file

@ -266,7 +266,7 @@ const bindLinearElementToElement = (
let existingElement; let existingElement;
if (start.id) { if (start.id) {
existingElement = elementStore existingElement = elementStore
.get() .getElements()
.find((ele) => ele?.id === start.id) as Exclude< .find((ele) => ele?.id === start.id) as Exclude<
ExcalidrawBindableElement, ExcalidrawBindableElement,
ExcalidrawImageElement | ExcalidrawFrameElement ExcalidrawImageElement | ExcalidrawFrameElement
@ -333,7 +333,7 @@ const bindLinearElementToElement = (
let existingElement; let existingElement;
if (end.id) { if (end.id) {
existingElement = elementStore existingElement = elementStore
.get() .getElements()
.find((ele) => ele?.id === end.id) as Exclude< .find((ele) => ele?.id === end.id) as Exclude<
ExcalidrawBindableElement, ExcalidrawBindableElement,
ExcalidrawImageElement | ExcalidrawFrameElement ExcalidrawImageElement | ExcalidrawFrameElement
@ -416,7 +416,7 @@ class ElementStore {
this.elementMap.set(ele.id, index); this.elementMap.set(ele.id, index);
} }
}; };
get = () => { getElements = () => {
return this.res; return this.res;
}; };
hasElementWithId = (id: string) => { hasElementWithId = (id: string) => {
@ -448,7 +448,7 @@ export const convertToExcalidrawElements = (
}); });
const pushedElements = const pushedElements =
elementStore.get() as readonly ExcalidrawProgrammaticElement[]; elementStore.getElements() as readonly ExcalidrawProgrammaticElement[];
pushedElements.forEach((element) => { pushedElements.forEach((element) => {
const elementWithId = { ...element }; const elementWithId = { ...element };
@ -550,5 +550,5 @@ export const convertToExcalidrawElements = (
elementStore.add(element); elementStore.add(element);
} }
}); });
return elementStore.get(); return elementStore.getElements();
}; };