Don't show the gutter when 'mini' is true on React editors

This commit is contained in:
Nathan Sobo 2014-07-13 13:06:37 -06:00
parent 4020ed1535
commit cc8b7b13b3
2 changed files with 9 additions and 2 deletions

View File

@ -1991,6 +1991,13 @@ describe "EditorComponent", ->
runSetImmediateCallbacks()
expect(lineNumberHasClass(4, 'cursor-line-no-selection')).toBe false
describe "when the 'mini' property is true", ->
beforeEach ->
component.setProps(mini: true)
it "does not render the gutter", ->
expect(componentNode.querySelector('.gutter')).toBeNull()
describe "legacy editor compatibility", ->
it "triggers the screen-lines-changed event before the editor:display-update event", ->
editor.setSoftWrap(true)

View File

@ -50,7 +50,7 @@ EditorComponent = React.createClass
render: ->
{focused, fontSize, lineHeight, fontFamily, showIndentGuide, showInvisibles, showLineNumbers, visible} = @state
{editor, cursorBlinkPeriod, cursorBlinkResumeDelay} = @props
{editor, mini, cursorBlinkPeriod, cursorBlinkResumeDelay} = @props
maxLineNumberDigits = editor.getLineCount().toString().length
invisibles = if showInvisibles then @state.invisibles else {}
hasSelection = editor.getSelection()? and !editor.getSelection().isEmpty()
@ -86,7 +86,7 @@ EditorComponent = React.createClass
className += ' has-selection' if hasSelection
div className: className, style: {fontSize, lineHeight, fontFamily}, tabIndex: -1,
if showLineNumbers
if not mini and showLineNumbers
GutterComponent {
ref: 'gutter', onMouseDown: @onGutterMouseDown, onWidthChanged: @onGutterWidthChanged,
lineDecorations, defaultCharWidth, editor, renderedRowRange, maxLineNumberDigits, scrollViewHeight,