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

"halloactivated" event handler isn't unhooked on destroy() #258

Open
bcdickinson opened this Issue Jul 7, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@bcdickinson

bcdickinson commented Jul 7, 2017

In hallo's _create method, there's a one-time event handler wired up to "halloactivated":

@element.one 'halloactivated', =>
   # We will populate the toolbar the first time this
   # editable is activated. This will make multiple
   # Hallo instances on same page load much faster
   @_prepareToolbar()

If you destroy the widget before it's been activated and then reinitialise it with a different set of plugins you get an error when the widget is first activated thrown from the handler whose set of plugins no longer matches`:

$(myElement).hallo({ plugins: { halloformat: {} });
$(myElement).hallo('destroy');
$(myElement).hallo({ plugins: { hallolists: {} });
$(myElement).click();
// Uncaught Error: Plugin halloformat not found

I'm just manually calling $(myElement).off('halloactivated') as a workaround for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment