mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-10-08 20:26:20 +08:00
fix(perspective): Always pop to root sheet when changing #2125
This commit is contained in:
parent
9d623dec12
commit
4c00cccbee
3 changed files with 14 additions and 6 deletions
|
@ -479,6 +479,13 @@ class Actions
|
||||||
###
|
###
|
||||||
@popSheet: ActionScopeWindow
|
@popSheet: ActionScopeWindow
|
||||||
|
|
||||||
|
###
|
||||||
|
Public: Pop the to the root sheet currently selected.
|
||||||
|
|
||||||
|
*Scope: Window*
|
||||||
|
###
|
||||||
|
@popToRootSheet: ActionScopeWindow
|
||||||
|
|
||||||
###
|
###
|
||||||
Public: Push a sheet of a specific type onto the Sheet stack maintained by the
|
Public: Push a sheet of a specific type onto the Sheet stack maintained by the
|
||||||
{WorkspaceStore}. Note that sheets have no state. To show a *specific* thread,
|
{WorkspaceStore}. Note that sheets have no state. To show a *specific* thread,
|
||||||
|
|
|
@ -60,7 +60,6 @@ class FocusedPerspectiveStore extends NylasStore
|
||||||
@_setPerspective(@_defaultPerspective(accountIds))
|
@_setPerspective(@_defaultPerspective(accountIds))
|
||||||
|
|
||||||
_onFocusPerspective: (perspective) =>
|
_onFocusPerspective: (perspective) =>
|
||||||
return if perspective.isEqual(@_current)
|
|
||||||
@_setPerspective(perspective)
|
@_setPerspective(perspective)
|
||||||
|
|
||||||
_onFocusAccounts: (accountsOrIds) =>
|
_onFocusAccounts: (accountsOrIds) =>
|
||||||
|
@ -72,18 +71,20 @@ class FocusedPerspectiveStore extends NylasStore
|
||||||
return MailboxPerspective.forInbox(accounts)
|
return MailboxPerspective.forInbox(accounts)
|
||||||
|
|
||||||
_setPerspective: (perspective) ->
|
_setPerspective: (perspective) ->
|
||||||
return if perspective?.isEqual(@_current)
|
unless perspective.isEqual(@_current)
|
||||||
NylasEnv.savedState.perspective = perspective.toJSON()
|
NylasEnv.savedState.perspective = perspective.toJSON()
|
||||||
@_current = perspective
|
@_current = perspective
|
||||||
@trigger()
|
@trigger()
|
||||||
|
|
||||||
if perspective.drafts
|
if perspective.drafts
|
||||||
desired = WorkspaceStore.Sheet.Drafts
|
desired = WorkspaceStore.Sheet.Drafts
|
||||||
else
|
else
|
||||||
desired = WorkspaceStore.Sheet.Threads
|
desired = WorkspaceStore.Sheet.Threads
|
||||||
|
|
||||||
|
# Always switch to the correct sheet and pop to root when perspective set
|
||||||
if desired and WorkspaceStore.rootSheet() isnt desired
|
if desired and WorkspaceStore.rootSheet() isnt desired
|
||||||
Actions.selectRootSheet(desired)
|
Actions.selectRootSheet(desired)
|
||||||
|
Actions.popToRootSheet()
|
||||||
|
|
||||||
_setPerspectiveByName: (categoryName) ->
|
_setPerspectiveByName: (categoryName) ->
|
||||||
categories = @_current.accountIds.map (aid) ->
|
categories = @_current.accountIds.map (aid) ->
|
||||||
|
|
|
@ -25,8 +25,8 @@ class WorkspaceStore extends NylasStore
|
||||||
@listenTo Actions.setFocus, @_onSetFocus
|
@listenTo Actions.setFocus, @_onSetFocus
|
||||||
@listenTo Actions.toggleWorkspaceLocationHidden, @_onToggleLocationHidden
|
@listenTo Actions.toggleWorkspaceLocationHidden, @_onToggleLocationHidden
|
||||||
@listenTo Actions.popSheet, @popSheet
|
@listenTo Actions.popSheet, @popSheet
|
||||||
|
@listenTo Actions.popToRootSheet, @popToRootSheet
|
||||||
@listenTo Actions.pushSheet, @pushSheet
|
@listenTo Actions.pushSheet, @pushSheet
|
||||||
@listenTo Actions.focusMailboxPerspective, @popToRootSheet
|
|
||||||
|
|
||||||
{windowType} = NylasEnv.getLoadSettings()
|
{windowType} = NylasEnv.getLoadSettings()
|
||||||
unless windowType is 'onboarding'
|
unless windowType is 'onboarding'
|
||||||
|
|
Loading…
Add table
Reference in a new issue