Compare commits

...

15 Commits

Author SHA1 Message Date
dwelle
2bf886c941 show autosave checkbox only if fileHandle exists 2021-04-06 21:34:18 +02:00
dwelle
6215256787 Merge branch 'master' into kb/auto-save-support
# Conflicts:
#	src/tests/__snapshots__/regressionTests.test.tsx.snap
2021-04-06 21:30:48 +02:00
dwelle
35d195e891 update snaps 2021-04-04 15:32:55 +02:00
dwelle
9d3d7f3500 update copy 2021-04-04 15:16:29 +02:00
dwelle
0b32757085 prevent autosave from prompting on failure & granularize error messages 2021-04-04 15:13:56 +02:00
dwelle
6442a45bd4 Merge branch 'master' into kb/auto-save-support 2021-04-04 14:47:38 +02:00
dwelle
d7a015cb3a autoSaveautosave 2021-03-26 21:49:43 +01:00
dwelle
f68404fbed handle error properly and display error message 2021-03-26 21:42:27 +01:00
kbariotis
01f5914a82 auto save only when its supported 2021-03-22 21:59:10 +02:00
kbariotis
5e1e16c150 Merge branch 'master' into kb/auto-save-support 2021-03-22 21:56:30 +02:00
kbariotis
14537cbaba update tests 2021-03-20 16:26:22 +02:00
kbariotis
92ac11c49d add eror handler, update snapshots 2021-03-20 16:22:57 +02:00
kbariotis
90d68b3e0b move to export dialog 2021-03-20 16:01:06 +02:00
kbariotis
006aad052d update tests 2021-02-14 23:55:17 +02:00
kbariotis
98a7707e26 initial commit 2021-02-14 23:42:54 +02:00
13 changed files with 142 additions and 2 deletions

View File

@ -238,3 +238,37 @@ export const actionExportWithDarkMode = register({
</div> </div>
), ),
}); });
export const actionToggleAutosave = register({
name: "toggleAutosave",
perform(elements, appState) {
trackEvent("toggle", "autosave");
return {
appState: {
...appState,
autosave: !appState.autosave,
},
commitToHistory: false,
};
},
PanelComponent: ({ appState, updateData }) =>
supported && appState.fileHandle ? (
<label style={{ display: "flex" }}>
<input
type="checkbox"
checked={appState.autosave}
onChange={(event) => updateData(event.target.checked)}
/>{" "}
{t("labels.toggleAutosave")}
<Tooltip
label={t("labels.toggleAutosave_details")}
position="above"
long={true}
>
<div className="TooltipIcon">{questionCircle}</div>
</Tooltip>
</label>
) : (
<></>
),
});

View File

@ -33,6 +33,7 @@ export { actionFinalize } from "./actionFinalize";
export { export {
actionChangeProjectName, actionChangeProjectName,
actionChangeExportBackground, actionChangeExportBackground,
actionToggleAutosave,
actionSaveScene, actionSaveScene,
actionSaveAsScene, actionSaveAsScene,
actionLoadScene, actionLoadScene,

View File

@ -51,6 +51,7 @@ export type ActionName =
| "changeOpacity" | "changeOpacity"
| "changeFontSize" | "changeFontSize"
| "toggleCanvasMenu" | "toggleCanvasMenu"
| "toggleAutosave"
| "toggleEditMenu" | "toggleEditMenu"
| "undo" | "undo"
| "redo" | "redo"

View File

@ -13,6 +13,7 @@ export const getDefaultAppState = (): Omit<
"offsetTop" | "offsetLeft" | "width" | "height" "offsetTop" | "offsetLeft" | "width" | "height"
> => { > => {
return { return {
autosave: false,
theme: "light", theme: "light",
collaborators: new Map(), collaborators: new Map(),
currentChartType: "bar", currentChartType: "bar",
@ -90,6 +91,7 @@ const APP_STATE_STORAGE_CONF = (<
>( >(
config: { [K in keyof T]: K extends keyof AppState ? T[K] : never }, config: { [K in keyof T]: K extends keyof AppState ? T[K] : never },
) => config)({ ) => config)({
autosave: { browser: true, export: false },
theme: { browser: true, export: false }, theme: { browser: true, export: false },
collaborators: { browser: false, export: false }, collaborators: { browser: false, export: false },
currentChartType: { browser: true, export: false }, currentChartType: { browser: true, export: false },

View File

@ -56,6 +56,7 @@ import {
MIME_TYPES, MIME_TYPES,
POINTER_BUTTON, POINTER_BUTTON,
SCROLL_TIMEOUT, SCROLL_TIMEOUT,
AUTO_SAVE_TIMEOUT,
TAP_TWICE_TIMEOUT, TAP_TWICE_TIMEOUT,
TEXT_TO_CENTER_SNAP_THRESHOLD, TEXT_TO_CENTER_SNAP_THRESHOLD,
TOUCH_CTX_MENU_TIMEOUT, TOUCH_CTX_MENU_TIMEOUT,
@ -64,7 +65,7 @@ import {
ZOOM_STEP, ZOOM_STEP,
} from "../constants"; } from "../constants";
import { loadFromBlob } from "../data"; import { loadFromBlob } from "../data";
import { isValidLibrary } from "../data/json"; import { saveAsJSON, isValidLibrary } from "../data/json";
import { Library } from "../data/library"; import { Library } from "../data/library";
import { restore } from "../data/restore"; import { restore } from "../data/restore";
import { import {
@ -923,6 +924,13 @@ class App extends React.Component<AppProps, AppState> {
.querySelector(".excalidraw") .querySelector(".excalidraw")
?.classList.toggle("theme--dark", this.state.theme === "dark"); ?.classList.toggle("theme--dark", this.state.theme === "dark");
if (this.state.autosave && this.state.fileHandle && supported) {
this.autosaveLocalSceneDebounced(
this.scene.getElementsIncludingDeleted(),
this.state,
);
}
if ( if (
this.state.editingLinearElement && this.state.editingLinearElement &&
!this.state.selectedElementIds[this.state.editingLinearElement.elementId] !this.state.selectedElementIds[this.state.editingLinearElement.elementId]
@ -1055,6 +1063,37 @@ class App extends React.Component<AppProps, AppState> {
}); });
}, SCROLL_TIMEOUT); }, SCROLL_TIMEOUT);
private autosaveLocalSceneDebounced = debounce(
async (elements: readonly ExcalidrawElement[], state: AppState) => {
if (this.state.autosave && this.state.fileHandle && supported) {
try {
await saveAsJSON(
elements,
state,
// only if fileHandle valid
true,
);
} catch (error) {
this.setState({
autosave: false,
toastMessage:
error.name === "NotAllowedError"
? t("toast.autosaveFailed_notAllowed")
: error.name === "NotFoundError"
? t("toast.autosaveFailed_notFound")
: t("toast.autosaveFailed"),
});
// shouldn't happen, so let's log it
if (!["NotAllowedError", "NotFoundError"].includes(error.name)) {
console.error(error);
}
}
}
},
AUTO_SAVE_TIMEOUT,
);
// Copy/paste // Copy/paste
private onCut = withBatchedUpdates((event: ClipboardEvent) => { private onCut = withBatchedUpdates((event: ClipboardEvent) => {

View File

@ -202,6 +202,7 @@ const ExportModal = ({
})} })}
</Stack.Row> </Stack.Row>
</div> </div>
{actionManager.renderAction("toggleAutosave")}
{actionManager.renderAction("changeExportBackground")} {actionManager.renderAction("changeExportBackground")}
{someElementIsSelected && ( {someElementIsSelected && (
<div> <div>

View File

@ -10,7 +10,7 @@
cursor: default; cursor: default;
left: 50%; left: 50%;
margin-left: -150px; margin-left: -150px;
padding: 4px 0; padding: 8px;
position: absolute; position: absolute;
text-align: center; text-align: center;
width: 300px; width: 300px;

View File

@ -101,6 +101,7 @@ export const TOUCH_CTX_MENU_TIMEOUT = 500;
export const TITLE_TIMEOUT = 10000; export const TITLE_TIMEOUT = 10000;
export const TOAST_TIMEOUT = 5000; export const TOAST_TIMEOUT = 5000;
export const VERSION_TIMEOUT = 30000; export const VERSION_TIMEOUT = 30000;
export const AUTO_SAVE_TIMEOUT = 500;
export const SCROLL_TIMEOUT = 100; export const SCROLL_TIMEOUT = 100;
export const ZOOM_STEP = 0.1; export const ZOOM_STEP = 0.1;

View File

@ -27,6 +27,7 @@ export const serializeAsJSON = (
export const saveAsJSON = async ( export const saveAsJSON = async (
elements: readonly ExcalidrawElement[], elements: readonly ExcalidrawElement[],
appState: AppState, appState: AppState,
onlyIfFileHandleValid = false,
) => { ) => {
const serialized = serializeAsJSON(elements, appState); const serialized = serializeAsJSON(elements, appState);
const blob = new Blob([serialized], { const blob = new Blob([serialized], {
@ -41,6 +42,7 @@ export const saveAsJSON = async (
extensions: [".excalidraw"], extensions: [".excalidraw"],
}, },
appState.fileHandle, appState.fileHandle,
onlyIfFileHandleValid,
); );
return { fileHandle }; return { fileHandle };
}; };

View File

@ -78,6 +78,8 @@
"ungroup": "Ungroup selection", "ungroup": "Ungroup selection",
"collaborators": "Collaborators", "collaborators": "Collaborators",
"showGrid": "Show grid", "showGrid": "Show grid",
"toggleAutosave": "Autosave to current file",
"toggleAutosave_details": "Automatically save changes when working on an existing file.",
"addToLibrary": "Add to library", "addToLibrary": "Add to library",
"removeFromLibrary": "Remove from library", "removeFromLibrary": "Remove from library",
"libraryLoadingMessage": "Loading library…", "libraryLoadingMessage": "Loading library…",
@ -249,6 +251,9 @@
"width": "Width" "width": "Width"
}, },
"toast": { "toast": {
"autosaveFailed_notAllowed": "Autosave was disabled.",
"autosaveFailed_notFound": "Autosave failed.\nIt seems the file no longer exists.",
"autosaveFailed": "Autosave failed.",
"copyStyles": "Copied styles.", "copyStyles": "Copied styles.",
"copyToClipboard": "Copied to clipboard.", "copyToClipboard": "Copied to clipboard.",
"copyToClipboardAsPng": "Copied {{exportSelection}} to clipboard as PNG\n({{exportColorScheme}})", "copyToClipboardAsPng": "Copied {{exportSelection}} to clipboard as PNG\n({{exportColorScheme}})",

View File

@ -2,6 +2,7 @@
exports[`given element A and group of elements B and given both are selected when user clicks on B, on pointer up only elements from B should be selected: [end of test] appState 1`] = ` exports[`given element A and group of elements B and given both are selected when user clicks on B, on pointer up only elements from B should be selected: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -463,6 +464,7 @@ exports[`given element A and group of elements B and given both are selected whe
exports[`given element A and group of elements B and given both are selected when user shift-clicks on B, on pointer up only element A should be selected: [end of test] appState 1`] = ` exports[`given element A and group of elements B and given both are selected when user shift-clicks on B, on pointer up only element A should be selected: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -930,6 +932,7 @@ exports[`given element A and group of elements B and given both are selected whe
exports[`regression tests Cmd/Ctrl-click exclusively select element under pointer: [end of test] appState 1`] = ` exports[`regression tests Cmd/Ctrl-click exclusively select element under pointer: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -1706,6 +1709,7 @@ exports[`regression tests Cmd/Ctrl-click exclusively select element under pointe
exports[`regression tests Drags selected element when hitting only bounding box and keeps element selected: [end of test] appState 1`] = ` exports[`regression tests Drags selected element when hitting only bounding box and keeps element selected: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -1910,6 +1914,7 @@ exports[`regression tests Drags selected element when hitting only bounding box
exports[`regression tests adjusts z order when grouping: [end of test] appState 1`] = ` exports[`regression tests adjusts z order when grouping: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -2368,6 +2373,7 @@ exports[`regression tests adjusts z order when grouping: [end of test] number of
exports[`regression tests alt-drag duplicates an element: [end of test] appState 1`] = ` exports[`regression tests alt-drag duplicates an element: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -2621,6 +2627,7 @@ exports[`regression tests alt-drag duplicates an element: [end of test] number o
exports[`regression tests arrow keys: [end of test] appState 1`] = ` exports[`regression tests arrow keys: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -2785,6 +2792,7 @@ exports[`regression tests arrow keys: [end of test] number of renders 1`] = `20`
exports[`regression tests can drag element that covers another element, while another elem is selected: [end of test] appState 1`] = ` exports[`regression tests can drag element that covers another element, while another elem is selected: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -3262,6 +3270,7 @@ exports[`regression tests can drag element that covers another element, while an
exports[`regression tests change the properties of a shape: [end of test] appState 1`] = ` exports[`regression tests change the properties of a shape: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "#fa5252", "currentItemBackgroundColor": "#fa5252",
@ -3498,6 +3507,7 @@ exports[`regression tests change the properties of a shape: [end of test] number
exports[`regression tests click on an element and drag it: [dragged] appState 1`] = ` exports[`regression tests click on an element and drag it: [dragged] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -3702,6 +3712,7 @@ exports[`regression tests click on an element and drag it: [dragged] number of r
exports[`regression tests click on an element and drag it: [end of test] appState 1`] = ` exports[`regression tests click on an element and drag it: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -3946,6 +3957,7 @@ exports[`regression tests click on an element and drag it: [end of test] number
exports[`regression tests click to select a shape: [end of test] appState 1`] = ` exports[`regression tests click to select a shape: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -4198,6 +4210,7 @@ exports[`regression tests click to select a shape: [end of test] number of rende
exports[`regression tests click-drag to select a group: [end of test] appState 1`] = ` exports[`regression tests click-drag to select a group: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -4559,6 +4572,7 @@ exports[`regression tests click-drag to select a group: [end of test] number of
exports[`regression tests deselects group of selected elements on pointer down when pointer doesn't hit any element: [end of test] appState 1`] = ` exports[`regression tests deselects group of selected elements on pointer down when pointer doesn't hit any element: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -4854,6 +4868,7 @@ exports[`regression tests deselects group of selected elements on pointer down w
exports[`regression tests deselects group of selected elements on pointer up when pointer hits common bounding box without hitting any element: [end of test] appState 1`] = ` exports[`regression tests deselects group of selected elements on pointer up when pointer hits common bounding box without hitting any element: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -5161,6 +5176,7 @@ exports[`regression tests deselects group of selected elements on pointer up whe
exports[`regression tests deselects selected element on pointer down when pointer doesn't hit any element: [end of test] appState 1`] = ` exports[`regression tests deselects selected element on pointer down when pointer doesn't hit any element: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -5369,6 +5385,7 @@ exports[`regression tests deselects selected element on pointer down when pointe
exports[`regression tests deselects selected element, on pointer up, when click hits element bounding box but doesn't hit the element: [end of test] appState 1`] = ` exports[`regression tests deselects selected element, on pointer up, when click hits element bounding box but doesn't hit the element: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -5555,6 +5572,7 @@ exports[`regression tests deselects selected element, on pointer up, when click
exports[`regression tests double click to edit a group: [end of test] appState 1`] = ` exports[`regression tests double click to edit a group: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -6008,6 +6026,7 @@ exports[`regression tests double click to edit a group: [end of test] number of
exports[`regression tests drags selected elements from point inside common bounding box that doesn't hit any element and keeps elements selected after dragging: [end of test] appState 1`] = ` exports[`regression tests drags selected elements from point inside common bounding box that doesn't hit any element and keeps elements selected after dragging: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -6326,6 +6345,7 @@ exports[`regression tests drags selected elements from point inside common bound
exports[`regression tests draw every type of shape: [end of test] appState 1`] = ` exports[`regression tests draw every type of shape: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -8360,6 +8380,7 @@ exports[`regression tests draw every type of shape: [end of test] number of rend
exports[`regression tests given a group of selected elements with an element that is not selected inside the group common bounding box when element that is not selected is clicked should switch selection to not selected element on pointer up: [end of test] appState 1`] = ` exports[`regression tests given a group of selected elements with an element that is not selected inside the group common bounding box when element that is not selected is clicked should switch selection to not selected element on pointer up: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -8722,6 +8743,7 @@ exports[`regression tests given a group of selected elements with an element tha
exports[`regression tests given a selected element A and a not selected element B with higher z-index than A and given B partialy overlaps A when there's a shift-click on the overlapped section B is added to the selection: [end of test] appState 1`] = ` exports[`regression tests given a selected element A and a not selected element B with higher z-index than A and given B partialy overlaps A when there's a shift-click on the overlapped section B is added to the selection: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "#fa5252", "currentItemBackgroundColor": "#fa5252",
@ -8977,6 +8999,7 @@ exports[`regression tests given a selected element A and a not selected element
exports[`regression tests given selected element A with lower z-index than unselected element B and given B is partially over A when clicking intersection between A and B B should be selected on pointer up: [end of test] appState 1`] = ` exports[`regression tests given selected element A with lower z-index than unselected element B and given B is partially over A when clicking intersection between A and B B should be selected on pointer up: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "#fa5252", "currentItemBackgroundColor": "#fa5252",
@ -9230,6 +9253,7 @@ exports[`regression tests given selected element A with lower z-index than unsel
exports[`regression tests given selected element A with lower z-index than unselected element B and given B is partially over A when dragging on intersection between A and B A should be dragged and keep being selected: [end of test] appState 1`] = ` exports[`regression tests given selected element A with lower z-index than unselected element B and given B is partially over A when dragging on intersection between A and B A should be dragged and keep being selected: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "#fa5252", "currentItemBackgroundColor": "#fa5252",
@ -9545,6 +9569,7 @@ exports[`regression tests given selected element A with lower z-index than unsel
exports[`regression tests key 2 selects rectangle tool: [end of test] appState 1`] = ` exports[`regression tests key 2 selects rectangle tool: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -9709,6 +9734,7 @@ exports[`regression tests key 2 selects rectangle tool: [end of test] number of
exports[`regression tests key 3 selects diamond tool: [end of test] appState 1`] = ` exports[`regression tests key 3 selects diamond tool: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -9873,6 +9899,7 @@ exports[`regression tests key 3 selects diamond tool: [end of test] number of re
exports[`regression tests key 4 selects ellipse tool: [end of test] appState 1`] = ` exports[`regression tests key 4 selects ellipse tool: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -10037,6 +10064,7 @@ exports[`regression tests key 4 selects ellipse tool: [end of test] number of re
exports[`regression tests key 5 selects arrow tool: [end of test] appState 1`] = ` exports[`regression tests key 5 selects arrow tool: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -10231,6 +10259,7 @@ exports[`regression tests key 5 selects arrow tool: [end of test] number of rend
exports[`regression tests key 6 selects line tool: [end of test] appState 1`] = ` exports[`regression tests key 6 selects line tool: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -10425,6 +10454,7 @@ exports[`regression tests key 6 selects line tool: [end of test] number of rende
exports[`regression tests key 7 selects draw tool: [end of test] appState 1`] = ` exports[`regression tests key 7 selects draw tool: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -10619,6 +10649,7 @@ exports[`regression tests key 7 selects draw tool: [end of test] number of rende
exports[`regression tests key a selects arrow tool: [end of test] appState 1`] = ` exports[`regression tests key a selects arrow tool: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -10813,6 +10844,7 @@ exports[`regression tests key a selects arrow tool: [end of test] number of rend
exports[`regression tests key d selects diamond tool: [end of test] appState 1`] = ` exports[`regression tests key d selects diamond tool: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -10977,6 +11009,7 @@ exports[`regression tests key d selects diamond tool: [end of test] number of re
exports[`regression tests key e selects ellipse tool: [end of test] appState 1`] = ` exports[`regression tests key e selects ellipse tool: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -11141,6 +11174,7 @@ exports[`regression tests key e selects ellipse tool: [end of test] number of re
exports[`regression tests key l selects line tool: [end of test] appState 1`] = ` exports[`regression tests key l selects line tool: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -11335,6 +11369,7 @@ exports[`regression tests key l selects line tool: [end of test] number of rende
exports[`regression tests key r selects rectangle tool: [end of test] appState 1`] = ` exports[`regression tests key r selects rectangle tool: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -11499,6 +11534,7 @@ exports[`regression tests key r selects rectangle tool: [end of test] number of
exports[`regression tests key x selects draw tool: [end of test] appState 1`] = ` exports[`regression tests key x selects draw tool: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -11693,6 +11729,7 @@ exports[`regression tests key x selects draw tool: [end of test] number of rende
exports[`regression tests make a group and duplicate it: [end of test] appState 1`] = ` exports[`regression tests make a group and duplicate it: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -12409,6 +12446,7 @@ exports[`regression tests make a group and duplicate it: [end of test] number of
exports[`regression tests noop interaction after undo shouldn't create history entry: [end of test] appState 1`] = ` exports[`regression tests noop interaction after undo shouldn't create history entry: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -12662,6 +12700,7 @@ exports[`regression tests noop interaction after undo shouldn't create history e
exports[`regression tests pinch-to-zoom works: [end of test] appState 1`] = ` exports[`regression tests pinch-to-zoom works: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -12764,6 +12803,7 @@ exports[`regression tests pinch-to-zoom works: [end of test] number of renders 1
exports[`regression tests rerenders UI on language change: [end of test] appState 1`] = ` exports[`regression tests rerenders UI on language change: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -12864,6 +12904,7 @@ exports[`regression tests rerenders UI on language change: [end of test] number
exports[`regression tests shift click on selected element should deselect it on pointer up: [end of test] appState 1`] = ` exports[`regression tests shift click on selected element should deselect it on pointer up: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -13031,6 +13072,7 @@ exports[`regression tests shift click on selected element should deselect it on
exports[`regression tests shift-click to multiselect, then drag: [end of test] appState 1`] = ` exports[`regression tests shift-click to multiselect, then drag: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -13352,6 +13394,7 @@ exports[`regression tests shift-click to multiselect, then drag: [end of test] n
exports[`regression tests should show fill icons when element has non transparent background: [end of test] appState 1`] = ` exports[`regression tests should show fill icons when element has non transparent background: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "#fa5252", "currentItemBackgroundColor": "#fa5252",
@ -13555,6 +13598,7 @@ exports[`regression tests should show fill icons when element has non transparen
exports[`regression tests single-clicking on a subgroup of a selected group should not alter selection: [end of test] appState 1`] = ` exports[`regression tests single-clicking on a subgroup of a selected group should not alter selection: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -14376,6 +14420,7 @@ exports[`regression tests single-clicking on a subgroup of a selected group shou
exports[`regression tests spacebar + drag scrolls the canvas: [end of test] appState 1`] = ` exports[`regression tests spacebar + drag scrolls the canvas: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -14476,6 +14521,7 @@ exports[`regression tests spacebar + drag scrolls the canvas: [end of test] numb
exports[`regression tests supports nested groups: [end of test] appState 1`] = ` exports[`regression tests supports nested groups: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -15208,6 +15254,7 @@ exports[`regression tests supports nested groups: [end of test] number of render
exports[`regression tests switches from group of selected elements to another element on pointer down: [end of test] appState 1`] = ` exports[`regression tests switches from group of selected elements to another element on pointer down: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -15613,6 +15660,7 @@ exports[`regression tests switches from group of selected elements to another el
exports[`regression tests switches selected element on pointer down: [end of test] appState 1`] = ` exports[`regression tests switches selected element on pointer down: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -15908,6 +15956,7 @@ exports[`regression tests switches selected element on pointer down: [end of tes
exports[`regression tests two-finger scroll works: [end of test] appState 1`] = ` exports[`regression tests two-finger scroll works: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -16010,6 +16059,7 @@ exports[`regression tests two-finger scroll works: [end of test] number of rende
exports[`regression tests undo/redo drawing an element: [end of test] appState 1`] = ` exports[`regression tests undo/redo drawing an element: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -16508,6 +16558,7 @@ exports[`regression tests undo/redo drawing an element: [end of test] number of
exports[`regression tests updates fontSize & fontFamily appState: [end of test] appState 1`] = ` exports[`regression tests updates fontSize & fontFamily appState: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
@ -16608,6 +16659,7 @@ exports[`regression tests updates fontSize & fontFamily appState: [end of test]
exports[`regression tests zoom hotkeys: [end of test] appState 1`] = ` exports[`regression tests zoom hotkeys: [end of test] appState 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",

View File

@ -2,6 +2,7 @@
exports[`exportToSvg with default arguments 1`] = ` exports[`exportToSvg with default arguments 1`] = `
Object { Object {
"autosave": false,
"collaborators": Map {}, "collaborators": Map {},
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",

View File

@ -39,6 +39,7 @@ export type Collaborator = {
}; };
export type AppState = { export type AppState = {
autosave: boolean;
isLoading: boolean; isLoading: boolean;
errorMessage: string | null; errorMessage: string | null;
draggingElement: NonDeletedExcalidrawElement | null; draggingElement: NonDeletedExcalidrawElement | null;