Opened 11 years ago
Closed 10 years ago
#12244 closed Bug (duplicate)
Weird issue with coreStyles (regexp?)
Reported by: | mpepito13 | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | Core : Styles | Version: | |
Keywords: | Cc: |
Description
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 :
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.
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 :
attributes: {'class': 'a a-b b'} }
but not this one !!!
attributes: {'class': 'a a-b a'} }
Here is the whole code :
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 ! :-)
Change History (1)
comment:1 Changed 10 years ago by
Keywords: | regexp rails gem removed |
---|---|
Resolution: | → duplicate |
Status: | new → closed |
Version: | 4.4.2 |
Thanks... This is in fact a duplicate of this ticket: #13206.
I will close this one and keep later one opened as the later has more detailed description of this problem.
NOTE: @mpepito13 as a workaround, please use your classes in alphabetical order.