gatsby-source-notion-churnotion 1.0.48 → 1.0.49

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,8 +10,13 @@ const processBlocks = async (blocks, actions, getCache, createNodeId, reporter)
10
10
  const { createNode } = actions;
11
11
  let thumbnail = null;
12
12
  for (const block of blocks) {
13
- if (isImageBlock(block) && block?.image?.file?.url) {
14
- const imageUrl = block.image.file.url;
13
+ if (isImageBlock(block)) {
14
+ const imageSourceType = block.image.type;
15
+ const imageUrl = imageSourceType === `external`
16
+ ? block.image.external?.url
17
+ : block.image?.file?.url;
18
+ if (!imageUrl)
19
+ continue;
15
20
  reporter.info(`[Image] got image > ${imageUrl}`);
16
21
  try {
17
22
  const fileNode = await (0, gatsby_source_filesystem_1.createRemoteFileNode)({
@@ -22,7 +27,10 @@ const processBlocks = async (blocks, actions, getCache, createNodeId, reporter)
22
27
  createNodeId,
23
28
  });
24
29
  if (fileNode) {
25
- block.image.file.url = fileNode.id;
30
+ block.image = {
31
+ id: fileNode.id,
32
+ caption: block.image.caption,
33
+ };
26
34
  if (!thumbnail)
27
35
  thumbnail = fileNode.id;
28
36
  reporter.info(`[SUCCESS] Image processed: ${fileNode.id}`);
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.0.48",
4
+ "version": "1.0.49",
5
5
  "skipLibCheck": true,
6
6
  "license": "0BSD",
7
7
  "main": "./dist/gatsby-node.js",