'WYSIWYG HTML editor that doesn't try and fix bad HTML

I need a WYSIWYG HTML editor that can edit PHP Blade and Handlebars* templates. I've tried TinyMCE, CKEditor and bootstrap wysihtml5 but they all "fix" my invalid HTML. Can anyone suggest an alternative?

I need to be able to toggle between WYSIWYG and Source mode without the following being altered.

<table>
  <thead>
    <tr>
      <tr>Column 1</tr>
      <tr>Column 2</tr>
    </tr>
  </thead>
  <tbody>
  @foreach ($data as $datum)
    <tr>
      <td>{{ $datum->col1 }}</td>
      <td>{{ $datum->col2 }}</td>
    </tr>
  @endforeach
  </tbody>
</table>

All the editors I have found remove the @foreach and sometimes break the table too. I don't care too much if the "visual" mode is broken but I need the HTML to remain untouched.

*I prefix Handlebars variables with $ so they're broadly compatible with blade templates.



Solution 1:[1]

There were some WYSIWYG editors for React, that I was able to find.

Demo of Pagedraw on YouTube.com, https://www.youtube.com/watch?v=NjH3koR1E6w

I read about the idea about WYSIWYG editing of components in https://medium.com/@vlascik/ember-in-the-middle-of-2019-the-good-the-bad-the-ugly-hopefully-d641cc73d6d1:

Pinegrow explicitly disavows this in the documentation, https://pinegrow.com/docs/pages/pages.html#formats

I saw an attempt to get Handlebars working with GrapesJS, but it ended up inconclusively, https://github.com/artf/grapesjs/issues/1162

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user7610