mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-10 18:23:21 +08:00
fix(*): A few patches for minor sentry errors
Summary: Fix edge cases where _getRangeInScope is null, fix logic errors fix(1932) Edge case where we can't find a container for the message Id we're asked to scroll to Check view exists before trying to perform actions. Will be fixed once keybindings are a React container Test Plan: Run specs Reviewers: evan Reviewed By: evan Differential Revision: https://phab.nylas.com/D1906
This commit is contained in:
parent
07996da960
commit
941e16bb11
3 changed files with 26 additions and 24 deletions
|
@ -481,7 +481,10 @@ class ContenteditableComponent extends React.Component
|
|||
|
||||
# Don't bother computing client rects if no scroll method has been provided
|
||||
else if @props.onScrollTo
|
||||
rect = @_getRangeInScope().getBoundingClientRect()
|
||||
rangeInScope = @_getRangeInScope()
|
||||
return unless rangeInScope
|
||||
|
||||
rect = rangeInScope.getBoundingClientRect()
|
||||
if @_isEmptyBoudingRect(rect)
|
||||
rect = @_getSelectionRectFromDOM(selection)
|
||||
|
||||
|
@ -763,31 +766,24 @@ class ContenteditableComponent extends React.Component
|
|||
toolbarPos: toolbarPos
|
||||
linkToModify: @_linkHoveringOver
|
||||
editAreaWidth: editAreaWidth
|
||||
|
||||
else if not @_selection? or @_selection.isCollapsed
|
||||
@_hideToolbar()
|
||||
|
||||
else
|
||||
if not @_selection? or @_selection.isCollapsed
|
||||
rect = @_getRangeInScope()?.getBoundingClientRect()
|
||||
if not rect or @_isEmptyBoudingRect(rect)
|
||||
@_hideToolbar()
|
||||
else
|
||||
if @_selection.isCollapsed
|
||||
linkRect = linksInside[0].getBoundingClientRect()
|
||||
isEmptyRect = @_isEmptyBoudingRect(linkRect)
|
||||
[left, top, editAreaWidth, toolbarPos] = @_getToolbarPos(linkRect)
|
||||
else
|
||||
selectionRect = @_getRangeInScope().getBoundingClientRect()
|
||||
isEmptyRect = @_isEmptyBoudingRect(selectionRect)
|
||||
[left, top, editAreaWidth, toolbarPos] = @_getToolbarPos(selectionRect)
|
||||
|
||||
if isEmptyRect
|
||||
@setState
|
||||
toolbarVisible: false
|
||||
else
|
||||
@setState
|
||||
toolbarVisible: true
|
||||
toolbarMode: "buttons"
|
||||
toolbarTop: top
|
||||
toolbarLeft: left
|
||||
toolbarPos: toolbarPos
|
||||
linkToModify: null
|
||||
editAreaWidth: editAreaWidth
|
||||
[left, top, editAreaWidth, toolbarPos] = @_getToolbarPos(rect)
|
||||
@setState
|
||||
toolbarVisible: true
|
||||
toolbarMode: "buttons"
|
||||
toolbarTop: top
|
||||
toolbarLeft: left
|
||||
toolbarPos: toolbarPos
|
||||
linkToModify: null
|
||||
editAreaWidth: editAreaWidth
|
||||
|
||||
_selectionInScope: (selection) =>
|
||||
return false if not selection?
|
||||
|
|
|
@ -383,7 +383,9 @@ class MessageList extends React.Component
|
|||
_onChildScrollRequest: ({messageId, rect}={}) =>
|
||||
return if @_draftScrollInProgress
|
||||
if messageId
|
||||
@refs.messageWrap.scrollTo(@_getMessageContainer(messageId), {
|
||||
messageElement = @_getMessageContainer(messageId)
|
||||
return unless messageElement
|
||||
@refs.messageWrap.scrollTo(messageElement, {
|
||||
position: ScrollRegion.ScrollPosition.Visible
|
||||
})
|
||||
else if rect
|
||||
|
|
|
@ -232,6 +232,8 @@ class ThreadList extends React.Component
|
|||
# Additional Commands
|
||||
|
||||
_onStarItem: =>
|
||||
return unless ThreadListStore.view()
|
||||
|
||||
if WorkspaceStore.layoutMode() is "list" and WorkspaceStore.topSheet() is WorkspaceStore.Sheet.Thread
|
||||
Actions.toggleStarFocused()
|
||||
else if ThreadListStore.view().selection.count() > 0
|
||||
|
@ -240,6 +242,8 @@ class ThreadList extends React.Component
|
|||
Actions.toggleStarFocused()
|
||||
|
||||
_onArchive: =>
|
||||
return unless ThreadListStore.view()
|
||||
|
||||
if WorkspaceStore.layoutMode() is "list" and WorkspaceStore.topSheet() is WorkspaceStore.Sheet.Thread
|
||||
Actions.archive()
|
||||
else if ThreadListStore.view().selection.count() > 0
|
||||
|
|
Loading…
Reference in a new issue