Domanda

I use Prototype JS as main JS library and I have integrate the last RedactorJS with jQuery in mode no conflict but i can't launch function like :

jQuery('#redactor').redactor('destroy');

OR

jQuery('#redactor').destroy();

ERROR : Error: No such method "destroy" for Redactor

Have you a solution to this problem?

Plunker Demo

È stato utile?

Soluzione

Tested with 9.X :

jQuery('#redactor').redactor('getObject').destroy();

Tested with 8.X :

jQuery('#redactor').redactor('getObject').destroyEditor();

DEMO

Altri suggerimenti

Not familiar with Redactor at all, but after taking a peak at the source code it looks like they store the Redactor object inside of the corresponding jQuery pointers data object. So I think you should be able to do the following

jQuery('#redactor').data('redactor').destroy();

The answer of callmehiphop gave me the final hint! Redactor 9 is still broken at this point :( Here's the fix:

if (typeof $('#redactor').data('redactor') != 'undefined') {
    // redactor is initialized!
    $('#redactor').destroy();
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top