From 6ad596e9f1ebd619e15b7264394404c86bd1a491 Mon Sep 17 00:00:00 2001 From: Brady Madden Date: Mon, 20 Jan 2020 00:56:19 -0500 Subject: [PATCH] Share excalidrawings as links! (#356) * shareable links * fix * review comments * json-excaliber (#464) * draw * Boom * backend * Remove local Co-authored-by: Lipis --- src/components/ExportDialog.tsx | 14 ++++++-- src/components/icons.tsx | 9 +++++ src/index.tsx | 32 +++++++++++++---- src/scene/data.ts | 61 +++++++++++++++++++++++++++++---- src/scene/index.ts | 4 ++- src/scene/types.ts | 2 +- 6 files changed, 104 insertions(+), 18 deletions(-) diff --git a/src/components/ExportDialog.tsx b/src/components/ExportDialog.tsx index 1028dda2..7a327b0c 100644 --- a/src/components/ExportDialog.tsx +++ b/src/components/ExportDialog.tsx @@ -4,7 +4,7 @@ import React, { useState, useEffect, useRef } from "react"; import { Modal } from "./Modal"; import { ToolIcon } from "./ToolIcon"; -import { clipboard, exportFile, downloadFile } from "./icons"; +import { clipboard, exportFile, downloadFile, link } from "./icons"; import { Island } from "./Island"; import { ExcalidrawElement } from "../element/types"; import { AppState } from "../types"; @@ -30,7 +30,8 @@ export function ExportDialog({ actionManager, syncActionResult, onExportToPng, - onExportToClipboard + onExportToClipboard, + onExportToBackend }: { appState: AppState; elements: readonly ExcalidrawElement[]; @@ -39,6 +40,7 @@ export function ExportDialog({ syncActionResult: UpdaterFn; onExportToPng: ExportCB; onExportToClipboard: ExportCB; + onExportToBackend: ExportCB; }) { const someElementIsSelected = elements.some(element => element.isSelected); const [modalIsShown, setModalIsShown] = useState(false); @@ -108,7 +110,6 @@ export function ExportDialog({ aria-label="Export to PNG" onClick={() => onExportToPng(exportedElements, scale)} /> - {probablySupportsClipboard && ( )} + onExportToBackend(exportedElements, 1)} + /> {actionManager.renderAction( diff --git a/src/components/icons.tsx b/src/components/icons.tsx index 8fb29dd3..f9b871e5 100644 --- a/src/components/icons.tsx +++ b/src/components/icons.tsx @@ -5,6 +5,15 @@ import React from "react"; +export const link = ( + +); + export const save = (