mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 10:17:11 +03:00
[Gutter][View Registry] Add Gutter view providers to the ViewRegistry
This commit is contained in:
parent
f3d2597bda
commit
6319c9722a
@ -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
|
||||
|
@ -2,6 +2,8 @@
|
||||
Grim = require 'grim'
|
||||
{Emitter, CompositeDisposable} = require 'event-kit'
|
||||
Serializable = require 'serializable'
|
||||
{createGutterView} = require './gutter-component-helpers'
|
||||
Gutter = require './gutter'
|
||||
Model = require './model'
|
||||
Pane = require './pane'
|
||||
PaneElement = require './pane-element'
|
||||
@ -60,6 +62,7 @@ class PaneContainer extends Model
|
||||
new PaneElement().initialize(model)
|
||||
atom.views.addViewProvider TextEditor, (model) ->
|
||||
new TextEditorElement().initialize(model)
|
||||
atom.views.addViewProvider(Gutter, createGutterView)
|
||||
|
||||
onDidChangeRoot: (fn) ->
|
||||
@emitter.on 'did-change-root', fn
|
||||
|
Loading…
Reference in New Issue
Block a user