[Gutter][View Registry] Add Gutter view providers to the ViewRegistry

This commit is contained in:
Jess Lin
2015-03-31 14:29:16 -07:00
parent f3d2597bda
commit 6319c9722a
2 changed files with 15 additions and 0 deletions

View File

@@ -1,6 +1,18 @@
# Helper methods shared among GutterComponent classes.
module.exports =
createGutterView: (gutterModel) ->
domNode = document.createElement('div')
domNode.classList.add('gutter')
domNode.setAttribute('gutter-name', gutterModel.name)
childNode = document.createElement('div')
if gutterModel.name is 'line-number'
childNode.classList.add('line-numbers')
else
childNode.classList.add('custom-decorations')
domNode.appendChild(childNode)
domNode
# Sets scrollHeight, scrollTop, and backgroundColor on the given domNode.
setDimensionsAndBackground: (oldState, newState, domNode) ->
if newState.scrollHeight isnt oldState.scrollHeight