Home Search Member List Faq Register Login  
UltimateEditor
Re: Updating Font

Thread Starter: Benavilu   Started: 09-17-2015 12:38 PM   Replies: 3
 Karamasoft Support Forums » General Discussions » UltimateEditor » Re: Updating Font
 Printable Version    « Previous Thread   Next Thread »
  17 Sep 2015, 12:38 PM
Benavilu is not online. Last active: 9/18/2015 12:22:48 PM Benavilu

Not Ranked
Joined on 12-11-2014
Posts 4
Updating Font
Hello,

Using Javascript, is it possible to select all the text inside the editor and set the font? What I'm trying to accomplish is after a user pastes text into the editor, update the text's font to Arial.

I'm trying to save the users a step by not requiring them to select all the text and updating the font. Any insight is appreciated, thanks.

  
  17 Sep 2015, 6:11 PM
Karamasoft is not online. Last active: 11/10/2017 3:24:14 PM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 6,818
Re: Updating Font
You can achieve what you are looking for by using the UltimateEditor client-API methods, however, it will need extensive programming. If you want to try it, please refer to the client-side programming samples and also the documentation at https://www.karamasoft.com/UltimateEditor/ClientAPI.htm. One approach might be to add a paste event handler, get the editor content and replace all the font-family values and then set the editor HTML. Or you can try using the GetCurrentRange method and work with the selection and range methods.

You can also initialize the toolbar items as you can see at
https://www.karamasoft.com/Samples.aspx?component=UltimateEditor&sample=InitializeToolbarItems. In the sample, the default font is set to Verdana so when you type inside the editor, the text will have the Verdana font. However, when your users paste inside the editor initially without typing any text, it will not retain the default settings.

  
  18 Sep 2015, 10:35 AM
Benavilu is not online. Last active: 9/18/2015 12:22:48 PM Benavilu

Not Ranked
Joined on 12-11-2014
Posts 4
Re: Updating Font
Thanks for getting back to me. Would it be possible for you to give me an example on using the GetCurrentRange method?
  
  19 Sep 2015, 11:21 AM
Karamasoft is not online. Last active: 11/10/2017 3:24:14 PM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 6,818
Re: Updating Font
You can refer to the following samples and click on Show Code link at the bottom of the page to see how you can use the GetCurrentRange method:

https://www.karamasoft.com/Samples.aspx?component=UltimateEditor&sample=CSSDropDown

https://www.karamasoft.com/Samples.aspx?component=UltimateEditor&sample=FontSizeDropDown

  
 Page 1 of 1 (4 items)
Karamasoft Support Forums » General Discussions » UltimateEditor » Re: Updating Font

You can add attachments
You can post new topics
You can reply to topics
You can delete your posts
You can edit your posts
You can create polls
You can vote in polls
Forum statistics are enabled
Forum is unmoderated

© 2002-2018 Karamasoft LLC. All rights reserved.