gatsby-source-notion-churnotion 1.0.23 → 1.0.24

Sign up to get free protection for your applications and to get access to all the features.
@@ -125,7 +125,14 @@ const getPages = async ({ databaseId, reporter, getCache, actions, createNode, c
125
125
  }
126
126
  const bookId = page.properties?.book?.relation?.[0]?.id || null;
127
127
  const markdownContent = await connector_1.n2m.pageToMarkdown(page.id);
128
- const thumbnailUrl = await (0, imageProcessor_1.processBlocks)(markdownContent, actions, getCache, createNodeId, reporter);
128
+ const imageBlock = await (0, imageProcessor_1.processBlocks)(markdownContent, actions, getCache, createNodeId, reporter);
129
+ const gatsbyImageData = {
130
+ childImageSharp: {
131
+ gatsbyImageData: imageBlock
132
+ ? `childImageSharp___NODE___${imageBlock}`
133
+ : null,
134
+ },
135
+ };
129
136
  const postNode = {
130
137
  id: nodeId,
131
138
  category: parentCategoryId,
@@ -150,7 +157,8 @@ const getPages = async ({ databaseId, reporter, getCache, actions, createNode, c
150
157
  tags: tagIds,
151
158
  parent: null,
152
159
  url: `${constants_1.COMMON_URI}/${constants_1.POST_URI}${categoryUrl}/${slug}`,
153
- thumbnailUrl: thumbnailUrl,
160
+ thumbnailUrl: imageBlock,
161
+ ...gatsbyImageData,
154
162
  };
155
163
  await createNode(postNode);
156
164
  // book과 post 부모-자식 관계 설정
@@ -22,9 +22,10 @@ const processBlocks = async (blocks, actions, getCache, createNodeId, reporter)
22
22
  createNodeId,
23
23
  });
24
24
  if (fileNode) {
25
- const publicUrl = fileNode.publicURL;
26
- block.parent = block.parent.replace(/\(https?:\/\/.*?\)/, `(${publicUrl || fileNode.relativePath})`);
27
- reporter.info(`[SUCCESS] Image processed: ${publicUrl}`);
25
+ block.parent = fileNode.id;
26
+ if (thumbnailUrl.length === 0)
27
+ thumbnailUrl = fileNode.id;
28
+ reporter.info(`[SUCCESS] Image processed: ${fileNode.publicURL}`);
28
29
  }
29
30
  }
30
31
  catch (error) {
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.23",
4
+ "version": "1.0.24",
5
5
  "skipLibCheck": true,
6
6
  "license": "0BSD",
7
7
  "main": "./dist/gatsby-node.js",