This commit is contained in:
Aakansha Doshi 2023-08-03 15:40:18 +05:30
parent eb415c1851
commit 1e633f7ed6
2 changed files with 15 additions and 7 deletions

View file

@ -346,7 +346,10 @@ import { activeConfirmDialogAtom } from "./ActiveConfirmDialog";
import { actionWrapTextInContainer } from "../actions/actionBoundText";
import BraveMeasureTextError from "./BraveMeasureTextError";
import { activeEyeDropperAtom } from "./EyeDropper";
import { convertToExcalidrawElements } from "../data/transform";
import {
ExcalidrawProgrammaticElement,
convertToExcalidrawElements,
} from "../data/transform";
import { ValueOf } from "../utility-types";
import { isSidebarDockedAtom } from "./Sidebar/Sidebar";
@ -2288,8 +2291,9 @@ class App extends React.Component<AppProps, AppState> {
} else if (data.elements) {
const elements = (
data.programmaticAPI
? //@ts-ignore
convertToExcalidrawElements(data.elements)
? convertToExcalidrawElements(
data.elements as ExcalidrawProgrammaticElement[],
)
: data.elements
) as readonly ExcalidrawElement[];
// TODO remove formatting from elements if isPlainPaste

View file

@ -334,10 +334,14 @@ const bindLinearElementToElement = (
if (end.id) {
existingElement = elementStore
.getElements()
.find((ele) => ele?.id === end.id) as Exclude<
ExcalidrawBindableElement,
ExcalidrawImageElement | ExcalidrawFrameElement
>;
.find(
(
ele,
): ele is Exclude<
ExcalidrawBindableElement,
ExcalidrawImageElement | ExcalidrawFrameElement
> => ele?.id === end.id,
);
if (!existingElement) {
console.error(`No element for end binding with id ${end.id} found`);
}