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

Raptor destroy is broken #173

Open
Petah opened this issue Jan 26, 2015 · 6 comments
Open

Raptor destroy is broken #173

Petah opened this issue Jan 26, 2015 · 6 comments
Labels

Comments

@Petah
Copy link
Contributor

Petah commented Jan 26, 2015

Cannot seem to destroy an instance of Raptor after initialisation. Should be as simple as:

$('.editable').raptor('destroy');

But it doesn't work.

@Petah Petah added the bug label Jan 26, 2015
@AriPaaWun
Copy link

Can confirm. Calling it first time does something since calling it a second time gives this error:

Uncaught Error: cannot call methods on raptor prior to initialization; attempted to call method 'destroy'(…)

But nothing seems to actually happen after the first call. I can still edit elements after calling it.

@deeknow
Copy link

deeknow commented Nov 21, 2015

Hey @Petah not sure if it was you who raised this or were just logging here on behalf of someone else but was just looking at this issue. I see there was a commit way back in 2013 (sha: d9405e4) in which the destroy() method was commented out in raptor-widget.js. It's mostly a call to destruct() which does seem to work as advertised in the raptor-editor docs, i.e..

Hides the toolbar, disables editing, and fires the destroy event, and unbinds any events
see: https://www.raptor-editor.com/documentation/api/symbols/RaptorWidget#.destruct

Is $('.editable').raptor('destruct'); the functionality you were looking for @AriPaaWun ?

If so maybe we should reintroduce that destroy() alias as it is a commonly used name for such things in other projects for garbage-collection-like operations.

@Petah
Copy link
Contributor Author

Petah commented Nov 21, 2015

I would have raised it on behalf.

Also I can't remember why the destroy method was removed, most likely it didn't work correctly, couldn't be re initialised after, or caused memory leaks (which would be especially bad when using Raptor in an Angular app etc).

@deeknow
Copy link

deeknow commented Nov 21, 2015

Yeah there's no easy way of going back after this call as it stands at the moment, be interesting to know what the original intent was. I think this should be marked closed as not a bug without any other info.

@Petah
Copy link
Contributor Author

Petah commented Nov 21, 2015

Its a legit bug as destroy should literally remove all functionality that Raptor placed on the elements, which it currently does not.

I tested the destruct function and its not quite there, it removes some functionality but still leaves some in a broken state: http://jsfiddle.net/6dvbbgcu/

@deeknow
Copy link

deeknow commented Nov 21, 2015

Brilliant, thanks for the jsfiddle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants