Class CKEditorConfig.ToolbarStyle

java.lang.Object
com.wontlost.ckeditor.CKEditorConfig.ToolbarStyle
Enclosing class:
CKEditorConfig

public static class CKEditorConfig.ToolbarStyle extends Object
Toolbar style configuration for customizing CKEditor toolbar appearance. Uses CSS injection for scoped styling per editor instance.

Supports styling:

  • Toolbar background, border, and border radius
  • Button states (default, hover, active, on)
  • Icon colors
  • Individual button styles via buttonStyles map

Security: All CSS values are validated to prevent CSS injection attacks. Only safe color values, sizes, and keywords are allowed.

Usage example:

 ToolbarStyle style = ToolbarStyle.builder()
     .background("#ffffff")
     .borderColor("#e0e0e0")
     .borderRadius("4px")
     .buttonBackground("transparent")
     .buttonHoverBackground("rgba(0, 0, 0, 0.05)")
     .buttonOnBackground("#e3f2fd")
     .buttonOnColor("#1976d2")
     .iconColor("#424242")
     .buttonStyle("Bold", ButtonStyle.builder()
         .background("#fff3e0")
         .iconColor("#e65100")
         .build())
     .build();
 
  • Method Details

    • builder

      public static CKEditorConfig.ToolbarStyle.Builder builder()
    • getBackground

      public String getBackground()
    • getBorderColor

      public String getBorderColor()
    • getBorderRadius

      public String getBorderRadius()
    • getButtonBackground

      public String getButtonBackground()
    • getButtonHoverBackground

      public String getButtonHoverBackground()
    • getButtonActiveBackground

      public String getButtonActiveBackground()
    • getButtonOnBackground

      public String getButtonOnBackground()
    • getButtonOnColor

      public String getButtonOnColor()
    • getIconColor

      public String getIconColor()
    • getButtonStyles

      public Map<String,CKEditorConfig.ButtonStyle> getButtonStyles()
    • toJson

      public tools.jackson.databind.node.ObjectNode toJson()
      Convert to JSON for frontend configuration.