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:
donteatfriedrice
2025-05-07 08:17:43 +00:00
parent 179701f587
commit 4c56b685a1
3 changed files with 31 additions and 16 deletions

View File

@@ -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() {