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

View file

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