Opened 11 years ago

Closed 10 years ago

#11986 closed Bug (expired)

SetData doesn't load content ckeditor 4.4

Reported by: Alex Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:

Description

I'm using the following code to populate data, this issue happens in chrome only, Jquery dialog opens with ckeditor, clears previous content and loads a new one with Ajax call. Sometimes content doesn't load, I able to reproduce it each time I open chrome developer tool in a background. Just press F12 and open jquery dialog with ckeditor inside, after opening web developer tool this error also randomly recreated with developer tool off. When I debug it I can see that second setData doesn't load Dto.HtmlContent

Chrome version: Version 34.0.1847.137 m Windows 7 I have disabled chrome plugins.

function Load(ID) {
    ShowEditorDialog();
    $('#Dialog').append(loader);
    CKEDITOR.instances['CkEditorTxt'].setData("", function () {
        PostAsyncAjax("GetData",
            { 'ID': ID},
            function (data) {
                var Dto = data.d;
                CKEDITOR.instances['CkEditorTxt'].setData(Dto.HtmlContent);
                $('#Loader').remove();
            }
        );
    });

    return false;
}

Attachments (1)

build-config.js (2.6 KB) - added by Alex 11 years ago.
Build config is attached

Download all attachments as: .zip

Change History (10)

Changed 11 years ago by Alex

Attachment: build-config.js added

Build config is attached

comment:1 Changed 11 years ago by Piotrek Koszuliński

Keywords: setData ckeditor removed
Status: newpending
Version: 4.4.0

Could you simplify the test case so we can run it on our machines? It's impossible to reproduce your TC now because it contains too much of custom, hidden logic.

comment:2 Changed 11 years ago by Alex

Here is simplified snippet without hidden logic, PostAsyncAjax is just a functions that returns html...

function Load(ID) {
    CKEDITOR.instances['CkEditorTxt'].setData("", function () {
        PostAsyncAjax("GetData",
            { 'ID': ID},
            function (data) {
                var Dto = data.d;
                CKEDITOR.instances['CkEditorTxt'].setData(Dto.HtmlContent);
            }
        );
    });

    return false;
}

comment:3 Changed 11 years ago by Piotrek Koszuliński

Does it call callback synchronously or asynchronously?

comment:4 Changed 11 years ago by Alex

Asynchronously, I don't think it matters, Every time I debug it I can see that data.d does get html. Also when the bug happens ckeditor doesn't load any content - then I'm not able to type anything until I click view source button - if I do click it then content does loads.

comment:5 Changed 11 years ago by Piotrek Koszuliński

It may not be crucial for your code, but it's crucial for CKEditor, because you call setData inside dataReady's listener - the correct timing is very important. Anyway, thanks for details, we'll verify it.

comment:6 Changed 11 years ago by Alex

Just tested it with synchronously call and got same result - (ckeditor doesn't work). Thank you.

Last edited 11 years ago by Alex (previous) (diff)

comment:7 Changed 11 years ago by Alex

I'm able to reproduce it also with a very simplified snippet Repro:

  1. Page refresh
  2. open Chrome developer tool (F12) (if I use Chrome Version 30.0.1599.101 m then the bug happen without opening web developer tool.)
  3. execute function Load(ID)
function Load(ID) {
    $('#ckEditorDialog').dialog('open');
    CKEDITOR.instances['CkEditorTxt'].setData("test");
    return false;
}

comment:8 Changed 11 years ago by Piotrek Koszuliński

I don't have time to check this right now, but I think that your code is incorrect. When you open a dialog you need to initialize editor afterwards. I guess you use classic editor which uses an iframe - please note that iframe does not work if it's detached from DOM. So when you use CKEditor with dialogs you need to take special precautions against this problem - initialize editor when your dialog is open and destroy before closing it.

comment:9 Changed 10 years ago by Piotrek Koszuliński

Resolution: expired
Status: pendingclosed
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy