Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 9abf0fc

Browse files
committed
chore: merge branch 'dev'
2 parents 64c920d + 05c8ac4 commit 9abf0fc

File tree

3 files changed

+14
-106
lines changed

3 files changed

+14
-106
lines changed

containers/Doraemon/InputEditor.js

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
} from './logic'
2121

2222
const InputEditor = ({ searching, value, prefix }) => {
23-
useShortcut(['ctrl+c', 'ctrl+g'], hidePanel)
23+
useShortcut(['ctrl+c', 'ctrl+g', 'esc'], hidePanel)
2424
useShortcut('ctrl+p', () => navSuggestion('up'))
2525
useShortcut('ctrl+n', () => navSuggestion('down'))
2626

@@ -46,54 +46,3 @@ const InputEditor = ({ searching, value, prefix }) => {
4646
}
4747

4848
export default InputEditor
49-
50-
/*
51-
52-
export default class InputEditor extends React.Component {
53-
@keydown(['ctrl+g', 'ctrl+c'])
54-
hidePanel() {
55-
hidePanel()
56-
}
57-
58-
// Prevent default behavior in text input while pressing arrow up
59-
// https://stackoverflow.com/questions/1080532/prevent-default-behavior-in-text-input-while-pressing-arrow-up
60-
@keydown(['ctrl+p'])
61-
up(e) {
62-
navSuggestion('up')
63-
e.preventDefault()
64-
}
65-
66-
@keydown(['ctrl+n'])
67-
down(e) {
68-
navSuggestion('down')
69-
e.preventDefault()
70-
}
71-
72-
render() {
73-
const { searching, value, prefix } = this.props
74-
75-
// if you want to use innerRef
76-
// see https://github.com/styled-components/styled-components/issues/102
77-
// innerRef={input => (this.doraemonInput = input)}
78-
return (
79-
<EditorBar>
80-
<PrefixWraper>
81-
<InputPrefix prefix={prefix} searching={searching} />
82-
</PrefixWraper>
83-
<InputBar
84-
id="doraemonInputbar"
85-
spellCheck={false}
86-
autoCapitalize="off"
87-
autoCorrect="off"
88-
autoComplete="off"
89-
onKeyDown={logic.handleKeyDown}
90-
onBlur={logic.inputOnBlur}
91-
onChange={logic.inputOnChange}
92-
value={value}
93-
placeholder="type ? for help"
94-
/>
95-
</EditorBar>
96-
)
97-
}
98-
}
99-
*/

containers/Doraemon/ResultsList.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
HintEnter,
1818
} from './styles/results_list'
1919

20-
import { navToSuggestion, selectSuggestion } from './logic'
20+
import { navToSuggestion, suggestionOnSelect } from './logic'
2121

2222
const HintIcon = ({ index, active, cur, length }) => {
2323
if (active === cur) {
@@ -38,7 +38,7 @@ const ResultsList = ({ searchValue, searchThread, suggestions, activeRaw }) => (
3838
key={suggestion.raw}
3939
id={suggestion.raw}
4040
onMouseEnter={navToSuggestion.bind(this, suggestion)}
41-
onClick={selectSuggestion}
41+
onClick={suggestionOnSelect}
4242
>
4343
<SuggestIcon
4444
raw={suggestion.raw}

containers/Doraemon/logic/index.js

Lines changed: 11 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -88,19 +88,22 @@ export const handleKeyDown = e => {
8888
export const navSuggestion = direction => SAK.navSuggestion(direction)
8989
// mounseEnter
9090
export const navToSuggestion = suggestion => SAK.navToSuggestion(suggestion)
91-
export const selectSuggestion = () => {
91+
export const suggestionOnSelect = () => {
9292
if (store.showThreadSelector) return doNavigate()
9393
doSpecCmd()
9494
}
9595

9696
export const inputOnBlur = () => {
97-
if (R.contains(store.prefix, ['/', '?', '@'])) {
98-
hidePanel()
99-
}
100-
101-
if (!store.showThreadSelector && R.isEmpty(store.prefix)) {
102-
hidePanel()
103-
}
97+
return false
98+
// if (R.contains(store.prefix, ['/', '?', '@'])) {
99+
// log('11')
100+
// hidePanel()
101+
// }
102+
103+
// if (!store.showThreadSelector && R.isEmpty(store.prefix)) {
104+
// log('22')
105+
// hidePanel()
106+
// }
104107
}
105108

106109
// do dearch when thread changes
@@ -545,47 +548,3 @@ export const useInit = _store => {
545548
}
546549
}, [_store])
547550
}
548-
549-
/*
550-
551-
export const init2 = _store => {
552-
if (store) return false
553-
554-
store = _store
555-
556-
pockect$ = new Pocket(store)
557-
SAK = new SwissArmyKnife(store)
558-
559-
initSpecCmdResolver()
560-
561-
pockect$.search().subscribe(res => {
562-
if (R.isEmpty(res)) return emptySearchStates()
563-
564-
store.markState({
565-
searching: true,
566-
showThreadSelector: true,
567-
showAlert: false,
568-
showUtils: false,
569-
})
570-
searchContents(store, sr71$, res)
571-
})
572-
573-
pockect$.searchUser().subscribe(name => {
574-
const nickname = R.slice(1, Infinity, name)
575-
store.markState({
576-
prefix: '@',
577-
searchThread: THREAD.USER,
578-
showThreadSelector: true,
579-
showAlert: false,
580-
})
581-
if (R.isEmpty(nickname)) return false
582-
searchContents(store, sr71$, nickname)
583-
})
584-
585-
pockect$.cmdSuggesttion().subscribe(res => store.loadSuggestions(res))
586-
pockect$.emptyInput().subscribe(() => store.clearSuggestions())
587-
588-
if (sub$) sub$.unsubscribe()
589-
sub$ = sr71$.data().subscribe($solver(DataSolver, ErrSolver))
590-
}
591-
*/

0 commit comments

Comments
 (0)