Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated initializePlugins to not wipe out previous plugins data #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ScottHamper
Copy link

Hey Brian,

I noticed today that calling initializePlugins multiple times would end up loading/executing all plugins, but would wipe out the plugins object on each invocation.

I was working on creating a plugin for Selectize that would add "singlePlugins" and "multiPlugins" settings, so that I could define default plugins more simply, when I ran into this issue. My custom "mode_plugins" plugin calls initializePlugins after Selectize has already initialized it and other plugins.

The main issue this causes in Selectize is that CSS classes are only applied for the latter round of plugins (single/multi), and not for the original listing of plugins, because Selectize looks at self.plugins.names to generate the classes.

This pull request includes a simple fix/test for Microplugin to ensure that all plugin data stays intact across multiple invocations of initializePlugins. One thing this fix potentially leaves the door open for is that self.plugins could already exist, but not be in the format that Microplugin expects. I wouldn't expect this to be an issue in practice, however.

Calling initializePlugins multiple times would load/execute all plugins,
but would only keep internal plugin data relevant to the last
invocation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant