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

206
Views
Tiptap editor framework: what is the difference between set and toggle functions?

I've been playing around with the tiptap editor framework for a few days now, and I have trouble understanding what is the difference between set and toggle functions. As an example, what is the difference between the setBold() function and the toggleBold() (https://tiptap.dev/api/marks/bold).

Thanks!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

In general "toggle" means switch back-and-forth between on and off

So if you know you definitely want to switch bolding ON, use .setBold()

If you definitely want to switch bolding OFF, use .unsetBold()

And if you just want to reverse the bolding state, use .toggleBold()

Why you may have found it difficult to see the difference

If you tried both, and found identical effects, probably you were testing from a state of "not bolded".

If you try the two functions on a piece of text that is already bold, you will see that "toggle" turns off the bold, and "set" leaves the text remaining bold.

about 4 years ago · Juan Pablo Isaza Report
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!