makenotion / notion-sdk-js

Official Notion JavaScript Client
https://developers.notion.com/docs
MIT License
4.96k stars 593 forks source link

Update index.js #456

Closed adasq closed 1 year ago

adasq commented 1 year ago

The current version doesn't support a general rich_text case, for the following block:

{
  type: 'rich_text',
  rich_text: [
    {
      type: 'text',
      text: [Object],
      annotations: [Object],
      plain_text: 'plain!',
      href: null
    }
  ]
}

The first if condition:

if (block[block.type].rich_text) {
        // This will be an empty string if it's an empty line.
        text = getPlainTextFromRichText(block[block.type].rich_text)
    }

doesn't cover it, as it resolves to block.rich_text.rich_text.

CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.

rhart92 commented 1 year ago

Unfortunately we had to remove an old .env file from the repo which required completely re-writing the commit history causing this PR's commit history to be out of date. Please re-submit this PR after pulling a fresh copy of this repo 🙏 Apologies for any inconvenience.