refactor(editor): add runtime type checks to database cell values (#10770)

This commit is contained in:
zzj3720
2025-03-12 09:22:41 +00:00
parent fd3ce431fe
commit 01151ec18f
54 changed files with 775 additions and 629 deletions

View File

@@ -79,11 +79,13 @@ export const database: InitFn = (collection: Workspace, id: string) => {
{ type: type, text: new Text(`Paragraph type ${type}`) },
databaseId
);
datasource.cellValueChange(
id,
richTextId,
new Text(`Paragraph type ${type}`)
);
if (richTextId) {
datasource.cellValueChange(
id,
richTextId,
new Text(`Paragraph type ${type}`)
);
}
});
const listTypes: ListType[] = ['numbered', 'bulleted', 'todo', 'toggle'];
@@ -93,11 +95,13 @@ export const database: InitFn = (collection: Workspace, id: string) => {
{ type: type, text: new Text(`List type ${type}`) },
databaseId
);
datasource.cellValueChange(
id,
richTextId,
new Text(`List type ${type}`)
);
if (richTextId) {
datasource.cellValueChange(
id,
richTextId,
new Text(`List type ${type}`)
);
}
});
// Add a paragraph after database
doc.addBlock('affine:paragraph', {}, noteId);