In my project I have a requirement to remove the paragraph format like "Address" and "Formatted" from the drop down and to add a new custom format called "Links" which would be Arial, 14px, bold, red. Is it possible to add custom paragraph format in CKEditor?
相关问题
- Drupal 8: How do I customize a form widget to show
- CKFinder how to get dimension URL and Dimension (w
- drupal :: order complete hook and upgrade user per
- Key events not working for multiple ckeditors
- Save Data From Multiple CKEditor Inline Editor Fie
相关文章
- Listen to event fired when the content has changed
- Render a Drupal node
- CKEditor add CSS styling to Preview and Editor
- How to allow multiple blocks in a module of Drupal
- How can I redirect a Drupal user after they create
- Drupal 6: Getting custom fields into the database
- Input Validation When Using a Rich Text Editor
- CKEditor 5 React custom image upload
Since you're working with Drupal,
ckeditor.styles.js
is the file you're looking for, this will allow you to add/edit/remove entries in the Styles menu.Comment out any entries you don't want, and use something like this to add a new paragraph format:
This will add the CSS class
links
to whatever paragraph you want, and you can define the class in your theme stylesheet. Make sure to define the class inckeditor.css
if you don't see the changes applied in the CKEditor instance.Alternatively, you could also apply the inline styles directly:
But the first method is clearly more flexible/clean.
Make sure to clear your Drupal and/or browser cache if you don't see your changes show up immediately.
Use CKEDITOR.config.formatTags to specify some new formatting:
To know more about styles see how CKEDITOR.styleSet works. Also note that since CKEditor 4.1, removing styles from "Paragraph format" has an impact on Advanced Content Filter.