Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
8d0b0f6
custom
dwelle Mar 11, 2022
63db62f
redesign
dwelle Jul 3, 2021
2d55f6c
zenMode status class && scene toolbar width in viewMode
dwelle Feb 28, 2021
e5505c1
make UserList vertical
dwelle May 9, 2021
53c719c
break to mobile at 800px
dwelle Apr 8, 2021
5622eec
add id prop for debugging
dwelle May 2, 2021
332eea7
use plus.excalidraw.com for svg font
dwelle May 3, 2021
821af2b
fix uselist props & remove custom footer due to type issues
dwelle May 24, 2021
7c03115
canvasActions & related
dwelle Jul 3, 2021
6a1e55e
npm tweaks
dwelle Jul 3, 2021
572aed2
release
dwelle Jul 3, 2021
9a7a236
remove i18n from build
dwelle Jul 4, 2021
95da8f4
release 0.2.0
dwelle Jul 4, 2021
93d76ba
release 0.2.2
dwelle Jul 5, 2021
c7e3fb6
support switching production build via window global
dwelle Jul 5, 2021
6a65424
release 0.2.3
dwelle Jul 5, 2021
e9cdf8b
add deploy script
dwelle Jul 9, 2021
d735075
hotfix for memory leak
dwelle Jul 9, 2021
a9033d1
release 0.3.4
dwelle Aug 25, 2021
20f76b4
release 0.3.15
dwelle Oct 23, 2021
bdb4055
use yarn publish
dwelle Oct 23, 2021
326fc8b
release 0.3.16 (master images)
dwelle Oct 27, 2021
76fdfed
release 0.3.17
dwelle Nov 4, 2021
7959f32
add `setup` script
dwelle Nov 19, 2021
21db1bb
fix lint
dwelle Nov 19, 2021
c2bbaf2
release 0.3.18
dwelle Nov 19, 2021
5482bce
inline library urls
dwelle Nov 22, 2021
39a8c3d
release 0.3.19
dwelle Nov 22, 2021
432bc6c
release 0.3.20
dwelle Nov 29, 2021
480379c
release 0.3.24
dwelle Nov 29, 2021
f248b3a
release 0.3.25
dwelle Dec 6, 2021
060790b
fix renderTopRightUI
dwelle Dec 7, 2021
d6dd81c
release 0.3.26
dwelle Dec 7, 2021
3be9fe2
expose `app` instance
dwelle Dec 8, 2021
2dcff02
release 0.3.27
dwelle Dec 8, 2021
68c00b1
release 0.3.28
dwelle Dec 13, 2021
b8cec74
release 0.3.29
dwelle Dec 15, 2021
6af8527
release 0.3.30
dwelle Dec 17, 2021
e06239a
release 0.3.31
dwelle Dec 17, 2021
e3766db
release 0.3.32
dwelle Dec 22, 2021
502eae2
release 0.3.33
dwelle Dec 23, 2021
149755c
release 0.3.34
dwelle Jan 3, 2022
2e83d42
release 0.3.35
dwelle Jan 6, 2022
4ebdcde
release 0.3.36
dwelle Jan 26, 2022
eedf48e
remove unused
dwelle Jan 29, 2022
ff8ecd9
v0.3.37
dwelle Jan 29, 2022
3c44693
v0.3.38
dwelle Feb 2, 2022
20bf0a5
temp: hide hintViewer in mobile
dwelle Feb 2, 2022
cad205c
v0.3.39
dwelle Feb 2, 2022
b89b164
v0.3.40
dwelle Feb 3, 2022
ca145a8
v0.3.42
dwelle Feb 3, 2022
264ede8
v0.3.43
dwelle Feb 6, 2022
f0d6953
v0.3.44
dwelle Feb 7, 2022
1566676
v0.3.45
dwelle Feb 9, 2022
6dddee9
add pull script
dwelle Feb 9, 2022
d50c147
fix SVG fonts path
dwelle Feb 12, 2022
248b2fe
v0.3.46
dwelle Feb 12, 2022
e9314c1
v0.3.47
dwelle Feb 22, 2022
6634f71
v0.3.48
dwelle Mar 2, 2022
34f3121
v0.3.49
dwelle Mar 2, 2022
7e8fe9d
v0.3.50
dwelle Mar 11, 2022
17f50ff
v0.3.51
dwelle Mar 11, 2022
8d68e39
v0.3.52
dwelle Mar 11, 2022
6f2aedd
rename collab button to sharing
dwelle Mar 15, 2022
ab2fa0e
v0.3.53
dwelle Mar 15, 2022
ca94242
v0.3.54
dwelle Mar 16, 2022
30551fc
v0.3.55
dwelle Mar 21, 2022
4e17fdf
v0.3.56
dwelle Mar 27, 2022
b01e4d1
v0.3.57
dwelle Mar 29, 2022
4e07027
v0.3.58
dwelle Mar 30, 2022
f85ad4e
v0.3.59
dwelle Apr 7, 2022
d1f67ca
export jotai store and scope
dwelle Apr 20, 2022
e274656
v0.3.60
dwelle Apr 20, 2022
973dfff
export libraryItemsAtom
dwelle Apr 20, 2022
fde85d5
v0.3.62
dwelle Apr 22, 2022
87249d1
v0.3.63
dwelle Apr 28, 2022
615d3da
fix prop change
dwelle May 11, 2022
e6124c0
fix home button width
dwelle May 11, 2022
71d9a1b
v0.3.64
dwelle May 11, 2022
c311181
fix
dwelle May 12, 2022
cc36743
v0.3.65
dwelle May 12, 2022
20bc413
v0.3.66
dwelle May 18, 2022
23ee0c1
v0.3.67
dwelle May 20, 2022
f2320cd
chore(deps-dev): bump @babel/core in /src/packages/utils
dependabot[bot] May 29, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
"prettier": "@excalidraw/prettier-config",
"private": true,
"scripts": {
"setup": "yarn && cd src/packages/excalidraw && yarn",
"build-node": "node ./scripts/build-node.js",
"build:app:docker": "REACT_APP_DISABLE_SENTRY=true react-scripts build",
"build:app": "REACT_APP_GIT_SHA=$VERCEL_GIT_COMMIT_SHA react-scripts build",
Expand All @@ -112,6 +113,8 @@
"test:typecheck": "tsc",
"test:update": "yarn test:app --updateSnapshot --watchAll=false",
"test": "yarn test:app",
"autorelease": "node scripts/autorelease.js"
"autorelease": "node scripts/autorelease.js",
"pull": "git pull upstream master --rebase",
"publish": "cd src/packages/excalidraw && npm run build:umd && yarn publish"
}
}
4 changes: 2 additions & 2 deletions src/actions/manager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export class ActionManager {
.sort((a, b) => (b.keyPriority || 0) - (a.keyPriority || 0))
.filter(
(action) =>
(action.name in canvasActions
(canvasActions && action.name in canvasActions
? canvasActions[action.name as keyof typeof canvasActions]
: true) &&
action.keyTest &&
Expand Down Expand Up @@ -141,7 +141,7 @@ export class ActionManager {
if (
this.actions[name] &&
"PanelComponent" in this.actions[name] &&
(name in canvasActions
(canvasActions && name in canvasActions
? canvasActions[name as keyof typeof canvasActions]
: true)
) {
Expand Down
48 changes: 46 additions & 2 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ import {
} from "../keys";
import { distance2d, getGridPoint, isPathALoop } from "../math";
import { renderScene } from "../renderer";
import { invalidateShapeForElement } from "../renderer/renderElement";
import {
clearRenderCache,
invalidateShapeForElement,
} from "../renderer/renderElement";
import {
calculateScrollCenter,
getTextBindableContainerAtPosition,
Expand Down Expand Up @@ -267,7 +270,7 @@ const DeviceTypeContext = React.createContext(defaultDeviceTypeContext);
export const useDeviceType = () => useContext(DeviceTypeContext);
const ExcalidrawContainerContext = React.createContext<{
container: HTMLDivElement | null;
id: string | null;
id?: string | null;
}>({ container: null, id: null });
export const useExcalidrawContainer = () =>
useContext(ExcalidrawContainerContext);
Expand Down Expand Up @@ -385,6 +388,7 @@ class App extends React.Component<AppProps, AppState> {
setActiveTool: this.setActiveTool,
setCursor: this.setCursor,
resetCursor: this.resetCursor,
app: this,
} as const;
if (typeof excalidrawRef === "function") {
excalidrawRef(api);
Expand Down Expand Up @@ -484,6 +488,7 @@ class App extends React.Component<AppProps, AppState> {
return (
<div
className={clsx("excalidraw excalidraw-container", {
"excalidraw--zen-mode": zenModeEnabled,
"excalidraw--view-mode": viewModeEnabled,
"excalidraw--mobile": this.deviceType.isMobile,
})}
Expand All @@ -499,6 +504,7 @@ class App extends React.Component<AppProps, AppState> {
>
<DeviceTypeContext.Provider value={this.deviceType}>
<LayerUI
onHomeButtonClick={this.props.onHomeButtonClick}
canvas={this.canvas}
appState={this.state}
files={this.files}
Expand Down Expand Up @@ -528,6 +534,7 @@ class App extends React.Component<AppProps, AppState> {
}
showThemeBtn={
typeof this.props?.theme === "undefined" &&
this.props.UIOptions.canvasActions &&
this.props.UIOptions.canvasActions.theme
}
libraryReturnUrl={this.props.libraryReturnUrl}
Expand Down Expand Up @@ -787,6 +794,13 @@ class App extends React.Component<AppProps, AppState> {
};
}

if (initialData?.scrollX != null) {
scene.appState.scrollX = initialData.scrollX;
}
if (initialData?.scrollY != null) {
scene.appState.scrollY = initialData.scrollY;
}

this.resetHistory();
this.syncActionResult({
...scene,
Expand Down Expand Up @@ -882,6 +896,25 @@ class App extends React.Component<AppProps, AppState> {
this.unmounted = true;
this.removeEventListeners();
this.scene.destroy();
clearRenderCache();

this.scene = new Scene();
this.history = new History();
this.actionManager = new ActionManager(
this.syncActionResult,
() => this.state,
() => this.scene.getElementsIncludingDeleted(),
this,
);
this.library = new Library(this);
this.canvas = null;
this.rc = null;

// @ts-ignore
this.excalidrawContainerRef.current = undefined;
this.nearestScrollableContainer = undefined;
this.excalidrawContainerValue = { container: null, id: "unmounted" };

clearTimeout(touchTimeout);
touchTimeout = 0;
}
Expand Down Expand Up @@ -922,6 +955,7 @@ class App extends React.Component<AppProps, AppState> {
this.disableEvent,
false,
);
document.fonts?.removeEventListener?.("loadingdone", this.onFontLoaded);

document.removeEventListener(
EVENT.GESTURE_START,
Expand Down Expand Up @@ -1059,6 +1093,15 @@ class App extends React.Component<AppProps, AppState> {
});
}

if (
!this.props.UIOptions.canvasActions &&
this.state.openMenu === "canvas"
) {
this.setState({
openMenu: null,
});
}

if (this.props.name && prevProps.name !== this.props.name) {
this.setState({
name: this.props.name,
Expand Down Expand Up @@ -1205,6 +1248,7 @@ class App extends React.Component<AppProps, AppState> {
this.scene.getElementsIncludingDeleted(),
this.state,
this.files,
this.props.id,
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Avatar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.Avatar {
width: 2.5rem;
height: 2.5rem;
border-radius: 1.25rem;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
Expand Down
41 changes: 40 additions & 1 deletion src/components/Island.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,49 @@
border-radius: var(--border-radius-lg);
padding: calc(var(--padding) * var(--space-factor));
position: relative;
transition: box-shadow 0.5s ease-in-out;

&.zen-mode {
box-shadow: none;
}

&::-webkit-scrollbar {
width: 10px;
}

&::-webkit-scrollbar-track {
background-color: transparent;
}

&::-webkit-scrollbar-thumb {
background-color: var(--color-scrollbar-thumb);
}
&::-webkit-scrollbar-thumb:hover {
background-color: var(--color-scrollbar-thumb-hover);
}

&::-webkit-scrollbar-thumb:active {
background-color: var(--color-scrollbar-thumb-active);
}
}

.App-menu_top {
.Stack_vertical {
.Island {
min-width: 216px;
}
.Stack_horizontal {
justify-content: center !important;
}
}
}

&.excalidraw--view-mode {
.App-menu_top {
.Stack_vertical {
.Island {
min-width: auto;
}
}
}
}
}
16 changes: 10 additions & 6 deletions src/components/JSONExportDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import React, { useState } from "react";
import { NonDeletedExcalidrawElement } from "../element/types";
import { t } from "../i18n";
import { useDeviceType } from "./App";
import { AppState, ExportOpts, BinaryFiles } from "../types";
import { AppState, CanvasActions, ExportOpts, BinaryFiles } from "../types";
import { Dialog } from "./Dialog";
import { exportFile, exportToFileIcon, link } from "./icons";
import { exportToFileIcon, link } from "./icons";
import { ToolButton } from "./ToolButton";
import { actionSaveFileToDisk } from "../actions/actionExport";
import { Card } from "./Card";
Expand Down Expand Up @@ -98,7 +98,7 @@ export const JSONExportDialog = ({
appState: AppState;
files: BinaryFiles;
actionManager: ActionManager;
exportOpts: ExportOpts;
exportOpts: CanvasActions["export"];
canvas: HTMLCanvasElement | null;
}) => {
const [modalIsShown, setModalIsShown] = useState(false);
Expand All @@ -111,16 +111,20 @@ export const JSONExportDialog = ({
<>
<ToolButton
onClick={() => {
setModalIsShown(true);
if (typeof exportOpts === "function") {
actionManager.executeAction(actionSaveFileToDisk);
} else {
setModalIsShown(true);
}
}}
data-testid="json-export-button"
icon={exportFile}
icon={exportToFileIcon}
type="button"
aria-label={t("buttons.export")}
showAriaLabel={useDeviceType().isMobile}
title={t("buttons.export")}
/>
{modalIsShown && (
{modalIsShown && exportOpts && typeof exportOpts !== "function" && (
<Dialog onCloseRequest={handleClose} title={t("buttons.export")}>
<JSONExportModal
elements={elements}
Expand Down
Loading