question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

there should be a way to add styles to the default stylesSet

See original GitHub issue

setting stylesSet replaces all styles. it would be nice to be able to add style to default ones. (also the style option should be added to the ‘CMS’ toolbar)

docs: http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.stylesSet.html

these are my settings:

CKEDITOR_SETTINGS = {
    'language': '{{ language }}',
    'toolbar': 'Full',
    'skin': 'moono',
    'stylesSet': [
        {'name': 'MY SPECIAL STYLE' , 'element': 'h3', 'styles': {'color': 'Blue'}}
    ],
}

Issue Analytics

  • State:closed
  • Created 11 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
Clindberghcommented, Mar 1, 2018

Great, thank you! This works when I copy paste the default styles as well, so /home/mysuser/myprojectroot/static/js/addons/ckeditor.wysiwyg.js has to be

CKEDITOR.stylesSet.add('default', [
/*
*
* Default styles located at 
* https://github.com/divio/djangocms-text-ckeditor/blob/master/djangocms_text_ckeditor/static/djangocms_text_ckeditor/ckeditor/styles.js 
* pasted here
*
*/,
  { name: 'My Custom Block', element: 'h3', styles: { color: 'blue'} },
  { name: 'My Custom Inline', element: 'span', attributes: {'class': 'mine'} }
]

(and CKEDITOR_SETTINGS = { 'stylesSet': 'default:/static/js/addons/ckeditor.wysiwyg.js' } in settings.py)

0reactions
vxsxcommented, Mar 1, 2018

It has to be in your static directory and the path should start from the root of the project. So for this example:

https://github.com/divio/django-cms-demo/blob/7a104acaa749c52a8ed4870a74898e38daf20e46/src/settings.py#L318-L324

the file is in /home/mysuser/myprojectroot/static/js/addons/ckeditor.wysiwyg.js

Read more comments on GitHub >

github_iconTop Results From Across the Web

there should be a way to add styles to the default stylesSet #3
setting stylesSet replaces all styles. it would be nice to be able to add style to default ones. (also the style option should...
Read more >
CKEditor custom stylesSet overrides default - Stack Overflow
stylesSet option to append your styles to default ones. You can edit the styles.js file, adding and removing styles from it. It is...
Read more >
Class StylesSet (CKEDITOR.stylesSet) - CKEditor 4 API docs
Note This object is an instance of CKEDITOR.resourceManager. // The set of styles for the <b>Styles</b> drop-down list. CKEDITOR.stylesSet.add( 'default' ...
Read more >
Setting config.stylesSet in Custom javascript configuration has ...
To add your style to style drop down / select box please use "Predefined styles " and/or "Predefined styles path " options from...
Read more >
CKEditor styles - Kentico DevNet
stylesSet.add('custom', [ /* Block Styles */ // These styles are already ... Is there a way to create/override the default styleset without ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found