Score:1

Disable source code formatting in CkEditor

ua flag

In Drupal 9, is there a way to avoid CkEditor re-formats the source code?

There is one text editing mode set in Drupal, Full HTML. When I edit or create a Basic page node, once I click the Source button, paste in code, deselect Source, and then re-select Source, the formatted code becomes CkEditor-ified.

I only found posts from years ago or that aren't for Drupal 9. I've tried the CkEditor Config module and the WYSIWYG Linebreaks module, but both have no effect, or maybe they are not configured right.

I would like to paste in this source code and keep it as is.

<div id="equipments" class="equipment__grid">
  <!-- equipment block fixed start -->
  <div class="equipment__block">
    <div class="equipment__block__img">
      <img alt="TITLE" src="/change/me.jpg">
    </div>
    <div class="equipment__block__info">
      <h3><a href="/change/me">TITLE</a></h3>
      <p>Location: LOCATION<br />Asking Price: $PRICE</p>
    </div>
  </div>
  <!-- equipment block fixed end -->
</div>

Instead CKEditor does this:

<div class="equipment__grid" id="equipments"><!-- equipment block fixed start -->
<div class="equipment__block">
<div class="equipment__block__img"><img alt="TITLE" src="/change/me.jpg" /></div>

<div class="equipment__block__info">
<h3><a href="/change/me">TITLE</a></h3>

<p>Location: LOCATION<br />
Asking Price: $PRICE</p>
</div>
</div>
<!-- equipment block fixed end --></div>

The CKEditor Config module is installed and activated. This is the current configuration.

CKEditor Config screencap

This is the configuration for the WYSIWYG Linebreak module.

WYSIWYG Linebreak screencap

The Full HTML enabled filters are the following.

Full HTML enabled filters

Kevin avatar
in flag
https://drupal.stackexchange.com/a/262515/57
Anthony Tailor avatar
ua flag
Thanks Kevin, I did come across that already. I have no idea how that's implemented in Drupal 9.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.