mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-20 03:26:47 +08:00
27 lines
812 B
TypeScript
27 lines
812 B
TypeScript
import { Protocol } from '@toeverything/datasource/db-service';
|
|
import {
|
|
AsyncBlock,
|
|
BaseView,
|
|
SelectBlock,
|
|
} from '@toeverything/framework/virgo';
|
|
import { YoutubeView } from './YoutubeView';
|
|
import {
|
|
Block2HtmlProps,
|
|
commonBlock2HtmlContent,
|
|
} from '../../utils/commonBlockClip';
|
|
|
|
export class YoutubeBlock extends BaseView {
|
|
public override selectable = true;
|
|
public override editable = false;
|
|
type = Protocol.Block.Type.youtube;
|
|
View = YoutubeView;
|
|
|
|
override async block2Text(block: AsyncBlock, selectInfo: SelectBlock) {
|
|
return block.getProperty('embedLink')?.value ?? '';
|
|
}
|
|
override async block2html({ block }: Block2HtmlProps) {
|
|
const url = block.getProperty('embedLink')?.value;
|
|
return `<p><a href="${url}">${url}</a></p>`;
|
|
}
|
|
}
|