fix(editor): can not clear embed card alias description (#12794)

Close
[BS-3600](https://linear.app/affine-design/issue/BS-3600/card-view下,编辑alias清空保存无效,无法实现清空)
Close
[BS-3599](https://linear.app/affine-design/issue/BS-3599/page-和canvas-mode下的note,对文本中的-embed-view-doc,隐藏掉-edit-按钮,避免误导,card)



#### PR Dependency Tree


* **PR #12794** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

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

- **New Features**
- The edit option has been removed from the toolbar for embedded synced
documents.
- **Bug Fixes**
- The description field is now always included when editing embedded
cards, even if left empty.
- **Tests**
- Removed tests related to editing and view switching of linked document
embeds.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
L-Sun
2025-06-12 12:33:57 +08:00
committed by GitHub
parent a71904e641
commit 2a9f7e1835
3 changed files with 2 additions and 191 deletions

View File

@@ -24,10 +24,7 @@ import {
} from '@blocksuite/affine/blocks/embed-doc';
import { SurfaceRefBlockComponent } from '@blocksuite/affine/blocks/surface-ref';
import { toggleEmbedCardEditModal } from '@blocksuite/affine/components/embed-card-modal';
import {
notifyLinkedDocClearedAliases,
notifyLinkedDocSwitchedToCard,
} from '@blocksuite/affine/components/notification';
import { notifyLinkedDocClearedAliases } from '@blocksuite/affine/components/notification';
import { isPeekable, peek } from '@blocksuite/affine/components/peek';
import { toast } from '@blocksuite/affine/components/toast';
import {
@@ -862,44 +859,6 @@ const embedSyncedDocToolbarConfig = {
});
},
},
{
id: 'edit',
tooltip: 'Edit',
icon: EditIcon(),
run(ctx) {
const block = ctx.getCurrentBlockByType(
EmbedSyncedDocBlockComponent
);
if (!block) return;
ctx.hide();
const model = block.model;
const doc = ctx.workspace.getDoc(model.props.pageId);
const abortController = new AbortController();
abortController.signal.onabort = () => ctx.show();
toggleEmbedCardEditModal(
ctx.host,
model,
'embed',
doc ? { title: doc.meta?.title } : undefined,
undefined,
(std, _component, props) => {
block.convertToCard(props);
notifyLinkedDocSwitchedToCard(std);
},
abortController
);
ctx.track('OpenedAliasPopup', {
category: 'linked doc',
type: 'embed view',
control: 'edit',
});
},
},
],
},
],