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 9135889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:52:52+00:00 2026-06-17T08:52:52+00:00

I am transitioning my CMS to use CKEditor. I am currently trying to make

  • 0

I am transitioning my CMS to use CKEditor. I am currently trying to make use of the Stylesheet Parser. I have a large number of sites with editor styles already defined. The definitions are made with simple class declarations: .[class]. By default the selector finds [element].[class] declarations.

I tried setting for stylesheetParser_validSelectors:

config.stylesheetParser_validSelectors = /\.\w+/;

…but the styles selection is empty.

I am using Firebug, and I don’t see any errors in the console.


My Solution

I ended up using the stylesSet configuration option for two reasons:

  1. It gives me control over the name that shows for a style selection
  2. I can set a default, but allow for overrides

Code:

if ((typeof EditorStyleSet === 'undefined')
        || (typeof EditorStyleSet !== 'object')
        || !(EditorStyleSet instanceof Array)) {
    // Allow this variable to be set at the site level
    EditorStyleSet = [
        {name:'Title', element:'span', attributes:{'class':'title'}},
        {name:'Subtitle', element:'span', attributes:{'class':'subTitle'}},
        {name:'Header Text', element:'span', attributes:{'class':'headerText'}},
        {name:'Red', element:'span', attributes:{'class':'red'}},
        {name:'Small', element:'span', attributes:{'class':'small'}},
        {name:'Hi-Lite', element:'span', attributes:{'class':'hi-lite'}}
    ];
}
config.stylesSet = EditorStyleSet;
  • 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-17T08:52:53+00:00Added an answer on June 17, 2026 at 8:52 am

    Your selectors are blocked by default skipSelectors (^\.):

    config.stylesheetParser_skipSelectors = /(^body\.|^\.)/i

    This is because stylesheetparser plugin wasn’t designed to deal with such cases. You can, however, override it:

    config.stylesheetParser_skipSelectors: /^body\./i

    Your styles will be visible on the list, but it will be visually broken. Now look at the code of stylesheedparser plugin (also log aClasses variable):

    for ( i = 0; i < aClasses.length; i++ ) {
        var oElement = aClasses[ i ].split( '.' ),
            element = oElement[ 0 ].toLowerCase(),
            sClassName = oElement[ 1 ];
    
        styles.push({
            name: element + '.' + sClassName,
            element: element,
            attributes: { 'class': sClassName }
        });
    }
    

    Patch it a little bit:

    for ( i = 0; i < aClasses.length; i++ ) {
        var oElement = aClasses[ i ].split( '.' ),
            element, sClassName;
    
        if ( !oElement.length ) {
            element = '',
            sClassName = oElement;
        } else {
            element = oElement[ 0 ].toLowerCase(),
            sClassName = oElement[ 1 ];
        }
    
        styles.push({
            name: element + '.' + sClassName,
            element: !element.length ? 'span' : element,
            attributes: { 'class': sClassName }
        });
    }
    

    And this is it!


    Edit: Created a ticket for this issue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From the Transitioning to ARC Release Notes Use Lifetime Qualifiers to Avoid Strong Reference
I am transitioning code that used implementations of Spring MVC's Controller to use the
I am currently transitioning from VB to C# and am having some issues with
I am transitioning from C to C++. In C++, is there any use for
My company is transitioning it's scrum workflow into TFS. Presently we have a public
I am trying to make my java application more standards compliant and one of
We are thinking of transitioning a large product from relying on Sun's JVM to
I have a list with one item on the list transitioning to the northeast
My company is currently transitioning to a new architecture, as well as a model
Currently transitioning a Rails 3.2+ app over to using Backbone.js to manage its front-end.

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.