mirror of
https://github.com/hcengineering/platform.git
synced 2025-03-15 02:23:12 +00:00
Apply feedback improvements: UBERF-9189 (#7778)
Some checks are pending
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / uitest-qms (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions
Some checks are pending
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / uitest-qms (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions
This commit is contained in:
parent
f82bf77a08
commit
992bc99cea
@ -33,10 +33,10 @@ export function canDisplayLinkPreview (val: LinkPreviewDetails): boolean {
|
|||||||
if (val.hostname === undefined) {
|
if (val.hostname === undefined) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if (val.image === undefined && val.description === undefined) {
|
if (val.image === undefined && val.description?.trim() === '') {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if (val.title === undefined && val.description === undefined) {
|
if (val.title?.trim() === '' && val.description?.trim() === '') {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
@ -53,7 +53,9 @@ export async function fetchLinkPreviewDetails (url: string, timeoutMs = 15000):
|
|||||||
headers: { Authorization: 'Bearer ' + token },
|
headers: { Authorization: 'Bearer ' + token },
|
||||||
signal: AbortSignal.timeout(timeoutMs)
|
signal: AbortSignal.timeout(timeoutMs)
|
||||||
})
|
})
|
||||||
return response.json() as LinkPreviewDetails
|
const res = (await response.json()) as LinkPreviewDetails
|
||||||
|
res.url = url
|
||||||
|
return res
|
||||||
} catch {
|
} catch {
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@
|
|||||||
{#await getJsonOrEmpty(value.file, value.name)}
|
{#await getJsonOrEmpty(value.file, value.name)}
|
||||||
<Spinner size="small" />
|
<Spinner size="small" />
|
||||||
{:then linkPreviewDetails}
|
{:then linkPreviewDetails}
|
||||||
<div class="flex-center icon">
|
<div class="flex-center icon image">
|
||||||
{#if linkPreviewDetails.icon !== undefined && !useDefaultIcon}
|
{#if linkPreviewDetails.icon !== undefined && !useDefaultIcon}
|
||||||
<img
|
<img
|
||||||
src={linkPreviewDetails.icon}
|
src={linkPreviewDetails.icon}
|
||||||
|
@ -333,7 +333,7 @@
|
|||||||
const hrefs = refContainer.getElementsByTagName('a')
|
const hrefs = refContainer.getElementsByTagName('a')
|
||||||
const newUrls: string[] = []
|
const newUrls: string[] = []
|
||||||
for (let i = 0; i < hrefs.length; i++) {
|
for (let i = 0; i < hrefs.length; i++) {
|
||||||
if (hrefs[i].target !== '_blank' || !isValidUrl(hrefs[i].href)) {
|
if (hrefs[i].target !== '_blank' || !isValidUrl(hrefs[i].href) || hrefs[i].rel === '') {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
const key = getUrlKey(hrefs[i].href)
|
const key = getUrlKey(hrefs[i].href)
|
||||||
@ -363,7 +363,7 @@
|
|||||||
if (canDisplayLinkPreview(meta) && meta.url !== undefined) {
|
if (canDisplayLinkPreview(meta) && meta.url !== undefined) {
|
||||||
const blob = new Blob([JSON.stringify(meta)])
|
const blob = new Blob([JSON.stringify(meta)])
|
||||||
const file = new File([blob], meta.url, { type: 'application/link-preview' })
|
const file = new File([blob], meta.url, { type: 'application/link-preview' })
|
||||||
void createAttachment(file)
|
await createAttachment(file)
|
||||||
}
|
}
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
void setPlatformStatus(unknownError(err))
|
void setPlatformStatus(unknownError(err))
|
||||||
|
@ -17,12 +17,14 @@
|
|||||||
import LinkPreviewPresenter from './LinkPreviewPresenter.svelte'
|
import LinkPreviewPresenter from './LinkPreviewPresenter.svelte'
|
||||||
import { type WithLookup } from '@hcengineering/core'
|
import { type WithLookup } from '@hcengineering/core'
|
||||||
import { type Attachment } from '@hcengineering/attachment'
|
import { type Attachment } from '@hcengineering/attachment'
|
||||||
|
import { Scroller } from '@hcengineering/ui'
|
||||||
export let attachments: WithLookup<Attachment>[] = []
|
export let attachments: WithLookup<Attachment>[] = []
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="gapV-2">
|
<div class="gapV-2">
|
||||||
{#each attachments as attachment}
|
{#each attachments as attachment}
|
||||||
<LinkPreviewPresenter {attachment} />
|
<Scroller contentDirection={'horizontal'} horizontal scrollSnap>
|
||||||
|
<LinkPreviewPresenter {attachment} />
|
||||||
|
</Scroller>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
<div class="quote content">
|
<div class="quote content">
|
||||||
{#if canDisplay}
|
{#if canDisplay}
|
||||||
<div class="gapV-2">
|
<div class="gapV-2">
|
||||||
<div class="flex gap-1">
|
<div class="flex-row-center gap-1">
|
||||||
{#if viewModel.icon !== undefined && !useDefaultIcon}
|
{#if viewModel.icon !== undefined && !useDefaultIcon}
|
||||||
<img
|
<img
|
||||||
src={viewModel.icon}
|
src={viewModel.icon}
|
||||||
@ -81,14 +81,15 @@
|
|||||||
max-height: 25rem;
|
max-height: 25rem;
|
||||||
}
|
}
|
||||||
.preview-icon {
|
.preview-icon {
|
||||||
max-width: 22px;
|
max-width: 16px;
|
||||||
max-height: 22px;
|
max-height: 16px;
|
||||||
}
|
}
|
||||||
.quote {
|
.quote {
|
||||||
border-left: 0.25rem solid;
|
border-left: 0.25rem solid;
|
||||||
padding-left: 15px;
|
padding-left: 0.75rem;
|
||||||
}
|
}
|
||||||
.content {
|
.content {
|
||||||
|
scroll-snap-align: start;
|
||||||
max-width: 35rem;
|
max-width: 35rem;
|
||||||
max-height: 35rem;
|
max-height: 35rem;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user