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

Disable interaction with protected table

3 Answers 109 Views
RichTextEditor
This is a migrated thread and some comments may be shown as answers.
Mihajlo
Top achievements
Rank 1
Iron
Mihajlo asked on 08 Apr 2020, 04:53 PM

I have a table in protected part of the document. I just use it to properly format some read-only data. Style of all borders is set to None.

How can I disable any kind of interaction with the table? This includes the pop-up "select all" button above the table's top-left corner, and Design and Layout tabs in ribbon bar. They should not appear. Context menu should also be trimmed, but I think I can handle that one.

3 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 10 Apr 2020, 07:08 AM

Hello Mihajlo,

This is considered an issue. This is why I have logged it on our feedback portal. You can track its progress, subscribe to status changes and add your comment to it here. I have updated your Telerik points as well.

Unfortunately due to the nature of the issue, I cannot suggest a workaround for it. What I can suggest is to inherit the RichTextEditorRibbonBar and override the method that shows the table tabs:

class CustomRichTextEditorRibbonBar : RichTextEditorRibbonBar
{
    public CustomRichTextEditorRibbonBar()
    {

    }

    protected override void HandleTableStylePropertiesOnCurrentEditingStyleChanged()
    {
        Paragraph p = this.GetCurrentParagraph();

        if (p == null)
        {
            return;
        }
        TableCell cell = p.Parent as TableCell;
        var isInRange = this.associatedRichTextEditor.Document.GetContainingAnnotationRanges<ReadOnlyRangeStart>(p.Inlines.First);
        if (isInRange.Any())
        {
            return;
        }


        base.HandleTableStylePropertiesOnCurrentEditingStyleChanged();
    }
}

Let me know if you have any other questions.

Regards,
Dimitar
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Mihajlo
Top achievements
Rank 1
Iron
answered on 21 Apr 2020, 03:16 PM

Method HandleTableStylePropertiesOnCurrentEditingStyleChanged does two things. It shows the two tabs when caret moves inside the table, and it hides the tabs when caret moves outside. If I have both a protected and an unprotected table and a caret moves from unprotected to protected then the only way to hide the tabs is to do it myself, copying the code from the last else-if part of HandleTableStylePropertiesOnCurrentEditingStyleChanged method.

This brings me to a spotted bug. The mentioned else-if part is "else if (this.tabTableStyle.IsSelected || this.tabTableLayout.IsSelected)". So, Imagine we have a table in a regular rich text editor. Move caret in table and two tabs show up, and the first is selected. Now select some other tab, like Home, and move caret outside the table. Two tabs will remain, which is an error. Instead of IsSelected I think the check should be "Visibility = ElementVisibility.Visible".

0
Accepted
Dimitar
Telerik team
answered on 22 Apr 2020, 10:13 AM

Hello Mihajlo,

Yes, I was able to reproduce this as well. I have updated the issue description and included this case as well. 

Let me know if you have any other questions.

Regards,
Dimitar
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
RichTextEditor
Asked by
Mihajlo
Top achievements
Rank 1
Iron
Answers by
Dimitar
Telerik team
Mihajlo
Top achievements
Rank 1
Iron
Share this question
or