Skip to content

Commit fb17ed1

Browse files
🚵
1 parent e9629b6 commit fb17ed1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+315
-178
lines changed

.eslintrc.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"root": true,
33
"extends": ["@fisch0920/eslint-config"],
44
"rules": {
5-
"react/function-component-definition": "off",
65
"react/prop-types": "off",
76
"unicorn/no-array-reduce": "off",
87
"unicorn/filename-case": "off",

.vscode/launch.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Next.js: debug server-side",
6+
"type": "node-terminal",
7+
"request": "launch",
8+
"command": "./node_modules/.bin/next dev",
9+
"cwd": "${workspaceFolder}/examples/minimal"
10+
},
11+
{
12+
"name": "Next.js: debug client-side",
13+
"type": "chrome",
14+
"request": "launch",
15+
"url": "http://localhost:3000"
16+
},
17+
{
18+
"name": "Next.js: debug full stack",
19+
"type": "node",
20+
"request": "launch",
21+
"program": "${workspaceFolder}/examples/minimal/node_modules/.bin/next",
22+
"cwd": "${workspaceFolder}/examples/minimal",
23+
"runtimeArgs": ["--inspect"],
24+
"skipFiles": ["<node_internals>/**"],
25+
"serverReadyAction": {
26+
"action": "debugWithEdge",
27+
"killOnServerStop": true,
28+
"pattern": "- Local:.+(https?://.+)",
29+
"uriFormat": "%s",
30+
"webRoot": "${workspaceFolder}/examples/minimal"
31+
}
32+
}
33+
]
34+
}

examples/full/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "notion-x-example-full",
33
"version": "6.16.2",
44
"private": true,
5-
"type": "commonjs",
5+
"type": "module",
66
"scripts": {
77
"dev": "next dev",
88
"build": "next build",

examples/minimal/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "notion-x-example-minimal",
33
"version": "6.16.1",
44
"private": true,
5-
"type": "commonjs",
5+
"type": "module",
66
"scripts": {
77
"dev": "next dev",
88
"build": "next build",

packages/react-notion-x/src/block.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,13 @@ const tocIndentLevelCache: {
5353

5454
const pageCoverStyleCache: Record<string, object> = {}
5555

56-
export const Block: React.FC<BlockProps> = (props: BlockProps) => {
56+
export function Block(props: BlockProps) {
57+
console.log('Block', {
58+
id: props.block.id,
59+
type: props.block.type,
60+
level: props.level
61+
})
62+
5763
const ctx = useNotionContext()
5864
const {
5965
components,
@@ -148,6 +154,16 @@ export const Block: React.FC<BlockProps> = (props: BlockProps) => {
148154
const hasAside = !!((hasToc || pageAside) && !page_full_width)
149155
const hasPageCover = !!(pageCover || page_cover)
150156

157+
console.log({
158+
disableHeader,
159+
header,
160+
pageCover,
161+
pageHeader,
162+
pageFooter,
163+
footer,
164+
components
165+
})
166+
151167
return (
152168
<div
153169
className={cs(

packages/react-notion-x/src/components/asset-wrapper.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ import { Text } from './text'
99

1010
const urlStyle = { width: '100%' }
1111

12-
export const AssetWrapper: React.FC<{
12+
export function AssetWrapper({
13+
blockId,
14+
block
15+
}: {
1316
blockId: string
1417
block: Block
15-
}> = ({ blockId, block }) => {
18+
}) {
1619
const value = block as BaseContentBlock
1720
const { components, mapPageUrl, rootDomain, zoom } = useNotionContext()
1821

packages/react-notion-x/src/components/asset.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,15 @@ const supportedAssetTypes = new Set([
2525
'drive'
2626
])
2727

28-
export const Asset: React.FC<{
28+
export function Asset({
29+
block,
30+
zoomable = true,
31+
children
32+
}: {
2933
block: BaseContentBlock
3034
children: any
3135
zoomable?: boolean
32-
}> = ({ block, zoomable = true, children }) => {
36+
}) {
3337
const { recordMap, mapImageUrl, components } = useNotionContext()
3438

3539
if (!block || !supportedAssetTypes.has(block.type)) {

packages/react-notion-x/src/components/audio.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ import { type AudioBlock } from 'notion-types'
44
import { useNotionContext } from '../context'
55
import { cs } from '../utils'
66

7-
export const Audio: React.FC<{
7+
export function Audio({
8+
block,
9+
className
10+
}: {
811
block: AudioBlock
912
className?: string
10-
}> = ({ block, className }) => {
13+
}) {
1114
const { recordMap } = useNotionContext()
1215
const source =
1316
recordMap.signed_urls[block.id] || block.properties?.source?.[0]?.[0]

packages/react-notion-x/src/components/checkbox.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ import type * as React from 'react'
22

33
import CheckIcon from '../icons/check'
44

5-
export const Checkbox: React.FC<{
5+
export function Checkbox({
6+
isChecked
7+
}: {
68
isChecked: boolean
79
blockId?: string
8-
}> = ({ isChecked }) => {
10+
}) {
911
let content = null
1012

1113
if (isChecked) {

packages/react-notion-x/src/components/eoi.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@ import { cs, formatNotionDateTime } from '../utils'
77
import { MentionPreviewCard } from './mention-preview-card'
88

99
// External Object Instance
10-
export const EOI: React.FC<{
10+
export function EOI({
11+
block,
12+
inline,
13+
className
14+
}: {
1115
block: Block
1216
inline?: boolean
1317
className?: string
14-
}> = ({ block, inline, className }) => {
18+
}) {
1519
const { components } = useNotionContext()
1620
const { original_url, attributes, domain } = block?.format || {}
1721
if (!original_url || !attributes) {

0 commit comments

Comments
 (0)