mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 21:27:20 +00:00
AudioMedia entity for loading & controlling a single audio media AudioMediaManagerService: Global audio state synchronization across tabs AudioAttachmentService + AudioAttachmentBlock for manipulating AttachmentBlock in affine - e.g., filling transcription (using mock endpoint for now) Added AudioBlock + AudioPlayer for rendering audio block in affine (new transcription block whose renderer is provided in affine) fix AF-2292 fix AF-2337
61 lines
1.3 KiB
TypeScript
61 lines
1.3 KiB
TypeScript
import {
|
|
BlockModel,
|
|
BlockSchemaExtension,
|
|
defineBlockSchema,
|
|
type Text,
|
|
} from '@blocksuite/store';
|
|
|
|
import type { BlockMeta } from '../../utils/types';
|
|
|
|
export type ParagraphType =
|
|
| 'text'
|
|
| 'quote'
|
|
| 'h1'
|
|
| 'h2'
|
|
| 'h3'
|
|
| 'h4'
|
|
| 'h5'
|
|
| 'h6';
|
|
|
|
export type ParagraphProps = {
|
|
type: ParagraphType;
|
|
text: Text;
|
|
collapsed: boolean;
|
|
} & BlockMeta;
|
|
|
|
export const ParagraphBlockSchema = defineBlockSchema({
|
|
flavour: 'affine:paragraph',
|
|
props: (internal): ParagraphProps => ({
|
|
type: 'text',
|
|
text: internal.Text(),
|
|
collapsed: false,
|
|
'meta:createdAt': undefined,
|
|
'meta:createdBy': undefined,
|
|
'meta:updatedAt': undefined,
|
|
'meta:updatedBy': undefined,
|
|
}),
|
|
metadata: {
|
|
version: 1,
|
|
role: 'content',
|
|
parent: [
|
|
'affine:note',
|
|
'affine:database',
|
|
'affine:paragraph',
|
|
'affine:list',
|
|
'affine:edgeless-text',
|
|
'affine:callout',
|
|
'affine:transcription',
|
|
],
|
|
},
|
|
toModel: () => new ParagraphBlockModel(),
|
|
});
|
|
|
|
export const ParagraphBlockSchemaExtension =
|
|
BlockSchemaExtension(ParagraphBlockSchema);
|
|
|
|
export class ParagraphBlockModel extends BlockModel<ParagraphProps> {
|
|
override isEmpty(): boolean {
|
|
return this.props.text$.value.length === 0 && this.children.length === 0;
|
|
}
|
|
}
|