Show error message when canvas to export is too big (#1256) (#2210)

Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
Giacomo Debidda 2020-10-28 20:52:53 +01:00 committed by GitHub
parent 5c26bd19d7
commit fc58e51ab3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 193 additions and 118 deletions

View file

@ -1022,12 +1022,12 @@ class App extends React.Component<ExcalidrawProps, AppState> {
copyToClipboard(this.scene.getElements(), this.state);
};
private copyToClipboardAsPng = () => {
private copyToClipboardAsPng = async () => {
const elements = this.scene.getElements();
const selectedElements = getSelectedElements(elements, this.state);
try {
exportCanvas(
await exportCanvas(
"clipboard",
selectedElements.length ? selectedElements : elements,
this.state,
@ -1040,13 +1040,13 @@ class App extends React.Component<ExcalidrawProps, AppState> {
}
};
private copyToClipboardAsSvg = () => {
private copyToClipboardAsSvg = async () => {
const selectedElements = getSelectedElements(
this.scene.getElements(),
this.state,
);
try {
exportCanvas(
await exportCanvas(
"clipboard-svg",
selectedElements.length ? selectedElements : this.scene.getElements(),
this.state,