diff --git a/src/app/features/metadata/components/cedar-template-form/cedar-template-form.component.ts b/src/app/features/metadata/components/cedar-template-form/cedar-template-form.component.ts index 16a562e69..4faf1a9cd 100644 --- a/src/app/features/metadata/components/cedar-template-form/cedar-template-form.component.ts +++ b/src/app/features/metadata/components/cedar-template-form/cedar-template-form.component.ts @@ -26,7 +26,6 @@ import { ActivatedRoute } from '@angular/router'; import { ENVIRONMENT } from '@core/provider/environment.provider'; import 'cedar-artifact-viewer'; -import 'cedar-embeddable-editor'; import { CEDAR_CONFIG, CEDAR_VIEWER_CONFIG } from '../../constants'; import { CedarMetadataHelper } from '../../helpers'; @@ -71,6 +70,8 @@ export class CedarTemplateFormComponent { readonly downloadUrl = signal(''); readonly schemaName = signal(''); + readonly fileGuid = toSignal(this.route.params.pipe(map((params) => params['fileGuid'])) ?? of(undefined)); + shareItems = [ { label: 'files.detail.actions.share.email', @@ -123,7 +124,17 @@ export class CedarTemplateFormComponent { this.validateCedarMetadata(); } - readonly fileGuid = toSignal(this.route.params.pipe(map((params) => params['fileGuid'])) ?? of(undefined)); + private initializeFormData(): void { + const template = this.template()?.attributes?.template; + if (!template) return; + const metadata = this.existingRecord()?.attributes?.metadata; + if (this.existingRecord()) { + const structuredMetadata = CedarMetadataHelper.buildStructuredMetadata(metadata); + this.formData.set(structuredMetadata); + } else { + this.formData.set(CedarMetadataHelper.buildEmptyMetadata()); + } + } downloadMetadadaRecord() { if (this.fileGuid()) { @@ -174,18 +185,6 @@ export class CedarTemplateFormComponent { } } - private initializeFormData(): void { - const template = this.template()?.attributes?.template; - if (!template) return; - const metadata = this.existingRecord()?.attributes?.metadata; - if (this.existingRecord()) { - const structuredMetadata = CedarMetadataHelper.buildStructuredMetadata(metadata); - this.formData.set(structuredMetadata); - } else { - this.formData.set(CedarMetadataHelper.buildEmptyMetadata()); - } - } - handleEmailShare(): void { const url = window.location.href; window.location.href = `mailto:?subject=${this.schemaName()}&body=${url}`; diff --git a/src/main.ts b/src/main.ts index e005d74a2..1285e5af0 100644 --- a/src/main.ts +++ b/src/main.ts @@ -3,6 +3,8 @@ import { bootstrapApplication } from '@angular/platform-browser'; import { AppComponent } from '@osf/app.component'; import { appConfig } from '@osf/app.config'; +import 'cedar-embeddable-editor'; + bootstrapApplication(AppComponent, { providers: [...appConfig.providers], }).catch((err) =>