mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-24 18:02:47 +08:00
fix(editor): chat panel text render link preview base url (#10791)
fix AF-2322
This commit is contained in:
@@ -6,7 +6,10 @@ import {
|
||||
type EditorHost,
|
||||
ShadowlessElement,
|
||||
} from '@blocksuite/affine/block-std';
|
||||
import { defaultImageProxyMiddleware } from '@blocksuite/affine/blocks/image';
|
||||
import {
|
||||
defaultImageProxyMiddleware,
|
||||
ImageProxyService,
|
||||
} from '@blocksuite/affine/blocks/image';
|
||||
import { PageEditorBlockSpecs } from '@blocksuite/affine/extensions';
|
||||
import { Container, type ServiceProvider } from '@blocksuite/affine/global/di';
|
||||
import { WithDisposable } from '@blocksuite/affine/global/lit';
|
||||
@@ -15,6 +18,7 @@ import {
|
||||
MarkdownInlineToDeltaAdapterExtensions,
|
||||
} from '@blocksuite/affine/rich-text';
|
||||
import { codeBlockWrapMiddleware } from '@blocksuite/affine/shared/adapters';
|
||||
import { LinkPreviewerService } from '@blocksuite/affine/shared/services';
|
||||
import type {
|
||||
ExtensionType,
|
||||
Query,
|
||||
@@ -254,6 +258,20 @@ export class TextRenderer extends WithDisposable(ShadowlessElement) {
|
||||
if (this.state === 'generating') {
|
||||
this._timer = setInterval(this._updateDoc, 600);
|
||||
}
|
||||
|
||||
// LinkPreviewerService & ImageProxyService config should read from host settings
|
||||
const linkPreviewerService = this.host?.std.store.get(LinkPreviewerService);
|
||||
const imageProxyService = this.host?.std.store.get(ImageProxyService);
|
||||
if (linkPreviewerService) {
|
||||
this._doc
|
||||
?.get(LinkPreviewerService)
|
||||
.setEndpoint(linkPreviewerService.endpoint);
|
||||
}
|
||||
if (imageProxyService) {
|
||||
this._doc
|
||||
?.get(ImageProxyService)
|
||||
.setImageProxyURL(imageProxyService.imageProxyURL);
|
||||
}
|
||||
}
|
||||
|
||||
private disposeDoc() {
|
||||
|
||||
Reference in New Issue
Block a user