Add new type excalidraw-api/clipboard for programmatic api

This commit is contained in:
Aakansha Doshi
2023-07-14 20:10:02 +05:30
parent bb778892dc
commit 7a94ee3191
4 changed files with 12 additions and 1 deletions
+5 -1
View File
@@ -330,6 +330,7 @@ import { activeConfirmDialogAtom } from "./ActiveConfirmDialog";
import { actionWrapTextInContainer } from "../actions/actionBoundText";
import BraveMeasureTextError from "./BraveMeasureTextError";
import { activeEyeDropperAtom } from "./EyeDropper";
import { convertToExcalidrawElements } from "../data/transform";
const AppContext = React.createContext<AppClassProperties>(null!);
const AppPropsContext = React.createContext<AppProps>(null!);
@@ -1933,9 +1934,12 @@ class App extends React.Component<AppProps, AppState> {
},
});
} else if (data.elements) {
const elements = data.programmaticAPI
? convertToExcalidrawElements(data.elements)
: data.elements;
// TODO remove formatting from elements if isPlainPaste
this.addElementsFromPasteOrLibrary({
elements: data.elements,
elements,
files: data.files || null,
position: "cursor",
retainSeed: isPlainPaste,