feat(editor): update embed iframe toolbar config (#11221)

part of [BS-2843](https://linear.app/affine-design/issue/BS-2843/iframe-embed-block-占位态)
This commit is contained in:
donteatfriedrice
2025-03-27 04:17:30 +00:00
parent e763061bd6
commit 0c73fde44a
3 changed files with 104 additions and 94 deletions
@@ -877,11 +877,11 @@ const embedIframeToolbarConfig = {
},
actions: [
{
id: 'a.copy-link-and-edit',
id: 'b.copy-link',
actions: [
{
id: 'copy-link',
tooltip: 'Copy link',
tooltip: 'Copy original link',
icon: CopyIcon(),
run(ctx) {
const model = ctx.getCurrentBlockByType(
@@ -895,52 +895,14 @@ const embedIframeToolbarConfig = {
toast(ctx.host, 'Copied link to clipboard');
ctx.track('CopiedLink', {
category: matchModels(model, [BookmarkBlockModel])
? 'bookmark'
category: matchModels(model, [EmbedIframeBlockModel])
? 'embed iframe block'
: 'link',
type: 'card view',
control: 'copy link',
});
},
},
{
id: 'edit',
tooltip: 'Edit',
icon: EditIcon(),
run(ctx) {
const component = ctx.getCurrentBlockByType(
EmbedIframeBlockComponent
);
if (!component) return;
ctx.hide();
const model = component.model;
const abortController = new AbortController();
abortController.signal.onabort = () => ctx.show();
toggleEmbedCardEditModal(
ctx.host,
model,
'card',
undefined,
undefined,
(_std, _component, props) => {
ctx.store.updateBlock(model, props);
component.requestUpdate();
},
abortController
);
ctx.track('OpenedAliasPopup', {
category: matchModels(model, [BookmarkBlockModel])
? 'bookmark'
: 'link',
type: 'card view',
control: 'edit',
});
},
},
],
},
],