Disable interaction with protected table

4 posts, 1 answers
  1. Mihajlo
    Mihajlo avatar
    47 posts
    Member since:
    Aug 2018

    Posted 08 Apr 2020 Link to this post

    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.

  2. Dimitar
    Admin
    Dimitar avatar
    2951 posts

    Posted 10 Apr 2020 Link to this post

    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.
  3. Mihajlo
    Mihajlo avatar
    47 posts
    Member since:
    Aug 2018

    Posted 21 Apr 2020 in reply to Dimitar Link to this post

    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".

  4. Answer
    Dimitar
    Admin
    Dimitar avatar
    2951 posts

    Posted 22 Apr 2020 Link to this post

    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.
Back to Top