fix(editor): banner of blookmark not shown in edgeless (#11796)

Close [BS-2651](https://app.graphite.dev/github/pr/toeverything/AFFiNE/11797/chore(editor)-add-feature-flag-to-embed-doc-with-alias)
### What Changes:
- Fixed banner of edgeless embed bookmark is not shown
- Add fallback bookmark creation with embed creation modal when there is not a `QuickSearchProvider` in blocksuite playground
- Add tests for embed blookmark and embed github block in edgeless
This commit is contained in:
L-Sun
2025-04-21 03:33:18 +00:00
parent c74b5dc214
commit 6d7cd6dd99
5 changed files with 68 additions and 4 deletions

View File

@@ -1,4 +1,6 @@
import { insertLinkByQuickSearchCommand } from '@blocksuite/affine-block-bookmark';
import { insertEmbedCard } from '@blocksuite/affine-block-embed';
import { toggleEmbedCardCreateModal } from '@blocksuite/affine-components/embed-card-modal';
import { LinkIcon } from '@blocksuite/affine-components/icons';
import { TelemetryProvider } from '@blocksuite/affine-shared/services';
import { QuickToolMixin } from '@blocksuite/affine-widget-edgeless-toolbar';
@@ -16,9 +18,30 @@ export class EdgelessLinkToolButton extends QuickToolMixin(LitElement) {
override type = 'default' as const;
private _onClick() {
const [_, { insertedLinkType }] = this.edgeless.std.command.exec(
const [success, { insertedLinkType }] = this.edgeless.std.command.exec(
insertLinkByQuickSearchCommand
);
if (!success) {
// fallback to create a bookmark block with input modal
toggleEmbedCardCreateModal(
this.edgeless.host,
'Links',
'The added link will be displayed as a card view.',
{
mode: 'edgeless',
onSave: url => {
insertEmbedCard(this.edgeless.std, {
flavour: 'affine:bookmark',
targetStyle: 'vertical',
props: { url },
});
},
}
).catch(console.error);
return;
}
insertedLinkType
?.then(type => {
const flavour = type?.flavour;