RadRichTextBox Performance and Features issues

8 posts, 0 answers
  1. Clément
    Clément avatar
    4 posts
    Member since:
    May 2014

    Posted 12 May 2014 Link to this post


    Hello,

    I am using a RadRichTextBox as HTML editor (I use HtmlDataProvider for that)

    In my xaml View, i got :  

                                         - A RadRichTextBoxRibbonUI (with only 6 RadRibbonGroup useful for HTML) and its QuickAccessToolBar
                                         - An HTMLDataProvider and its settings
                                         - A RadRichTextBox 

    In my Controller the first call of InitializeComponent();  takes about 8 seconds to load the page (it is rather long)

    It's only the first call (after that this is cached). I think, it's not possible to construct all of this under 3 seconds.

    So I decided to implement a loader for my users. 

    But due to WPF limitations (MTA thread, ...) it's pretty tough to do that. Have you an example of loader? An other solution?

    An other issue is on old computers : it takes a long time when typing on keyboard in the RadRichTextBox (I already disable some features to improve that)
    Have you a list of all the things which can slow the RadRichTextBox typing?


    Features : 

    1) How to draw a line (<hr>) in an HTML Editor ? I didn't found any buttons in the Ribbon to do that 

    2) How to open an HTML document with relative path image? Images are considered as bad images


    Regards,

     





  2. Petya
    Admin
    Petya avatar
    975 posts

    Posted 14 May 2014 Link to this post

    Hello,

    While we do not have an example of a loader, there is something I can suggest you do to increase the initial loading time of RadRichTextBox. Please check the code snippet in this article which shows how to manually initialize the catalog loaded by MEF. Placing the snippet in your application should significantly increase the loading time.

    As to your other questions, at this point lines are not supported in RadRichTextBox. The feature is in our to-do list, but I cannot say when it might be implemented. You can subscribe to this item in the Feedback & Ideas portal to be notified for our progress on this.

    When it comes to loading images with relative paths, you can take advantage of the export/import settings of HtmlFormatProvider. This article explains the settings in details and the attached application shows how to utilize the ImageExporting/LoadImageFromUrl events.

    I hope this helps.

    Regards,
    Petya
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Clément
    Clément avatar
    4 posts
    Member since:
    May 2014

    Posted 15 May 2014 Link to this post


    Hello,

    I added MEF to my project and the snippet.
    I earn around 2 seconds for loading time. If i could earn few more seconds, it could be perfect and without the need of a loader.

    For line, I follow your item.

    Finally for LoadImageFromUrl, I used ExportImagesSeparately as a starting point.
    But FileStream throws errors for relative path such "test.png" 
    So I implement my own Import and DragNDrop methods to save the "current FilePath" in a variable.
    And in LoadImageFromUrl, if the image path is relative, I pass to the filestream the CurrentFilePath + ImagePath.
    It works well and the image now appears on the editor.

    An other question related to the "RichTextBoxEditor + HTMLEditor" :
    If we take for example the ExportImagesSeparately, Is this possible to "Format/Indent" the HTML code?
    It could be great to have an HTML well formatted to allow user to make change directly in HTML. 

    <p>Test</p>
    <p>Test2</p>
    ...

    One line by tag.

    Is this possible?

    Thank you for your help,
    Regards,

    Clément























  5. Petya
    Admin
    Petya avatar
    975 posts

    Posted 16 May 2014 Link to this post

    Hi Clément,

    I'm glad to hear you were able to implement the desired functionality.

    As to the performance, the only other thing I can suggest to increase the loading time is to disable some of the features, for example the SpellChecker. Also note that if you are not using some of the types in the catalog I pointed you to, you can drop them from the manual initialization.

    When it comes to your last question, I added your request to our backlog and we will consider implementing it for one of our future releases. In the meantime, as the generated content is valid XHTML, you can use XmlWriter and XmlWriterSettings to write the file with Indent specified as true.

    I hope this helps.

    Regards,
    Petya
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  6. Clément
    Clément avatar
    4 posts
    Member since:
    May 2014

    Posted 02 Jun 2014 in reply to Petya Link to this post


    Hi,

    Thank you for your help.

    Now, I got an HTML indented as an XML in my preview (only "<" chars break my indent HTML, but it's sufficient for most of the cases)

    The only issue is the combination of XmlWriter and Telerik Import method :

    I use the default indent char for XmlWriter (which is 2 spaces).

    But Telerik seems to transform them in spans at import, is there a way to prevent that?

    Telerik add span, XMLWriter indent and add space, Telerik transform them in span, etc

    There is no end and the file become larger and larger each time I import it,


    Thanks in advance,
    Clément
    There is no end and the file become larger each time I import it








  7. Petya
    Admin
    Petya avatar
    975 posts

    Posted 05 Jun 2014 Link to this post

    Hello Clément,

    I'm not sure I understand you properly. Could you please send us an example of HTML containing such spaces which are converted to spans when importing in RadRichTextBox? I am having a hard time replicating the result you are observing on your end.

    Regards,
    Petya
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  8. Clément
    Clément avatar
    4 posts
    Member since:
    May 2014

    Posted 06 Jun 2014 in reply to Petya Link to this post


    Hello Petya,


    To help you I will give you a way to reproduce the case :

    1) Take for example the project ExportImageSeparately

    2) In the HTML editor, lets paste some indented html :

    <body>
      <p style="margin-top: 0px;margin-bottom: 0px;line-height: 1;">
        <span style="font-family: 'Arial';font-size: 16px;">Hello</span>
      </p>
    </body>

    Now, we can see Hello in the Text editor.

    3) In the Text Editor we modify Hello, for example : Hello2

    The HTML editor will completely change the HTML :

    <p style="margin-top: 0px;margin-bottom: 0px;line-height: 1;"><span style="font-family: 'Times New Roman';font-size: 16px;"> </span><span style="font-family: 'Arial';font-size: 16px;">Hello2</span><span style="font-family: 'Times New Roman';font-size: 16px;"> </span></p>

    We can see the adding of 2 spans with a space inside.

    The spaces of my indented HTML are transformed into spans, which is a big issue for me. Because spans are considered as valid tags, so they will be reindented. The indentation generates spaces which will transform into spans, etc, etc Infinite Loop .. :(

    Have you a tip which I could use to avoir this behavior? 

    Thanks in advance,

    Clément



  9. Mihail
    Admin
    Mihail avatar
    192 posts

    Posted 11 Jun 2014 Link to this post

    Hi Clément,

    Thank you for the additional information.
     I can confirm that the problem exists and will be logged to our to do list for further investigation and fix. The priority at this point is low as the problem needs some uncommon conditions to be reproduced. Like showing the output html in formatted form to the end user.

    There is a possible workaround which might work but its a long shot and you should decide whether to implement it.
    There are three main points to follow.
    1. Remove any unnecessary spans when importing formatted html.
    2. Remove any unnecessary spans when exporting html.
    3. Format the html - Which you've already done. 

    Here is the explanation for the first two points:
    1. After importing the document with HtmlFormatProvider remove the first and the last span in each paragraph if the span contains only single space. Please notice that this should be done before showing the document in the editor.
    2. For this point full copy of the document from the editor will be needed. At this point the most secure way to achieve that is to export and import it with XamlFormatProvider. This way the required information will be preserved. After that all spans which contains single space should be removed from the document copy. And the final step is to export the document to html format.

    Regards,
    Mihail
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top
UI for WPF is Visual Studio 2017 Ready