mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-10-04 10:28:46 +08:00
🎨(plugins): Add install button in preferences
This commit is contained in:
parent
94580240ba
commit
6823b31e21
3 changed files with 9 additions and 3 deletions
|
@ -31,6 +31,7 @@ PackagesStore = Reflux.createStore
|
|||
NylasEnv.commands.add 'body',
|
||||
'application:install-package': => @_onInstallPackage()
|
||||
|
||||
@listenTo PluginsActions.installNewPackage, @_onInstallPackage
|
||||
@listenTo PluginsActions.createPackage, @_onCreatePackage
|
||||
@listenTo PluginsActions.updatePackage, @_onUpdatePackage
|
||||
@listenTo PluginsActions.setGlobalSearchValue, @_onGlobalSearchChange
|
||||
|
@ -169,7 +170,7 @@ PackagesStore = Reflux.createStore
|
|||
|
||||
_onInstallPackage: ->
|
||||
NylasEnv.showOpenDialog
|
||||
title: "Choose a Package Directory"
|
||||
title: "Choose a Plugin Directory"
|
||||
properties: ['openDirectory']
|
||||
, (filenames) =>
|
||||
return if not filenames or filenames.length is 0
|
||||
|
@ -177,9 +178,9 @@ PackagesStore = Reflux.createStore
|
|||
return if err
|
||||
packageName = path.basename(filenames[0])
|
||||
msg = "#{packageName} has been installed and enabled. No need to \
|
||||
restart! If you don't see the package loaded, check the \
|
||||
restart! If you don't see the plugin loaded, check the \
|
||||
console for errors."
|
||||
@_displayMessage("Plugin installed 🎉", msg)
|
||||
@_displayMessage("Plugin installed! 🎉", msg)
|
||||
|
||||
_onCreatePackage: ->
|
||||
if not NylasEnv.inDevMode()
|
||||
|
|
|
@ -8,6 +8,7 @@ Actions = [
|
|||
'disablePackage',
|
||||
'enablePackage',
|
||||
'installPackage',
|
||||
'installNewPackage'
|
||||
'uninstallPackage',
|
||||
'createPackage',
|
||||
'reloadPackage',
|
||||
|
|
|
@ -38,6 +38,7 @@ class TabInstalled extends React.Component
|
|||
value={@state.search}
|
||||
onChange={@_onSearchChange }
|
||||
placeholder="Search Installed Plugins"/>
|
||||
<div className="btn btn-large" onClick={@_onInstallPackage}>Install Plugin...</div>
|
||||
<PackageSet
|
||||
packages={@state.packages.user}
|
||||
title="Third Party"
|
||||
|
@ -74,6 +75,9 @@ class TabInstalled extends React.Component
|
|||
_onChange: =>
|
||||
@setState(@_getStateFromStores())
|
||||
|
||||
_onInstallPackage: =>
|
||||
PluginsActions.installNewPackage()
|
||||
|
||||
_onCreatePackage: =>
|
||||
PluginsActions.createPackage()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue