TinyMCE5:从所有h1-h6元素中删除]; >> 默认情况下,TinyMCE允许h1-h6元素包含<strong>元素,但这是有问题的,因为对于某些字体,然后通过额外的权重添加标头标签的默认强权,这看起来可怕。 我尝试使用valid_children选项: valid_children : '-h1[strong],-h2[strong],-h3[strong],-h4[strong],-h5[strong],-h6[strong]' 但是,虽然这阻止了在<strong>-h1上实现h6,但它通过删除h1-h6元素并将其替换为p元素来解决现有情况: <h3><strong>Subtitle goes here</strong></h3> 已转换为: <p><strong>Subtitle goes here</strong></p> 但是,期望的行为是: <h3>Subtitle goes here</h3> 如何实现? 默认情况下,TinyMCE允许h1-h6元素包含元素,但这是有问题的,因为对于某些字体,然后通过额外的... 添加更多的标题标签来增强其默认的粗体... ] >>

问题描述 投票:0回答:1

默认情况下,TinyMCE允许h1-h6元素包含<strong>元素,但这是有问题的,因为对于某些字体,然后通过额外的权重添加标头标签的默认强权,这看起来可怕。

我尝试使用valid_children选项:

valid_children : '-h1[strong],-h2[strong],-h3[strong],-h4[strong],-h5[strong],-h6[strong]'

但是,虽然这阻止了在<strong>-h1上实现h6,但它通过删除h1-h6元素并将其替换为p元素来解决现有情况:

<h3><strong>Subtitle goes here</strong></h3>

已转换为:

<p><strong>Subtitle goes here</strong></p>

但是,期望的行为是:

<h3>Subtitle goes here</h3>

如何实现?

默认情况下,TinyMCE允许h1-h6元素包含元素,但这是有问题的,因为对于某些字体,然后通过额外的...

添加更多的标题标签来增强其默认的粗体...
tinymce tinymce-5
1个回答
0
投票

我尝试添加这些代码:

  formats: {
    h1: { block : 'h1', styles: { fontSize: '40px', 'font-weight': 'normal' }},
    h2: { block : 'h2', styles: { fontSize: '32px', 'font-weight': 'normal' }},
    h3: { block : 'h3', styles: { fontSize: '28px', 'font-weight': 'normal' }},
    h4: { block : 'h4', styles: { fontSize: '24px', 'font-weight': 'normal' }},
    h5: { block : 'h5', styles: { fontSize: '20px', 'font-weight': 'normal' }},
    h6: { block : 'h6', styles: { fontSize: '16px', 'font-weight': 'normal' }},
  },
© www.soinside.com 2019 - 2024. All rights reserved.