CKeditor Html 5 <figure> tag issue

 ̄綄美尐妖づ 提交于 2019-12-24 05:52:35

问题


I using CKeditor version 4. And I facing issue related HTML 5 tag. Input Html Code:

<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>

Output return from 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>

Issue:-

  1. It will replace the "figure" tag with "p" tag

  2. Outer anchor tag replace with inner anchor tag


回答1:


I found the proper solution

Change in CKeditor Setting

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

This can resolve the issue of anchor tag and figure tag



来源:https://stackoverflow.com/questions/38888373/ckeditor-html-5-figure-tag-issue

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!