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