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 7
7
import React from 'react'
8
8
9
9
import { connectStore , buildLog } from '@utils'
10
+ import { usePlatform } from '@hooks'
11
+
10
12
import { PageOverlay , PanelContainer } from './styles'
11
13
12
14
import InputEditor from './InputEditor'
@@ -16,13 +18,15 @@ import ThreadSelectBar from './ThreadSelectBar'
16
18
import AlertBar from './AlertBar'
17
19
import UtilsBar from './UtilsBar'
18
20
19
- import * as logic from './logic'
21
+ import { useInit , useScrollbar , hidePanel } from './logic'
20
22
21
23
/* eslint-disable-next-line */
22
24
const log = buildLog ( 'C:Doraemon' )
23
25
24
26
const DoraemonContainer = ( { doraemon } ) => {
25
- logic . useInit ( doraemon )
27
+ useInit ( doraemon )
28
+ const { isMacOS } = usePlatform ( )
29
+ useScrollbar ( isMacOS )
26
30
27
31
const {
28
32
inputValue,
@@ -43,7 +47,7 @@ const DoraemonContainer = ({ doraemon }) => {
43
47
44
48
return (
45
49
< React . Fragment >
46
- < PageOverlay visible = { visible } onClick = { logic . hidePanel } />
50
+ < PageOverlay visible = { visible } onClick = { hidePanel } />
47
51
< PanelContainer visible = { visible } >
48
52
< InputEditor value = { inputValue } searching = { searching } prefix = { prefix } />
49
53
Original file line number Diff line number Diff line change @@ -493,16 +493,22 @@ const initSpecCmdResolver = () => {
493
493
// ###############################
494
494
// init & uninit handlers
495
495
// ###############################
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
+
496
505
export const useInit = _store => {
497
506
useEffect ( ( ) => {
498
507
store = _store
499
508
500
509
pockect$ = new Pocket ( store )
501
510
SAK = new SwissArmyKnife ( store )
502
511
503
- /* eslint-disable no-undef */
504
- OverlayScrollbars ( document . getElementById ( 'suggestion-scroller' ) , { } )
505
-
506
512
initSpecCmdResolver ( )
507
513
508
514
pockect$ . search ( ) . subscribe ( res => {
You can’t perform that action at this time.
0 commit comments