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,
};
},
PanelComponent: ({ appState, updateData }) => (
<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>
),
PanelComponent: ({ appState, updateData }) =>
supported ? (
<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

@ -910,7 +910,7 @@ class App extends React.Component<ExcalidrawProps, AppState> {
.querySelector(".excalidraw")
?.classList.toggle("theme--dark", this.state.theme === "dark");
if (this.state.autoSave && this.state.fileHandle) {
if (this.state.autoSave && this.state.fileHandle && supported) {
try {
this.saveLocalSceneDebounced(
this.scene.getElementsIncludingDeleted(),