mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-01 09:30:01 +08:00
feat(editor): support embed iframe block in edgeless (#10830)
To close: [BS-2665](https://linear.app/affine-design/issue/BS-2665/iframe-embed-block-edgeless-mode-支持) [BS-2666](https://linear.app/affine-design/issue/BS-2666/iframe-embed-block-edgeless-toolbar) [BS-2667](https://linear.app/affine-design/issue/BS-2667/iframe-embed-block-edgeless-mode-拖拽调整支持) [BS-2789](https://linear.app/affine-design/issue/BS-2789/iframe-embed-block-edgeless-block-component)
This commit is contained in:
@@ -441,6 +441,7 @@ export class EdgelessClipboardController extends PageClipboard {
|
||||
this.registerBlock('affine:embed-html', this._createHtmlEmbedBlock);
|
||||
this.registerBlock('affine:embed-loom', this._createLoomEmbedBlock);
|
||||
this.registerBlock('affine:embed-youtube', this._createYoutubeEmbedBlock);
|
||||
this.registerBlock('affine:embed-iframe', this._createIframeEmbedBlock);
|
||||
|
||||
// internal links
|
||||
this.registerBlock(
|
||||
@@ -881,6 +882,36 @@ export class EdgelessClipboardController extends PageClipboard {
|
||||
return embedYoutubeId;
|
||||
}
|
||||
|
||||
private _createIframeEmbedBlock(embedIframe: BlockSnapshot) {
|
||||
const {
|
||||
xywh,
|
||||
caption,
|
||||
url,
|
||||
title,
|
||||
description,
|
||||
iframeUrl,
|
||||
scale,
|
||||
width,
|
||||
height,
|
||||
} = embedIframe.props;
|
||||
|
||||
return this.crud.addBlock(
|
||||
'affine:embed-iframe',
|
||||
{
|
||||
url,
|
||||
iframeUrl,
|
||||
xywh,
|
||||
caption,
|
||||
title,
|
||||
description,
|
||||
scale,
|
||||
width,
|
||||
height,
|
||||
},
|
||||
this.surface.model.id
|
||||
);
|
||||
}
|
||||
|
||||
private async _edgelessToCanvas(
|
||||
edgeless: EdgelessRootBlockComponent,
|
||||
bound: IBound,
|
||||
|
||||
Reference in New Issue
Block a user