@@ -151,6 +151,7 @@ class NoteList extends React.Component {
151
151
const { selectedNoteKeys } = this . state
152
152
const visibleNoteKeys = this . notes && this . notes . map ( note => note . key )
153
153
const note = this . notes && this . notes [ 0 ]
154
+ const key = location . search && queryString . parse ( location . search ) . key
154
155
const prevKey = prevProps . location . search && queryString . parse ( prevProps . location . search ) . key
155
156
const noteKey = visibleNoteKeys . includes ( prevKey ) ? prevKey : note && note . key
156
157
@@ -173,25 +174,25 @@ class NoteList extends React.Component {
173
174
return
174
175
}
175
176
176
- // Auto scroll //<<<<<<<<<<<<<< fix me later
177
- // if (_.isString(location.query. key) && prevProps.location.query.key === location.query. key) {
178
- // const targetIndex = this.getTargetIndex()
179
- // if (targetIndex > -1) {
180
- // const list = this.refs.list
181
- // const item = list.childNodes[targetIndex]
182
-
183
- // if (item == null) return false
184
-
185
- // const overflowBelow = item.offsetTop + item.clientHeight - list.clientHeight - list.scrollTop > 0
186
- // if (overflowBelow) {
187
- // list.scrollTop = item.offsetTop + item.clientHeight - list.clientHeight
188
- // }
189
- // const overflowAbove = list.scrollTop > item.offsetTop
190
- // if (overflowAbove) {
191
- // list.scrollTop = item.offsetTop
192
- // }
193
- // }
194
- // }
177
+ // Auto scroll
178
+ if ( _ . isString ( key ) && prevKey === key ) {
179
+ const targetIndex = this . getTargetIndex ( )
180
+ if ( targetIndex > - 1 ) {
181
+ const list = this . refs . list
182
+ const item = list . childNodes [ targetIndex ]
183
+
184
+ if ( item == null ) return false
185
+
186
+ const overflowBelow = item . offsetTop + item . clientHeight - list . clientHeight - list . scrollTop > 0
187
+ if ( overflowBelow ) {
188
+ list . scrollTop = item . offsetTop + item . clientHeight - list . clientHeight
189
+ }
190
+ const overflowAbove = list . scrollTop > item . offsetTop
191
+ if ( overflowAbove ) {
192
+ list . scrollTop = item . offsetTop
193
+ }
194
+ }
195
+ }
195
196
}
196
197
197
198
focusNote ( selectedNoteKeys , noteKey , pathname ) {
0 commit comments