auto save only when its supported

This commit is contained in:
kbariotis 2021-03-22 21:59:10 +02:00
parent 5e1e16c150
commit 01f5914a82
2 changed files with 21 additions and 18 deletions

View File

@ -248,7 +248,8 @@ export const actionToggleAutoSave = register({
commitToHistory: false, commitToHistory: false,
}; };
}, },
PanelComponent: ({ appState, updateData }) => ( PanelComponent: ({ appState, updateData }) =>
supported ? (
<label style={{ display: "flex" }}> <label style={{ display: "flex" }}>
<input <input
type="checkbox" type="checkbox"
@ -264,5 +265,7 @@ export const actionToggleAutoSave = register({
<div className="TooltipIcon">{questionCircle}</div> <div className="TooltipIcon">{questionCircle}</div>
</Tooltip> </Tooltip>
</label> </label>
) : (
<></>
), ),
}); });

View File

@ -910,7 +910,7 @@ class App extends React.Component<ExcalidrawProps, 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) { if (this.state.autoSave && this.state.fileHandle && supported) {
try { try {
this.saveLocalSceneDebounced( this.saveLocalSceneDebounced(
this.scene.getElementsIncludingDeleted(), this.scene.getElementsIncludingDeleted(),