CKeditor Html 5 <figure>标签问题

时间:2016-08-11 06:03:41

标签: ckeditor

我使用CKeditor版本4.我面临问题相关的HTML 5标记。 输入Html代码:

<div class="col-md-4 col-sm-4">
    <div class="item-cont"> 
        <a href="contents/view/home">
          <figure>
            <img src="img/1468996695_img-1.jpg" />
          </figure>
          <div class="item-content">
            <div class="align-content">
              <div class="text-cont">
                <h1>Text</h1>
                <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry.</p>
              </div>
            </div>
          </div>
        </a>
    </div>
</div>

Ckeditor的输出返回

 <div class="col-md-4 col-sm-4">
    <div class="item-cont">
    <p><a href="contents/view/home"><img src="img/gallery/subGallery_1/1468996695_img-1.jpg" /> </a></p>

  <div class="item-content">
     <div class="align-content">
       <div class="text-cont">
       <h1><a href="contents/view/home">Aarhus</a></h1>

          <p><a href="contents/view/home">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry.</a></p>
     </div>
      </div>
    </div>
 </div>
 </div>

问题: -

  1. 它会将“figure”标签替换为“p”标签

  2. 外部锚标签替换为内部锚标记

1 个答案:

答案 0 :(得分:1)

我找到了合适的解决方案

CKeditor设置的变化

$(function(){
     CKEDITOR.replace('tinyeditor');
     CKEDITOR.dtd.a.div = 1;
     CKEDITOR.dtd.a.figure = 1;
     CKEDITOR.config.allowedContent = true;
});

这可以解决锚标记和图形标记

的问题