当前位置: 首页 > 文档资料 > tinyMCE 帮助文档 >

HTML5 formats example

优质
小牛编辑
117浏览
2023-12-01

This example shows you how to edit HTML5 content such as sections and articles.

<textarea id="format-hmtl5">
  <section>Section
    <p>Paragraph</p>
  </section>
  <article>Article
    <p>Paragraph</p>
  </article>
  <blockquote>Blockquote
    <p>Paragraph</p>
  </blockquote>
  <aside>Section
    <p>Paragraph</p>
  </aside>
  <figure>Figure
    <figcaption>Figcaption</figcaption>
  </figure>
</textarea>
tinymce.init({
  selector: 'textarea#format-hmtl5',
  height: 500,
  plugins: 'visualblocks',
    content_css: [
    '//fonts.googleapis.com/css?family=Lato:300,300i,400,400i',
    '//www.tiny.cloud/css/codepen.min.css'
  ],
  style_formats: [
    { title: 'Headers', items: [
      { title: 'h1', block: 'h1' },
      { title: 'h2', block: 'h2' },
      { title: 'h3', block: 'h3' },
      { title: 'h4', block: 'h4' },
      { title: 'h5', block: 'h5' },
      { title: 'h6', block: 'h6' }
    ] },

    { title: 'Blocks', items: [
      { title: 'p', block: 'p' },
      { title: 'div', block: 'div' },
      { title: 'pre', block: 'pre' }
    ] },

    { title: 'Containers', items: [
      { title: 'section', block: 'section', wrapper: true, merge_siblings: false },
      { title: 'article', block: 'article', wrapper: true, merge_siblings: false },
      { title: 'blockquote', block: 'blockquote', wrapper: true },
      { title: 'hgroup', block: 'hgroup', wrapper: true },
      { title: 'aside', block: 'aside', wrapper: true },
      { title: 'figure', block: 'figure', wrapper: true }
    ] }
  ],
  visualblocks_default_state: true,
  end_container_on_empty_block: true
});