This is a migrated thread and some comments may be shown as answers.

Insert font tags before and after selected text in editor

1 Answer 90 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 13 Apr 2010, 05:58 PM
Hello, I'm hoping someone can help me with this problem:

In my Rad editor I have a default-type editor tool that sets the fore color of text.  You click on it and get a panel that opens giving you the option of choosing many colors.  However,  my users reuse just two colors time after time.  Thus, I would like to add two more buttons that would be to simply add either one of those colors.

My preference would be to have the functionality act like the Bold or Italics buttons (i.e., when clicked, the color would stay on until changed).  However, if that isn't possible (or is too time consuming to develop) then a button that would insert font tags on either side of selected text would work.

How can I accomplish this?

Thank you!

1 Answer, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 14 Apr 2010, 03:54 PM
Hi Michael,

Your requirement is already demonstrates in the Add Custom Tools live demo. Test the first toolbar button by selecting some text and press the button.

Here is the JavaScript command of the button:

Telerik.Web.UI.Editor.CommandList["ApplySizeColor"] = function(commandName, editor, args)
{
     editor.fire("FontSize", {value : "4"}); //fire the FontSize command
     editor.fire("ForeColor", {value : "red"});  //fire the ForeColor command
};



All the best,
Rumen
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Editor
Asked by
Michael
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or