CKEditor 中getData()和setData()中的问题
今天写了一段代码:目的是向CKEditor中插入数据如下:
function insertSrc(srcArray){var oEditor = CKEDITOR.instances.articleContent; var editorData_old = oEditor.getData() ;var old_begin = editorData_old.substring(0,editorData_old.indexOf('</head>')) ;var old_end = editorData_old.substring(editorData_old.indexOf('</head>')) ;var insertData = '' ;for(var i=0;i<srcArray.length;i++){ insertData = insertData + srcArray[i] ;}var editorData_new =old_begin + insertData + old_end ;oEditor.setData(editorData_new) ;}
?
注:我们应该知道CKEditor中getData()方法是正常的方法,而setData()方法是异步方法。