mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-20 15:37:46 +03:00
Remove unused properties in EditorComponent and children
This commit is contained in:
parent
c4b5a0f411
commit
a5580a704d
@ -9,10 +9,10 @@ HighlightsComponent = React.createClass
|
|||||||
|
|
||||||
render: ->
|
render: ->
|
||||||
div className: 'highlights',
|
div className: 'highlights',
|
||||||
@renderHighlights() if @props.performedInitialMeasurement
|
@renderHighlights() if @props.presenter?
|
||||||
|
|
||||||
renderHighlights: ->
|
renderHighlights: ->
|
||||||
{editor, presenter} = @props
|
{presenter} = @props
|
||||||
highlightComponents = []
|
highlightComponents = []
|
||||||
for key, state of presenter.state.content.highlights
|
for key, state of presenter.state.content.highlights
|
||||||
highlightComponents.push(HighlightComponent({key, state}))
|
highlightComponents.push(HighlightComponent({key, state}))
|
||||||
|
@ -17,11 +17,10 @@ LinesComponent = React.createClass
|
|||||||
displayName: 'LinesComponent'
|
displayName: 'LinesComponent'
|
||||||
|
|
||||||
render: ->
|
render: ->
|
||||||
{presenter, performedInitialMeasurement, cursorBlinkPeriod, cursorBlinkResumeDelay} = @props
|
{presenter} = @props
|
||||||
|
|
||||||
if performedInitialMeasurement
|
if presenter?
|
||||||
{editor, presenter, overlayDecorations, highlightDecorations, placeholderText, backgroundColor} = @props
|
{editor, presenter, overlayDecorations, placeholderText, backgroundColor} = @props
|
||||||
{lineHeightInPixels, defaultCharWidth, scrollViewHeight, scopedCharacterWidthsChangeCount, cursorPixelRects} = @props
|
|
||||||
|
|
||||||
@oldState ?= {content: {lines: {}}}
|
@oldState ?= {content: {lines: {}}}
|
||||||
@newState = presenter.state
|
@newState = presenter.state
|
||||||
@ -29,7 +28,7 @@ LinesComponent = React.createClass
|
|||||||
{scrollWidth} = @newState.content
|
{scrollWidth} = @newState.content
|
||||||
|
|
||||||
style =
|
style =
|
||||||
height: Math.max(scrollHeight, scrollViewHeight)
|
height: scrollHeight
|
||||||
width: scrollWidth
|
width: scrollWidth
|
||||||
WebkitTransform: @getTransform()
|
WebkitTransform: @getTransform()
|
||||||
backgroundColor: if editor.isMini() then null else backgroundColor
|
backgroundColor: if editor.isMini() then null else backgroundColor
|
||||||
@ -38,7 +37,7 @@ LinesComponent = React.createClass
|
|||||||
div className: 'placeholder-text', placeholderText if placeholderText?
|
div className: 'placeholder-text', placeholderText if placeholderText?
|
||||||
|
|
||||||
CursorsComponent {presenter}
|
CursorsComponent {presenter}
|
||||||
HighlightsComponent {presenter, performedInitialMeasurement}
|
HighlightsComponent {presenter}
|
||||||
|
|
||||||
getTransform: ->
|
getTransform: ->
|
||||||
{scrollTop} = @newState
|
{scrollTop} = @newState
|
||||||
@ -70,9 +69,9 @@ LinesComponent = React.createClass
|
|||||||
else
|
else
|
||||||
@overlayManager = new OverlayManager(@getDOMNode())
|
@overlayManager = new OverlayManager(@getDOMNode())
|
||||||
|
|
||||||
componentDidUpdate: (prevProps) ->
|
componentDidUpdate: ->
|
||||||
{visible, scrollingVertically, performedInitialMeasurement} = @props
|
{visible, scrollingVertically, presenter} = @props
|
||||||
return unless performedInitialMeasurement
|
return unless presenter?
|
||||||
|
|
||||||
@removeLineNodes() unless @oldState?.content.indentGuidesVisible is @newState?.content.indentGuidesVisible
|
@removeLineNodes() unless @oldState?.content.indentGuidesVisible is @newState?.content.indentGuidesVisible
|
||||||
@updateLineNodes()
|
@updateLineNodes()
|
||||||
@ -268,7 +267,7 @@ LinesComponent = React.createClass
|
|||||||
editor.setDefaultCharWidth(charWidth)
|
editor.setDefaultCharWidth(charWidth)
|
||||||
|
|
||||||
remeasureCharacterWidths: ->
|
remeasureCharacterWidths: ->
|
||||||
return unless @props.performedInitialMeasurement
|
return unless @props.presenter?
|
||||||
|
|
||||||
@clearScopedCharWidths()
|
@clearScopedCharWidths()
|
||||||
@measureCharactersInNewLines()
|
@measureCharactersInNewLines()
|
||||||
|
@ -4,7 +4,8 @@ class OverlayManager
|
|||||||
@overlays = {}
|
@overlays = {}
|
||||||
|
|
||||||
render: (props) ->
|
render: (props) ->
|
||||||
{editor, overlayDecorations, lineHeightInPixels} = props
|
{presenter, editor, overlayDecorations} = props
|
||||||
|
lineHeight = presenter.getLineHeight()
|
||||||
|
|
||||||
existingDecorations = null
|
existingDecorations = null
|
||||||
for markerId, {headPixelPosition, tailPixelPosition, decorations} of overlayDecorations
|
for markerId, {headPixelPosition, tailPixelPosition, decorations} of overlayDecorations
|
||||||
@ -12,7 +13,7 @@ class OverlayManager
|
|||||||
pixelPosition =
|
pixelPosition =
|
||||||
if decoration.position is 'tail' then tailPixelPosition else headPixelPosition
|
if decoration.position is 'tail' then tailPixelPosition else headPixelPosition
|
||||||
|
|
||||||
@renderOverlay(editor, decoration, pixelPosition, lineHeightInPixels)
|
@renderOverlay(editor, decoration, pixelPosition, lineHeight)
|
||||||
|
|
||||||
existingDecorations ?= {}
|
existingDecorations ?= {}
|
||||||
existingDecorations[decoration.id] = true
|
existingDecorations[decoration.id] = true
|
||||||
@ -24,7 +25,7 @@ class OverlayManager
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
renderOverlay: (editor, decoration, pixelPosition, lineHeightInPixels) ->
|
renderOverlay: (editor, decoration, pixelPosition, lineHeight) ->
|
||||||
item = atom.views.getView(decoration.item)
|
item = atom.views.getView(decoration.item)
|
||||||
unless overlay = @overlays[decoration.id]
|
unless overlay = @overlays[decoration.id]
|
||||||
overlay = @overlays[decoration.id] = document.createElement('atom-overlay')
|
overlay = @overlays[decoration.id] = document.createElement('atom-overlay')
|
||||||
@ -38,9 +39,9 @@ class OverlayManager
|
|||||||
if left + itemWidth - editor.getScrollLeft() > editor.getWidth() and left - itemWidth >= editor.getScrollLeft()
|
if left + itemWidth - editor.getScrollLeft() > editor.getWidth() and left - itemWidth >= editor.getScrollLeft()
|
||||||
left -= itemWidth
|
left -= itemWidth
|
||||||
|
|
||||||
top = pixelPosition.top + lineHeightInPixels
|
top = pixelPosition.top + lineHeight
|
||||||
if top + itemHeight - editor.getScrollTop() > editor.getHeight() and top - itemHeight - lineHeightInPixels >= editor.getScrollTop()
|
if top + itemHeight - editor.getScrollTop() > editor.getHeight() and top - itemHeight - lineHeight >= editor.getScrollTop()
|
||||||
top -= itemHeight + lineHeightInPixels
|
top -= itemHeight + lineHeight
|
||||||
|
|
||||||
overlay.style.top = top + 'px'
|
overlay.style.top = top + 'px'
|
||||||
overlay.style.left = left + 'px'
|
overlay.style.left = left + 'px'
|
||||||
|
@ -113,14 +113,9 @@ TextEditorComponent = React.createClass
|
|||||||
style: hiddenInputStyle
|
style: hiddenInputStyle
|
||||||
|
|
||||||
LinesComponent {
|
LinesComponent {
|
||||||
ref: 'lines',
|
ref: 'lines', @presenter, editor, hostElement, @useHardwareAcceleration, useShadowDOM,
|
||||||
editor, lineHeightInPixels, defaultCharWidth, tokenizedLines,
|
@scrollingVertically, mouseWheelScreenRow, visible, placeholderText, @backgroundColor,
|
||||||
lineDecorations, highlightDecorations, overlayDecorations, hostElement,
|
overlayDecorations
|
||||||
renderedRowRange, @pendingChanges, scrollTop, scrollLeft,
|
|
||||||
@scrollingVertically, scrollHeight, scrollWidth, mouseWheelScreenRow,
|
|
||||||
visible, scrollViewHeight, @scopedCharacterWidthsChangeCount, lineWidth, @useHardwareAcceleration,
|
|
||||||
placeholderText, @performedInitialMeasurement, @backgroundColor, cursorPixelRects,
|
|
||||||
cursorBlinkPeriod, cursorBlinkResumeDelay, useShadowDOM, @presenter
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollbarComponent
|
ScrollbarComponent
|
||||||
|
Loading…
Reference in New Issue
Block a user