mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-16 15:45:13 +00:00
ConfigModifier.removePlugin should toggle off if default
This commit is contained in:
+2
-2
@@ -12,8 +12,8 @@ module.exports = {
|
||||
PluginDependency: require('./models/pluginDependency'),
|
||||
|
||||
// Modifiers
|
||||
SummaryModifier: Modifiers.Summary,
|
||||
ConfigModifier: Modifiers.Config,
|
||||
SummaryModifier: Modifiers.Summary,
|
||||
ConfigModifier: Modifiers.Config,
|
||||
|
||||
// Constants
|
||||
CONFIG_FILES: require('./constants/configFiles.js'),
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
var DEFAULT_PLUGINS = require('../../constants/defaultPlugins');
|
||||
var togglePlugin = require('./togglePlugin');
|
||||
|
||||
/**
|
||||
* Remove a plugin from a book's configuration
|
||||
@@ -8,6 +10,16 @@
|
||||
function removePlugin(config, pluginName) {
|
||||
var deps = config.getPluginDependencies();
|
||||
|
||||
var isDefault = DEFAULT_PLUGINS.find(function(dep) {
|
||||
return dep.getName() === pluginName;
|
||||
});
|
||||
|
||||
// For default plugin, we have to disable it instead of removing from the list
|
||||
if (isDefault) {
|
||||
return togglePlugin(config, pluginName, false);
|
||||
}
|
||||
|
||||
// Remove the dependency from the list
|
||||
deps = deps.filter(function(dep) {
|
||||
return dep.getName() === pluginName;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user