fix(editor): use img tag for link preview icon and banner (#11637)

close AF-2377
This commit is contained in:
forehalo
2025-04-11 08:48:04 +00:00
parent 9c6d94f597
commit 2f5647ac77
2 changed files with 3 additions and 16 deletions

View File

@@ -81,21 +81,10 @@ export class BookmarkCard extends SignalWatcher(
const theme = this.bookmark.std.get(ThemeProvider).theme; const theme = this.bookmark.std.get(ThemeProvider).theme;
const { LoadingIcon, EmbedCardBannerIcon } = getEmbedCardIcons(theme); const { LoadingIcon, EmbedCardBannerIcon } = getEmbedCardIcons(theme);
const titleIconType =
!icon?.split('.').pop() || icon?.split('.').pop() === 'svg'
? 'svg+xml'
: icon?.split('.').pop();
const titleIcon = this.loading const titleIcon = this.loading
? LoadingIcon ? LoadingIcon
: icon : icon
? html`<object ? html`<img src=${icon} alt="icon" />`
type="image/${titleIconType}"
data=${icon}
draggable="false"
>
${WebIcon16}
</object>`
: WebIcon16; : WebIcon16;
const descriptionText = this.loading const descriptionText = this.loading
@@ -108,9 +97,7 @@ export class BookmarkCard extends SignalWatcher(
const bannerImage = const bannerImage =
!this.loading && image !this.loading && image
? html`<object type="image/webp" data=${image} draggable="false"> ? html`<img src=${image} alt="banner" />`
${EmbedCardBannerIcon}
</object>`
: EmbedCardBannerIcon; : EmbedCardBannerIcon;
return html` return html`

View File

@@ -183,7 +183,7 @@ export function buildAppModule(env: Env) {
// doc service only // doc service only
.useIf(() => env.flavors.doc, DocServiceModule) .useIf(() => env.flavors.doc, DocServiceModule)
// self hosted server only // self hosted server only
.useIf(() => env.selfhosted, WorkerModule, SelfhostModule) .useIf(() => env.dev || env.selfhosted, WorkerModule, SelfhostModule)
// gcloud // gcloud
.useIf(() => env.gcp, GCloudModule); .useIf(() => env.gcp, GCloudModule);