diff --git a/src/app/dialogs/embed-object-dialog/embed-object-dialog.component.html b/src/app/dialogs/embed-object-dialog/embed-object-dialog.component.html index 7234d988..ce389b9d 100644 --- a/src/app/dialogs/embed-object-dialog/embed-object-dialog.component.html +++ b/src/app/dialogs/embed-object-dialog/embed-object-dialog.component.html @@ -15,9 +15,24 @@

{{ 'Embed this object' | translate }}

/>
-
+ + + +
+ +
diff --git a/src/app/dialogs/embed-object-dialog/embed-object-dialog.component.scss b/src/app/dialogs/embed-object-dialog/embed-object-dialog.component.scss index eef3d17f..4cd8c538 100644 --- a/src/app/dialogs/embed-object-dialog/embed-object-dialog.component.scss +++ b/src/app/dialogs/embed-object-dialog/embed-object-dialog.component.scss @@ -7,6 +7,10 @@ width: 100%; justify-content: space-between; align-items: center; + + h3 { + font-weight: bold; + } } .end-dialog-buttons { @@ -19,5 +23,5 @@ } app-outlined-input { - padding-top: 0; + padding-top: 15px; } diff --git a/src/app/dialogs/embed-object-dialog/embed-object-dialog.component.ts b/src/app/dialogs/embed-object-dialog/embed-object-dialog.component.ts index e9d7f9e1..32e6690d 100644 --- a/src/app/dialogs/embed-object-dialog/embed-object-dialog.component.ts +++ b/src/app/dialogs/embed-object-dialog/embed-object-dialog.component.ts @@ -1,4 +1,4 @@ -import { Component, computed, Inject, inject } from '@angular/core'; +import { Component, computed, inject } from '@angular/core'; import { MatButtonModule } from '@angular/material/button'; import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog'; @@ -31,9 +31,7 @@ export class EmbedObjectDialogComponent { elementUrlText = computed(() => { let embedHTML: string; - const iframe = document.querySelector('.iframe-container > iframe') as - | HTMLIFrameElement - | undefined; + const iframe = this.iFrameElement(); if (!iframe) return this.#snackbar.showMessage('Could not find viewer'); @@ -64,8 +62,21 @@ export class EmbedObjectDialogComponent { return embedHTML; }); - public copy() { + elementUrl = computed(() => { + return this.iFrameElement()?.src; + }); + + iFrameElement = computed(() => { + return document.querySelector('.iframe-container > iframe') as HTMLIFrameElement | undefined; + }); + + public copyEmbed() { const embedText = this.elementUrlText() as string; this.#detailPageHelper.copyEmbed(embedText); } + + public copyUrl() { + const urlText = this.elementUrl() as string; + this.#detailPageHelper.copyUrl(urlText); + } } diff --git a/src/app/services/detail-page-helper.service.ts b/src/app/services/detail-page-helper.service.ts index ad784d11..2708b43e 100644 --- a/src/app/services/detail-page-helper.service.ts +++ b/src/app/services/detail-page-helper.service.ts @@ -43,6 +43,16 @@ export class DetailPageHelperService { } } + public copyUrl(url: string) { + try { + this.copyToClipboard(url); + this.snackbar.showMessage('Model link copied to clipboard.', 3); + } catch (e) { + console.error(e); + this.snackbar.showMessage('Could not access your clipboard.', 3); + } + } + public copyEmbed(embed: string) { try { this.copyToClipboard(embed);