gatsby-source-notion-churnotion 1.1.9 → 1.1.11
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/util/processor.js +24 -7
- package/package.json +1 -1
package/dist/util/processor.js
CHANGED
@@ -14,7 +14,25 @@ const processBlocksForContent = async (blocks, actions, getCache, createNodeId,
|
|
14
14
|
const tableOfContents = [];
|
15
15
|
let thumbnail = null;
|
16
16
|
let rawText = "";
|
17
|
-
const updatedBlocks =
|
17
|
+
const updatedBlocks = [];
|
18
|
+
let firstImageBlock = null;
|
19
|
+
for (const block of blocks) {
|
20
|
+
if (isImageBlock(block)) {
|
21
|
+
firstImageBlock = block;
|
22
|
+
break;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
if (firstImageBlock) {
|
26
|
+
const updatedBlock = await processImageBlock(firstImageBlock, actions, getCache, createNodeId, reporter, cache);
|
27
|
+
if (updatedBlock?.image?.fileId) {
|
28
|
+
thumbnail = updatedBlock.image.fileId;
|
29
|
+
}
|
30
|
+
updatedBlocks[blocks.indexOf(firstImageBlock)] =
|
31
|
+
updatedBlock || firstImageBlock;
|
32
|
+
}
|
33
|
+
await Promise.all(blocks.map(async (block, index) => {
|
34
|
+
if (block === firstImageBlock)
|
35
|
+
return;
|
18
36
|
await (0, tableOfContent_1.processTableOfContents)(block, tableOfContents);
|
19
37
|
const plainText = extractPlainText(block);
|
20
38
|
if (plainText) {
|
@@ -22,13 +40,12 @@ const processBlocksForContent = async (blocks, actions, getCache, createNodeId,
|
|
22
40
|
}
|
23
41
|
if (isImageBlock(block)) {
|
24
42
|
const updatedBlock = await processImageBlock(block, actions, getCache, createNodeId, reporter, cache);
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
43
|
+
updatedBlocks[index] = updatedBlock || block;
|
44
|
+
}
|
45
|
+
else {
|
46
|
+
updatedBlocks[index] = block;
|
29
47
|
}
|
30
|
-
|
31
|
-
}))).filter((block) => block !== null);
|
48
|
+
}));
|
32
49
|
return { thumbnail, tableOfContents, updatedBlocks, rawText };
|
33
50
|
};
|
34
51
|
const isTextContentBlock = (block) => {
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "gatsby-source-notion-churnotion",
|
3
3
|
"description": "Gatsby plugin that can connect with One Notion Database RECURSIVELY using official API",
|
4
|
-
"version": "1.1.
|
4
|
+
"version": "1.1.11",
|
5
5
|
"skipLibCheck": true,
|
6
6
|
"license": "0BSD",
|
7
7
|
"main": "./dist/gatsby-node.js",
|