Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

376
Vistas
I failed to make blocks ordering with BlockManager

Using grapesjs with custom blocks I need

  1. Collapse all, but extend only 1 block
  2. to order them . I managed to make point 1), but searching for decision of point2) I found this branch : https://github.com/artf/grapesjs/issues/780

and I do it as with timer:

let has_opened_block= false
setTimeout(() => {
    console.log('setTimeout::')
    var closedBlocks = ['Templates', 'Blocks', 'Images', 'Basic', 'Extra', 'forms'];  // I need to collapse these blocks and move them to the bottom


    gjsEditor.Blocks.getCategories().forEach(ct => {

        ct.set('open', false);
        if(!has_opened_block) {  // to open only 1st block which is not in closedBlocks                    
            if (!closedBlocks.includes(ct.id)) {
                has_opened_block = true
                ct.set('open', true);
            }
        }
    });



    const bm = gjsEditor.BlockManager;
    var blocksToRender= [ // I want to see these blocks at top
        bm.get('h2'),
        bm.get('d5'),
        bm.get('f4')
    ]
    for (var i=0; i< closedBlocks.length;i++) { // I want to see all blocks which are not in blocksToRender at bottom
        blocksToRender[blocksToRender.length]= bm.get(closedBlocks[i])
    }
    bm.render( blocksToRender )



}, 8000)

But as result I see 9 blocks, but which looks like empty : https://prnt.sc/86w-dqziZakn

Also I can not drag and drop content of these blocks - nothing is dropped.

What is wrong in my blocks ordering ?

Thanks!

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda