ckeditor / ckeditor4

The best enterprise-grade WYSIWYG editor. Fully customizable with countless features and plugins.
https://ckeditor.com/ckeditor-4
Other
5.79k stars 2.48k forks source link

Only Reload Or Create Instance For Last Item ?! #2047

Closed bekab95 closed 6 years ago

bekab95 commented 6 years ago

Type of report

Task

Provide description of the task

I am working with Flask-Admin and rebuilding Ckeditor after new Document add in Document

    <script type="text/javascript">
        $('.control-group a').click( function(e) {e.preventDefault(); 
        for(var instanceName in CKEDITOR.instances)
                CKEDITOR.remove(CKEDITOR.instances[instanceName]);
                CKEDITOR.replaceAll('ckeditor');
         return false; } );

    </script>

the bug here is that if I will not save each newly added Document and continue adding and filling new documents removing instances will delete unsaved info in newly added textareas.

So I need to only rebuild instance for newly added Document, As I tested when I add new document (click event) new Ckeditor instance is not created (tried replaceAlll(ckeditor) but it has error. So how to add new instance for new Document ?

Other details

jacekbogdanski commented 6 years ago

Hello,

If you want to fully detach editor from HTML use editor.destroy() function.

Please note that our GitHub issue tracker serves for reporting bugs and new features only. Unfortunately, your request is neither of them, therefore please leave your question on Stack Overflow where our team and the community assist other users in solving their issues. Also, since CKEditor is an Open Source software, we believe it’s crucial to share proposed solutions and make others benefit from them.

If you have CKEditor license, please contact our support team. You also can ask your implementation questions at Stack Overflow.

bekab95 commented 6 years ago

@jacekbogdanski I only want to add new instance for newly added textarea (replaceAll is not called during field addition) may destroy will not work, may another method can be like replaceAll to check new field and add editor if it has ckeditor class