How can I unload a Ckeditor 5 instance from a form object? I can load it with ClassicEditor.create(). I found the editor.destroy() method but it does not work. The Javascript console says "editor.destroy is not a function".
Current testing code is:
<button type="button" onclick="ckEditor('load')">Start</button><button type="button" onclick="ckEditor('unload')">Stop</button>
<textarea id="welcomeText" class="form-control" tabindex="21" name="txt_welcomeText" rows="10"><p>This is my welcome text.</textarea>
<script>
function ckEditor(action) {
editor = ClassicEditor.create( document.querySelector( '#welcomeText' ) ).catch( error => {console.error( error );});
if (action == "unload") editor.destroy();
}
</script>
Best regards,
George