diff --git a/blocksuite/affine/blocks/block-attachment/src/attachment-block.ts b/blocksuite/affine/blocks/block-attachment/src/attachment-block.ts index 220a7376f1..dc319c5b75 100644 --- a/blocksuite/affine/blocks/block-attachment/src/attachment-block.ts +++ b/blocksuite/affine/blocks/block-attachment/src/attachment-block.ts @@ -28,7 +28,7 @@ import { checkAttachmentBlob, downloadAttachmentBlob } from './utils'; @Peekable({ enableOn: ({ model }: AttachmentBlockComponent) => { - return model.type.endsWith('pdf'); + return model.props.type.endsWith('pdf'); }, }) export class AttachmentBlockComponent extends CaptionedBlockComponent { @@ -104,7 +104,7 @@ export class AttachmentBlockComponent extends CaptionedBlockComponent { this.doc.updateBlock(this.model, { style: AttachmentBlockStyles[1], @@ -170,7 +170,7 @@ export class AttachmentBlockComponent extends CaptionedBlockComponent(); // Fix auto focus setTimeout(() => inputRef.value?.focus()); - const originalName = model.name; + const originalName = model.props.name; const nameWithoutExtension = originalName.slice( 0, originalName.lastIndexOf('.') diff --git a/blocksuite/affine/blocks/block-attachment/src/configs/toolbar.ts b/blocksuite/affine/blocks/block-attachment/src/configs/toolbar.ts index 53cfe9d88b..2db47aaa06 100644 --- a/blocksuite/affine/blocks/block-attachment/src/configs/toolbar.ts +++ b/blocksuite/affine/blocks/block-attachment/src/configs/toolbar.ts @@ -100,7 +100,7 @@ const createAttachmentViewDropdownMenuWith = ( const actions = this.actions.map(action => ({ ...action })); const viewType$ = computed(() => { const [cardAction, embedAction] = actions; - const embed = model.embed$.value ?? false; + const embed = model.props.embed$.value ?? false; cardAction.disabled = !embed; embedAction.disabled = embed && embedProvider.embedded(model); diff --git a/blocksuite/affine/blocks/block-attachment/src/embed.ts b/blocksuite/affine/blocks/block-attachment/src/embed.ts index 14b59c5af0..671ef34ca7 100644 --- a/blocksuite/affine/blocks/block-attachment/src/embed.ts +++ b/blocksuite/affine/blocks/block-attachment/src/embed.ts @@ -113,11 +113,11 @@ export class AttachmentEmbedService extends Extension { blobUrl?: string, maxFileSize = this._maxFileSize ) { - if (!model.embed || !blobUrl) return; + if (!model.props.embed || !blobUrl) return; const config = this.values.find(config => config.check(model, maxFileSize)); if (!config || !config.template) { - console.error('No embed view template found!', model, model.type); + console.error('No embed view template found!', model, model.props.type); return; } @@ -130,7 +130,7 @@ const embedConfig: AttachmentEmbedConfig[] = [ name: 'image', check: model => model.doc.schema.flavourSchemaMap.has('affine:image') && - model.type.startsWith('image/'), + model.props.type.startsWith('image/'), async action(model, std) { const component = std.view.getBlock(model.id); if (!component) return; @@ -141,7 +141,7 @@ const embedConfig: AttachmentEmbedConfig[] = [ { name: 'pdf', check: (model, maxFileSize) => - model.type === 'application/pdf' && model.size <= maxFileSize, + model.props.type === 'application/pdf' && model.props.size <= maxFileSize, template: (_, blobUrl) => { // More options: https://tinytip.co/tips/html-pdf-params/ // https://chromium.googlesource.com/chromium/src/+/refs/tags/121.0.6153.1/chrome/browser/resources/pdf/open_pdf_params_parser.ts @@ -162,7 +162,7 @@ const embedConfig: AttachmentEmbedConfig[] = [ { name: 'video', check: (model, maxFileSize) => - model.type.startsWith('video/') && model.size <= maxFileSize, + model.props.type.startsWith('video/') && model.props.size <= maxFileSize, template: (_, blobUrl) => html`