TinyMCE: How can I change the formats ("Paragraph", "Heading 1", etc.) -


by default tinymce (4) has "paragraph ▼" dropdown, , if click on list of formatting options ("paragraph", "heading 1", etc.).

i'd able 2 things. first, want change options , names (eg. "normal" , "heading"), , found block_formats option that:

block_formats: 'normal=p;heading=h1' 

however, i'm stuck on thing #2: adding classes generated elements. instead of plain <h1> elements, when picks "heading" want generate <h1 class="heading">.

i thought maybe work:

block_formats: 'normal=p;heading=h1.heading' 

... doesn't, , haven't been able find other option let me this. again, tinymce documentation isn't easiest place find answers, why came here.

does know how configure tinymce have "paragraph ▼" dropdown customized names , custom classes on generated elements?

i never did find way this, wound doing instead remove block format drop-down entirely , replace (custom) format dropdown. in other words i:

  1. removed formatselect toolbar1 config (removing un-configurable normal formatting dropdown)
  2. added custom format dropdown (styleselect) toolbar1 config
  3. defined style_formats config entry custom styles

the style_formats config looked this:

style_formats: [     {         title: 'header',         inline: 'span',         classes: 'someclass',         styles: {somestyle: '5px'}     }, ], // next style go here 

there 2 downsides of approach. first, dropdown says "formats", , don't seem able configure anywhere. have single formatting dropdown, options want, , options add desired classes formatted text, dropdown's name isn't big deal.

the second issue tinymce uses <iframe>, prevents using our stylesheet. have written stylesheet tinymce , appended <iframe> (or used tinymce mechanism, if there one) ... i'm lazy used style: entries each custom format define style.


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -