mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
fix(editor): footnote and citation icon url should be built with image proxy (#12169)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Improved how bookmark and footnote icons are displayed by routing image URLs through an image proxy service for enhanced reliability and consistency. - **Refactor** - Adjusted the timing of service configuration for link previews and image proxies to occur after document initialization, ensuring more robust setup during content rendering. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -273,6 +273,21 @@ export class TextRenderer extends WithDisposable(ShadowlessElement) {
|
||||
this._doc.readonly = true;
|
||||
this.requestUpdate();
|
||||
if (this.state !== 'generating') {
|
||||
// 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);
|
||||
}
|
||||
this._clearTimer();
|
||||
}
|
||||
})
|
||||
@@ -289,20 +304,6 @@ 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