type |
array |
default |
[
["formatting", "fontSize"],
["bold", "italic", "underline", "strikeThrough"],
["foreColor", "backColor"],
["link", "insertImage", "createTable"],
"textAlignment",
["subscript", "superscript"],
["indent", "outdent"],
["ul", "ol", "hr"],
"removeFormat",
["source", "fullScreen"]
] |
The editor’s toolbar buttons are defined using a 2-dimensional array. Each sub-array represents a group of buttons that will be displayed together in the toolbar. This allows you to easily organize related buttons into logical groups.
btns: [
["formatting", "fontSize"], // Group 1: Formatting options
["bold", "italic", "underline", "strikeThrough"], // Group 2: Text styling
["foreColor", "backColor"], // Group 3: Text colors
["link", "insertImage", "createTable"], // Group 4: Insert elements
"textAlignment", // Group 5: Text alignment (single button group)
["subscript", "superscript"], // Group 6: Subscript and superscript
["indent", "outdent"], // Group 7: Indentation
["ul", "ol", "hr"], // Group 8: Lists and horizontal rule
"removeFormat", // Group 9: Remove formatting (single button)
["source", "fullScreen"] // Group 10: Source code view and fullscreen mode
]
In this structure, groups of buttons are defined as arrays, and individual buttons can be defined as single strings. For example, "textAlignment"
and "removeFormat"
are single buttons, while groups like ["bold", "italic", "underline"]
contain multiple buttons related to text styling.
You can customize the toolbar by adding, removing, or rearranging buttons and groups to fit your needs.