From cc8b7b13b3a75c7d718cf0e6be6906fdf6a37d88 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Sun, 13 Jul 2014 13:06:37 -0600 Subject: [PATCH] Don't show the gutter when 'mini' is true on React editors --- spec/editor-component-spec.coffee | 7 +++++++ src/editor-component.coffee | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/spec/editor-component-spec.coffee b/spec/editor-component-spec.coffee index 42f7bdb3b..2c2f8ed16 100644 --- a/spec/editor-component-spec.coffee +++ b/spec/editor-component-spec.coffee @@ -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) diff --git a/src/editor-component.coffee b/src/editor-component.coffee index 217b1c20f..59d969c3a 100644 --- a/src/editor-component.coffee +++ b/src/editor-component.coffee @@ -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,