如何解决删除 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 举报,一经查实,本站将立刻删除。