0

I have written some HTML in custom block, but every time I open the editor in Drupal Admin UI some extra code is added to the block. Essentially, this means I have to remove the added code every time I want to edit the file which is becoming quite annoying. I am using Drupal 8 on the Acquia Cloud. Does anyone know what might be the cause of this?

Edit 1:

I'm using CKEditor

My HTML goes from this

 <div>
   <div>
     <nav>
       <a>
         <img src=""/>
         <p>Test</p>
       </a>
       <button>
         <div></div>
       </button>
       <div>
         <ul>
           <li><a>Sign In</a></li>
           <li><a>Sign up</a></li>
         </ul>
      </div>
    </nav>
  </div>
</div>

To this

<div>
  <div>
    <nav>
      <a><img alt="" data-entity-type="" data-entity-uuid="" src="" /> </a>
      <p><a>Test</a></p>
      <a></a>
      <button></button>

      <div> </div>
      <button></button>

      <div>
       <ul>
         <li><a>Sign In </a></li>
         <li><a>Sign up </a></li>
       </ul>
      </div>
    </nav>
  </div>
</div>

Edit 2: I'm also getting the following code added to a second block

<div class="menu-toggle-icon">&nbsp;</div>
<button aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation" class="navbar-toggler" data-target="#navbarSupportedContent" data-toggle="collapse" type="button"></button>
3
  • You should be more specific here. What is the code? It's likely not the host provider, but rather your site configuration (e.g. a WYSIWYG config or format filter that is altering the block markup).
    – Shawn Conn
    Jul 6, 2018 at 5:37
  • @ShawnConn, question updated. thanks for the comment
    – aydow
    Jul 9, 2018 at 2:10
  • @ShawnConn, added an extra part to the question
    – aydow
    Jul 9, 2018 at 3:58

1 Answer 1

1

The data-entity-type & data-entity-uuid properties are added with WYSIWYG fields when you have the Track images uploaded via a Text Editor filter . This filter is designed to track usage of images as they are dropped into HTML body fields and update the fields accordingly when the image is updated.

To disable it, navigate to the Text formats and editors admin section and configure the format that's being used for your custom block. Untick the Track images uploaded via a Text Editor filter option and click the Save configuration button to disable the filter.

1
  • thanks for the response, but on the format that i'm using in my custom block has no filters enabled. could it be some higher level setting?
    – aydow
    Jul 9, 2018 at 3:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.