删除 ckeditor 5 的重复实例

问题描述

目前,当一个模式打开时,我有以下脚本:

ClassicEditor
    .create( document.querySelector( '.citation-notes' ),{
        toolbar: {
            items: [
                'heading','|','bold','underline','italic','alignment','link','bulletedList','numberedList','undo','redo'
            ]
        },language: 'en',licenseKey: '',} )
    .then( editor => {
        window.citationCreateNoteEditor = editor;
    } )
    .catch( error => {
        console.error( 'Oops,something went wrong!' );
        console.error( 'Please,report the following error on https://github.com/ckeditor/ckeditor5/issues with the build id and the error stack trace:' );
        console.warn( 'Build id: 7iwhfvp6ghdp-auj6rsxejjya' );
        console.error( error );
    } );

setInterval( () => {
    console.log( 'ckeditor5.updateElement()' );
    console.log(editor);
    citationCreateNoteEditor.updateSourceElement();
},2000 );

但是,如果模态被多次打开,那么 ckeditor 会被创建多次,我最终会得到很多重复的实例。

有没有办法在创建另一个实例之前检测现有实例?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)