#14715 closed Bug (invalid)
change default text color
Reported by: | Alexandre Tiertant | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | |
Keywords: | Cc: |
Description
Steps to reproduce
adding this to config
config.colorButton_foreStyle: { element: 'font', attributes: { 'color': '#FF0000' } }
Expected result
i would like to change default text color as said in doc:
is there a way to change de default text color via the api?
Actual result
do nothing
Other details (browser, OS, CKEditor version, installed plugins)
Change History (5)
comment:1 Changed 9 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
Version: | 4.5.10 (GitHub - master) |
comment:2 Changed 9 years ago by
this only change the color in the editor, not in the html content produced...
comment:3 Changed 9 years ago by
Your target page (where content lands) needs to have same styles as used in the editor. After all you are creating content for particular page so styles should match.
comment:4 Changed 9 years ago by
well i'm not using editor to write web site page content... editor is for html that's true but html isn't used only in web content... i would like to set per user default color this is why i would like to change color by default via api. i googled "ckeditor change default text color" and i was not the only one looking at this but noone found a real solution...
comment:5 Changed 9 years ago by
You can try below:
CKEDITOR.addCss('.myItalic {font-style: italic;}'); var editor = CKEDITOR.replace( 'editor1', { extraAllowedContent : 'p{color}', on: { pluginsLoaded: function( evt ) { evt.editor.dataProcessor.dataFilter.addRules( { elements: { p: function( el ) { el.attributes['style'] = 'color:#ccc'; } } } ); } } });
The #ccc
can be dynamic. You can read some color value from request and assign it to some JavaScript property in your name space or existing one.
You need to set default color it in contents.css