CKEditor Memory Leak on setData ()

I think I have big memory leaks related to the CDeditor setData () function. I have a web application where users can create their own content using Javascript. CKEditor is used as a WYSIWYG editor so that users can write the contents of each part of the design.

Each time a user clicks on an editable text element in his design, the .setData editor is called and he sets the CKEditor data to everything that is in the user text design element that is clicked.

This works fine several times, but every time the user clicks on a new text element and calls .setData (), the application becomes slower, slower and slower until the site crashes. I tried disabling the setData () function in my Javascript and I have no memory leaks or performance issues when I do this.

Has anyone had similar problems? Anyone have any recommendations how can I avoid memory leak and performance loss?

Function called and creating a performance loss:

function clickTextElement() {
    var location = $(this);
    $('.selected').removeClass('selected');
    location.addClass('selected');
    $('#main-tools').hide();

    if(location.hasClass('textarea')){
        $('#imageeditor').hide();
        $('#texteditor').show();
        editor.setData( $('.selected').html() );
    }
}
+3
source share
1 answer

I was able to improve the performance of this function by first adding the following code:

editor.document.clearCustomData();
editor.document.removeAllListeners();
editor.window.getFrame().clearCustomData();
editor.window.getFrame().removeAllListeners();

clickTextElement(); , , , . , , , / , .

CKEditor Config. Google CKEditor, , , 50+. 15.

. ( clickTextElement()) 10-20 , . / - .

- clearCustomData() removeAllListeners(), .

+3

All Articles