More export events (#2441)

This commit is contained in:
Lipis 2020-12-03 12:03:29 +02:00 committed by GitHub
parent abde1daba4
commit 0ef60dce2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 32 deletions

View file

@ -2029,6 +2029,7 @@ class App extends React.Component<ExcalidrawProps, AppState> {
resetCursor();
if (!event[KEYS.CTRL_OR_CMD]) {
trackEvent(EVENT_SHAPE, "text", "double-click");
this.startTextEditing({
sceneX,
sceneY,

View file

@ -18,6 +18,7 @@ import useIsMobile from "../is-mobile";
import { Dialog } from "./Dialog";
import { canvasToBlob } from "../data/blob";
import { CanvasError } from "../errors";
import { EVENT_ACTION, trackEvent } from "../analytics";
const scales = [1, 2, 3];
const defaultScale = scales.includes(devicePixelRatio) ? devicePixelRatio : 1;
@ -250,7 +251,10 @@ export const ExportDialog = ({
return (
<>
<ToolButton
onClick={() => setModalIsShown(true)}
onClick={() => {
trackEvent(EVENT_ACTION, "export", "dialog");
setModalIsShown(true);
}}
icon={exportFile}
type="button"
aria-label={t("buttons.export")}

View file

@ -218,6 +218,7 @@ export const exportToBackend = async (
url.hash = `json=${json.id},${exportedKey.k!}`;
const urlString = url.toString();
window.prompt(`🔒${t("alerts.uploadedSecurly")}`, urlString);
trackEvent(EVENT_ACTION, "export", "backend");
} else if (json.error_class === "RequestTooLargeError") {
window.alert(t("alerts.couldNotCreateShareableLinkTooBig"));
} else {
@ -321,8 +322,10 @@ export const exportCanvas = async (
fileName: `${name}.svg`,
extensions: [".svg"],
});
trackEvent(EVENT_ACTION, "export", "svg");
return;
} else if (type === "clipboard-svg") {
trackEvent(EVENT_ACTION, "export", "clipboard-svg");
copyTextToSystemClipboard(tempSvg.outerHTML);
return;
}
@ -354,9 +357,11 @@ export const exportCanvas = async (
fileName,
extensions: [".png"],
});
trackEvent(EVENT_ACTION, "export", "png");
} else if (type === "clipboard") {
try {
await copyCanvasToClipboardAsPng(tempCanvas);
trackEvent(EVENT_ACTION, "export", "clipboard-png");
} catch (error) {
if (error.name === "CANVAS_POSSIBLY_TOO_BIG") {
throw error;