Skip to main content
Question

How to set bold text in UI Plugin?


JoaoVictorCamargo

Hey! I hope that someone can help me

I’m trying to make a Plugin that call components from my library and edit his text property

But I can’t get the font weight to change to bold. I was wondering how to make a RichText editor where the changes are instantly visible to the user

There are a plenty of plugins that make this, but the function document.execCommand is not working for me =(

I was trying this:

Texto da bolha Bold

Thanks!

This topic has been closed for comments

2 replies

JoaoVictorCamargo
<div>
<textarea class="textarea" rows="2" id="idTextoBolha">Texto da bolha</textarea>
<button id="bold_button">Bold</button>
<script>
  document.getElementById('bold_button').onclick = () => {
        document.execCommand("bold",true,null);
  }  
</script>
</div>

Pavel_Kiselev

Text area has no formatting capabilities. You need to use “div contenteditable” for that


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings