Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

162
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!