Enabling A Subset of all UI Plugins


Leave a comment (example only)


John Smith
Hey, just wanted to say great stuff, and have a nice day. Cheers!
1 hour ago Reply

Description

The buttons in the editor's toolbar are referred to as 'UI plugins'. To selectively enable UI plugins, set the enableUi option to false, and set the plugins option to an object containing the UI plugins you would like enabled, for example:

  1. plugins: {
  2. textBold: true,
  3. textItalic: true,
  4. textUnderline: true
  5. }

This is a good way to limit users to a set of 'safe' editing actions, in places where it is not appropriate to allow the user access to the full suite of editing controls. For example when using Raptor to allow users to include simple formatting in a comment form.

The Code

  1. $('.comment-example textarea').raptor({
  2. autoEnable: true,
  3. enableUi: false,
  4. unloadWarning: false,
  5. classes: 'raptor-editing-inline',
  6. plugins: {
  7. textBold: true,
  8. textItalic: true,
  9. textUnderline: true,
  10. textStrike: true,
  11. textBlockQuote: true,
  12. textSizeDecrease: true,
  13. textSizeIncrease: true,
  14. dock: {
  15. docked: true,
  16. dockToElement: true
  17. },
  18. unsavedEditWarning: false
  19. },
  20. });