Skip to content

Commit

Permalink
fix: save and export when nexcloud isn't configured or well configure…
Browse files Browse the repository at this point in the history
…d insted of showing choice modal
  • Loading branch information
Quentin-Guillemin committed Jun 2, 2023
1 parent 1d9f7c3 commit c9cefc4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions client/src/components/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ function Editor({
userApi
);

language = language || "en";
readOnly = readOnly || false;
language = language ?? "en";
readOnly = readOnly ?? false;
const isNextcloudConfigured = nextcloudUrl && userApi;

const [room, setRoom] = useState<string | undefined>(roomId);
const [joinRoom, setJoinRoom] = useState<string | undefined>(undefined);
Expand All @@ -80,6 +81,10 @@ function Editor({
const [nextcloudModal, setNextcloudModal] = useState<any>(undefined);

const handleSave = (app: TldrawApp) => {
if (!isNextcloudConfigured) {
onSaveProject(app);
return;
}
if (nextcloudModal) return;
setNextcloudModal(
<NextcloudModal
Expand All @@ -98,6 +103,10 @@ function Editor({
};

const handleExport = async (app: TldrawApp, info: TDExport) => {
if (!isNextcloudConfigured) {
donwloadImageFile(app, info);
return;
}
if (nextcloudModal) return;
setNextcloudModal(
<NextcloudModal
Expand Down

0 comments on commit c9cefc4

Please sign in to comment.