Open Petah opened 9 years ago
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.
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.
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).
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.
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/
Brilliant, thanks for the jsfiddle.
Cannot seem to destroy an instance of Raptor after initialisation. Should be as simple as:
But it doesn't work.