mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-25 03:42:30 +00:00
ConfigModifier.removePlugin should toggle off if default
This commit is contained in:
@@ -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