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

Automatically strip tags when publish button is hit...

2 Answers 82 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 12 Oct 2007, 05:48 PM
Excellent took this is for MOSS users. Much better then the built in one... I have been playing with this Lite RadEditor, and I have not been able to figure a few things out... Hopefully someone can help.

I really like the feature which strips tags like span, font, etc... But You have to manually do this... Is there anyway to automatically strip these tags when the publish button is hit? I do not want any font tags, or span tags included (when people copy from the web), to be included.

As well, I was wondering is there a way to include some custom JavaScript so that when the Publish button is hit, it will do whatever is in the javascript function?

Any help would be appreciated.

Thanks
Steve

2 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 16 Oct 2007, 11:56 AM
Hi Steve,

You can use the FormatStripper tool and the "RADEVENT_SUBMIT" event of RadEditor to achieve your scenario. Here are the configuration steps:
  1. Open the \Program Files\Common Files\Microsoft Shared\web server extensions\wpresources\RadEditorSharePoint\4.4.0.0__1f131a624888eeed\RadControls\Editor\ConfigFile.xml
    file and register the OnClientLoad event:

    <configuration>
      ...
      <property name="OnClientLoad">OnClientLoad</property>
    </configuration>

  2. Open the page with the <radE:RadHtmlField in Microsoft Office SharePoint Designer and put the following JavaScript inside the PlaceHolderAdditionalPageHead asp:content tag:

    <asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">
    <script type="text/javascript">
    function OnClientLoad(editor)
    {
       editor.AttachEventHandler ("RADEVENT_SUBMIT", function (e)
      {

           // the code below will call the Format Stripper tool with the "Span" tags
           // the other possible options are All, CSS, WORD_ALL, WORD and SPAN
           oTool = new Object();
           oTool.GetSelectedValue = function() { return "SPAN"; }
           editor.Fire("FormatStripper", oTool);
      }
      );
    }
    </script>
    ...
  3. Save the files.
  4. You can see the attached video demonstrating my test.

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Steve
Top achievements
Rank 1
answered on 16 Oct 2007, 12:58 PM
Rumen, thanks a million! This works like a charm! I used the WORD_ALL and it takes out everything I need (so far that I tested at least). As well, I can add more custom JavaScript after this function to do a few other things I want (I have a custom JavaScript written to make sure a table is not bigger then 500 px), and if it is, make it 500 px).

Now if only the hyperlink tool worked fine, I would be ready to launch my Web Content Management System...

Again many thanks.
Tags
WebParts for SharePoint
Asked by
Steve
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Steve
Top achievements
Rank 1
Share this question
or