diff --git a/.vscode/launch.json b/.vscode/launch.json index b9dc845ca2..2e571562ed 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -59,11 +59,11 @@ "args": ["src/__start.ts"], "env": { "ELASTIC_URL": "http://localhost:9200", - "MONGO_URL": "postgresql://postgres:example@localhost:5432;mongodb://localhost:27017", + "MONGO_URL": "mongodb://localhost:27017", "APM_SERVER_URL2": "http://localhost:8200", "METRICS_CONSOLE": "false", "METRICS_FILE": "${workspaceRoot}/metrics.txt", // Show metrics in console evert 30 seconds., - "STORAGE_CONFIG": "minio|localhost:9000?accessKey=minioadmin&secretKey=minioadmin", + "STORAGE_CONFIG": "minio|localhost?accessKey=minioadmin&secretKey=minioadmin", "SERVER_SECRET": "secret", "ENABLE_CONSOLE": "true", "COLLABORATOR_URL": "ws://localhost:3078", diff --git a/packages/ui/src/components/PlainTextEditor.svelte b/packages/ui/src/components/PlainTextEditor.svelte index 398b5c03b4..b9ede5b999 100644 --- a/packages/ui/src/components/PlainTextEditor.svelte +++ b/packages/ui/src/components/PlainTextEditor.svelte @@ -48,6 +48,10 @@ afterUpdate(adjustHeight) function adjustHeight (): void { + if (input == null) { + return + } + input.style.height = 'auto' input.style.height = `${input.scrollHeight + 2}px` } diff --git a/plugins/controlled-documents-resources/src/components/EditDocPanel.svelte b/plugins/controlled-documents-resources/src/components/EditDocPanel.svelte index 8661ce0c7a..ff03dfff51 100644 --- a/plugins/controlled-documents-resources/src/components/EditDocPanel.svelte +++ b/plugins/controlled-documents-resources/src/components/EditDocPanel.svelte @@ -96,6 +96,7 @@ let innerWidth: number let isTitlePressed: boolean = false + let creating: boolean = false const notificationClient = getResource(notification.function.GetInboxNotificationsClient).then((res) => res()) @@ -212,30 +213,41 @@ } async function onCreateNewDraft (): Promise { - if ($controlledDocument != null && $canCreateNewDraft && $documentLatestVersion != null) { - const latest = $documentLatestVersion - const version = { major: latest.major, minor: latest.minor + 1 } - const project = await getLatestProjectId($controlledDocument.space) + if (creating) { + return + } - if (project !== undefined) { - try { - const id = await createNewDraftForControlledDoc( - client, - $controlledDocument, - $controlledDocument.space, - version, - project - ) - const loc = getProjectDocumentLink(id, project) - navigate(loc) - } catch (err) { - await setPlatformStatus(unknownError(err)) + creating = true + try { + if ($controlledDocument != null && $canCreateNewDraft && $documentLatestVersion != null) { + const latest = $documentLatestVersion + const version = { major: latest.major, minor: latest.minor + 1 } + const project = await getLatestProjectId($controlledDocument.space) + + if (project !== undefined) { + try { + const { id, success } = await createNewDraftForControlledDoc( + client, + $controlledDocument, + $controlledDocument.space, + version, + project + ) + if (success) { + const loc = getProjectDocumentLink(id, project) + navigate(loc) + } + } catch (err) { + await setPlatformStatus(unknownError(err)) + } + } else { + console.warn('No document project found for space', $controlledDocument.space) } } else { - console.warn('No document project found for space', $controlledDocument.space) + console.warn('Unexpected document state', $documentState) } - } else { - console.warn('Unexpected document state', $documentState) + } finally { + creating = false } } @@ -349,7 +361,13 @@ {/if} {#if $canCreateNewDraft} -