I am been having this problem with my D8 installation. I add some code in Source view. Switch out of source to visual editor. Then I swtich back to source a lot of the tags are removed. I am using FULL editor.


Here is an example.


I paste this code in Source.

<div class="flowplayer is-splash">
 
   <!-- initial clip -->
   <video>
      <source type="application/x-mpegurl"
              src="//mydomain.com/video1.m3u8">
      <source type="video/mp4"
              src="//mydomain.com/video1.mp4">
   </video>
 
   <!-- playlist root -->
   <div class="fp-playlist">
 
      <!-- playlist entries or "trigger" elements -->
      <a href="//mydomain.com/video1.mp4"></a>
      <a href="//mydomain.com/video2.mp4"></a>
      <a href="//mydomain.com/video3.mp4"></a>
      <a href="//mydomain.com/video4.mp4"></a>
   </div>
 
   <!-- optional prev/next buttons -->
   <a class="fp-prev"></a>
   <a class="fp-next"></a>
 
</div>

When I switch to text / visual and then back to source code I see this.


<div class="flowplayer is-splash"><!-- initial clip -->
<video><source src="//mydomain.com/video1.m3u8" type="application/x-mpegurl" /> <source src="//mydomain.com/video1.mp4" type="video/mp4" /></video>
<!-- playlist root -->

<div class="fp-playlist"><!-- playlist entries or "trigger" elements --></div>
<!-- optional prev/next buttons --> </div>

Comments

Stefan Lehmann’s picture

Just tested it on simplytest.me and you're right the HTML is cleaned up.

I think it's the Advanced Content Filter (ACF) coming directly from the CKEditor plugin, which does that.

One way to solve this would be to change the markup in a way that it doesn't get stripped by that ACF mechanism anymore. I think the main reason here is that you're having empty tags eg:

<a href="//mydomain.com/video4.mp4"></a>

which you would have to change to something like:

<a href="//mydomain.com/video4.mp4">Video 4</a>

.. which would prevent the markup from being stripped. Also adding a closure to the source tags might be a good idea, like this here:<source type="video/mp4" src="//mydomain.com/video1.mp4" />.

The other way would be to disable ACF completely. For that (I believe) you have to change the config.js of the ckeditor, but I have no idea where that lives in D8 and what the preferred way to do is at the moment.

I like cookies!

tepelena’s picture

I think you are correct. Now I need to disable ACF. There doesn't seem to seem any easy way to do this other than changing ckedior file in core. Which is not ideal as it will get overwritten during update.

http://www.lifesahack.com/how-to-disable-advanced-content-filter-acf-dru...

Stefan Lehmann’s picture

There must be a way to override this value without hacking core. Maybe post an issue in the D8 issue queue, if you can't find any examples.

I like cookies!

tepelena’s picture

Update!

As a workaround you can change
<a class="addthis_button_tweet"></a>
to
<a class="addthis_button_tweet"> &nbsp;</a>
Than editor will not remove your code.

As a workaround you can change

to
 
Than editor will not remove your code.

Read more about this issue here:
https://www.drupal.org/node/1606596

Wim Leers’s picture

This is not a best practice… in fact, it's a worst practice.

See https://www.drupal.org/node/2866027#comment-12025850 for guidance.