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

141
Visualizações
TinyMCE valid_children not working as expected

We're trying to add a custom style format to TinyMCE which acts as a wrapper but don't want it to appear inside another DIV, table cell or list.

We thought that we could achieve this with the valid_children option but it is being ignored.

Here is a test configuration;

tinymce.init({
selector: 'textarea.tinymce',
width: '100%',
height: 600,
 plugins: [
  'advlist autolink link lists anchor',
  'visualblocks visualchars code',
  'table paste'
],
style_formats: [
        {'title': 'Test', 'block': 'div', 'wrapper': true, 'block_expand': true, 'deep': true, 'classes': 'test', 'remove': 'all'}
  ],
  valid_children: '-div[div], -li[div], -ul[div], -ol[div], -td[div], -th[div]',
});

And here's a fiddle: https://jsfiddle.net/r4ymo893/

If you make a selection that contains part of a list or table then the wrapper is applied inside each list/cell which breaks the rules we set in valid_children

Any help would be much appreciated!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I think its cause you have valid_children twice. Need to update to this:

  tinymce.init({
    selector: 'textarea.tinymce',
    width: '100%',
    height: 600,
     plugins: [
      'advlist autolink link lists anchor',
      'visualblocks visualchars code',
      'table paste'
    ],
    style_formats: [
            {'title': 'Test', 'block': 'div', 'wrapper': true, 'block_expand': true, 'deep': true, 'classes': 'test', 'remove': 'all'}
      ],
      valid_children: '+body[style], -div[div], -li[div], -ul[div], -ol[div], -td[div], -th[div]',
  });
about 4 years ago · Juan Pablo Isaza Relatório
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