mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Put the hidden input in the overlayer
The overlayer is absolutely positioned to exactly fill the scroll-view. If we can retain this strategy and never give the input a position that exceeds the bounds of the overlayer, we can guarantee that it never forces the scroll position of the scroll view to change when it is focused due to the browsers default behavior.
This commit is contained in:
@@ -13,7 +13,8 @@ React.createClass
|
||||
render: ->
|
||||
div className: 'editor',
|
||||
div className: 'scroll-view', ref: 'scrollView',
|
||||
div className: 'overlayer'
|
||||
div className: 'overlayer',
|
||||
InputComponent ref: 'hiddenInput', className: 'hidden-input', onInput: @onInput
|
||||
@renderVisibleLines()
|
||||
div className: 'vertical-scrollbar', ref: 'verticalScrollbar', onScroll: @onVerticalScroll,
|
||||
div outlet: 'verticalScrollbarContent', style: {height: @getScrollHeight()}
|
||||
@@ -25,7 +26,6 @@ React.createClass
|
||||
followingHeight = (lineCount - endRow) * @state.lineHeight
|
||||
|
||||
div className: 'lines', ref: 'lines', style: {WebkitTransform: "translateY(#{-@state.scrollTop}px)"}, [
|
||||
InputComponent ref: 'hiddenInput', onInput: @onInput
|
||||
div className: 'spacer', key: 'top-spacer', style: {height: precedingHeight}
|
||||
(for tokenizedLine in @props.editor.linesForScreenRows(startRow, endRow - 1)
|
||||
LineComponent({tokenizedLine, key: tokenizedLine.id}))...
|
||||
@@ -120,7 +120,7 @@ LineComponent = React.createClass
|
||||
|
||||
InputComponent = React.createClass
|
||||
render: ->
|
||||
input @props.className, ref: 'input'
|
||||
input className: @props.className, ref: 'input'
|
||||
|
||||
getInitialState: ->
|
||||
{lastChar: ''}
|
||||
|
||||
Reference in New Issue
Block a user