Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

223
Visualizações
Writing a custom converter to handle non-html tags

When CKEditor5 sees bad HTML like this:

  @foreach ($data as $datum)
    <div>
      <span>{{ $datum }}</span>
    </div>
  @endforeach

It will wrap the tags in 'p' so it turns out looking like this:

<p>
    @foreach ($data as $datum)
</p>
<div>
    <span>{{ $datum }}</span>
</div>
<p>
    @endforeach
</p>

I believe it should be possible to prevent that from happening with a custom converter plugin or even in the config by messing with the model writer. Or do I need to hack it during the upcasting stage, which I'd be willing to do. What should I look at to start with this? Thanks.

I think I would start by getting the data model to not see it as "paragraph".

If it's not possible, how do I change the paragraph to something else? Using a different tag would work for me.

I also need it to work in tables as well. This just gets deleted:

<table>
    <tbody>
        <tr>
            <td>
                foo
            </td>
        </tr>
  @foreach ($data as $datum)
        <tr>
            <td>
                {{ $datum }}
            </td>
        </tr>
  @endforeach
        <tr>
            <td>
                bar
            </td>
        </tr>
    </tbody>
</table>

How do I make this not be deleted?

enter image description here

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda