File tree Expand file tree Collapse file tree 3 files changed +19
-2
lines changed
react-notion-x/src/components Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,7 @@ export interface BaseContentBlock extends BaseBlock {
131
131
caption ?: Decoration [ ]
132
132
}
133
133
format ?: {
134
+ block_alignment : 'center' | 'left' | 'right'
134
135
block_width : number
135
136
block_height : number
136
137
display_source : string
@@ -351,6 +352,7 @@ export interface GoogleDriveBlock extends BaseContentBlock {
351
352
user_name : string
352
353
modified_time : number
353
354
}
355
+ block_alignment : 'center' | 'left' | 'right'
354
356
block_width : number
355
357
block_height : number
356
358
display_source : string
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ export const AssetWrapper: React.FC<{
74
74
return figure
75
75
}
76
76
77
- function isValidURL ( str ) {
77
+ function isValidURL ( str : string ) {
78
78
// TODO: replace this with a more well-tested package
79
79
const pattern = new RegExp (
80
80
'^(https?:\\/\\/)?' + // protocol
@@ -88,7 +88,7 @@ function isValidURL(str) {
88
88
return ! ! pattern . test ( str )
89
89
}
90
90
91
- function extractHostname ( url ) {
91
+ function extractHostname ( url : string ) {
92
92
try {
93
93
const hostname = new URL ( url ) . hostname
94
94
return hostname
Original file line number Diff line number Diff line change @@ -87,6 +87,21 @@ export const Asset: React.FC<{
87
87
}
88
88
}
89
89
} else {
90
+ switch ( block . format ?. block_alignment ) {
91
+ case 'center' : {
92
+ style . alignSelf = 'center'
93
+ break
94
+ }
95
+ case 'left' : {
96
+ style . alignSelf = 'start'
97
+ break
98
+ }
99
+ case 'right' : {
100
+ style . alignSelf = 'end'
101
+ break
102
+ }
103
+ }
104
+
90
105
if ( block_width ) {
91
106
style . width = block_width
92
107
}
You can’t perform that action at this time.
0 commit comments