Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9229303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:32:17+00:00 2026-06-18T05:32:17+00:00

I want to set ckeditor tool bar based on the user type and some

  • 0

I want to set ckeditor tool bar based on the user type and some condition.

Partialy I done as below:

switch(UserMode)
{
    case "1":
        config.toolbar_MyTool = [
            ['Find', 'SelectAll'], ['Anchor'], ['Maximize']
        ];
        break;
    case "2":
        config.toolbar_MyTool = [
            ['Find'], ['Anchor'], ['Maximize']
        ];
        break;
}

Code goes long based on the usermode
so I want to create a array and just I want to assign the toolbar
like as below:

config.toolbar_MyTool = myToolArray;

Also I want to check own post or other person post. If it is own post I want to add some tools additionally.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T05:32:18+00:00Added an answer on June 18, 2026 at 5:32 am

    You would start by defining your different toolbars in the config.js

    config.toolbar_MyToolUserMode1 = [
            ['Find', 'SelectAll'], ['Anchor'], ['Maximize']
        ];
    
    config.toolbar_MyToolUserMode2 = [
            ['Find'], ['Anchor'], ['Maximize']
        ];
    

    Those toolbar-definitions can then be used later in your page, but be aware that as soon as you create an instance of CKEditor, the toolbar layout CAN NOT be changed:

    CKEDITOR.config.toolbar = "MyToolUserMode1";
    var instance = CKEDITOR.appendTo(parentElement);
    

    Solution 1:

    You would have to create a new instance to change the toolbar dynamically:

    switch(UserMode)
    {
    case "1":
        if (instance) instance.destroy();
        CKEDITOR.config.toolbar = "MyToolUserMode1";
        instance = CKEDITOR.appendTo(parentElement);
        break;
    case "2":
        if (instance) instance.destroy();
        CKEDITOR.config.toolbar = "MyToolUserMode2";
        instance = CKEDITOR.appendTo(parentElement);
        break;
    }
    

    Solution 2:

    However, if you are happy with showing the full toolbar also in usermode 2 and greying the SelectAll-Button, then the following could be your solution:

    CKEDITOR.config.toolbar = "MyToolUserMode1";
    var instance = CKEDITOR.appendTo(parentElement);
    
    switch(UserMode)
    {
    case "1":
        instance.getCommand('selectAll').enable();
        break;
    case "2":
        instance.getCommand('selectAll').disable();
        break;
    }
    

    [EDIT feb 15]

    Solution 3:

    According to your comment -> how to dynamically construct with array.push

    No configuration needed in config.js

        // your code
        var myToolbarSection1 = new Array();
        myToolbarSection1.push('Bold');
        myToolbarSection1.push('Italic');
    
        // attaching this section to toolbar
        var myToolbar = new Array();
        myToolbar.push(myToolbarSection1);
    
        // setting the toolbar
        CKEDITOR.config.toolbar_Dynamic = myToolbar;
        CKEDITOR.config.toolbar = 'Dynamic';
    
        var instance = CKEDITOR.appendTo('myDIVID');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want set value of input type if condition is true but my function
I want to set the type of a list to be ints but I
I want set progress bar until the next activity start.That mean i want to
I Want Set Access level user For Buttons in the forms. example in the
i want set some fields, like updateDate, createDate and deleteDate, for each my entities,
I want set default icon of some extension by C#. But this gives me
I want to set a field in my table based on another field in
I want set a dropdown(select) to be change based on the value of the
I want set interfaceOrientation in one UIView as LandscapeLeft and Portrait in other UIView.
i want set the visibility to itemized overlay in map view. if the zoom

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.