mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: Track current version (#2731)
This commit is contained in:
parent
3a130cb102
commit
001880ba88
4 changed files with 44 additions and 13 deletions
|
@ -70,6 +70,7 @@ export const DEFAULT_FONT_SIZE = 20;
|
|||
export const DEFAULT_FONT_FAMILY: FontFamily = 1;
|
||||
export const DEFAULT_TEXT_ALIGN = "left";
|
||||
export const DEFAULT_VERTICAL_ALIGN = "top";
|
||||
export const DEFAULT_VERSION = "{version}";
|
||||
|
||||
export const CANVAS_ONLY_ACTIONS = ["selectAll"];
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import React, {
|
|||
useRef,
|
||||
useState,
|
||||
} from "react";
|
||||
import { trackEvent } from "../analytics";
|
||||
import { getDefaultAppState } from "../appState";
|
||||
import { ExcalidrawImperativeAPI } from "../components/App";
|
||||
import { ErrorDialog } from "../components/ErrorDialog";
|
||||
|
@ -22,7 +23,12 @@ import Excalidraw, {
|
|||
languages,
|
||||
} from "../packages/excalidraw/index";
|
||||
import { AppState, ExcalidrawAPIRefValue } from "../types";
|
||||
import { debounce, ResolvablePromise, resolvablePromise } from "../utils";
|
||||
import {
|
||||
debounce,
|
||||
getVersion,
|
||||
ResolvablePromise,
|
||||
resolvablePromise,
|
||||
} from "../utils";
|
||||
import { SAVE_TO_LOCAL_STORAGE_TIMEOUT } from "./app_constants";
|
||||
import CollabWrapper, { CollabAPI } from "./collab/CollabWrapper";
|
||||
import { LanguageList } from "./components/LanguageList";
|
||||
|
@ -223,6 +229,7 @@ function ExcalidrawWrapper(props: { collab: CollabAPI }) {
|
|||
const { collab } = props;
|
||||
|
||||
useEffect(() => {
|
||||
trackEvent("load", "version", getVersion());
|
||||
excalidrawRef.current!.readyPromise.then((excalidrawApi) => {
|
||||
initializeScene({
|
||||
resetScene: excalidrawApi.resetScene,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import colors from "./colors";
|
||||
import {
|
||||
CURSOR_TYPE,
|
||||
DEFAULT_VERSION,
|
||||
FONT_FAMILY,
|
||||
WINDOWS_EMOJI_FALLBACK_FONT,
|
||||
} from "./constants";
|
||||
|
@ -361,3 +362,8 @@ export const nFormatter = (num: number, digits: number): string => {
|
|||
(num / si[index].value).toFixed(digits).replace(rx, "$1") + si[index].symbol
|
||||
);
|
||||
};
|
||||
|
||||
export const getVersion = () => {
|
||||
const version = document.querySelector('meta[name="version"]');
|
||||
return version ? (version as any).content : DEFAULT_VERSION;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue