How to show color/font button on the toolbar of CKEditor in rails_admin?

26 Views Asked by At

i use ruby on rails and rails_admin, but i can't find button of edit color and font-size on the toolbar.

  1. this is my code in model.rb.
rails_admin do
  edit do
    field :analysis, :ck_editor
  end
end
  1. then ckeditor shows as following figure:

ckeditor field

i searched and use some config on the internet, my config.js as follow

CKEDITOR.editorConfig = function (config) {
    config.extraPlugins = 'lineheight,colorbutton,font';
    config.line_height="1em;1.1em;1.2em;1.3em;1.4em;1.5em;1.6em;1.7em;1.8em;1.9em;2em";
    config.enterMode = CKEDITOR.ENTER_BR;
    config.shiftEnterMode = CKEDITOR.ENTER_BR;
    // color
    config.allowedContent = true;
    config.colorButton_enableAutomatic = true;
    config.colorButton_enableMore = true;
    config.colorButton_colors = 'CF5D4E,454545,FFF,DDD,CCEAEE,66AB16';
    config.fontSize_sizes = '16/16px;17/17px;18/18px;24/24px;30/30px;36/36px;42/42px;48/48px;';
}

CKEDITOR.replace( '#editor', {
  toolbar: 'Full',
  colorButton_enableAutomatic: true,
  colorButton_enableMore: true,
  extraPlugins: 'lineheight,colorbutton,font'
} );
0

There are 0 best solutions below