fix(editor): subscribe docLinkClicked event for text renderer (#12406)

Closes: [BS-3520](https://linear.app/affine-design/issue/BS-3520/chat-panel-doc-citation-点击没有响应)

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - Enhanced citation cards to support double-click actions for improved interaction.
  - Added the ability to open a preview view when clicking document links within rendered text content.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
donteatfriedrice
2025-05-21 07:34:28 +00:00
parent 928892c5b4
commit 20e93543e2
2 changed files with 35 additions and 2 deletions

View File

@@ -259,7 +259,7 @@ export class EmbedLinkedDocBlockComponent extends EmbedBlockComponent<EmbedLinke
);
}
private _handleDoubleClick(event: MouseEvent) {
private readonly _handleDoubleClick = (event: MouseEvent) => {
event.stopPropagation();
const openDocService = this.std.get(OpenDocExtensionIdentifier);
const shouldOpenInPeek =
@@ -270,7 +270,7 @@ export class EmbedLinkedDocBlockComponent extends EmbedBlockComponent<EmbedLinke
: 'open-in-active-view',
event,
});
}
};
private _isDocEmpty() {
const linkedDoc = this.linkedDoc;
@@ -311,6 +311,7 @@ export class EmbedLinkedDocBlockComponent extends EmbedBlockComponent<EmbedLinke
.citationIdentifier=${footnoteIdentifier}
.active=${this.selected$.value}
.onClickCallback=${this._handleClick}
.onDoubleClickCallback=${this._handleDoubleClick}
></affine-citation-card>
</div> `;
};