Javascript in MOSS radEditor

41 posts, 1 answers
  1. Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 10 Jul 2009 Link to this post

    Hi Archana,

    Unfortunately this is again browser behavior of MS Internet Explorer. I tested the issue in FireFox and the javascript worked fine. Unfortunately currently we do not know of any workarounds for this. We will inform you if we find a fix for this.


    Sincerely yours,
    Stanimir
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  2. Archana
    Archana avatar
    18 posts
    Member since:
    May 2009

    Posted 20 Jul 2009 Link to this post

    Hi Stanimir,

    I am using radEditor version 5.5.0.0.  
    I have activated the radEditor feature for using it in Sharepoint lists as well.
    But in lists fields, it strips the script tag.
    I have set "AllowScripts" property true in both ConfigFile.xml and ListConfigFile.xml.
    Am I missing something to render script tags in list field?

    Regards,
    Archana

  3. Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 20 Jul 2009 Link to this post

    Hi Archana,

    You cannot use Javascript in RadEditor in SharePoint forms scenario (Lists, Wikis, Blogs, etc.). There RadEditor does not have control over the presentation view which means that we cannot control the output when it is not in edit mode.

    Greetings,
    Stanimir
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  4. Nate
    Nate avatar
    28 posts
    Member since:
    Jul 2007

    Posted 28 Oct 2010 Link to this post

    I am sort of confused here why it is that Telerik folks keep saying it is MOSS or WSS3 that is stripping the special chars and script tags. Maybe there is something I am missing here but if I create a custom control and use a basic asp.net textbox to fill the multiline text field type with the text from the textbox the special stuff is NOT stripped. If however I swap the textbox for a MossRadEditor ver5.8.0.0 it strips the special stuff out. Below is the FieldControl class which works fine when using the textbox(commented in the value fill and swapped for the radeditor).

    public class WERCRichTextFieldControl : BaseFieldControl
        {        
      
            private MOSSRadEditor editCtrl;
            protected TextBox ScriptTextBox;
            protected Literal litMsg;
            protected PlaceHolder EditorPlaceHolder;
      
            protected override string DefaultTemplateName
            {
                get
                {
                    return "WERCRichTextField";
                    //return base.DefaultTemplateName;
                }
            }
      
      
            protected override void RenderFieldForDisplay(HtmlTextWriter output)
            {
                RenderChildren(output);
            }
      
            protected override void CreateChildControls()
            {
                if (this.Field == null || this.ControlMode == SPControlMode.Display || this.ControlMode == SPControlMode.Invalid)
                    return;
      
                base.CreateChildControls();
      
                if (ControlMode == SPControlMode.Edit || ControlMode == SPControlMode.New)
                {
                    ScriptTextBox = (TextBox)TemplateContainer.FindControl("ScriptTextBox");
                    litMsg = (Literal)TemplateContainer.FindControl("litMsg");
                    EditorPlaceHolder = (PlaceHolder)TemplateContainer.FindControl("EditorPlaceHolder");
                    editCtrl = new MOSSRadEditor();
                    editCtrl.AllowScripts = true; 
                    //--also added allowscripts in both the ListConfigFile.xml
                    //--and ConfigFile.xml                
                    EditorPlaceHolder.Controls.Add(editCtrl);
                    if (!this.Web.CurrentUser.IsSiteAdmin)
                    {
                        ScriptTextBox.Visible = false;
                        ScriptTextBox.ReadOnly = true;
                        litMsg.Text = "Only Site Administrators can add Script<br />";
                    }
                }
            }
      
            public override object Value
            {
                get
                {
                    EnsureChildControls();
                    //---see right here if I were using the ScriptTextBox 
                    //---it has no problem saving anything that I plug in and the
                    //---base MultiLineTextField type is not stripping html content 
                    //return ScriptTextBox.Text;
                    return editCtrl.Content;
                }
                set
                {
                    EnsureChildControls();
                    base.Value = value;
                    ScriptTextBox.Text = value.ToString();
                    editCtrl.Content = value.ToString();
                }
            }
        }
  5. Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 01 Nov 2010 Link to this post

    Hi Nate,

    Thank you for the provided information, how ever the way your control is written I do not think that it will support SharePoint's automated features, such as automatic update of reusable content or automatic update of links etc. The price of supporting this features is that the content is modified by the SharePoint content filters which strip a lot of "invalid" (according to them) code.

    Sincerely yours,
    Stanimir
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Nate
    Nate avatar
    28 posts
    Member since:
    Jul 2007

    Posted 01 Nov 2010 Link to this post

    Thanks for your response; however, I really am asking a question. Sorry I didn't word that more directly.
    I need to get the special characters into a rich text field. I know I can do it if I create a custom field type based on the same type the OOTB rich text box uses and just use my own asp.net textbox as shown from the previous post. That doesn't work though with the MOSSRadEditor. Maybe the answer here is that I have to use the basic radeditor and not the MOSSRadEditor? How exactly does the MOSSRadEditor tie into the sharepoint libraries? Does it call internal sharepoint stuff before the .content of the MOSSRadEditor is handed back? 
     
     
  7. Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 03 Nov 2010 Link to this post

    Hello Nate,

    Does it call internal sharepoint stuff before the .content of the MOSSRadEditor is handed back? - Yes RadEditor uses SharePoint API in order to display and save the content. If you open an official support ticket and you have valid license information I will provide you with the source code of the control and you will be able to see the exact implementation.


    Greetings,
    Stanimir
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  8. Nate
    Nate avatar
    28 posts
    Member since:
    Jul 2007

    Posted 03 Nov 2010 Link to this post

    In the last post I had the question "Maybe the answer here is that I have to use the basic radeditor and not the MOSSRadEditor?"
    If I were to use the regular radeditor vs. the sharepoint version what major losses would I have in functionality?
    Or would it be better to like you said take the source code for the MOSSRadEditor and rewrite it so that it doesn't leverage the sharepoint stripping engine before it inserts its value into the field? Or do you guys already have a version or hotfix like that? It just sounds like not everyone cares to allow sharepoint to strip the potentially bad code blocks. It seems like it would be an easy enough thing to set up as a configurable choice for MOSSRadEditor.

  9. Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 04 Nov 2010 Link to this post

    Hello Nate,

    If you use the regular ASP.NET AJAX RadEditor, you will loose the filebrowser based dialogs, such as ImageManager, DocumentManager etc. In RadEditor for MOSS there is a specially designed content provider, which works with SharePoint libraries.

    Regards,
    Stanimir
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  10. Nate
    Nate avatar
    28 posts
    Member since:
    Jul 2007

    Posted 04 Nov 2010 Link to this post

    Oh yea. Totally didn't think about that.. BUT arn't those just pages that are installed into layouts or are resources? Can't I just add them as tools to the regular rad editor as long as I have the MOSSRadEditor installed in that same sharepoint web?
    If so how do I point to those?
  11. Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 05 Nov 2010 Link to this post

    Hello Nate,

    Actually these are the same dialogs the think that is different is the content provider, which is embedded in the MOSS RadEditor. Review the following blog post: Using the RadFileExplorer for ASP.NET AJAX in a MOSS web application. Also review the following online demo: Editor / Custom File Dialogs Content Provider

    Sincerely yours,
    Stanimir
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top