How to programmatically determine name of CKEditor instance

后端 未结 6 2001
野趣味
野趣味 2021-01-05 03:40

I\'ve added a CKEditor instance programmatically to my page in the code-behind of my ASP.NET page:

VB.NET:

itemEditor = New CkEditor
cell.Controls.Ad         


        
6条回答
  •  生来不讨喜
    2021-01-05 04:10

    Assuming you only have one editor instance:

    for ( var i in CKEDITOR.instances ){
       var currentInstance = i;
       break;
    }
    var oEditor   = CKEDITOR.instances[currentInstance];
    

    Here is what the JavaScript API says about instances.

    Here is another way of defining the CKEditor. Here 'fck' is the input fields id:

    CKEDITOR.replace( 'fck', {
        customConfig : prefix + 'js/ckeditor/config.js',
        height: 600,
        width: 950
    });
    
    editor = CKEDITOR.instances.fck;
    

    Notice how I am then able to reference the instance using .fck.

提交回复
热议问题