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

PastePlainText

4 Answers 164 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Zal
Top achievements
Rank 1
Zal asked on 08 Jul 2008, 03:48 PM
Hey

I had the previous version of Telerik controls, and the PastePlainText was not working so we had to put custom javascript in the code, now that i am trying to upgrade using the trail version of telerik before we purchase the new version, i have tried
<Telerik:RadEditor ID="radEditor1" Runat="server"
                                        Width="99%" Height="350px" EditModes="Design"
                                        Skin="WebBlue" StripFormattingOptions="All"
                                        ToolsFile="ToolsFile.xml" OnClientCommandExecuting="OnClientCommandExecuting" >
                                        </Telerik:RadEditor>
<script type="text/javascript">          
                                            function OnClientCommandExecuting(editor, commandName, oTool) {          
                                                    if (commandName == "Paste") {          
                                                            editor.fire("PastePlainText");       
                                                            return false;          
                                                    }              
                                            }
                                        </script>
but when i try to load html text from word into the editro control it is still taking all the html tags along with it.

In the old version with the custom javascript on the page the stripping was working but now it seems not to be, am i missing something?

Many thnaks in advance

I have also tried the the following javascript but it doesnt work either
function OnClientCommandExecuting(editor, args) {          
                                                    var name = args.get_name();
                                                    var val = args.get_value();
                                                    if (name == "Paste")
                                                    {
                                                            editor.fire("PastePlainText");  
                                                            args.set_cancel(true);
                                                    }              
                                            }

Zal

4 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 10 Jul 2008, 04:07 PM
Hi Zal,

Could you please set the StripFormattingOptions="All" or StripFormattingOptions="AllExceptNewLines" and see whether this will help you?

You can also strip the Word formatting on submit with the solution provided here.

If these settings do not help, please provide more information about the problem and how to reproduce it on our side. Please, provide sample Word content, specify the browser version and steps to reproduce the problem.


If the problem that you experience exists only in Firefox 3: The problem is due to that Firefox 3.0 is presenting itself to MS Word as a XML client and the content pasted in the editor has new format different to this one pasted in Firefox 2.0. That is why the regular expressions used by the editor's Paste From Word filters are not stripping the new MS Word XML formatting. This problem is logged in our bug tracking system and we will fix it in one of the upcoming hotfixes.


Best regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Zal
Top achievements
Rank 1
answered on 16 Jul 2008, 01:41 PM
Hi,

It still isnt working how i thought it would be.
Also i want the word count to appear at the bottom of the control but with only one editmode selected the word count does nto appear.  I do not want to display all the editmodes, just the Design mode but when i run the page in the browser the word count does not appear.  But if i add two edit modes i.e. preview and design, then the word count does appear.
As you can see i have tried to keep to the mimimal as possible but it does not work.

I havent even included my style sheet yet, so that i could make sure that it was not something in my style sheet that was messing up the telerik control.

I have tried to paste from uisng the icon button in both IE7 and FF3, as well as IE6 and the paste as plain is not working in any of them.

In previous version of the editor control there was custom javascript code which worked. 

I do hope there is a way otherwise we will not be upgrading to the new version of telerik, which would be a disater in my view.

My code looks like

<Telerik:RadEditor ID="radEditor1" Runat="server"
                                        Width="99%" Height="350px" EditModes="Design"
                                        Skin="WebBlue" ToolsFile="ToolsFile.xml" OnClientLoad="OnClientLoad" StripFormattingOptions="All" >
                                        </Telerik:RadEditor>
                                        <div class="spacer"></div>
                                        <script type="text/javascript">          
                                            function OnClientLoad(editor, args)
                                            {
                                                 editor.fire("SelectAll");
                                                 editor.fire("FormatStripper", {value : "All"}); //strips the MS Word formatting
                                            }
                                        </script>

Mt tools.xml file looks like
<root>
    <contextMenus>
        <contextMenu forElement="*">
            <tool name="Cut" Shortcute="Ctrl+X" />
            <tool name="Copy" Shortcute="Ctrl+C" />
            <tool name="PastePlainText" Shortcute="Ctrl+V" />
        </contextMenu>
    </contextMenus>
    <modules>
        <module name="RadEditorStatistics" dockingZone="Bottom" enabled="true" visible="true">
            <argument name="ShowTableCount" value="true" />
            <argument name="ShowImgCount" value="true" />
            <argument name="Arg3" value="Value3" />
        </module>
        <!--<module name="RadEditorStatistics" dockingZone="Bottom" enabled="true" visible="true" dockable="true" />-->
    </modules>
    <tools dockable="false">
        <tool name="AjaxSpellCheck"/>
        <tool name="FindAndReplace"/>
        <tool name="Print"/>
        <tool separator="true"/>
        <tool name="Cut"/>
        <tool name="Copy"/>
        <tool name="PastePlainText"/>
        <tool separator="true"/>
        <tool name="Undo"/>
        <tool name="Redo"/>
        <tool separator="true"/>
        <tool name="LinkManager"/>
        <tool name="Unlink"/>
        <tool name="InsertSymbol"/>
    </tools>
    <tools dockable="false">
        <tool name="Bold"/>
        <tool separator="true"/>
        <tool name="InsertOrderedList"/>
        <tool name="InsertUnorderedList"/>
        <tool name="Outdent"/>
        <tool name="Indent"/>
        <tool separator="true"/>
        <tool name="Superscript"/>
        <tool name="Subscript"/>
    </tools>

</root>


0
Rumen
Telerik team
answered on 18 Jul 2008, 02:59 PM
Hi Zal,

Indeed, when the EditModes property is set to "Design" this hides the Statistics module too. In order to achieve your scenario does not set the EditModes property and put the following class in the page with the editor:

    <style type="text/css">
            .rade_editorModesCell {display:none !important;}
    </style>

It will hide the three mode buttons of RadEditor without hiding the Statistics module.

Unfortunately, I am not aware of the second problem concerning the paste functionality. Could you please, open a support ticket and send a sample working project with instructions how to reproduce the problem on our side?

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Zal
Top achievements
Rank 1
answered on 22 Jul 2008, 10:00 AM
Thank-you for your help, I have just opened a support ticket with attached files.
Zal

Tags
Editor
Asked by
Zal
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Zal
Top achievements
Rank 1
Share this question
or