Dom I Nic
Dom I Nic

Reputation: 71

Remove "Blocks" in "Format" button dropdown menu in TinyMCE

I have this "Format" toolbar button in tinymce, and I just want to know if there's a way to configure it's dropdown list items and how.

For now I have "Headers", "Inline", "Blocks" and "Alignment", and I want to remove "Blocks".

Thanks in advance :)

Here's a screenshot of what I want to remove:

tinymce dropdown menu item http://imageshack.com/a/img34/2654/wr2h.png

Upvotes: 3

Views: 2958

Answers (3)

Zenith
Zenith

Reputation: 1

I know I'm late with the answer, but if someone is struggling with this in TinyMCE 7 - removing some menu items (as per their docs), like "Blocks" from the menu dropdown is done like this:

tinymce.init({
  selector: '#editableItem',
  removed_menuitems: 'blocks'
});

Upvotes: 0

Robin Savinsky
Robin Savinsky

Reputation: 63

I know this post is old but it appears an answer was never provided. The following will create a custom format menu for the toolbar in TinyMCE 5.0

tinymce.init({
style_formats: [
    { title: 'Headers', items: [
      { title: 'Heading 2', block: 'h2' },
      { title: 'Heading 3', block: 'h3' },
      { title: 'Heading 4', block: 'h4' },
      { title: 'Heading 5', block: 'h5' },
      { title: 'Heading 6', block: 'h6' }
      ]
    },
    { title: 'Blocks', items: [
      { title: 'Paragraph', block: 'p' },
      { title: 'Div', block: 'div' },
      { title: 'Blockquote', block: 'blockquote' },
      { title: 'pre', block: 'pre' }
      ]
    }
  ]
});

Upvotes: 2

Rahul
Rahul

Reputation: 988

can you try this?

tinymce.init({
menu: { 
    file: {title: 'File', items: 'newdocument'}, 
    edit: {title: 'Edit', items: 'undo redo | cut copy paste | selectall'}, 
    insert: {title: 'Insert', items: '|'}, 
    view: {title: 'View', items: 'visualaid'}, 
    format: {title: 'Format', items: 'bold italic underline strikethrough superscript subscript | formats | removeformat'}, 
    table: {title: 'Table'}, 
    tools: {title: 'Tools'} 
}
});

Upvotes: 0

Related Questions