HtmlEditor Default PastWord

Last post 07-16-2009 8:47 PM by obout_teo. 5 replies.

Sort Posts:

  • HtmlEditor Default PastWord

    07-03-2009, 9:48 AM
    • Member
      point Member
    • Ruinkir
    • Member since 07-03-2009, 1:43 PM
    • Posts 3

    How to make ToolbarButton.PasteWord setted (clicked) as default for every copy- past ?

    Thank's!

  • Re: HtmlEditor Default PastWord

    07-04-2009, 3:30 AM
    • Participant
      1,810 point Participant
    • obout_teo
    • Member since 05-21-2009, 9:25 PM
    • Posts 307

    Hi,
    Do you mean to replace the default behavior of Ctrl-V and Shift-Ins ?

    Don't forget to mark this post as "answer", if it helped you...
  • Re: HtmlEditor Default PastWord

    07-06-2009, 1:33 AM
    Answer
    • Participant
      1,810 point Participant
    • obout_teo
    • Member since 05-21-2009, 9:25 PM
    • Posts 307

    If you mean it, see the solution:

    <script  type="text/javascript">
        function pageLoad() {
            $find('editor').get_editPanel().get_modePanels()[0].captureInDesign = function(ev) {
                 var designPanel = this; 
                 // Local key event signature 
                 var isKey = ((AjaxControlToolkit.HTMLEditor.isIE || AjaxControlToolkit.HTMLEditor.isSafari) && ev.type=="keydown") || (ev.type=="keypress");
                 var paste = false;
                 if (isKey) { 
                     // Shift-Ins
                     if (ev.shiftKey && ev.keyCode == 45) {
                         paste = true;
                     } else {
                         // If Ctrl+key
                         if (ev.ctrlKey && !ev.altKey) { 
                             // what a key 
                             var code = (AjaxControlToolkit.HTMLEditor.isIE || window.opera || AjaxControlToolkit.HTMLEditor.isSafari) ? ev.keyCode : ev.charCode;
                             var key = String.fromCharCode(code).toLowerCase();
                             // Ctrl-V 
                             if (key == 'v') { 
                                 paste = true;
                             }
                         }
                     }
                 } 
    
                 if (paste) {
                     if (AjaxControlToolkit.HTMLEditor.isIE) { 
                         // Do 'paste with clean up' 
                         designPanel._paste(true,true);
                         // Break the default event processing 
                         return false; 
                     } else { 
                         // Switch on 'pasting from MS Word' 
                         designPanel.isWord = true;
                     }
                 }
                 // Continue the default event processing
                 return true; 
            };
        }
    </script>


     

    Don't forget to mark this post as "answer", if it helped you...
  • Re: HtmlEditor Default PastWord

    07-13-2009, 3:27 AM
    Answer
    • Member
      point Member
    • Ruinkir
    • Member since 07-03-2009, 1:43 PM
    • Posts 3

    Wow!!!

    it's just that i need!!

    really many many many thanks!Smile



  • Re: HtmlEditor Default PastWord

    07-16-2009, 9:16 AM
    • Member
      point Member
    • Ruinkir
    • Member since 07-03-2009, 1:43 PM
    • Posts 3

    really sorry but...

    why when i try the part of javascript : "$find "

    whith the ID = "editor" or clientID = "ctl00_ContentPlaceHolder1_editor"

    return null ... so the javascript go in error.


    here a part of my cord

    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit.HTMLEditor"
        TagPrefix="HTMLEditor" %>

    <div>
            <ajaxToolkit:ToolkitScriptManager runat="Server" EnablePartialRendering="true" ID="ScriptManager1"
                EnableScriptGlobalization="true" />
            <asp:Panel runat="server" ID="PanelAllEditor">           
                <asp:Panel ID="PanelEditor" runat="server">
                    <asp:UpdatePanel ID="UpdatePanelEditor" runat="server">
                        <ContentTemplate>
                            <HTMLEditor:Editor runat="server" ID="editor" Width="100%" Height="500px"
                                ActiveMode="Design" AutoFocus="true" InitialCleanUp="true" IgnoreTab="true" CssClass="myStyle" />
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </asp:Panel>
            </asp:Panel>
            <asp:Label ID="lblTesto" runat="server"></asp:Label>
        </div>



    thanks in advance


  • Re: HtmlEditor Default PastWord

    07-16-2009, 8:47 PM
    • Participant
      1,810 point Participant
    • obout_teo
    • Member since 05-21-2009, 9:25 PM
    • Posts 307

    Sorry,

    Use $find("<%= editor.ClientID %>") in your case

    Don't forget to mark this post as "answer", if it helped you...
Page 1 of 1 (6 items)