mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-11 20:08:37 +00:00
feat(nbstore): add more data to indexer (#12815)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved display of image and attachment blocks by ensuring image captions are shown as content for images, while attachment names remain as content for attachments. <!-- end of auto-generated comment: release notes by coderabbit.ai --> #### PR Dependency Tree * **PR #12815** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) --------- Co-authored-by: fengmk2 <fengmk2@gmail.com>
This commit is contained in:
@@ -1673,6 +1673,7 @@ exports[`should read doc blocks work 1`] = `
|
||||
"BFZk3c2ERp-sliRvA7MQ_p3NdkdCLt2Ze0DQ9i21dpA=",
|
||||
],
|
||||
"blockId": "lcZphIJe63",
|
||||
"content": "",
|
||||
"docId": "test-doc",
|
||||
"flavour": "affine:image",
|
||||
"parentBlockId": "6x7ALjUDjj",
|
||||
@@ -1702,6 +1703,7 @@ exports[`should read doc blocks work 1`] = `
|
||||
"HWvCItS78DzPGbwcuaGcfkpVDUvL98IvH5SIK8-AcL8=",
|
||||
],
|
||||
"blockId": "JlgVJdWU12",
|
||||
"content": "",
|
||||
"docId": "test-doc",
|
||||
"flavour": "affine:image",
|
||||
"parentBlockId": "6x7ALjUDjj",
|
||||
@@ -1731,6 +1733,7 @@ exports[`should read doc blocks work 1`] = `
|
||||
"ZRKpsBoC88qEMmeiXKXqywfA1rLvWoLa5rpEh9x9Oj0=",
|
||||
],
|
||||
"blockId": "lht7AqBqnF",
|
||||
"content": "",
|
||||
"docId": "test-doc",
|
||||
"flavour": "affine:image",
|
||||
"parentBlockId": "6x7ALjUDjj",
|
||||
@@ -3361,6 +3364,7 @@ exports[`should read doc blocks work without root doc 1`] = `
|
||||
"BFZk3c2ERp-sliRvA7MQ_p3NdkdCLt2Ze0DQ9i21dpA=",
|
||||
],
|
||||
"blockId": "lcZphIJe63",
|
||||
"content": "",
|
||||
"docId": "test-doc",
|
||||
"flavour": "affine:image",
|
||||
"parentBlockId": "6x7ALjUDjj",
|
||||
@@ -3390,6 +3394,7 @@ exports[`should read doc blocks work without root doc 1`] = `
|
||||
"HWvCItS78DzPGbwcuaGcfkpVDUvL98IvH5SIK8-AcL8=",
|
||||
],
|
||||
"blockId": "JlgVJdWU12",
|
||||
"content": "",
|
||||
"docId": "test-doc",
|
||||
"flavour": "affine:image",
|
||||
"parentBlockId": "6x7ALjUDjj",
|
||||
@@ -3419,6 +3424,7 @@ exports[`should read doc blocks work without root doc 1`] = `
|
||||
"ZRKpsBoC88qEMmeiXKXqywfA1rLvWoLa5rpEh9x9Oj0=",
|
||||
],
|
||||
"blockId": "lht7AqBqnF",
|
||||
"content": "",
|
||||
"docId": "test-doc",
|
||||
"flavour": "affine:image",
|
||||
"parentBlockId": "6x7ALjUDjj",
|
||||
|
||||
@@ -648,12 +648,24 @@ export async function readAllBlocksFromDoc({
|
||||
parentBlockId,
|
||||
});
|
||||
}
|
||||
} else if (flavour === 'affine:attachment' || flavour === 'affine:image') {
|
||||
} else if (flavour === 'affine:attachment') {
|
||||
const blobId = block.get('prop:sourceId');
|
||||
if (typeof blobId === 'string') {
|
||||
blockDocuments.push({
|
||||
...commonBlockProps,
|
||||
blob: [blobId],
|
||||
content: block.get('prop:name')?.toString() ?? '',
|
||||
parentFlavour,
|
||||
parentBlockId,
|
||||
});
|
||||
}
|
||||
} else if (flavour === 'affine:image') {
|
||||
const blobId = block.get('prop:sourceId');
|
||||
if (typeof blobId === 'string') {
|
||||
blockDocuments.push({
|
||||
...commonBlockProps,
|
||||
blob: [blobId],
|
||||
content: block.get('prop:caption')?.toString() ?? '',
|
||||
parentFlavour,
|
||||
parentBlockId,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user