Add custom element to 'formatting' dropdown #25

Closed
iamkeir opened this Issue Oct 9, 2012 · 2 comments

Projects

None yet

3 participants

@iamkeir

Finding it tricky to add an additional block element to the formatting dropdown in the toolbar.

I can edit the redactor.js directly to add a new element (an <h5> for example) but I'd rather not influence the core code in this way.

Does anyone know if new elements can be aded to the formatting dropdown through the config?

Ideally, I'd like to be able to add custom elements such as:
'small print' = <div class="smallprint"></div>

Any ideas/pointers greatly appreciated.

K

@vjpr

On initialise you could pass in a different toolbar.dropdown option.

var Redactor = function(element, options) {
  ...
  // Options
  this.opts = $.extend({
  ...
    toolbar: { dropdown: { ... } }

You could also try creating a plugin - its quite easy and you have access to everything.

@iamkeir

Hey @vjpr - thanks for your input, I'll have a play and report back.

I also edited my OP as I hadn't formatted code correctly.

@html5cat html5cat closed this Jun 30, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment