Commit Graph

12 Commits

Author SHA1 Message Date
Jess Lin
0a7f6ae187 [Gutter] Migrate LineNumberGutterComponent to consume new state format 2015-05-13 10:59:31 -07:00
Nathan Sobo
192997c8cf Clear line numbers from previous usages of the gutter element
In adding custom gutter APIs, I suggested to @jssln that we associate
the gutter model objects with DOM nodes in the view registry to make
it easy for package authors to get at the view layer for a particular
gutter. She also applied this treatment to the line numbers gutter,
which makes sense.

However, using the view registry opened up an unexpected wrinkle…

When you detach an editor, we need to tear down all the associated view
logic because at that point, we don’t know whether the element is about
to be reattached or whether it’s going to get garbage collected. In the
case where we reattach, we end up constructing a new TextEditorComponent
for the element. When this happens, the gutter component requests a DOM
node for the gutter from the view registry. Except in this case the
DOM element isn’t empty because it was already used by a different
component for the same element before it was detached. The fix is simply
to always clear out the line numbers to ensure we start in a clean
state.

@jssln: You should apply this same fix to custom gutters or we’ll see
the same issues.
2015-04-28 20:05:25 -06:00
Jess Lin
9abd0232ce [Gutter] Remove ::getName from gutter components; save names in GutterContainerComponent 2015-04-22 07:29:00 -07:00
Jess Lin
09d1b977de [Gutter] Convert ! to 'not', && to 'and' 2015-04-22 07:28:59 -07:00
Jess Lin
85188ced03 [Gutter] Move 'lineNumberGutter' state to nest under 'gutters' in the presenter state 2015-04-22 07:28:59 -07:00
Jess Lin
14e5d38354 [Gutter] TextEditorPresenter: Consolidate common gutter state under @state.gutters 2015-04-22 07:28:58 -07:00
Jess Lin
0d7f89467f [Gutter][DOM Persistence] Add ::hideNode and ::showNode to GutterComponent classes 2015-04-22 07:28:58 -07:00
Jess Lin
66f1f33861 [Gutter][View Registry] Make LineNumber- and Custom- GutterComponent get their view from the ViewRegistry 2015-04-22 07:28:58 -07:00
Jess Lin
e2e737369a [Gutter] Factor out method to set common gutter component properties 2015-04-22 07:28:58 -07:00
Jess Lin
754b38f410 [Gutter] Add ::getDomNode to LineNumberGutterComponent 2015-04-22 07:28:57 -07:00
Jess Lin
28f70c912e [Gutter] Add ::getName to LineNumberGutterComponent 2015-04-22 07:28:57 -07:00
Jess Lin
b4ffa04e4c [Gutter] Rename GutterComponent to LineNumberGutterComponent 2015-04-22 07:28:57 -07:00