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

Detect if the current selection has bullets

1 Answer 90 Views
RichTextEditor
This is a migrated thread and some comments may be shown as answers.
Simon
Top achievements
Rank 1
Simon asked on 15 Aug 2017, 10:58 PM
I have a radRichTextEditor in a small space so there is no room for a RichTextEditorRibbonBar. Instead I'm putting all of the formatting options I need on the context menu. I've added a "Bullets" menu item to the context menu and got this working to add bullets to the selected text. However I'd like this to work in a Toggle fashion so that if the selected text already has bullets, it removes them. If the selected text doesn't have text, it adds them. How do I work out if the selected text has bullets or not?

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 16 Aug 2017, 09:35 AM
Hello Simon,

You can use the CurrentEditingStyleChanged event to check if the cursor is within a bullet list. Here is the code:
private void RadRichTextEditor1_CurrentEditingStyleChanged(object sender, EventArgs e)
{
    var helper = new StyleUIHelper(radRichTextEditor1.RichTextBoxElement);
    var isBulletList = helper.GetIsBulleted();
    Debug.WriteLine(isBulletList);
}

Please let me know if there is something else I can help you with. 

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
RichTextEditor
Asked by
Simon
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or