feat(editor): unify block props api (#10888)

Closes: [BS-2707](https://linear.app/affine-design/issue/BS-2707/统一使用props获取和更新block-prop)
This commit is contained in:
Saul-Mirone
2025-03-16 05:48:34 +00:00
parent 8f9e5bf0aa
commit 26285f7dcb
193 changed files with 1019 additions and 891 deletions
@@ -151,7 +151,7 @@ export class AttachmentViewerPanel extends SignalWatcher(
open(model: AttachmentBlockModel) {
this.#dialog.showModal();
const { name, size } = model;
const { name, size } = model.props;
const fileType = name.split('.').pop() ?? '';
const icon = getAttachmentFileIcon(fileType);
@@ -165,7 +165,7 @@ export class AttachmentViewerPanel extends SignalWatcher(
};
if (!isPDF) return;
if (!model.sourceId) return;
if (!model.props.sourceId) return;
if (this.#worker) return;
const process = async ({ data }: MessageEvent<MessageData>) => {
@@ -182,7 +182,7 @@ export class AttachmentViewerPanel extends SignalWatcher(
console.debug('connected');
this.#state.value = State.Connected;
const blob = await model.doc.blobSync.get(model.sourceId!);
const blob = await model.doc.blobSync.get(model.props.sourceId!);
if (!blob) return;
const buffer = await blob.arrayBuffer();