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

168
Vistas
Is there a way of extending the functionality of basic Lexical nodes?

I know I can create custom nodes that are an extension of inbuilt node classes. And it works great, But I would also like to extend the functionality of inbuilt classes themselves.

For example, I have this helper function:

import { LexicalNode } from 'lexical'

function insertMultipleAfter(targetNode: LexicalNode, nodesToInsert: LexicalNode[]) {
  ;[...nodesToInsert].reverse().forEach(node => targetNode.insertAfter(node))
}

and I would like to make it part of LexicalNode itself, so I can call node.insertMultipleAfter(arrayOfNodes) on any node of any type - or perhaps even add a new overload to insertAfter to make it also handle an array.

Is there a "correct" way to do this? Or is it not advisable, and should I stick to my helper functions?

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