﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
12244	Weird issue with coreStyles (regexp?)	mpepito13		"Hi there,

Ive been trying to create a custom plugin for ages before understanding I faced a nasty bug.

I am using CKEditor 4.4.2 (revision 1567b48) in a rails4 project thanks to the ckeditor gem.

To be brief, here is a functional code :
{{{#!js
CKEDITOR.config.coreStyles_comment = {  
  element : 'p', 
  attributes: {'class': 'alert alert-info comment'} }
}}}


while that one below is buggy. The button is added in the toolbar but disabled.
{{{#!js
CKEDITOR.config.coreStyles_comment = {  
  element : 'p', 
  attributes: {'class': 'comment alert alert-info'} }
}}}

The only difference is the order in the class attribute.

I made few tests by changing the classes name but I couldn't figure out the problem.
this one works :
{{{#!js  
attributes: {'class': 'a a-b b'} } 
}}}
but not this one !!!
{{{#!js  
attributes: {'class': 'a a-b a'} } 
}}}


Here is the whole code :
{{{#!js
CKEDITOR.config.coreStyles_comment = {  
  element : 'p', 
  attributes: {'class': 'alert alert-info comment'} }


CKEDITOR.plugins.add( 'comment', {
  icons: 'comment',
  
  init: function( editor ) {
    var config = editor.config,
        style = new CKEDITOR.style( config.coreStyles_comment );

    // Listen to contextual style activation.
    editor.attachStyleStateChange( style, function( state ) {
      !editor.readOnly && editor.getCommand( 'insertComment' ).setState( state );
    } );


    editor.addCommand( 'insertComment', new CKEDITOR.styleCommand( style ) );
    editor.ui.addButton( 'Comment', {
      label: 'Insert Comment',
      command: 'insertComment',
      toolbar: 'pao'
    });
  }
});
}}}


Seems like a dev's nightmare to me don't you think? Good luck with that one ! :-)"	Bug	closed	Normal		Core : Styles		duplicate		
