notion-utils
Advanced tools
Comparing version 4.2.0 to 4.2.6
@@ -12,5 +12,9 @@ "use strict"; | ||
var _a; | ||
if (!block.properties) { | ||
// TODO: check parent page? | ||
return null; | ||
} | ||
var collection = (_a = recordMap.collection[block.parent_id]) === null || _a === void 0 ? void 0 : _a.value; | ||
if (collection) { | ||
var propertyId = Object.keys(collection.schema).find(function (key) { return collection.schema[key].name === propertyName; }); | ||
var propertyId = Object.keys(collection.schema).find(function (key) { var _a; return ((_a = collection.schema[key]) === null || _a === void 0 ? void 0 : _a.name) === propertyName; }); | ||
if (propertyId) { | ||
@@ -17,0 +21,0 @@ return get_text_content_1.getTextContent(block.properties[propertyId]); |
@@ -9,5 +9,9 @@ import { getTextContent } from './get-text-content'; | ||
var _a; | ||
if (!block.properties) { | ||
// TODO: check parent page? | ||
return null; | ||
} | ||
var collection = (_a = recordMap.collection[block.parent_id]) === null || _a === void 0 ? void 0 : _a.value; | ||
if (collection) { | ||
var propertyId = Object.keys(collection.schema).find(function (key) { return collection.schema[key].name === propertyName; }); | ||
var propertyId = Object.keys(collection.schema).find(function (key) { var _a; return ((_a = collection.schema[key]) === null || _a === void 0 ? void 0 : _a.name) === propertyName; }); | ||
if (propertyId) { | ||
@@ -14,0 +18,0 @@ return getTextContent(block.properties[propertyId]); |
{ | ||
"name": "notion-utils", | ||
"version": "4.2.0", | ||
"version": "4.2.6", | ||
"description": "Useful utilities for working with Notion data. Isomorphic.", | ||
@@ -24,3 +24,3 @@ "repository": "NotionX/react-notion-x", | ||
}, | ||
"gitHead": "af37c43765cce2fca1827ce154e169af047c04cc" | ||
"gitHead": "3f79e70ac0cc31985349ddbfd8b4fbf324316b2e" | ||
} |
@@ -14,2 +14,7 @@ import { Block, ExtendedRecordMap } from 'notion-types' | ||
): string | null { | ||
if (!block.properties) { | ||
// TODO: check parent page? | ||
return null | ||
} | ||
const collection = recordMap.collection[block.parent_id]?.value | ||
@@ -19,3 +24,3 @@ | ||
const propertyId = Object.keys(collection.schema).find( | ||
(key) => collection.schema[key].name === propertyName | ||
(key) => collection.schema[key]?.name === propertyName | ||
) | ||
@@ -22,0 +27,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
771631
8696