Using ck editor inline

dear all

i have 2 ck editors in my page where below is my code that i am using :

                                                       
    <div id="CkEditor_Details" runat="server" class="LiteralStyle_N_WithBorder" contenteditable="true"
                                                                style="height: 66px">
                                                            </div>

Open in new window


below is how i am declaring the editor:
 
var m_CkEditor_Details = document.getElementById('<%=CkEditor_Details.ClientID%>').id;
            setCkEditorToolbar(m_CkEditor_Details);
function setCkEditorToolbar(m_CkEditor) {
    
    var config = {};

    config.toolbarGroups = [
    { name: 'document', groups: ['mode', 'document', 'doctools'] },
    { name: 'clipboard', groups: ['clipboard', 'undo'] },
    { name: 'editing', groups: ['find', 'selection', 'spellchecker', 'editing'] },
    '/',
    { name: 'forms', groups: ['forms'] },
    { name: 'basicstyles', groups: ['basicstyles', 'cleanup'] },
    { name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align', 'bidi', 'paragraph'] },
    { name: 'links', groups: ['links'] },
    { name: 'insert', groups: ['insert'] },
    '/',
    { name: 'styles', groups: ['styles'] },
    { name: 'colors', groups: ['colors'] },
    { name: 'tools', groups: ['tools'] },
    { name: 'others', groups: ['others'] },
    { name: 'about', groups: ['about'] }
    ];

    config.removeButtons = 'Source,Save,NewPage,Preview,Print,Templates,PasteText,Form,Checkbox,Radio,TextField,Textarea,Select,Button,HiddenField,Blockquote,CreateDiv,Anchor,Flash,HorizontalRule,Smiley,PageBreak,Iframe,ShowBlocks,About';
    CKEDITOR.disableAutoInline = true;
    config.autoParagraph = false;
    config.resize_enabled = true;
    //Editor instances have to be destroyed explicitly first.
    try{
        var editor = CKEDITOR.inline(m_CkEditor, config);
    } catch (e) {

    }
    
    
};

Open in new window


Editor instances have to be destroyed explicitly first.
how can i do that while using 2 instances of ck editot
LVL 1
pamela rizkDeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Pravin AsarPrincipal Systems EngineerCommented:
Look into (CKEDITOR.instances); it  is an array of instances you should loop it to destroy each one:

for (key in CKEDITOR.instances) {
    CKEDITOR.instances[key].destroy(true);
}
0
pamela rizkDeveloperAuthor Commented:
where shoudl i add this code?
should i add it before addind new instances ?
0
Pravin AsarPrincipal Systems EngineerCommented:
This all depends , when you want to remove/destroy an instance.


Here is a working example:

https://jsfiddle.net/pravinasar/xpvt214o/107654/


This shows, how you can destroy an instance explicitly
Core part of the code is

CKEDITOR.instances['editor1'].destroy(true);

Which event should trigger this action is upto you.

Good Luck!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.