Skip to content

Commit cb9b304

Browse files
#442 - Fix files are not working
1 parent 6493adc commit cb9b304

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ export const Block: React.FC<BlockProps> = (props) => {
8888
disableHeader
8989
} = props
9090

91+
console.log({ block })
92+
9193
if (!block) {
9294
return null
9395
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ export const Asset: React.FC<{
126126

127127
let source =
128128
recordMap.signed_urls?.[block.id] || block.properties?.source?.[0]?.[0]
129+
130+
if (block.space_id) {
131+
source = source.concat('&spaceId=', block.space_id)
132+
}
129133
let content = null
130134

131135
if (!source) {

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ export const Audio: React.FC<{
1010
className?: string
1111
}> = ({ block, className }) => {
1212
const { recordMap } = useNotionContext()
13-
const source =
13+
14+
let source =
1415
recordMap.signed_urls[block.id] || block.properties?.source?.[0]?.[0]
1516

17+
if (block.space_id) {
18+
source = source.concat('&spaceId=', block.space_id)
19+
}
1620
return (
1721
<div className={cs('notion-audio', className)}>
1822
<audio controls preload='none' src={source} />

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,14 @@ export const File: React.FC<{
1212
className?: string
1313
}> = ({ block, className }) => {
1414
const { components, recordMap } = useNotionContext()
15-
const source =
15+
16+
let source =
1617
recordMap.signed_urls[block.id] || block.properties?.source?.[0]?.[0]
1718

19+
if (block.space_id) {
20+
source = source.concat('&spaceId=', block.space_id)
21+
}
22+
1823
return (
1924
<div className={cs('notion-file', className)}>
2025
<components.Link

0 commit comments

Comments
 (0)