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,21 +248,24 @@ export const actionToggleAutoSave = register({
commitToHistory: false, commitToHistory: false,
}; };
}, },
PanelComponent: ({ appState, updateData }) => ( PanelComponent: ({ appState, updateData }) =>
<label style={{ display: "flex" }}> supported ? (
<input <label style={{ display: "flex" }}>
type="checkbox" <input
checked={appState.autoSave} type="checkbox"
onChange={(event) => updateData(event.target.checked)} checked={appState.autoSave}
/>{" "} onChange={(event) => updateData(event.target.checked)}
{t("labels.toggleAutoSave")} />{" "}
<Tooltip {t("labels.toggleAutoSave")}
label={t("labels.toggleAutoSave_details")} <Tooltip
position="above" label={t("labels.toggleAutoSave_details")}
long={true} position="above"
> long={true}
<div className="TooltipIcon">{questionCircle}</div> >
</Tooltip> <div className="TooltipIcon">{questionCircle}</div>
</label> </Tooltip>
), </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(),