Paste from word in 2 editors in multipage problem

6 posts, 1 answers
  1. Yeroon
    Yeroon avatar
    87 posts
    Member since:
    Oct 2012

    Posted 07 Feb 2012 Link to this post

    Hello,

    I have 2 RadEditors in a RadMultiPage. The tabstrip uses the pagviews to show one of the two editors. When I use the Past from Word button in the first tab, then in the second tab it will no longer work. I can paste normally, but the paste from word buttons dont do anything. This is in IE9 with browser mode and dec mode both set to IE9.

    Now if I set the Doc mode to IE8  standards, the buttons will react again, but extremely slow.
    To reproduce, just use below aspx code and past some word content with the past from word button in the first tab and then try and past the same content with the past from word button in the second tab.

    ASPX and toolsfile:

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Tricks.aspx.cs" Inherits="Tricks" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head runat="server">
        <title></title>
        <style type="text/css">
            .tooltip
            {
                cursor: pointer;
                border-bottom: 1px dashed #009900;
                color: #009900;
            }
        </style>
        <telerik:RadScriptBlock ID="rsb" runat="server">
            <script type="text/javascript">
                function setSplitInfo(sender, args) {
     
                }
                function setSplitInfoTop(sender, args) {
     
                }
                function rtvExplore_OnNodeExpandedCollapsed(sender, eventArgs) {
                    var allNodes = eventArgs._node.get_treeView().get_allNodes();
     
                    var i;
                    var selectedNodes = "";
     
                    for (i = 0; i < allNodes.length; i++) {
                        if (allNodes[i].get_expanded())
                            selectedNodes += allNodes[i].get_value() + "*";
                    }
     
                    Set_Cookie("expandedNodes", selectedNodes, 30);
                }
     
                function Set_Cookie(name, value, expires, path, domain, secure) {
                    var today = new Date();
                    today.setTime(today.getTime());
                    if (expires) {
                        expires = expires * 1000 * 60 * 60 * 24;
                    }
                    var expires_date = new Date(today.getTime() + (expires));
     
                    document.cookie = name + "=" + escape(value) +
                        ((expires) ? ";expires=" + expires_date.toGMTString() : "") +
                            ((path) ? ";path=" + path : "") +
                                ((domain) ? ";domain=" + domain : "") +
                                    ((secure) ? ";secure" : "");
                }
                function editorModeChanged(editor, args) {
                     
                }
                function OnClientLoad(sender, args) {
                     
                }
     
            </script>
        </telerik:RadScriptBlock>
    </head>
    <body>
        <form id="form1" runat="server">
        <telerik:RadFormDecorator runat="server" ID="rfd" DecoratedControls="All" Skin="Metro" />
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <Scripts>
                <%--Needed for JavaScript IntelliSense in VS2010--%>
                <%--For VS2008 replace RadScriptManager with ScriptManager--%>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
            </Scripts>
        </telerik:RadScriptManager>
        <telerik:RadToolTipManager runat="server" ID="rttm" AutoTooltipify="True">
        </telerik:RadToolTipManager>
        <div>
            <telerik:RadTabStrip ID="rtsArtikel" runat="server" MultiPageID="MultiPage2">
                <Tabs>
                    <telerik:RadTab Text="Kernwoorden" Selected="true" PageViewID="rpvKernwoorden">
                    </telerik:RadTab>
                    <telerik:RadTab Text="Artikel" PageViewID="rpvArtikel">
                    </telerik:RadTab>
                    <telerik:RadTab Text="Product" PageViewID="rpvKruisjes">
                    </telerik:RadTab>
                </Tabs>
            </telerik:RadTabStrip>
            <telerik:RadMultiPage ID="MultiPage2" runat="server" Height="100%">
                <telerik:RadPageView ID="rpvKernwoorden" runat="server" Selected="true" Height="98%">
                    <div id="divKernwoorden" runat="server">
                        <div style="width: 240px; display: inline; float: left; margin-left: 4px; margin-top: 4px;">
                            <asp:Button runat="server" ID="btnSave" Text="Opslaan" Width="100" />
                            <asp:Button runat="server" ID="btnPreview" Text="Preview" OnClientClick="return false;"
                                Width="100" />
                        </div>
                        <div style="width: 40px; display: inline; float: left; margin-top: 12px;">
                            <telerik:RadAjaxLoadingPanel ID="lp" runat="server" IsSticky="True" EnableAjaxSkinRendering="False"
                                EnableEmbeddedSkins="False">
                                <asp:Image ID="Image2" runat="server" AlternateText="Loading..." ImageUrl="~/Styles/Images/whiteloader.gif" />
                            </telerik:RadAjaxLoadingPanel>
                        </div>
                        <div style="width: 320px; display: inline; float: left; margin-left: 4px; margin-top: 12px;">
                            <asp:Label runat="server" ID="lblInfo2"></asp:Label>
                        </div>
                        <telerik:RadEditor ID="RadEditor2" runat="server" ToolbarMode="Default" ToolsFile="Tools.xml"
                            StripFormattingOptions="All" NewLineMode="P" Width="98%" Language="nl-NL" AutoResizeHeight="False"
                            OnClientModeChange="editorModeChanged" ContentAreaCssFile="~/Styles/EditorCss.css"
                            LocalizationPath="~/Resources/" ExternalDialogsPath="~/Resources/EditorDialogs/"
                            EnableViewState="true" OnClientLoad="OnClientLoad" ContentFilters="None">
                            <FontNames>
                                <telerik:EditorFont runat="server" Value="Verdana" />
                            </FontNames>
                            <SpellCheckSettings AllowAddCustom="True" DictionaryLanguage="nl-NL"></SpellCheckSettings>
                            <MediaManager UploadPaths="~/Media/" ViewPaths="~/Media/" DeletePaths="~/Media/"
                                MaxUploadFileSize="10240000"></MediaManager>
                            <ImageManager UploadPaths="~/Media/" ViewPaths="~/Media/" DeletePaths="~/Media/"
                                EnableImageEditor="False" MaxUploadFileSize="10240000" EnableThumbnailLinking="True">
                            </ImageManager>
                            <DocumentManager ViewPaths="~/Documents/" UploadPaths="~/Documents/" DeletePaths="~/Documents/" />
                        </telerik:RadEditor>
                    </div>
                </telerik:RadPageView>
                <telerik:RadPageView ID="rpvArtikel" runat="server" Selected="false" Height="98%">
                    <div id="divArtikel" runat="server">
                        <div style="width: 240px; display: inline; float: left; margin-left: 4px; margin-top: 4px;">
                            <asp:Button runat="server" ID="btnSave2" Text="Opslaan" Width="100" />
                            <asp:Button runat="server" ID="btnPreview2" Text="Preview" OnClientClick="return false;"
                                Width="100" />
                        </div>
                        <div style="width: 40px; display: inline; float: left; margin-top: 12px;">
                            <telerik:RadAjaxLoadingPanel ID="lp2" runat="server" IsSticky="True" EnableAjaxSkinRendering="False"
                                EnableEmbeddedSkins="False">
                                <asp:Image ID="Image1" runat="server" AlternateText="Loading..." ImageUrl="~/Styles/Images/whiteloader.gif" />
                            </telerik:RadAjaxLoadingPanel>
                        </div>
                        <div style="width: 320px; display: inline; float: left; margin-left: 4px; margin-top: 12px;">
                            <asp:Label runat="server" ID="lblInfo"></asp:Label>
                        </div>
                        <telerik:RadEditor ID="RadEditor1" runat="server" ToolbarMode="Default" ToolsFile="Tools.xml"
                            StripFormattingOptions="All" NewLineMode="P" EnableViewState="true" Width="98%"
                            Language="nl-NL" AutoResizeHeight="False" OnClientModeChange="editorModeChanged"
                            ContentAreaCssFile="~/Styles/EditorCss.css" LocalizationPath="~/Resources/" ExternalDialogsPath="~/Resources/EditorDialogs/"
                            OnClientLoad="OnClientLoad" ContentFilters="None">
                            <FontNames>
                                <telerik:EditorFont runat="server" Value="Verdana" />
                            </FontNames>
                            <SpellCheckSettings AllowAddCustom="True" DictionaryLanguage="nl-NL"></SpellCheckSettings>
                            <MediaManager UploadPaths="~/Media/" ViewPaths="~/Media/" DeletePaths="~/Media/"
                                MaxUploadFileSize="10240000"></MediaManager>
                            <ImageManager UploadPaths="~/Media/" ViewPaths="~/Media/" DeletePaths="~/Media/"
                                EnableImageEditor="False" MaxUploadFileSize="10240000" EnableThumbnailLinking="True">
                            </ImageManager>
                            <DocumentManager ViewPaths="~/Documents/" UploadPaths="~/Documents/" DeletePaths="~/Documents/" />
                        </telerik:RadEditor>
                    </div>
                </telerik:RadPageView>
                <telerik:RadPageView ID="rpvKruisjes" runat="server" Selected="false" Height="98%">
                    <div id="divKruisjes" runat="server">
                        <div style="width: 240px; display: inline; float: left; margin-left: 4px; margin-top: 4px;">
                            <asp:Button runat="server" ID="btnSave3" Text="Opslaan" Width="100" />
                            <asp:Button runat="server" ID="btnPreview3" Text="Preview" OnClientClick="return false;"
                                Width="100" />
                        </div>
                        <div style="width: 40px; display: inline; float: left; margin-top: 12px;">
                            <telerik:RadAjaxLoadingPanel ID="lp3" runat="server" IsSticky="True" EnableAjaxSkinRendering="False"
                                EnableEmbeddedSkins="False">
                                <asp:Image ID="Image3" runat="server" AlternateText="Loading..." ImageUrl="~/Styles/Images/whiteloader.gif" />
                            </telerik:RadAjaxLoadingPanel>
                        </div>
                        <div style="width: 320px; display: inline; float: left; margin-left: 4px; margin-top: 12px;">
                            <asp:Label runat="server" ID="lblInfo3"></asp:Label>
                        </div>
                        <div style="clear: both; margin-left: 20px; margin-top: 40px; padding-top: 20px;">
                            <asp:CheckBox runat="server" ID="cbBTW" Text="BTW-ondernemer: Aftrekbaar" /><br />
                            <asp:CheckBox runat="server" ID="cbOverheid" Text="Overheid/geen ondernemer: Compensabel" /><br />
                            <asp:CheckBox runat="server" ID="cbKostprijs" Text="Kostprijsverhogend" />
                        </div>
                    </div>
                </telerik:RadPageView>
            </telerik:RadMultiPage>
        </div>
        </form>
    </body>
    </html>

    Toolstfile

    <root>
      <modules>
        <module name="RadEditorStatistics" dockingZone="Bottom" enabled="true" visible="true"  />
        <module name="RadEditorHtmlInspector" dockingZone="Module" enabled="true" visible="false"  />
      </modules>
      <tools enabled="true" dockable="true">
        <tool name="Bold" />
        <tool name="Italic" />
        <tool name="Underline" />
        <tool name="StrikeThrough" />
        <tool separator="true" />
        <tool name="JustifyLeft" />
        <tool name="JustifyCenter" />
        <tool name="JustifyRight" />
        <tool name="JustifyFull" />
        <tool name="JustifyNone" />
        <tool separator="true" />
        <tool name="Superscript" />
        <tool name="Subscript" />
        <tool separator="true" />
        <tool name="ConvertToLower" />
        <tool name="ConvertToUpper" />
        <tool name="Indent" />
        <tool name="Outdent" />
        <tool name="InsertOrderedList" />
        <tool name="InsertUnorderedList" />
        <tool name="ToggleTableBorder" />
        <tool name="ToggleScreenMode" />
      </tools>
      <tools enabled="true">
        <tool name="Undo" />
        <tool name="Redo" />
        <tool separator="true" />
        <tool name="Cut" />
        <tool name="Copy" />
        <tool name="Paste" shortcut="CTRL+!" />
        <tool separator="true" />
        <tool name="PasteFromWord" />
        <tool name="PasteFromWordNoFontsNoSizes" />
        <tool name="PastePlainText" />
        <tool name="PasteAsHtml"  />
        <tool separator="true" />
        <tool name="Print" />
        <tool name="FindAndReplace" />
        <tool name="SelectAll" />
        <tool separator="true" />
        <tool name="InsertGroupbox" />
        <tool name="InsertParagraph" />
        <tool name="InsertHorizontalRule" />
        <tool separator="true" />
        <tool name="InsertDate" />
        <tool name="InsertTime" />
      </tools>
      <tools name="InsertToolbar" enabled="true" >
        <tool name="AjaxSpellCheck" />
        <tool separator="true" />
        <tool name="ImageManager" shortcut="CTRL+M" />
        <tool name="MediaManager" />
        <tool name="DocumentManager" />
        <tool name="InsertSpecialLink" text="Tooltip invoegen" shortcut="CTRL+T" />
        <tool name="LinkManager" />
        <tool name="Unlink" />
        <tool separator="true" />
        <tool name="InsertTable" />
        <tool name="InsertRowAbove" />
        <tool name="InsertRowBelow" />
        <tool name="DeleteRow" />
        <tool name="InsertColumnLeft" />
        <tool name="InsertColumnRight" />
        <tool name="DeleteColumn" />
        <tool separator="true" />
        <tool name="MergeColumns" />
        <tool name="MergeRows" />
        <tool separator="true" />
        <tool name="SplitCell" />
        <tool name="DeleteCell" />
        <tool name="SetCellProperties" />
        <tool name="SetTableProperties" />
        <tool separator="true" />
        <tool name="Help" />
      </tools>
      <tools name="DropdownToolbar" dockable="true" >
        <tool name="ForeColor" />
        <tool name="BackColor" />
        <tool separator="true" />
        <tool name="FontName" />
        <tool name="FontSize" />
        <tool name="RealFontSize" />
         
        <tool name="InsertCustomLink" />
        <tool name="FormatBlock" />
        <tool name="Zoom" />
      </tools>
      <tools name="MainToolbar" enabled="true">
        <tool name="FormatCodeBlock" />
        <tool name="InsertSymbol" />
        <tool name="FormatStripper" />
        <tool separator="true" />
        <tool name="StripAll" />
        <tool name="StripCss" />
        <tool name="StripFont" />
        <tool name="StripSpan" />
        <tool name="StripWord" />
      </tools>
      <symbols>
      </symbols>
      <fontNames>
      </fontNames>
      <fontSizes>
      </fontSizes>
      <colors>
      </colors>
      <classes>
      </classes>
      <paragraphs>
      </paragraphs>
      <dialogParameters>
      </dialogParameters>
      <languages>
      </languages>
    </root>

    Any suggestions?

    Thx

    /Yeroon
  2. Rumen
    Admin
    Rumen avatar
    12846 posts

    Posted 09 Feb 2012 Link to this post

    Hello Yeroon,

    Could you please test the current beta build of RadControls for ASP.NET AJAX and let me know if the problem still persists?

    Best regards,
    Rumen
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Yeroon
    Yeroon avatar
    87 posts
    Member since:
    Oct 2012

    Posted 10 Feb 2012 Link to this post

    Hello,

    Thanks for your reply. With the 2012 beta the problem still exists, with exactly the same behaviour.
    Any more suggestions?

    Thx.
    /Yeroon
  5. Gerald
    Gerald avatar
    2 posts
    Member since:
    Aug 2006

    Posted 14 Feb 2012 Link to this post

    I have a very similar issue -
    I have a multipage with several page views - and each page view contains one or even more editors (with very basic toolsfiles).
    I need to ensure that there is no way of pasting texts from Word in any of them. However, the editors seem to behave in a very unpredictable manner. Firstly, it is impossible to disable the CTRL+V shortcut for them. It simply does not work. I have used the small JavaScrip snippet for that (recommended by telerik)

    function OnClientCommandExecuting(editor, args) {

    if ("Paste" == args.get_commandName())

    args.set_cancel(

    true);

    }


    It is not cancelling the event (although the event itself is triggered). So the Word-formatted text gets inserted.

    Sometimes, there is a JavaSript error thrown by the editors on this line

     

    $telerik.isSafari?a:a.contentWindow.document.body;


    but it is impossible to determine why and when it will happen.

    The button PasteFromWordStripFont was not working at all. I had to remove it - and replace by the "PastePlaintext" although it is not the solution - I cannot force the end users to use this button. Principally, I need at least to disable the shortcut for pasting any text to the editor.
    Any suggestion?
  6. Answer
    Rumen
    Admin
    Rumen avatar
    12846 posts

    Posted 15 Feb 2012 Link to this post

    Hello Yeroon,

    It appeared a bug that will be researched and fixed.

    I updated your Telerik points for your bug report and logged the issue in our PITS system at: Public URL.

    I noticed that the problem is not reproducible in IE7 and Firefox as well as that the content is pasted without delay. If you would like you can render the page in IE7 mode using the following meta tag: <meta http-equiv="X-UA-Compatible" content="IE=7" /> until we fix the issue.

    Kind regards,
    Rumen
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  7. Rumen
    Admin
    Rumen avatar
    12846 posts

    Posted 15 Feb 2012 Link to this post

    Here is how I was able to cancel the Paste event in RadEditor in Multipage:

    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head id="Head1" runat="server">
    <meta http-equiv="X-UA-Compatible" content="IE=8" />
        <title></title>
        <style type="text/css">
             
        </style>
       
    </head>
    <body>
        <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <telerik:RadTabStrip ID="rtsArtikel" runat="server" MultiPageID="MultiPage2">
            <Tabs>
                <telerik:RadTab Text="Kernwoorden" Selected="true" PageViewID="rpvKernwoorden">
                </telerik:RadTab>
                <telerik:RadTab Text="Artikel" PageViewID="rpvArtikel">
                </telerik:RadTab>
                <telerik:RadTab Text="Product" PageViewID="rpvKruisjes">
                </telerik:RadTab>
            </Tabs>
        </telerik:RadTabStrip>
        <telerik:RadMultiPage ID="MultiPage2" runat="server" Height="100%">
            <telerik:RadPageView ID="rpvKernwoorden" runat="server" Selected="true" Height="98%">
                <telerik:RadEditor ID="RadEditor2" OnClientPasteHtml="OnClientPasteHtml"
                   runat="server">
                </telerik:RadEditor>
            </telerik:RadPageView>
            <telerik:RadPageView ID="rpvArtikel" runat="server" Selected="false" Height="98%">
                <telerik:RadEditor ID="RadEditor1"
                    OnClientPasteHtml="OnClientPasteHtml" runat="server">
                </telerik:RadEditor>
            </telerik:RadPageView>
            <telerik:RadPageView ID="rpvKruisjes" runat="server" Selected="false" Height="98%">
            </telerik:RadPageView>
        </telerik:RadMultiPage>
        <script type="text/javascript">
            function OnClientPasteHtml(sender, args)
            {
                var commandName = args.get_commandName();
                var value = args.get_value();
         
                if (commandName == "Paste")
                {
                    args.set_value("");
                }
            }
        </script>
            <telerik:RadEditor ID="RadEditor3"
                    OnClientPasteHtml="OnClientPasteHtml" runat="server">
                </telerik:RadEditor>
        </form>
    </body>
    </html>



    Best regards,
    Rumen
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017