When kindeditor with requirejs use, ready failure

KindEditor official documents when using KindEditor like this:

KindEditor.ready(function(K)) {
        K.create('#editor_id');
}
Use the ready to provide their own, and want to create a rich text box in the dom loaded. There will not be a problem under normal circumstances, I am also available in dome in. The code official until today the project, unitary moths emerge friends, how rich text box do not appear. It took an hour to locate the problem ready. Cause of the problem is that I call KindEditor use requirejs code is introduced, in the implementation of KindEditor.ready code dom structure already completed, dynamically inserted script code does not trigger DOMContentLoaded event again, so KindEditor.ready registered callback It never is executed, of course, a rich text box does not appear it. The solution is simple, do not use KinkEditor.ready, direct KindEditor.create (... Jiuhaola.

Published 55 original articles · won praise 39 · views 80000 +

Guess you like

Origin blog.csdn.net/Chinese521/article/details/52354496