Как выгрузить экземпляр Ckeditor 5 из объекта формы?Я могу загрузить его с ClassicEditor.create ().Я нашел метод editor.destroy (), но он не работает.Консоль Javascript говорит: «editor.destroy не является функцией».
Текущий код тестирования:
<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>
С уважением,
Джордж