小编dar*_*k19的帖子

TinyMCE中的自定义格式div与之前的div合并

我在编辑器中创建了一个自定义格式

array(
    'title' => 'Tab',
    'block' => 'div',
    'classes' => 'tab',
    'wrapper' => true,
    'exact' => true,
),
Run Code Online (Sandbox Code Playgroud)

然后,我可以通过选择一些文本并选择我的格式来使用它:

<div class="tab">
   <h3>My Content heading 1</h3>
   <p>My first bit of content here...</p>
</div>
Run Code Online (Sandbox Code Playgroud)

到现在为止还挺好.但是,当我选择以下文本并选择我的格式时,它会扩展现有的div而不是插入新的div,所以我最终得到:

<div class="tab">
  <h3>My Content heading 1</h3>
  <p>My first bit of content here...</p>
  <h3>My Content heading 2</h3>
  <p>My second bit of content here...</p>
</div>
Run Code Online (Sandbox Code Playgroud)

当我想要的是这个:

<div class="tab">
  <h3>My Content heading 1</h3>
  <p>My first bit of content here...</p>
</div>
<div class="tab">
  <h3>My Content heading 2</h3>
  <p>My second bit of …
Run Code Online (Sandbox Code Playgroud)

php wordpress tinymce tinymce-4

7
推荐指数
1
解决办法
349
查看次数

标签 统计

php ×1

tinymce ×1

tinymce-4 ×1

wordpress ×1