This repository was archived by the owner on Nov 8, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 77import React from 'react'
88
99import { connectStore , buildLog } from '@utils'
10+ import { usePlatform } from '@hooks'
11+
1012import { PageOverlay , PanelContainer } from './styles'
1113
1214import InputEditor from './InputEditor'
@@ -16,13 +18,15 @@ import ThreadSelectBar from './ThreadSelectBar'
1618import AlertBar from './AlertBar'
1719import UtilsBar from './UtilsBar'
1820
19- import * as logic from './logic'
21+ import { useInit , useScrollbar , hidePanel } from './logic'
2022
2123/* eslint-disable-next-line */
2224const log = buildLog ( 'C:Doraemon' )
2325
2426const DoraemonContainer = ( { doraemon } ) => {
25- logic . useInit ( doraemon )
27+ useInit ( doraemon )
28+ const { isMacOS } = usePlatform ( )
29+ useScrollbar ( isMacOS )
2630
2731 const {
2832 inputValue,
@@ -43,7 +47,7 @@ const DoraemonContainer = ({ doraemon }) => {
4347
4448 return (
4549 < React . Fragment >
46- < PageOverlay visible = { visible } onClick = { logic . hidePanel } />
50+ < PageOverlay visible = { visible } onClick = { hidePanel } />
4751 < PanelContainer visible = { visible } >
4852 < InputEditor value = { inputValue } searching = { searching } prefix = { prefix } />
4953
Original file line number Diff line number Diff line change @@ -493,16 +493,22 @@ const initSpecCmdResolver = () => {
493493// ###############################
494494// init & uninit handlers
495495// ###############################
496+ export const useScrollbar = isMacOS => {
497+ useEffect ( ( ) => {
498+ if ( isMacOS ) {
499+ /* eslint-disable no-undef */
500+ OverlayScrollbars ( document . getElementById ( 'suggestion-scroller' ) , { } )
501+ }
502+ } , [ isMacOS ] )
503+ }
504+
496505export const useInit = _store => {
497506 useEffect ( ( ) => {
498507 store = _store
499508
500509 pockect$ = new Pocket ( store )
501510 SAK = new SwissArmyKnife ( store )
502511
503- /* eslint-disable no-undef */
504- OverlayScrollbars ( document . getElementById ( 'suggestion-scroller' ) , { } )
505-
506512 initSpecCmdResolver ( )
507513
508514 pockect$ . search ( ) . subscribe ( res => {
You can’t perform that action at this time.
0 commit comments