@@ -84,35 +84,35 @@ const NotionPage = ({ post, className }) => {
84
84
} , [ ] )
85
85
86
86
const zoom =
87
- typeof window !== 'undefined' &&
87
+ isBrowser &&
88
88
mediumZoom ( {
89
- container : '.notion-viewport' ,
89
+ // container: '.notion-viewport',
90
90
background : 'rgba(0, 0, 0, 0.2)' ,
91
91
margin : getMediumZoomMargin ( )
92
92
} )
93
+
93
94
const zoomRef = useRef ( zoom ? zoom . clone ( ) : null )
94
95
95
96
useEffect ( ( ) => {
96
- if ( ! isBrowser ) return
97
-
98
97
// 将相册gallery下的图片加入放大功能
99
98
if ( siteConfig ( 'POST_DISABLE_GALLERY_CLICK' ) ) {
100
99
setTimeout ( ( ) => {
101
- const imgList = document ?. querySelectorAll (
102
- '.notion-asset-wrapper-image img'
103
- )
104
-
105
- console . log ( '放大' , imgList )
106
-
107
- if ( imgList && zoomRef . current ) {
108
- for ( let i = 0 ; i < imgList . length ; i ++ ) {
109
- zoomRef . current . attach ( imgList [ i ] )
100
+ if ( isBrowser ) {
101
+ const imgList = document ?. querySelectorAll (
102
+ '.notion-collection-card-cover img'
103
+ )
104
+ if ( imgList && zoomRef . current ) {
105
+ for ( let i = 0 ; i < imgList . length ; i ++ ) {
106
+ zoomRef . current . attach ( imgList [ i ] )
107
+ }
110
108
}
111
- }
112
109
113
- const cards = document . getElementsByClassName ( 'notion-collection-card' )
114
- for ( const e of cards ) {
115
- e . removeAttribute ( 'href' )
110
+ const cards = document . getElementsByClassName (
111
+ 'notion-collection-card'
112
+ )
113
+ for ( const e of cards ) {
114
+ e . removeAttribute ( 'href' )
115
+ }
116
116
}
117
117
} , 800 )
118
118
}
0 commit comments